:root {
  color-scheme: light;
  --bg: #f7f0e8;
  --bg-strong: #efe0d0;
  --panel: rgba(255, 252, 247, 0.78);
  --panel-strong: rgba(255, 250, 244, 0.95);
  --line: rgba(89, 63, 44, 0.12);
  --line-strong: rgba(89, 63, 44, 0.2);
  --text: #2c221d;
  --text-muted: #69544a;
  --shadow: 0 18px 48px rgba(79, 51, 35, 0.12);
  --shadow-soft: 0 10px 28px rgba(79, 51, 35, 0.08);
  --partner-a: #db6f5d;
  --partner-a-soft: rgba(219, 111, 93, 0.15);
  --partner-b: #2d928e;
  --partner-b-soft: rgba(45, 146, 142, 0.15);
  --accent: #9e6d3b;
  --danger: #aa4d43;
  --travel: #f4a259;
  --fertility: #c76d91;
  --food: #d36a4c;
  --anniversary: #cf8e6d;
  --wellness: #5b8b7d;
  --home: #7b84c1;
  --font-heading: "Fraunces", "Iowan Old Style", "Baskerville", serif;
  --font-body: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  position: relative;
  overflow-x: hidden;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(244, 162, 89, 0.2), transparent 32%),
    radial-gradient(circle at 88% 12%, rgba(45, 146, 142, 0.18), transparent 28%),
    linear-gradient(180deg, #fdf6f0 0%, #f8efe4 48%, #f4e7d7 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.ambient {
  position: fixed;
  inset: auto;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(12px);
  opacity: 0.48;
  z-index: 0;
}

.ambient--top {
  top: -8rem;
  left: -8rem;
  background: radial-gradient(circle, rgba(244, 162, 89, 0.55), transparent 68%);
}

.ambient--bottom {
  right: -10rem;
  bottom: -12rem;
  background: radial-gradient(circle, rgba(45, 146, 142, 0.5), transparent 70%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.panel,
.card {
  background: var(--panel);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.panel {
  animation: rise 520ms ease both;
}

.panel--compact {
  padding: 22px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.95fr);
  gap: 22px;
  padding: 28px;
  margin-bottom: 22px;
}

.hero__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow,
.card__eyebrow,
.toolbar__label {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hero h1,
.card h2,
.section-heading h2,
#month-label,
#selected-date-heading {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(2.25rem, 3.8vw, 4.4rem);
  max-width: 10ch;
}

.hero__lead {
  margin: 18px 0 24px;
  max-width: 58ch;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text-muted);
}

.hero__actions,
.modal__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.session-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.button,
.icon-button,
.filter-chip,
.segment {
  border: 0;
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}

.button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #4d3930, #6d4c39);
  color: #fff7ef;
  box-shadow: var(--shadow-soft);
}

.button:hover,
.icon-button:hover,
.filter-chip:hover,
.segment:hover {
  transform: translateY(-1px);
}

.button--secondary {
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  border: 1px solid rgba(89, 63, 44, 0.12);
  box-shadow: none;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.28);
  color: var(--text);
  border: 1px solid rgba(89, 63, 44, 0.12);
  box-shadow: none;
}

.button--danger {
  background: linear-gradient(135deg, #8e3e37, #b0564d);
  color: #fff5f2;
}

.hero__insight {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card__header,
.section-heading,
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.muted,
.feedback {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.feedback {
  min-height: 24px;
  font-size: 0.95rem;
}

.feedback--error {
  color: #93473e;
}

.feedback--success {
  color: #2d7a5c;
}

.mode-pill,
.meta-pill,
.legend-pill,
.mini-label,
.empty-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  line-height: 1;
}

.mode-pill {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  border: 1px solid rgba(89, 63, 44, 0.12);
}

.mode-pill--cloud {
  background: rgba(45, 146, 142, 0.16);
  color: #1f6966;
}

.mode-pill--local {
  background: rgba(212, 132, 66, 0.16);
  color: #8d5d2f;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  border: 1px solid rgba(89, 63, 44, 0.09);
}

.stat-card__value {
  display: block;
  margin-top: 8px;
  font-family: var(--font-heading);
  font-size: 2rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.9fr);
  gap: 22px;
}

.calendar {
  padding: 22px;
}

.calendar__toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.month-nav h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  border: 1px solid rgba(89, 63, 44, 0.12);
  box-shadow: var(--shadow-soft);
}

