:root {
  --bg: #f6f1e8;
  --card: #fffdf8;
  --ink: #2a2a26;
  --muted: #7a756a;
  --line: #e6dfd1;
  --green: #3f5a45;
  --green-soft: #e3ebe2;
  --gold: #b08d4f;
  --gold-soft: #f3ead9;
  --red: #a6493a;
  --red-soft: #f6e3de;
  --blue-soft: #e4e9f1;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; }
h1 { font-size: 34px; line-height: 1.1; }
h2 { font-size: 24px; }
.amp { font-style: italic; color: var(--gold); font-weight: 500; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; color: var(--muted); margin: 0 0 4px; }
.sub { color: var(--muted); margin: 6px 0 0; font-family: var(--serif); font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 32px 24px; text-align: center; box-shadow: 0 10px 40px rgba(60, 50, 30, .08); }
.login-card form { text-align: left; margin-top: 28px; }
.label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 14px 0 6px; }
.who-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.who-pick label { position: relative; }
.who-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.who-pick span { display: block; text-align: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 500; }
.who-pick input:checked + span { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.who-pick input:focus-visible + span { outline: 2px solid var(--gold); }
.error { color: var(--red); font-size: 14px; margin: 10px 0 0; }

input, select, textarea { width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
textarea { min-height: 80px; resize: vertical; }

.btn { font: inherit; font-weight: 500; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 10px 18px; cursor: pointer; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: var(--red-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--green); padding: 8px 10px; }
.btn.wide { width: 100%; margin-top: 20px; padding: 13px; }
.btn:disabled { opacity: .6; cursor: default; }

/* App shell */
#app { max-width: 820px; margin: 0 auto; padding: 0 16px 120px; }
.top { display: flex; justify-content: space-between; align-items: flex-start; padding: 28px 0 14px; }
.countdown { margin: 8px 0 0; font-family: var(--serif); font-size: 19px; color: var(--green); }
.icon-btn { background: var(--card); border: 1px solid var(--line); color: var(--muted); border-radius: 50%; width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer; }
.tabs { position: sticky; top: 0; z-index: 5; display: flex; gap: 4px; background: var(--bg); padding: 8px 0 12px; overflow-x: auto; }
.tabs button { flex: 1; font: inherit; font-weight: 500; font-size: 14px; color: var(--muted); background: transparent; border: 0; padding: 9px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 0 var(--line), 0 0 0 1px var(--line); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card h2 { margin-bottom: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }

/* Overview */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-family: var(--serif); font-size: 28px; font-weight: 600; line-height: 1.2; }
.stat .aud { font-size: 12px; color: var(--muted); }
.stat.hero { grid-column: 1 / -1; }
.stat.hero .v { font-size: 38px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, 1fr); } }

.bar { position: relative; height: 12px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 12px 0 8px; }
.bar > span { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 999px; }
.bar .planned { background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold); }
.bar .committed { background: var(--gold); }
.bar .paid { background: var(--green); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.warn { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.cta { background: var(--gold-soft); border-radius: 10px; padding: 12px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; }

.cat-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.cat-row:first-of-type { border-top: 0; }
.cat-row .bar { grid-column: 1 / -1; height: 6px; margin: 4px 0 0; }

.split { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.split div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.split .k { font-size: 12px; color: var(--muted); }
.split .v { font-weight: 600; }

/* Lists */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.list-row:first-child { border-top: 0; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .title { font-weight: 500; }
.list-row .meta { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .amt { text-align: right; font-weight: 600; white-space: nowrap; }
.list-row .amt .muted { font-weight: 400; font-size: 12px; display: block; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.pill.idea { background: var(--line); color: var(--muted); }
.pill.quoted { background: var(--blue-soft); color: #44608a; }
.pill.booked { background: var(--gold-soft); color: #8a6a31; }
.pill.done { background: var(--green-soft); color: var(--green); }
.pill.overdue { background: var(--red-soft); color: var(--red); }
.pay-check { width: 26px; height: 26px; flex: none; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; color: #fff; }
.pay-check.on { background: var(--green); border-color: var(--green); }
.group-label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 18px 4px 8px; }
.filters { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.filters button { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; cursor: pointer; white-space: nowrap; color: var(--muted); }
.filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.log-row { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.log-row:first-child { border-top: 0; }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 13px; background: var(--line); color: var(--muted); }
.avatar.Jonty { background: var(--green-soft); color: var(--green); }
.avatar.Kinsey { background: var(--gold-soft); color: #8a6a31; }

.fab { position: fixed; right: max(20px, calc(50% - 390px)); bottom: calc(24px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--green); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; box-shadow: 0 8px 24px rgba(40, 60, 45, .3); }

/* Dialogs */
dialog { border: 0; padding: 0; border-radius: 20px; width: min(560px, calc(100% - 24px)); max-height: calc(100% - 32px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
dialog::backdrop { background: rgba(40, 35, 25, .45); }
.dlg { padding: 22px 20px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.close { background: none; border: 0; font-size: 26px; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px 8px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
input[type=date] { min-width: 0; -webkit-appearance: none; appearance: none; min-height: 44px; }
dialog { overflow-x: hidden; }
.pay-edit { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin-top: 10px; background: var(--bg); }
.pay-edit .label { margin-top: 8px; }
.pay-edit .row-end { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; }
.pay-edit .row-end label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.pay-edit input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); }
.dlg-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.dlg-foot .right { display: flex; gap: 10px; margin-left: auto; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

.receipt { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; font-size: 14px; }
.receipt a { color: var(--green); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.receipt-btn { display: inline-block; margin-top: 8px; }
.receipt-btn.busy { opacity: .6; pointer-events: none; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
