:root {
  color-scheme: light;
  --canvas: #f4f2ec;
  --surface: #ffffff;
  --surface-soft: #f8f7f3;
  --ink: #172c2b;
  --muted: #657371;
  --muted-strong: #475957;
  --line: #dfe4e0;
  --line-soft: #ecefeb;
  --forest: #123b3a;
  --forest-2: #1d5551;
  --forest-3: #2f6d66;
  --sage: #dcebe2;
  --sage-strong: #8fb8a2;
  --sand: #f1e5cf;
  --amber: #a96819;
  --red: #a33f3f;
  --red-soft: #f9eaea;
  --green: #28735e;
  --shadow-sm: 0 1px 2px rgb(18 59 58 / 5%), 0 8px 24px rgb(18 59 58 / 5%);
  --shadow-lg: 0 24px 70px rgb(20 43 42 / 22%);
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 100% 0, rgb(220 235 226 / 58%), transparent 28rem),
    var(--canvas);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body:has(dialog[open]) {
  overflow: hidden;
}

body.auth-required {
  padding-left: 0;
  overflow: auto;
}

.auth-required .app-frame,
.auth-required > .connection-banner,
body:not(.auth-required) .auth-shell {
  display: none !important;
}

.auth-shell {
  min-height: 100dvh;
  padding: max(22px, var(--safe-top)) max(16px, var(--safe-right)) max(22px, var(--safe-bottom)) max(16px, var(--safe-left));
  background:
    radial-gradient(circle at 10% 0, rgb(143 184 162 / 34%), transparent 23rem),
    linear-gradient(160deg, #f5f3ed 0%, #e7eee9 100%);
}

.auth-card {
  width: min(100%, 520px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 28px;
  background: rgb(255 255 255 / 94%);
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 25px 24px 21px;
  background: var(--forest);
  color: #fff;
}

.auth-brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 18px;
  background: rgb(255 255 255 / 12%);
  color: #cfe5d7;
}

.auth-brand-mark svg { width: 35px; height: 35px; fill: currentColor; stroke: none; }
.auth-brand-mark .brand-mark-detail { fill: var(--forest); }
.auth-brand span:not(.auth-brand-mark) { color: #b9d5c5; font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.auth-brand h1 { margin-top: 1px; font-size: 25px; }
.auth-brand p { margin-top: 3px; color: #d7e6de; font-size: 12px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 19px 20px 0;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-soft);
}

.auth-tabs button {
  min-height: 44px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.auth-tabs button[aria-selected="true"] { background: #fff; color: var(--forest); box-shadow: var(--shadow-sm); }

.auth-form { display: grid; gap: 15px; padding: 23px 24px 10px; }
.auth-form[hidden] { display: none; }
.auth-intro { margin-bottom: 2px; }
.auth-intro h2 { font-size: 22px; }
.auth-intro p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.auth-form label { display: grid; gap: 6px; color: var(--muted-strong); font-size: 12px; font-weight: 750; }
.auth-form label > small { color: var(--muted); font-size: 10px; font-weight: 600; }
.auth-form input,
.auth-form select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
}
.auth-name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-date-kind { margin: 0; padding: 0; border: 0; }
.auth-date-kind legend { margin-bottom: 7px; color: var(--muted-strong); font-size: 12px; font-weight: 750; }
.auth-date-kind { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.auth-date-kind legend { grid-column: 1 / -1; }
.auth-date-kind label { display: flex; min-height: 58px; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; }
.auth-date-kind label:has(input:checked) { border-color: var(--sage-strong); background: #f1f7f3; }
.auth-date-kind input { width: 18px; min-height: 18px; padding: 0; accent-color: var(--forest-3); }
.auth-date-kind label span { display: grid; gap: 1px; }
.auth-date-kind strong { color: var(--ink); font-size: 12px; }
.auth-date-kind small { color: var(--muted); font-size: 10px; }
.auth-primary-button { min-height: 49px; border: 0; border-radius: 14px; background: var(--forest); color: #fff; font-size: 14px; font-weight: 850; cursor: pointer; }
.auth-primary-button:disabled { opacity: .6; cursor: wait; }
.auth-message { margin: 4px 24px 0; padding: 11px 12px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 12px; font-weight: 700; }
.auth-privacy { display: flex; gap: 8px; margin: 17px 24px 23px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.auth-privacy svg { width: 17px; height: 17px; flex: 0 0 auto; }

.account-settings-card { display: grid; gap: 16px; }
.account-summary { display: flex; align-items: center; gap: 12px; }
.account-avatar { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border-radius: 16px; background: var(--forest); color: #fff; font-size: 15px; font-weight: 850; }
.account-summary h3 { font-size: 18px; }
.account-summary p { margin-top: 2px; color: var(--muted); font-size: 11px; }
.account-details { display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--line-soft); }
.account-details div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 10px 12px; background: #fff; }
.account-details dt { color: var(--muted); font-size: 11px; }
.account-details dd { text-align: right; font-size: 12px; font-weight: 750; }
.account-logout-button { width: 100%; }

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

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button,
summary,
a {
  touch-action: manipulation;
}

.glossary-term {
  display: inline;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px dotted currentColor;
  border-radius: 3px;
  background: rgb(143 184 162 / 13%);
  color: inherit;
  font: inherit;
  font-weight: 800;
  line-height: inherit;
  text-decoration: none;
  cursor: help;
}

.glossary-term:active {
  background: rgb(143 184 162 / 30%);
}

.glossary-term:focus-visible {
  outline: 2px solid var(--forest-3);
  outline-offset: 2px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(47 109 102 / 35%);
  outline-offset: 3px;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

h1,
h2,
h3,
strong {
  letter-spacing: -0.02em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: var(--forest);
  color: white;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.connection-banner {
  position: relative;
  z-index: 90;
  padding: calc(8px + var(--safe-top)) 18px 8px;
  background: #80571c;
  color: white;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
}

.app-frame {
  min-height: 100dvh;
}

.app-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: calc(72px + var(--safe-top));
  padding: calc(12px + var(--safe-top)) calc(18px + var(--safe-right)) 12px calc(18px + var(--safe-left));
  border-bottom: 1px solid rgb(223 228 224 / 82%);
  background: rgb(244 242 236 / 88%);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--forest);
  box-shadow: 0 8px 18px rgb(18 59 58 / 18%);
  color: #dcebe2;
}

.brand-mark svg {
  width: 29px;
  height: 29px;
  fill: currentColor;
  stroke: none;
}

.brand-mark .brand-mark-detail {
  fill: var(--forest-3);
}

.eyebrow,
.section-kicker {
  display: block;
  color: var(--forest-3);
  font-size: 11px;
  font-weight: 780;
  letter-spacing: 0.075em;
  line-height: 1.25;
  text-transform: uppercase;
}

.brand-lockup h1 {
  margin-top: 2px;
  overflow: hidden;
  font-size: clamp(17px, 5vw, 20px);
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-state {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  border: 1px solid #cfdbd2;
  border-radius: 999px;
  background: rgb(255 255 255 / 68%);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 680;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgb(40 115 94 / 11%);
}

.save-state.is-saving .save-dot {
  background: var(--amber);
  animation: pulse 900ms infinite alternate;
}

.save-state.is-error .save-dot {
  background: var(--red);
}

@keyframes pulse {
  to { opacity: 0.35; }
}

.app-content {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 18px max(16px, var(--safe-right)) calc(104px + var(--safe-bottom)) max(16px, var(--safe-left));
}

.view {
  animation: view-in 220ms ease-out;
}

.view[hidden] {
  display: none !important;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.scenario-card,
.progress-card,
.details-card,
.settings-card,
.guide-section,
.income-total-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.scenario-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.calculation-window-card {
  align-items: stretch;
  background:
    linear-gradient(135deg, rgb(220 235 226 / 38%), transparent 58%),
    var(--surface);
}

.calculation-window-card > div:first-child {
  min-width: 0;
}

.calculation-window-card h3 {
  line-height: 1.3;
}

.calculation-window-card h3 + p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.window-card-action {
  display: grid;
  align-content: center;
  gap: 9px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid #cdded4;
  border-radius: 14px;
  background: var(--sage);
}

.window-card-action > span {
  color: var(--forest-2);
  font-size: 12px;
  font-weight: 730;
  overflow-wrap: anywhere;
}

.window-card-action button {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid rgb(18 59 58 / 10%);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgb(18 59 58 / 8%);
  color: var(--forest);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.window-card-action button:active {
  background: var(--surface-soft);
}

.scenario-card h3,
.progress-card h3,
.settings-card h3 {
  margin-top: 3px;
  font-size: 16px;
}

.segmented-control,
.entry-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: #ecefea;
}

.segmented-control button,
.entry-mode button {
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted-strong);
  font-weight: 720;
  cursor: pointer;
}

.segmented-control button[aria-checked="true"],
.entry-mode button[aria-checked="true"] {
  background: var(--surface);
  box-shadow: 0 1px 4px rgb(23 44 43 / 12%);
  color: var(--forest);
}

.hero-card {
  position: relative;
  min-height: 245px;
  margin-top: 14px;
  padding: 27px 24px 22px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 5%), transparent 58%),
    var(--forest);
  box-shadow: 0 20px 42px rgb(18 59 58 / 21%);
  color: white;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.hero-orb-one {
  top: -70px;
  right: -45px;
  width: 210px;
  height: 210px;
  background: rgb(143 184 162 / 14%);
  box-shadow: inset 0 0 0 40px rgb(255 255 255 / 2%);
}

.hero-orb-two {
  right: 83px;
  bottom: -92px;
  width: 155px;
  height: 155px;
  border: 28px solid rgb(255 255 255 / 4%);
}

.hero-label,
.hero-period,
.hero-status {
  position: relative;
  z-index: 1;
}

.hero-label {
  color: #d7e8df;
  font-size: 14px;
  font-weight: 620;
}

.hero-value {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 9px;
  font-size: clamp(42px, 13vw, 62px);
  font-variant-numeric: tabular-nums;
  font-weight: 780;
  letter-spacing: -0.055em;
  line-height: 1;
}

.hero-period {
  display: block;
  margin-top: 7px;
  color: #bbd2c7;
  font-size: 14px;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  margin-top: 23px;
  padding: 8px 11px;
  border: 1px solid rgb(220 235 226 / 18%);
  border-radius: 999px;
  background: rgb(255 255 255 / 9%);
  color: #e6f1eb;
  font-size: 12px;
  font-weight: 680;
}

.hero-status svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.primary-action {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid #cbdcd1;
  border-radius: var(--radius);
  background: var(--sage);
  color: var(--forest);
  text-align: left;
  cursor: pointer;
}

.action-icon,
.summary-icon,
.settings-icon {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  background: rgb(255 255 255 / 70%);
}

.action-icon svg,
.summary-icon svg,
.settings-icon svg {
  width: 22px;
  height: 22px;
}

.primary-action span:nth-child(2),
.details-card summary > span:nth-child(2) {
  display: grid;
  gap: 2px;
}

.primary-action strong,
.details-card summary strong {
  font-size: 15px;
}

.primary-action small,
.details-card summary small {
  color: var(--muted-strong);
  font-size: 12px;
}

.chevron {
  width: 20px;
  height: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.stat-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.stat-icon {
  display: grid;
  width: 36px;
  height: 36px;
  margin-bottom: 16px;
  place-items: center;
  border-radius: 12px;
  color: var(--forest);
}

.stat-icon.sage { background: var(--sage); }
.stat-icon.sand { background: var(--sand); color: #795428; }
.stat-icon svg { width: 20px; height: 20px; }

.stat-label,
.stat-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.stat-card strong {
  display: block;
  margin: 3px 0 1px;
  overflow: hidden;
  font-size: clamp(18px, 5.8vw, 24px);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-card {
  margin-top: 14px;
  padding: 17px;
}

.card-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.progress-count {
  flex: 0 0 auto;
  color: var(--forest-2);
  font-size: 19px;
}

.progress-track {
  height: 8px;
  margin-top: 17px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9ede9;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sage-strong), var(--forest-3));
  transition: width 320ms ease;
}

.progress-card p {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

.details-card {
  margin-top: 14px;
  overflow: hidden;
}

.details-card summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 13px 15px;
  list-style: none;
  cursor: pointer;
}

.details-card summary::-webkit-details-marker,
.guide-section summary::-webkit-details-marker {
  display: none;
}

.summary-icon {
  background: var(--surface-soft);
  color: var(--forest-3);
}

.details-chevron {
  width: 20px;
  height: 20px;
  transition: transform 180ms ease;
}

.details-card[open] .details-chevron,
.guide-section[open] summary > svg {
  transform: rotate(180deg);
}

.details-body {
  padding: 0 15px 16px;
  border-top: 1px solid var(--line-soft);
}

.breakdown-list {
  padding-top: 6px;
}

.breakdown-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-height: 46px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.breakdown-list dt {
  color: var(--muted-strong);
  font-size: 13px;
}

.breakdown-list dd {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
}

.result-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--sage);
  color: var(--forest);
}

.result-strip.negative {
  background: var(--red-soft);
  color: var(--red);
}

.result-strip span { font-size: 13px; }
.result-strip strong { font-size: 19px; font-variant-numeric: tabular-nums; }
.result-strip small { grid-column: 1 / -1; opacity: .78; font-size: 11px; }

.local-note {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 16px;
  padding: 0 3px;
  color: var(--muted);
  font-size: 12px;
}

.local-note svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  color: var(--forest-3);
}

.local-note strong { color: var(--muted-strong); }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin: 3px 1px 18px;
}

.view-header h2 {
  margin-top: 3px;
  font-size: 28px;
  line-height: 1.15;
}

.view-header p {
  max-width: 560px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.month-count {
  flex: 0 0 auto;
  margin-top: 7px;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--item-soft, var(--sage));
  color: var(--item-strong, var(--forest-2));
  font-size: 11px;
  font-weight: 750;
}

.income-mode-note,
.guide-highlight {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid #cdded4;
  border-radius: var(--radius);
  background: var(--sage);
  color: var(--forest);
}

.income-mode-note > span,
.guide-highlight > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: rgb(255 255 255 / 60%);
}

.income-mode-note svg,
.guide-highlight svg {
  width: 21px;
  height: 21px;
}

.income-mode-note p,
.guide-highlight p {
  align-self: center;
  font-size: 13px;
}

.month-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.month-card {
  width: 100%;
  min-height: 82px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
}

.month-card.is-empty {
  border-style: dashed;
  border-color: #b9c7bf;
  background: rgb(248 247 243 / 72%);
  box-shadow: none;
}

.month-card.is-empty .month-date {
  background: #ecefeb;
  color: var(--muted-strong);
}

.month-card.is-empty .month-amount strong {
  color: var(--muted-strong);
}

.month-card-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.month-date {
  display: grid;
  width: 50px;
  height: 54px;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-soft);
  color: var(--forest);
}

.month-date strong {
  align-self: end;
  font-size: 14px;
  line-height: 1;
}

.month-date small {
  align-self: start;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.month-copy {
  min-width: 0;
}

.month-copy > strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-copy > span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.company-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage-strong);
}

.company-dot.is-empty { background: #c9cfcb; }

.month-amount {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 92px;
}

.month-amount strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.month-amount span {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}

.month-amount svg {
  width: 14px;
  height: 14px;
}

.income-total-card {
  display: grid;
  margin-top: 15px;
  padding: 18px;
  background: var(--forest);
  color: white;
}

.income-total-card span,
.income-total-card small { color: #bed5cb; font-size: 12px; }
.income-total-card strong { margin: 4px 0 2px; font-size: 27px; font-variant-numeric: tabular-nums; }

.income-target-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgb(255 255 255 / 13%);
}

.income-target-grid > div {
  min-width: 0;
  padding: 10px 11px;
  border-radius: 12px;
  background: rgb(255 255 255 / 7%);
}

.income-target-grid span {
  display: block;
  line-height: 1.3;
}

.income-target-grid strong {
  display: block;
  margin-top: 4px;
  color: white;
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.settings-card {
  padding: 16px;
}

.settings-card + .details-card,
.details-card + .settings-card {
  margin-top: 14px;
}

.settings-card-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line-soft);
}

.settings-icon {
  background: var(--sage);
  color: var(--forest-2);
}

.settings-card-heading p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.form-stack {
  display: grid;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 122px;
  align-items: center;
  gap: 12px;
  min-height: 77px;
  border-bottom: 1px solid var(--line-soft);
}

.field-row:last-child { border-bottom: 0; }

.field-row > span:first-child {
  display: grid;
  gap: 2px;
}

.field-row strong { font-size: 14px; }
.field-row small { color: var(--muted); font-size: 11px; }

.input-with-unit,
.large-input {
  position: relative;
  display: block;
}

.input-with-unit input,
.large-input input {
  width: 100%;
  min-height: 48px;
  padding: 10px 42px 10px 10px;
  border: 1px solid #ccd5cf;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-align: right;
}

.input-with-unit em,
.large-input em {
  position: absolute;
  top: 50%;
  right: 10px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  transform: translateY(-50%);
  pointer-events: none;
}

.rules-card .summary-icon { background: var(--sand); color: #795428; }

.rule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 14px;
}

.rule-grid > div {
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.rule-grid dt { color: var(--muted); font-size: 11px; }
.rule-grid dd { margin-top: 3px; font-size: 15px; font-weight: 750; }

.action-settings {
  padding-bottom: 3px;
}

.settings-action {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  padding: 12px 2px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.settings-action:last-child { border-bottom: 0; }
.settings-action > span { display: grid; gap: 2px; }
.settings-action strong { font-size: 14px; }
.settings-action small { color: var(--muted); font-size: 11px; }
.settings-action svg { width: 20px; height: 20px; color: var(--muted); }
.danger-action strong, .danger-action svg { color: var(--red); }

.sync-settings-card {
  margin-top: 14px;
}

.sync-icon {
  background: #dcebea;
  color: var(--forest-2);
}

.sync-status-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.sync-status-row > span:last-child {
  display: grid;
  gap: 2px;
}

.sync-status-row strong { font-size: 14px; }
.sync-status-row small { color: var(--muted); font-size: 11px; }

.sync-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #9aa5a1;
  box-shadow: 0 0 0 4px rgb(154 165 161 / 13%);
}

.sync-status-dot.is-connected {
  background: var(--forest-2);
  box-shadow: 0 0 0 4px rgb(47 116 80 / 13%);
}

.sync-status-dot.is-conflict {
  background: #b86b25;
  box-shadow: 0 0 0 4px rgb(184 107 37 / 13%);
}

.sync-setup,
.sync-connected {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.sync-field {
  display: grid;
  gap: 6px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

.sync-field input,
.sync-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid #ccd5cf;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
}

.sync-field textarea {
  min-height: 78px;
  resize: vertical;
  overflow-wrap: anywhere;
}

.sync-wide-button { width: 100%; }

.sync-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.sync-divider::before,
.sync-divider::after {
  content: "";
  height: 1px;
  background: var(--line-soft);
}

.sync-button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sync-text-button {
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted-strong);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.sync-conflict {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #e1b77f;
  border-radius: 12px;
  background: #fff7e9;
}

.sync-conflict p,
.sync-privacy-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.sync-privacy-note {
  margin-top: 14px;
}

.sync-settings-card [hidden] { display: none !important; }

.guide-highlight {
  padding: 16px;
}

.guide-highlight strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.guide-sections {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.guide-section {
  overflow: hidden;
}

.guide-section summary {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  min-height: 65px;
  padding: 12px 14px;
  list-style: none;
  cursor: pointer;
}

.guide-section summary > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--forest-3);
  font-size: 11px;
  font-weight: 800;
}

.guide-section summary strong { font-size: 14px; }
.guide-section summary > svg { width: 19px; height: 19px; transition: transform 180ms ease; }

.guide-body {
  display: grid;
  gap: 14px;
  padding: 15px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-strong);
  font-size: 13px;
}

.guide-body article {
  padding: 14px;
  border-radius: 13px;
  background: var(--surface-soft);
}

.guide-body article h3 {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 14px;
}

.steps-list,
.plain-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: flex-start;
}

