/* MyWeddingPlan — warm, calm, mobile-first. */
:root {
  --bg: #faf6f2;
  --surface: #ffffff;
  --surface-2: #f3ece6;
  --text: #2b2422;
  --muted: #7d716d;
  --line: #e8dfd8;
  --accent: #b5646e;
  --accent-strong: #9a4e58;
  --accent-soft: #f5e4e4;
  --sage: #7f9a83;
  --sage-soft: #e7efe7;
  --amber: #c98b3a;
  --amber-soft: #f7ecda;
  --danger: #b4493f;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 40, 35, .06), 0 8px 24px rgba(60, 40, 35, .06);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1a19;
    --surface: #2a2322;
    --surface-2: #332b29;
    --text: #f3ebe7;
    --muted: #b3a6a1;
    --line: #403633;
    --accent: #d98791;
    --accent-strong: #e8a0a9;
    --accent-soft: #3d2a2c;
    --sage-soft: #28332a;
    --amber-soft: #3a3022;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: var(--accent-strong); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
p { margin: 0 0 1em; }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px calc(env(safe-area-inset-bottom, 0px) + 32px);
}

.splash { min-height: 70dvh; display: grid; place-items: center; }
.brand { font-family: var(--serif); font-size: 1.4rem; color: var(--accent); letter-spacing: .01em; }
.brand-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }

.field { display: block; }
.field span { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%;
  font: inherit;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-height: 48px;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .error { display: block; color: var(--danger); font-size: .85rem; margin-top: 6px; }
.field.invalid input { border-color: var(--danger); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600;
  border: 0; border-radius: 12px;
  padding: 13px 20px; min-height: 48px;
  cursor: pointer; text-decoration: none;
  background: var(--accent); color: #fff;
  transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--accent-strong); padding-inline: 8px; }
.btn.ghost:hover { background: var(--accent-soft); }

.banner {
  border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: .92rem;
  background: var(--amber-soft);
}
.banner.success { background: var(--sage-soft); }
.banner .btn { min-height: 0; padding: 4px 8px; }

.links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 18px; font-size: .92rem; }

.countdown { font-family: var(--serif); font-size: 3rem; color: var(--accent); line-height: 1; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  background: var(--text); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; max-width: calc(100% - 32px);
  box-shadow: var(--shadow); font-size: .95rem;
}

/* Forms: select, textarea, checkbox */
.field select, .field textarea {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-height: 48px;
}
.field textarea { resize: vertical; min-height: 110px; }
.field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }
[data-field].invalid > .chips + .error, .chips + .error { display: block; }
.error { color: var(--danger); font-size: .85rem; display: block; margin-top: 6px; }

/* Chips (multi / single choice) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .95rem;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 16px;
  min-height: 42px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 600; }
.chips.static .chip { cursor: default; min-height: 0; padding: 5px 12px; font-size: .88rem; }

/* Wizard */
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-bottom: 26px; }
.progress-bar { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .3s ease; }
.wizard-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 6px; }

/* Home */
.header-actions { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.header-actions .btn { min-height: 40px; padding: 8px 10px; font-size: .92rem; }
.hello { margin-bottom: 2px; }
.couple { margin-bottom: 6px; }
.countdown-line { margin-bottom: 22px; }
.countdown-line .countdown { font-size: 2.4rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-head a { font-size: .92rem; }

.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.todo li:first-child { border-top: 0; padding-top: 2px; }
.todo li::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 7px; background: var(--muted); }
.todo-urgent::before { background: var(--accent) !important; }
.todo-soon::before { background: var(--amber) !important; }
.todo-later::before { background: var(--sage) !important; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 12px; }
.stats div { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.stats dt { font-size: .8rem; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-weight: 600; font-size: 1.02rem; overflow-wrap: anywhere; }
.status { margin: 0; font-size: .95rem; }
.status::before { content: "● "; }
.status-ok::before { color: var(--sage); }
.status-warn::before { color: var(--amber); }
.status-over::before { color: var(--danger); }

.facts { list-style: none; padding: 0; margin: 0 0 14px; }
.facts li { padding: 4px 0; }

@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 14px; }
}

/* Compact header on phones; amounts never break before the currency sign. */
.brand-header { gap: 8px; }
.brand-header .brand { flex: none; }
.header-actions { flex-wrap: nowrap; }
.header-actions .btn { white-space: nowrap; }
.stats dd { white-space: nowrap; font-size: clamp(.9rem, 3.6vw, 1.05rem); overflow-wrap: normal; }
@media (max-width: 420px) {
  .brand-header .brand { font-size: 1.2rem; }
  .header-actions .btn { padding: 6px 8px; font-size: .88rem; }
}