.icon-button--small {
  width: 36px;
  height: 36px;
}

.toolbar__filters {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.filter-row,
.legend__group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-chip {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-muted);
  border: 1px solid rgba(89, 63, 44, 0.1);
}

.filter-chip.is-active {
  background: rgba(77, 57, 48, 0.92);
  color: #fff7ef;
  border-color: transparent;
}

.filter-chip--owner[data-owner="partner_a"].is-active {
  background: linear-gradient(135deg, rgba(219, 111, 93, 0.98), rgba(186, 78, 63, 0.98));
}

.filter-chip--owner[data-owner="partner_b"].is-active {
  background: linear-gradient(135deg, rgba(45, 146, 142, 0.98), rgba(31, 104, 101, 0.98));
}

.calendar__weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 2px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.calendar__weekdays span {
  text-align: center;
}

.calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.day-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 138px;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(89, 63, 44, 0.08);
  background: rgba(255, 255, 255, 0.76);
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.day-card:hover {
  border-color: rgba(89, 63, 44, 0.18);
  box-shadow: var(--shadow-soft);
}

.day-card--today {
  background:
    linear-gradient(180deg, rgba(255, 224, 195, 0.92), rgba(255, 255, 255, 0.82)),
    rgba(255, 255, 255, 0.76);
}

.day-card--selected {
  border-color: rgba(77, 57, 48, 0.26);
  box-shadow: 0 12px 24px rgba(79, 51, 35, 0.12);
}

.day-card--outside {
  opacity: 0.52;
}

.day-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.day-card__date {
  font-family: var(--font-heading);
  font-size: 1.15rem;
}

.day-card__count {
  min-width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: rgba(89, 63, 44, 0.08);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.day-card__entries {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mini-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 0.84rem;
  color: var(--text);
  background: rgba(89, 63, 44, 0.06);
}

.mini-entry::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.mini-entry--partner_a {
  background: var(--partner-a-soft);
}

.mini-entry--partner_a::before {
  background: var(--partner-a);
}

.mini-entry--partner_b {
  background: var(--partner-b-soft);
}

.mini-entry--partner_b::before {
  background: var(--partner-b);
}

.mini-entry__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-entry__more {
  margin-top: auto;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.sidebar {
  display: grid;
  gap: 22px;
}

.entries,
.upcoming-list {
  display: grid;
  gap: 12px;
}

.entry-card,
.upcoming-card,
.empty-state {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(89, 63, 44, 0.08);
}

.entry-card {
  position: relative;
  overflow: hidden;
}

.entry-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: rgba(89, 63, 44, 0.2);
}

.entry-card--partner_a::before {
  background: var(--partner-a);
}

.entry-card--partner_b::before {
  background: var(--partner-b);
}

.entry-card__header,
.upcoming-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.entry-card__title,
.upcoming-card__title {
  margin: 0;
  font-size: 1rem;
}

.entry-card__time,
.upcoming-card__time {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.entry-card__meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.meta-pill {
  background: rgba(89, 63, 44, 0.08);
  color: var(--text-muted);
}

.meta-pill--partner_a {
  background: var(--partner-a-soft);
  color: #8e4135;
}

.meta-pill--partner_b {
  background: var(--partner-b-soft);
  color: #1b6662;
}

.meta-pill--travel {
  background: rgba(244, 162, 89, 0.15);
  color: #99612f;
}

.meta-pill--fertility {
  background: rgba(199, 109, 145, 0.14);
  color: #924f6f;
}

.meta-pill--food {
  background: rgba(211, 106, 76, 0.16);
  color: #944833;
}

.meta-pill--anniversary {
  background: rgba(207, 142, 109, 0.15);
  color: #935d42;
}

.meta-pill--wellness {
  background: rgba(91, 139, 125, 0.15);
  color: #45685d;
}

.meta-pill--home {
  background: rgba(123, 132, 193, 0.16);
  color: #59619a;
}

.entry-card__description,
.upcoming-card__description {
  margin: 14px 0 0;
  color: var(--text-muted);
  line-height: 1.68;
}

.entry-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-muted);
}