.steps-list li > span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
  background: var(--sage);
  color: var(--forest);
  font-size: 11px;
  font-weight: 800;
}

.plain-list { padding-left: 18px; list-style: disc; }

.formula-box {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 13px;
  background: var(--forest);
  color: white;
}

.formula-box span { color: #bed5cb; font-size: 10px; font-weight: 750; text-transform: uppercase; }
.formula-box strong { font-size: 13px; }

.source-list { gap: 0; }

.source-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--forest-2);
  font-weight: 680;
  text-decoration: none;
}

.source-list a:last-child { border-bottom: 0; }
.source-list svg { flex: 0 0 auto; width: 18px; height: 18px; }

.legal-disclaimer {
  margin: 16px 5px 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

/* Family hub */
.home-welcome {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 3px 1px 18px;
}

.home-welcome h2 {
  margin-top: 3px;
  font-size: clamp(26px, 8vw, 34px);
  line-height: 1.12;
}

.home-welcome p {
  max-width: 520px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.today-chip {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #d6dfd9;
  border-radius: 999px;
  background: rgb(255 255 255 / 72%);
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 720;
  text-transform: capitalize;
}

.pregnancy-home-card,
.home-money-card,
.cap-goal-card,
.timeline-card,
.doctor-profile-card,
.calendar-card,
.agenda-card,
.important-progress-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.pregnancy-home-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 18px 18px 14px;
  overflow: hidden;
  border-color: #cbded2;
  background:
    radial-gradient(circle at 96% 0, rgb(143 184 162 / 25%), transparent 14rem),
    linear-gradient(145deg, #f8fcf9, #edf5f0);
}

.pregnancy-illustration {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 18px;
  background: white;
  color: var(--forest-2);
  box-shadow: 0 8px 22px rgb(18 59 58 / 9%);
}

.pregnancy-illustration svg { width: 35px; height: 35px; }
.pregnancy-illustration svg path:first-child { fill: var(--sage); stroke: var(--forest-2); }

.pregnancy-home-copy {
  align-self: center;
}

.pregnancy-home-copy h3 {
  margin-top: 3px;
  font-size: 19px;
}

.pregnancy-home-copy p {
  margin-top: 5px;
  color: var(--muted-strong);
  font-size: 12px;
}

.card-link-button {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  margin-top: 2px;
  padding: 9px 2px 0;
  border: 0;
  border-top: 1px solid rgb(18 59 58 / 10%);
  background: transparent;
  color: var(--forest-2);
  font-size: 13px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.card-link-button svg { width: 19px; height: 19px; }

.home-money-card {
  margin-top: 14px;
  padding: 17px 17px 12px;
}

.home-card-heading {
  display: flex;
  align-items: center;
  gap: 11px;
}

.home-card-heading h3 {
  margin-top: 2px;
  font-size: 16px;
}

.home-card-icon {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 13px;
  background: var(--sage);
  color: var(--forest-2);
}

.home-card-icon.finance { background: var(--sand); color: #795428; }
.home-card-icon svg { width: 21px; height: 21px; }

.money-snapshot,
.cap-goal-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.money-snapshot > div,
.cap-goal-values > div {
  min-width: 0;
  padding: 12px;
  border-radius: 13px;
  background: var(--surface-soft);
}

.money-snapshot span,
.cap-goal-values span {
  display: block;
  color: var(--muted);
  font-size: 10px;
}

.money-snapshot strong,
.cap-goal-values strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: clamp(15px, 4.8vw, 20px);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cap-goal-values > .wide {
  grid-column: 1 / -1;
  background: var(--sage);
}

.cap-goal-values > .wide strong {
  color: var(--forest-2);
}

.cap-goal-values strong {
  overflow: visible;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

.cap-completion-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-weight: 650;
}

.cap-completion-status::before {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--sage-strong);
  box-shadow: 0 0 0 3px rgb(143 184 162 / 16%);
  content: "";
}

.cap-progress {
  height: 7px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece8;
}

.cap-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sage-strong), var(--forest-3));
  transition: width 320ms ease;
}