/* Bottom navigation */
.view:has(.bottom-nav) { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; gap: 8px;
  padding: 8px 16px calc(env(safe-area-inset-bottom, 0px) + 8px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.bottom-nav a {
  flex: 0 1 140px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 10px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: .8rem; font-weight: 600;
}
.bottom-nav a.active { color: var(--accent-strong); background: var(--accent-soft); }
.bottom-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Page header */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.page-head h1 { margin: 0; }
.page-head .btn { min-height: 42px; padding: 8px 16px; }
.filters { margin-bottom: 14px; }
.progress-text { margin: 0 0 10px; }

/* Tasks */
.tasks { list-style: none; margin: 0; padding: 0; }
.task { display: flex; gap: 12px; align-items: flex-start; border-top: 1px solid var(--line); padding: 4px 0; }
.task:first-child { border-top: 0; }
.task-check {
  flex: none; width: 28px; height: 28px; margin: 10px 0 0; border-radius: 50%;
  border: 2px solid var(--muted); background: transparent; cursor: pointer; position: relative;
}
.task-urgent .task-check { border-color: var(--accent); }
.task-soon .task-check { border-color: var(--amber); }
.task-later .task-check { border-color: var(--sage); }
.task-check[aria-pressed="true"] { background: var(--sage); border-color: var(--sage); }
.task-check[aria-pressed="true"]::after {
  content: ""; position: absolute; left: 8px; top: 3px; width: 7px; height: 13px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.task-body {
  flex: 1; min-width: 0; text-align: left; font: inherit; color: inherit; background: none; border: 0;
  padding: 9px 0; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.task-title { font-weight: 500; }
.task-meta { font-size: .85rem; color: var(--muted); }
.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.is-blocked .task-title { color: var(--muted); }
.task-group summary { cursor: pointer; font-weight: 600; }
.task-group[open] summary { margin-bottom: 8px; }
.reassure { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; font-size: .95rem; }
.next { margin: 10px 0 12px; }
.meter { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.meter-fill { display: block; height: 100%; width: 0; background: var(--sage); border-radius: inherit; transition: width .4s ease; }

/* Bottom sheet dialog */
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0; padding: 18px 20px calc(env(safe-area-inset-bottom, 0px) + 20px);
  border: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--text);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .15); overflow-y: auto;
}
.sheet::backdrop { background: rgba(30, 20, 18, .45); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.sheet-head h2 { margin: 6px 0 0; }
.sheet-head .close { min-height: 40px; font-size: 1.1rem; }
.sheet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.btn.danger { color: var(--danger); }
@media (min-width: 600px) {
  .sheet { margin: auto; border-radius: 20px; }
}

.up-to-date { background: var(--sage-soft); border-radius: 12px; padding: 14px 16px; }
.up-to-date p { margin: 0 0 6px; }
.up-to-date p:last-child { margin-bottom: 0; }
.up-to-date-title { font-family: var(--serif); font-size: 1.2rem; }
.task-auto { color: var(--sage); }

/* Budget */
.plain { list-style: none; margin: 0; padding: 0; }
.text-over { color: var(--danger); }
.stats-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 480px) { .stats-4 { grid-template-columns: repeat(4, 1fr); } }
.stack-bar { display: flex; height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 4px 0 8px; }
.stack-bar .seg { display: block; height: 100%; width: 0; transition: width .4s ease; }
.seg-paid { background: var(--sage); }
.seg-committed { background: var(--accent); }
.seg-forecast { background: var(--amber); opacity: .55; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 0; margin: 0 0 10px; font-size: .8rem; color: var(--muted); }
.legend li::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: 0; }
.l-paid::before { background: var(--sage); }
.l-committed::before { background: var(--accent); }
.l-forecast::before { background: var(--amber); opacity: .55; }

.split { list-style: none; margin: 0; padding: 0; }
.split-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.split-row:first-child { border-top: 0; }
.split-input { display: flex; align-items: center; gap: 6px; }
.split-input input { width: 7.5em; text-align: right; font: inherit; padding: 8px 10px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); }

.row-button {
  width: 100%; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px;
  text-align: left; font: inherit; color: inherit; background: none; border: 0; border-top: 1px solid var(--line);
  padding: 11px 0; cursor: pointer;
}
li:first-child > .row-button { border-top: 0; }
.cat-name { font-weight: 500; }
.cat-amounts { font-size: .9rem; color: var(--muted); }
.cat-bar { flex-basis: 100%; height: 5px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.cat-fill { display: block; height: 100%; width: 0; background: var(--sage); border-radius: inherit; transition: width .4s ease; }
.cat.is-over .cat-fill { background: var(--danger); }
.cat.is-over .cat-amounts { color: var(--danger); }

.pay-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.pay-row:first-child { border-top: 0; }
.pay-row .btn { min-height: 38px; padding: 6px 12px; flex: none; }
.pay-form { align-items: flex-end; flex-wrap: wrap; }
.pay-form .btn { flex: none; }
.payments h3 { font-size: 1rem; margin: 8px 0 0; font-family: var(--sans); }

.schedule-row { display: grid; grid-template-columns: 1.4fr 1fr 1.3fr auto; gap: 6px; align-items: center; }
.schedule-row input { min-width: 0; font: inherit; font-size: .9rem; padding: 9px 8px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--text); }
.schedule-row .btn { min-height: 36px; padding: 4px 8px; }
.pill { font-size: .75rem; background: var(--sage-soft); color: var(--sage); border-radius: 999px; padding: 3px 8px; font-weight: 600; }
@media (max-width: 420px) {
  .schedule-row { grid-template-columns: 1fr 1fr; }
}

.diy-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.diy-item:first-child { border-top: 0; }
.diy-item .check { flex: 1; }
.diy-item .btn { min-height: 34px; padding: 4px 8px; }
.diy-add { display: grid; grid-template-columns: 2fr 1fr 1.4fr; gap: 8px; align-items: end; }
.diy-add .btn { grid-column: 1 / -1; }