.text-button:hover {
  color: var(--text);
}

.legend {
  gap: 16px;
}

.legend-pill {
  border: 1px solid rgba(89, 63, 44, 0.1);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
}

.legend-pill::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-pill--partner_a::before {
  background: var(--partner-a);
}

.legend-pill--partner_b::before {
  background: var(--partner-b);
}

.legend-pill--travel::before {
  background: var(--travel);
}

.legend-pill--fertility::before {
  background: var(--fertility);
}

.legend-pill--food::before {
  background: var(--food);
}

.legend-pill--anniversary::before {
  background: var(--anniversary);
}

.legend-pill--wellness::before {
  background: var(--wellness);
}

.legend-pill--home::before {
  background: var(--home);
}

.empty-state {
  text-align: center;
}

.empty-state h3 {
  margin: 6px 0 8px;
  font-family: var(--font-heading);
  font-size: 1.2rem;
}

.empty-state p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.65;
}

.empty-pill {
  background: rgba(89, 63, 44, 0.08);
  color: var(--text-muted);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 10;
  padding: 24px;
}

.modal.hidden,
.hidden {
  display: none !important;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(47, 33, 25, 0.36);
  backdrop-filter: blur(6px);
}

.modal__panel {
  position: relative;
  width: min(760px, calc(100vw - 24px));
  max-height: min(92vh, 860px);
  overflow: auto;
  padding: 24px;
  border-radius: var(--radius-xl);
  background: rgba(255, 250, 244, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: var(--shadow);
  animation: rise 220ms ease both;
}

.modal__panel--narrow {
  width: min(520px, calc(100vw - 24px));
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.entry-form {
  display: grid;
  gap: 16px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(89, 63, 44, 0.12);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

.field textarea {
  min-height: 116px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(158, 109, 59, 0.26);
  outline-offset: 2px;
}

.field--checkbox {
  align-self: end;
}

.field--checkbox input {
  width: 20px;
  min-height: 20px;
  padding: 0;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segment {
  position: relative;
  display: inline-flex;
}

.segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment span {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(89, 63, 44, 0.1);
  color: var(--text);
}

.segment input:checked + span {
  color: #fff7ef;
  border-color: transparent;
  box-shadow: var(--shadow-soft);
}

.segment--partner_a input:checked + span {
  background: linear-gradient(135deg, rgba(219, 111, 93, 0.98), rgba(186, 78, 63, 0.98));
}

.segment--partner_b input:checked + span {
  background: linear-gradient(135deg, rgba(45, 146, 142, 0.98), rgba(31, 104, 101, 0.98));
}

.modal__actions-spacer {
  flex: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  min-width: min(460px, calc(100vw - 28px));
  max-width: min(560px, calc(100vw - 28px));
  padding: 14px 18px;
  border-radius: 999px;
  background: rgba(47, 33, 25, 0.92);
  color: #fffaf5;
  text-align: center;
  box-shadow: var(--shadow);
  z-index: 12;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .calendar__toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 16px, 100%);
    padding: 16px 0 28px;
  }

  .hero,
  .calendar,
  .panel--compact,
  .modal__panel {
    padding: 18px;
    border-radius: 24px;
  }

  .hero h1 {
    max-width: 100%;
  }

  .stats-grid,
  .field-grid--two,
  .field-grid--three {
    grid-template-columns: 1fr;
  }

  .calendar__grid {
    gap: 6px;
  }

  .day-card {
    min-height: 98px;
    padding: 10px;
    border-radius: 18px;
  }

  .day-card__entries {
    gap: 6px;
  }

  .mini-entry {
    min-height: 28px;
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  .calendar__weekdays {
    gap: 6px;
    font-size: 0.82rem;
  }

  .button,
  .filter-chip,
  .segment span {
    min-height: 42px;
  }

  .modal {
    padding: 12px;
  }

  .modal__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .modal__actions-spacer {
    display: none;
  }
}