.cap-progress.large { height: 10px; }

.home-section {
  margin-top: 22px;
}

.home-section-heading,
.agenda-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 0 2px 11px;
}

.home-section-heading h3,
.agenda-heading h3 {
  margin-top: 2px;
  font-size: 18px;
}

.home-section-heading button,
.agenda-heading button {
  min-height: 44px;
  padding: 7px 2px;
  border: 0;
  background: transparent;
  color: var(--forest-2);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.shortcut-card {
  display: grid;
  align-content: start;
  justify-items: start;
  min-height: 132px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
}

.shortcut-icon,
.more-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 12px;
  background: var(--sage);
  color: var(--forest-2);
}

.shortcut-icon svg,
.more-icon svg { width: 20px; height: 20px; }
.shortcut-card.legal .shortcut-icon, .more-icon.legal { background: #e7e6f4; color: #514f84; }
.shortcut-card.doctor .shortcut-icon, .more-icon.doctor { background: #e5f0ee; color: #26706a; }
.shortcut-card.important .shortcut-icon, .more-icon.important { background: var(--sand); color: #825721; }
.shortcut-card.pregnancy .shortcut-icon, .more-icon.pregnancy { background: #f3e5e5; color: #8a4c56; }
.shortcut-card.notes .shortcut-icon { background: #edf1f7; color: #526782; }
.shortcut-card.documents .shortcut-icon, .more-icon.documents { background: #e8f1e9; color: #477157; }
.more-icon.settings { background: #e8eceb; color: var(--muted-strong); }

.shortcut-card strong { font-size: 14px; }
.shortcut-card small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.upcoming-list,
.agenda-list,
.notes-list {
  display: grid;
  gap: 9px;
}

.upcoming-home-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
}

.upcoming-home-item time {
  display: grid;
  width: 43px;
  height: 49px;
  place-items: center;
  align-content: center;
  border-radius: 12px;
  background: var(--sage);
  color: var(--forest-2);
  line-height: 1;
  text-align: center;
}

.upcoming-home-item time strong { font-size: 18px; }
.upcoming-home-item time span { margin-top: 3px; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.upcoming-home-item > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
.upcoming-home-item > span:nth-child(2) strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-home-item small { color: var(--muted); font-size: 10px; }
.text-chevron { color: var(--muted); font-size: 24px; font-weight: 300; }

.cap-goal-card {
  margin-top: 14px;
  padding: 17px;
}

.cap-goal-card .card-heading-row > strong {
  color: var(--forest-2);
  font-size: 22px;
}

.scenario-sync-note {
  margin: 8px 4px -4px;
  color: var(--muted);
  font-size: 11px;
}

.back-button {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted-strong);
  cursor: pointer;
}

.back-button svg { width: 21px; height: 21px; }

.pregnancy-status-card {
  position: relative;
  padding: 22px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0, rgb(143 184 162 / 20%), transparent 18rem),
    var(--forest);
  box-shadow: 0 18px 40px rgb(18 59 58 / 18%);
  color: white;
}

.pregnancy-status-label {
  display: inline-flex;
  padding: 6px 9px;
  border: 1px solid rgb(255 255 255 / 17%);
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  color: #d7e8df;
  font-size: 10px;
  font-weight: 760;
  text-transform: uppercase;
}

.pregnancy-status-card > strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(27px, 8vw, 42px);
  line-height: 1.1;
}

.pregnancy-status-card > p {
  max-width: 570px;
  margin-top: 7px;
  color: #bed5cb;
  font-size: 12px;
}

.pregnancy-status-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 18px;
}

.pregnancy-status-stats[hidden] { display: none; }
.pregnancy-status-stats > div { padding: 12px; border-radius: 13px; background: rgb(255 255 255 / 8%); }
.pregnancy-status-stats span { display: block; color: #bed5cb; font-size: 9px; }
.pregnancy-status-stats strong { display: block; margin-top: 3px; font-size: 15px; }

.pregnancy-form-card,
.doctor-form-card { margin-top: 14px; }

.profile-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding-top: 15px;
}

.profile-field {
  display: grid;
  align-content: start;
  gap: 7px;
}

.profile-field.full { grid-column: auto; }
.profile-field { min-width: 0; }
.profile-field > span { display: grid; gap: 2px; }
.profile-field strong { font-size: 12px; }
.profile-field small { color: var(--muted); font-size: 10px; }

.pregnancy-sync-feedback {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 42px;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 12px;
  line-height: 1.45;
}

.pregnancy-sync-feedback::before {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}

.pregnancy-sync-feedback.is-ready {
  border-color: #c6ded0;
  background: var(--sage);
  color: var(--forest-2);
}

.pregnancy-sync-feedback.is-ready::before {
  background: var(--sage-strong);
  box-shadow: 0 0 0 3px rgb(143 184 162 / 18%);
}

.profile-field input,
.profile-field textarea,
.dialog-field input,
.dialog-field textarea,
.dialog-field select,
.search-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid #ccd5cf;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 16px;
}

.profile-field textarea,
.dialog-field textarea {
  min-height: 112px;
  resize: vertical;
}

.timeline-card {
  margin-top: 14px;
  padding: 17px;
}

.timeline-list {
  position: relative;
  display: grid;
  margin-top: 17px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  min-height: 74px;
  padding-bottom: 16px;
}

button.timeline-item { width: 100%; padding: 0 0 16px; border: 0; appearance: none; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.timeline-item.is-calendar-event { margin: 0; padding: 0 0 16px; border: 0; background: transparent; }
.timeline-item.is-calendar-event > time { color: var(--item-strong); }
.timeline-item.is-calendar-event strong { color: var(--item-strong); }

.timeline-item:not(:last-child)::before {
  position: absolute;
  top: 19px;
  bottom: -2px;
  left: 6px;
  width: 1px;
  background: #d4dfd8;
  content: "";
}

.timeline-marker {
  position: relative;
  z-index: 1;
  width: 13px;
  height: 13px;
  margin-top: 3px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--forest-3);
  box-shadow: 0 0 0 1px var(--sage-strong);
}

.timeline-item.is-past .timeline-marker { background: #aab5af; }
.timeline-item.is-calendar-event .timeline-marker,
.timeline-item.is-calendar-event.is-past .timeline-marker { background: var(--item-strong); box-shadow: 0 0 0 1px var(--item-strong); }
.timeline-item > div { display: grid; align-content: start; gap: 3px; }
.timeline-item strong { font-size: 13px; }
.timeline-item p { color: var(--muted); font-size: 10px; }
.timeline-item time { color: var(--forest-2); font-size: 10px; font-weight: 750; white-space: nowrap; }

.medical-note,
.location-warning {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #ead9bd;
  border-radius: 15px;
  background: #faf3e8;
  color: #6e5635;
  font-size: 11px;
}

.medical-note svg,
.location-warning svg { width: 19px; height: 19px; }

.doctor-profile-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 18px;
}

.doctor-avatar {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 19px;
  background: var(--sage);
  color: var(--forest-2);
}

.doctor-avatar svg { width: 30px; height: 30px; }
.doctor-profile-card > div:nth-child(2) { min-width: 0; }
.doctor-profile-card > div:nth-child(2) > span { color: var(--forest-3); font-size: 10px; font-weight: 750; }
.doctor-profile-card h3 { margin-top: 3px; overflow: hidden; font-size: 20px; text-overflow: ellipsis; white-space: nowrap; }
.doctor-profile-card p { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.doctor-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
  margin-top: 2px;
}

.doctor-actions[hidden],
.doctor-actions a[hidden] { display: none; }
.doctor-actions a { display: grid; min-height: 48px; place-items: center; align-content: center; gap: 3px; border-radius: 12px; background: var(--surface-soft); color: var(--forest-2); font-size: 10px; font-weight: 750; text-decoration: none; }
.doctor-actions svg { width: 19px; height: 19px; }

.action-header { align-items: center; }

.compact-primary {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 9px 12px;
  border: 0;
  border-radius: 13px;
  background: var(--forest);
  color: white;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.compact-primary svg { width: 18px; height: 18px; }

.calendar-card { padding: 14px; }
.calendar-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; text-align: center; }
.calendar-toolbar h3 { margin-top: 2px; font-size: 17px; text-transform: capitalize; }
.calendar-weekdays,
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-weekdays { margin-top: 15px; padding: 0 2px; color: var(--muted); font-size: 9px; font-weight: 750; text-align: center; text-transform: uppercase; }
.calendar-weekdays span { padding: 7px 0; }
.calendar-grid { gap: 3px; }

.calendar-day {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 46px;
  padding: 5px 1px;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  font-size: 12px;
  font-weight: 680;
  cursor: pointer;
}

.calendar-day.is-outside { color: #aab3b0; }
.calendar-day.has-events { border-color: var(--day-event-border); background: var(--day-event-background); color: var(--ink); }
.calendar-day.is-today { box-shadow: inset 0 0 0 1px var(--sage-strong); color: var(--forest-2); }
.calendar-day.is-selected { background: var(--forest); color: white; box-shadow: none; }
.calendar-dots { display: flex; gap: 2px; height: 4px; }
.calendar-dots b { width: 4px; height: 4px; border-radius: 50%; background: #8aa69a; }
.calendar-dots b.medical { background: #4d8b82; }
.calendar-dots b.administrative { background: #bc823d; }
.calendar-dots b.financial { background: #6d739f; }
.calendar-dots b.personal { background: #a86c7b; }
.calendar-day.is-selected .calendar-dots b { background: white; }

.agenda-card { margin-top: 14px; padding: 16px; }
.agenda-heading { align-items: center; margin: 0 1px 12px; }
.agenda-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  min-height: 62px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
}

button.agenda-item { cursor: pointer; }
.agenda-item.is-generated { border-style: dashed; }
.agenda-marker { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: #a86c7b; }
.agenda-item .agenda-marker { background: var(--item-strong); }
.agenda-copy { display: grid; gap: 2px; min-width: 0; }
.agenda-copy strong { font-size: 13px; }
.agenda-copy small { color: var(--muted); font-size: 9px; }
.agenda-copy p { margin-top: 3px; color: var(--muted-strong); font-size: 10px; }

.agenda-empty-action,
.agenda-income-action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 68px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 15px;
  background: var(--surface-soft);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.agenda-income-action {
  border-style: solid;
  border-color: #d4dfd8;
  background: linear-gradient(145deg, #f8fbf9, #eef5f1);
}

.agenda-empty-action > span:nth-child(2),
.agenda-income-action > span:nth-child(2) { display: grid; gap: 3px; }
.agenda-empty-action strong,
.agenda-income-action strong { font-size: 13px; }
.agenda-empty-action small,
.agenda-income-action small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.agenda-empty-icon,
.agenda-income-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 12px; background: var(--sage-soft); color: var(--forest-2); }
.agenda-empty-icon svg,
.agenda-income-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.agenda-income-icon { background: #e0ece5; }
.agenda-empty-chevron { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; color: var(--muted); }

.search-field {
  position: relative;
  display: block;
  margin-bottom: 13px;
}

.search-field svg { position: absolute; z-index: 1; top: 50%; left: 13px; width: 19px; height: 19px; color: var(--muted); transform: translateY(-50%); }
.search-field input { padding-left: 42px; background: var(--surface); }

.note-card {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
}

.note-card.is-pinned { border-color: #c9dccf; background: linear-gradient(145deg, #fff, #f3f8f5); }
.note-card,
.note-card.is-pinned { border-color: var(--item-strong); background: linear-gradient(145deg, var(--surface), var(--item-soft)); }
.note-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.note-topline > strong { font-size: 15px; }
.note-topline > span { padding: 4px 7px; border-radius: 999px; background: var(--sage); color: var(--forest-2); font-size: 8px; font-weight: 760; }
.note-card p { display: -webkit-box; overflow: hidden; color: var(--muted-strong); font-size: 12px; white-space: pre-wrap; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.note-card > small { color: var(--muted); font-size: 9px; }

.note-attachments {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 17px;
  background: var(--surface-soft);
}

.note-attachments-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.note-attachments-heading > span { display: grid; gap: 2px; }
.note-attachments-heading strong { font-size: 13px; }
.note-attachments-heading small,
.note-storage-hint { color: var(--muted); font-size: 9px; line-height: 1.4; }
.note-upload-button { display: inline-flex; min-height: 40px; align-items: center; gap: 6px; padding: 8px 11px; border: 1px solid #cbdad1; border-radius: 12px; background: #edf5f0; color: var(--forest-2); font-size: 11px; font-weight: 750; cursor: pointer; }
.note-upload-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.note-upload-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.note-attachment-list { display: grid; gap: 7px; }
.note-attachment-list > p { margin: 0; padding: 10px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); font-size: 10px; text-align: center; }
.note-attachment-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface); }
.note-attachment-row.is-pending { grid-template-columns: minmax(0, 1fr) auto; background: #f3f8f5; }
.note-attachment-row > span { display: grid; min-width: 0; gap: 2px; }
.note-attachment-row strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.note-attachment-row small { color: var(--muted); font-size: 8px; }
.note-attachment-row a,
.note-attachment-row button { min-height: 34px; padding: 7px 8px; border: 0; border-radius: 9px; background: var(--surface-soft); color: var(--forest-2); font-size: 9px; font-weight: 720; text-decoration: none; cursor: pointer; }
.note-attachment-row button { color: #98606b; }

.documents-local-note { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 14px; padding: 11px 13px; border-radius: 14px; background: #f5f3ed; color: var(--muted-strong); }
.documents-local-note svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; }
.documents-local-note p { margin: 0; font-size: 10px; line-height: 1.45; }
.documents-library { display: grid; gap: 20px; padding-bottom: 12px; }
.document-category { display: grid; gap: 10px; }
.document-category-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; }
.document-category-heading h3 { font-size: 16px; }
.document-category-heading span { display: grid; min-width: 27px; height: 27px; place-items: center; border-radius: 999px; background: var(--sage-soft); color: var(--forest-2); font-size: 10px; font-weight: 780; }
.document-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.document-card { position: relative; display: grid; min-width: 0; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink); }
.document-open-link { display: grid; min-width: 0; color: inherit; text-decoration: none; }
.document-preview { display: grid; height: 92px; place-items: center; overflow: hidden; background: linear-gradient(145deg, #edf3ef, #f8faf9); color: var(--forest-2); font-size: 16px; font-weight: 850; letter-spacing: .05em; }
.category-pdf .document-preview { background: #fff0f0; color: #a34f58; }
.category-spreadsheets .document-preview { background: #edf7f0; color: #39704c; }
.category-documents .document-preview { background: #eef2fb; color: #52678f; }
.document-preview img { width: 100%; height: 100%; object-fit: cover; }
.document-copy { display: grid; min-width: 0; gap: 3px; padding: 10px; }
.document-copy strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.document-copy small { overflow: hidden; color: var(--muted); font-size: 8px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.document-delete-button { position: absolute; top: 7px; right: 7px; display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid rgba(255,255,255,.8); border-radius: 10px; background: rgba(255,255,255,.9); color: #98606b; box-shadow: var(--shadow-sm); cursor: pointer; }
.document-delete-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.documents-header-actions { display: grid; justify-items: end; gap: 7px; }
.documents-upload-button { display: inline-flex; min-height: 38px; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 12px; background: var(--forest); color: white; font-size: 10px; font-weight: 780; cursor: pointer; }
.documents-upload-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.documents-upload-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.color-picker-field { margin: 0; padding: 0; border: 0; }
.color-picker-field legend { margin-bottom: 9px; color: var(--muted-strong); font-size: 11px; font-weight: 720; }
.color-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.color-picker label { position: relative; display: block; cursor: pointer; }
.color-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.color-picker label > span { display: block; width: 32px; height: 32px; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 1px var(--line); }
.color-picker input:checked + span { box-shadow: 0 0 0 3px var(--ink); transform: scale(.9); }
.color-picker input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 4px; }
.color-picker .sage > span { background: #3f9166; }
.color-picker .rose > span { background: #c5526c; }
.color-picker .lavender > span { background: #795bb8; }
.color-picker .sand > span { background: #b77a1d; }
.color-picker .sky > span { background: #4387b1; }
.color-picker .coral > span { background: #c76c4c; }
.color-picker .mint > span { background: #319181; }
.color-picker .slate > span { background: #5d7480; }

@media (min-width: 620px) {
  .document-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.location-warning { margin: 0 0 14px; }
.important-progress-card { margin-bottom: 16px; padding: 15px; }
.important-progress-card > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.important-progress-card span { color: var(--muted-strong); font-size: 11px; }
.important-progress-card strong { font-size: 17px; }
.important-progress-card .cap-progress { margin-top: 10px; }

.task-groups { display: grid; gap: 18px; }
.task-group { display: grid; gap: 9px; }
.task-group[hidden] { display: none; }
.task-group-heading { margin: 0 3px 2px; }
.task-group-heading > span { color: var(--forest-3); font-size: 9px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.task-group-heading h3 { margin-top: 2px; font-size: 17px; }

.task-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: flex-start;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.task-card > input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.task-card > input:focus-visible + .task-check {
  outline: 3px solid rgb(47 109 102 / 35%);
  outline-offset: 3px;
}
.task-check { display: grid; width: 25px; height: 25px; margin-top: 1px; place-items: center; border: 1px solid #bccac1; border-radius: 8px; background: var(--surface-soft); color: transparent; }
.task-check svg { width: 17px; height: 17px; stroke-width: 2.5; }
.task-copy { display: grid; gap: 3px; }
.task-copy strong { font-size: 14px; }
.task-copy small { color: var(--forest-3); font-size: 10px; font-weight: 700; }
.task-copy p { margin-top: 3px; color: var(--muted-strong); font-size: 11px; }
.task-copy a { justify-self: start; min-height: 44px; margin-top: 4px; padding: 11px 0; color: var(--forest-2); font-size: 10px; font-weight: 760; }
.task-card.is-done { background: #f4f8f5; }
.task-card.is-done .task-check { border-color: var(--forest-3); background: var(--forest-3); color: white; }
.task-card.is-done .task-copy > strong { color: var(--muted); text-decoration: line-through; }
.task-card[hidden] { display: none; }
.task-card { overflow: hidden; }
.task-card .task-check,
.task-card .task-copy { position: relative; z-index: 1; transition: transform .22s ease; }
.task-card.is-showing-hide .task-check,
.task-card.is-showing-hide .task-copy { transform: translateX(-82px); }
.task-hide-action { position: absolute; z-index: 0; top: 0; right: 0; display: grid; width: 78px; height: 100%; place-content: center; gap: 5px; border: 0; background: #a84f5e; color: white; font-size: 9px; font-weight: 780; opacity: 0; pointer-events: none; cursor: pointer; transition: opacity .18s ease; }
.task-card.is-showing-hide .task-hide-action,
.task-hide-action:focus-visible { opacity: 1; pointer-events: auto; }
.task-hide-action svg { width: 20px; height: 20px; margin: auto; fill: none; stroke: currentColor; stroke-width: 1.8; }
.personal-tasks-empty { margin: 0; padding: 14px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); font-size: 10px; line-height: 1.45; text-align: center; }
#personalTasksList { display: grid; gap: 9px; }
.hidden-tasks-button { display: grid; min-width: 58px; min-height: 58px; place-items: center; align-content: center; gap: 1px; padding: 5px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--muted-strong); cursor: pointer; }
.hidden-tasks-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.hidden-tasks-button span { font-size: 8px; font-weight: 700; }
.hidden-tasks-button strong { position: absolute; margin: -39px 0 0 39px; display: grid; min-width: 19px; height: 19px; place-items: center; border-radius: 999px; background: var(--forest); color: white; font-size: 8px; }
.hidden-tasks-button.has-items { border-color: #c8d9cf; color: var(--forest-2); }
.hidden-tasks-button:not(.has-items) strong { display: none; }
.hidden-tasks-explanation { margin: 0 0 12px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.hidden-tasks-list { display: grid; gap: 8px; }
.hidden-task-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--surface-soft); }
.hidden-task-row strong { font-size: 11px; }
.hidden-task-row button { min-height: 38px; padding: 7px 10px; border: 0; border-radius: 10px; background: var(--sage-soft); color: var(--forest-2); font-size: 9px; font-weight: 760; }
.note-destinations { display: grid; gap: 9px; }
.note-schedule-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 10px; border-radius: 14px; background: var(--surface-soft); }
.note-schedule-fields[hidden] { display: none; }

.more-menu {
  display: grid;
  gap: 9px;
}

.more-menu > button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
}

.more-menu .more-icon { margin: 0; }
.more-menu > button > span:nth-child(2) { display: grid; gap: 2px; }
.more-menu strong { font-size: 14px; }
.more-menu small { color: var(--muted); font-size: 10px; }
.more-menu .chevron { color: var(--muted); }

.empty-state {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 1px dashed #ccd6d0;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.empty-state span { color: var(--sage-strong); font-size: 24px; }
.empty-state p { max-width: 390px; font-size: 11px; }

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: calc(68px + var(--safe-bottom));
  padding: 6px max(8px, var(--safe-right)) var(--safe-bottom) max(8px, var(--safe-left));
  border-top: 1px solid rgb(211 218 213 / 90%);
  background: rgb(253 253 250 / 91%);
  box-shadow: 0 -10px 30px rgb(18 59 58 / 7%);
  backdrop-filter: blur(22px) saturate(1.35);
  -webkit-backdrop-filter: blur(22px) saturate(1.35);
}

.nav-item {
  display: grid;
  min-height: 57px;
  padding: 5px 2px 4px;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: #7b8784;
  cursor: pointer;
}

.nav-item svg {
  width: 23px;
  height: 23px;
}

.nav-item span {
  font-size: 10px;
  font-weight: 700;
}

.nav-item.is-active {
  background: var(--sage);
  color: var(--forest);
}

dialog {
  padding: 0;
  border: 0;
  color: var(--ink);
}

dialog::backdrop {
  background: rgb(16 36 35 / 58%);
  backdrop-filter: blur(3px);
}

.month-dialog {
  width: 100%;
  max-width: none;
  max-height: min(92dvh, 850px);
  margin: auto 0 0;
  overflow: visible;
  border-radius: 25px 25px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.month-dialog[open] {
  animation: sheet-in 260ms cubic-bezier(.2,.8,.2,1);
}

@keyframes sheet-in {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.month-sheet {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(92dvh, 850px);
}

.sheet-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 16px 16px 13px;
  border-bottom: 1px solid var(--line-soft);
}

.sheet-header h2 { margin-top: 2px; font-size: 21px; }

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 13px;
  background: var(--surface-soft);
  color: var(--muted-strong);
  cursor: pointer;
}

.icon-button svg { width: 21px; height: 21px; }

.eligible-pill {
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--sage);
  color: var(--forest-2);
  font-size: 10px;
  font-weight: 760;
}

.eligible-pill.is-ineligible {
  background: var(--red-soft);
  color: var(--red);
}

.sheet-content {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 15px 16px 18px;
}

.entry-mode {
  margin-bottom: 13px;
}

.entry-mode button {
  font-size: 13px;
}

.edit-fields[hidden] { display: none; }

.edit-fields {
  display: grid;
  gap: 10px;
}

.money-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  align-items: center;
  gap: 12px;
  min-height: 73px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface-soft);
}

.money-field > span:first-child { display: grid; gap: 2px; }
.money-field strong { font-size: 14px; }
.money-field small { color: var(--muted); font-size: 10px; }

.large-input input {
  min-height: 50px;
  padding-right: 41px;
  background: white;
  font-size: 17px;
}

.large-input:has(em:last-child:not(:only-child)) input { padding-right: 48px; }

.live-preview {
  margin-top: 13px;
  padding: 15px;
  border-radius: 16px;
  background: var(--forest);
  color: white;
}

.live-preview > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.live-preview > div span { color: #bed5cb; font-size: 12px; }
.live-preview > div strong { font-size: 23px; font-variant-numeric: tabular-nums; }

.live-preview dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 13px;
}

.live-preview dl > div {
  padding: 10px;
  border-radius: 11px;
  background: rgb(255 255 255 / 7%);
}

.live-preview dt { color: #bed5cb; font-size: 10px; }
.live-preview dd { margin-top: 2px; font-size: 13px; font-weight: 700; }

.clear-month-button {
  width: 100%;
  min-height: 48px;
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid rgb(163 63 63 / 22%);
  border-radius: 13px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.clear-month-button:active {
  background: #f3dddd;
}

.clear-month-button[hidden] {
  display: none;
}

.sheet-footer {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 10px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--line-soft);
  background: var(--surface);
}

.compact-sheet-dialog {
  max-height: min(88dvh, 720px);
}

.compact-sheet-dialog .month-sheet {
  max-height: min(88dvh, 720px);
}

.dialog-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
}

.dialog-field {
  display: grid;
  align-content: start;
  gap: 6px;
}

.dialog-field.full,
.pin-field.full {
  grid-column: auto;
}

.dialog-field > span {
  color: var(--muted-strong);
  font-size: 11px;
  font-weight: 720;
}

.pin-field {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface-soft);
}

.pin-field input {
  width: 22px;
  height: 22px;
  accent-color: var(--forest-3);
}

.pin-field > span { display: grid; gap: 1px; }
.pin-field strong { font-size: 12px; }
.pin-field small { color: var(--muted); font-size: 10px; }

.editor-footer {
  grid-template-columns: auto minmax(90px, .8fr) minmax(110px, 1.2fr);
}

.danger-link-button {
  min-height: 50px;
  padding: 10px 12px;
  border: 0;
  border-radius: 13px;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 750;
  cursor: pointer;
}

.danger-link-button[hidden] { display: none; }

.secondary-button,
.save-button,
.danger-button {
  min-height: 50px;
  padding: 11px 16px;
  border: 0;
  border-radius: 13px;
  font-weight: 750;
  cursor: pointer;
}

.secondary-button { background: #ecefeb; color: var(--muted-strong); }
.save-button { background: var(--forest); color: white; }
.danger-button { background: var(--red); color: white; }

.glossary-dialog {
  width: min(calc(100% - 32px), 430px);
  margin: auto;
  overflow: visible;
  border-radius: var(--radius-lg);
  background: transparent;
}

.glossary-dialog[open] {
  animation: glossary-in 180ms ease-out;
}

.glossary-card {
  padding: 20px;
  border: 1px solid rgb(255 255 255 / 55%);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.glossary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.glossary-code {
  display: inline-flex;
  min-height: 32px;
  padding: 6px 10px;
  align-items: center;
  border-radius: 10px;
  background: var(--sage);
  color: var(--forest-2);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: .05em;
}

.glossary-card h2 {
  margin-top: 17px;
  font-size: 21px;
  line-height: 1.2;
}

.glossary-card > p {
  margin-top: 9px;
  color: var(--muted-strong);
  font-size: 14px;
  line-height: 1.55;
}

.glossary-close-button {
  width: 100%;
  margin-top: 20px;
}

@keyframes glossary-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.confirm-dialog {
  width: min(calc(100% - 32px), 390px);
  margin: auto;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.confirm-card {
  display: grid;
  justify-items: center;
  padding: 23px;
  text-align: center;
}

.confirm-icon {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 16px;
  background: var(--red-soft);
  color: var(--red);
}

.confirm-icon svg { width: 25px; height: 25px; }
.confirm-card h2 { margin-top: 14px; font-size: 20px; }
.confirm-card p { margin-top: 7px; color: var(--muted); font-size: 13px; }

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  width: 100%;
  margin-top: 20px;
}

.toast {
  position: fixed;
  z-index: 120;
  right: 16px;
  bottom: calc(84px + var(--safe-bottom));
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 15px;
  border-radius: 14px;
  background: #173d38;
  box-shadow: 0 14px 34px rgb(18 59 58 / 24%);
  color: white;
  font-size: 13px;
  font-weight: 680;
}

.toast[hidden] { display: none; }
.toast svg { width: 19px; height: 19px; }

@media (max-width: 390px) {
  .month-card {
    min-height: 96px;
    padding: 12px;
  }

  .month-card-inner {
    grid-template-columns: 46px minmax(0, 1fr);
    align-items: start;
    column-gap: 10px;
    row-gap: 3px;
  }

  .month-date {
    grid-row: 1 / span 2;
    width: 46px;
    height: 52px;
  }

  .month-copy > strong {
    white-space: normal;
  }

  .month-copy > span {
    line-height: 1.3;
  }

  .month-amount {
    grid-row: 2;
    grid-column: 2;
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
  }

  .month-amount strong {
    font-size: 15px;
  }

  .month-amount span {
    flex: 0 0 auto;
  }
}

@media (max-width: 370px) {
  .save-state span:last-child { display: none; }
  .save-state { width: 29px; height: 29px; padding: 0; justify-content: center; }
  .hero-card { padding-inline: 20px; }
  .stat-grid { grid-template-columns: 1fr; }
  .money-field { grid-template-columns: 1fr; }
  .large-input { width: 100%; }
  .profile-form,
  .dialog-form-grid { grid-template-columns: 1fr; }
  .profile-field.full,
  .dialog-field.full,
  .pin-field.full { grid-column: auto; }
  .view-header.action-header { align-items: flex-start; }
  .compact-primary span { display: none; }
  .money-snapshot,
  .cap-goal-values { grid-template-columns: 1fr; }
  .income-target-grid { grid-template-columns: 1fr; }
  .editor-footer { grid-template-columns: 1fr 1fr; }
  .editor-footer .danger-link-button { grid-column: 1 / -1; }
}

@media (min-width: 640px) {
  .app-content { padding-top: 24px; }
  .scenario-card { grid-template-columns: 1fr 280px; align-items: center; }
  .hero-card { min-height: 270px; padding: 32px 30px 25px; }
  .hero-status { margin-top: 27px; }
  .month-list { grid-template-columns: 1fr 1fr; }
  .income-total-card { grid-column: 1 / -1; }
  .profile-form,
  .dialog-form-grid { grid-template-columns: 1fr 1fr; }
  .profile-field.full,
  .dialog-field.full,
  .pin-field.full { grid-column: 1 / -1; }
}

@media (min-width: 900px) {
  body { padding-left: 112px; }

  .app-header {
    min-height: 82px;
    padding-right: 30px;
    padding-left: 30px;
  }

  .bottom-nav {
    top: 0;
    right: auto;
    bottom: 0;
    left: 0;
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, 76px);
    align-content: center;
    width: 112px;
    min-height: 100dvh;
    padding: 20px 12px;
    border-top: 0;
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 30px rgb(18 59 58 / 5%);
  }

  .nav-item {
    min-height: 66px;
  }

  .nav-item span { font-size: 11px; }
  .app-content { padding-bottom: 50px; }

  .month-dialog {
    width: min(calc(100% - 48px), 620px);
    max-height: min(88dvh, 790px);
    margin: auto;
    border-radius: var(--radius-lg);
  }

  .month-sheet { max-height: min(88dvh, 790px); }
  .sheet-footer { padding-bottom: 14px; }
  .toast { right: 30px; bottom: 26px; left: auto; min-width: 280px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.reserve-months-card { margin-top: 14px; }
.reserve-months-body > p { margin: 0 0 14px; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.reserve-months-body .month-list { margin: 0; }
.month-card.status-assimilated .month-date { background: #eef0ff; color: #5d5b89; }
.month-card.status-gap { opacity: .72; }
.month-selection-label { font-weight: 700; }
.status-income .month-selection-label,
.status-assimilated .month-selection-label { color: var(--sage-dark); }
.month-status-fieldset { margin: 0 0 18px; padding: 0; border: 0; }
.month-status-fieldset legend { margin-bottom: 10px; color: var(--ink); font-size: .88rem; font-weight: 800; }
.month-status-options { display: grid; gap: 8px; }
.month-status-options label { display: flex; min-height: 58px; align-items: center; gap: 11px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); cursor: pointer; }
.month-status-options label:has(input:checked) { border-color: var(--sage); background: var(--sage-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--sage) 16%, transparent); }
.month-status-options input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--sage-dark); }
.month-status-options span { display: grid; gap: 2px; }
.month-status-options strong { font-size: .9rem; }
.month-status-options small { color: var(--muted); font-size: .75rem; line-height: 1.35; }
.assimilated-fields { display: grid; gap: 12px; margin-bottom: 18px; padding: 14px; border-radius: 18px; background: #f5f4ff; }
.assimilated-fields[hidden],
#incomeEntryFields[hidden] { display: none; }
