/* eLalini — the calm private book, one warm rose on white.
   A single rose scale at twelve volumes; even the ink is the deepest rose,
   never true black. Light is the hero; dark is the same rose after sunset.
   Nunito throughout, tabular numerals for money. Money in vs out is told by
   fill + sign, never by red/green. Overdue is a calm fact, not an alarm. */

:root {
  /* the rose scale — every colour on screen is this one hue */
  --r-25:#FEFBFB;  --r-50:#FCF4F6;  --r-100:#F8E5EA; --r-200:#F1CCD6;
  --r-300:#E5A8B9; --r-400:#D97F97; --r-500:#C95877; --r-600:#A94060;
  --r-700:#86304B; --r-800:#5E2236; --r-900:#3B1523;

  /* dark defaults — the script sets data-theme explicitly; light block is the hero */
  --bg: #190910;
  --elev-1: #221019;
  --elev-2: #2C1520;
  --elev-3: #2C1520;
  --hairline: rgba(252,244,246,0.09);
  --hairline-2: rgba(252,244,246,0.15);
  --text: #FCF4F6;
  --sec: #C99AA9;
  --ter: #A87E8C;
  --teal: var(--r-500);           /* the single primary — a rose, not a teal */
  --teal-ink: #E5A8B9;            /* rose as accent text on dark surfaces */
  --teal-soft: rgba(201,88,119,0.24);
  --teal-softer: rgba(201,88,119,0.12);
  --warning: #E5A8B9;             /* overdue = calm rose, never red */
  --warning-soft: #3B1523;
  --danger: #E5A8B9;
  --danger-soft: rgba(217,127,151,0.16);
  --success: #E5A8B9;
  --gold: #D97F97;                /* the balanced-book seal, kept in-hue */
  --on-teal: #FFFFFF;             /* text on the primary rose button */
  --radius: 18px;
  --radius-lg: 22px;
  --mono: "Nunito", ui-sans-serif, system-ui, sans-serif;   /* numerals: Nunito tabular */
  --body: "Nunito", system-ui, -apple-system, sans-serif;
  --display: "Nunito", system-ui, sans-serif;
  --dur: 180ms;
  --dur-sheet: 240ms;
  --ease: cubic-bezier(.32,.72,.24,1);
  --nav-h: calc(64px + env(safe-area-inset-bottom, 0px));
  --shadow-sheet: 0 -12px 40px rgba(0,0,0,0.5);
  --shadow-pop: 0 8px 28px rgba(0,0,0,0.45);
}
html[data-theme="light"] {
  --bg: #FFFFFF;
  --elev-1: #FFFFFF;
  --elev-2: #FCF4F6;
  --elev-3: #FFFFFF;
  --hairline: #F3E2E7;
  --hairline-2: #F1CCD6;
  --text: #3B1523;               /* ink — the deepest rose, never true black */
  --sec: #9A6E7B;
  --ter: #C99AA9;
  --teal: var(--r-500);
  --teal-ink: #A94060;           /* readable rose text on white */
  --teal-soft: rgba(201,88,119,0.13);
  --teal-softer: rgba(201,88,119,0.06);
  --warning: #5E2236;
  --warning-soft: #F8E5EA;
  --danger: #A94060;
  --danger-soft: rgba(169,64,96,0.10);
  --success: #C95877;
  --gold: #A94060;
  --shadow-sheet: 0 -12px 40px rgba(59,21,35,0.16);
  --shadow-pop: 0 8px 28px rgba(59,21,35,0.12);
}

/* ---------- base ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--body); font-size: 15px; line-height: 1.45; color: var(--text);
  background: var(--bg); min-height: 100%;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; background: none; border: none; padding: 0; cursor: pointer; }
a { color: var(--teal-ink); text-decoration: none; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 4px; }
::placeholder { color: var(--ter); }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
svg { display: block; }

/* ---------- app frame ---------- */
.app { max-width: 640px; margin: 0 auto; padding: 0 16px calc(var(--nav-h) + 24px); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 2px 10px; position: sticky; top: 0; z-index: 30;
  background: linear-gradient(var(--bg) 78%, transparent);
}
.lockup { display: flex; align-items: center; gap: 10px; }
.lockup svg { width: 24px; height: 24px; }
.wordmark { font-weight: 700; letter-spacing: -0.02em; font-size: 20px; color: var(--text); }
.wordmark span { color: var(--teal); }
.topbar-tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ter); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal);
  transition: background var(--dur); }
.sync-dot.off { background: var(--warning); }
.sync-dot.busy { background: var(--ter); }

/* ---------- bottom navigation ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; justify-content: center;
  background: color-mix(in srgb, var(--elev-1) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--hairline);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottomnav-inner { display: flex; align-items: center; width: 100%; max-width: 640px; height: 64px; }
.navbtn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--sec); font-size: 10px; font-weight: 600; letter-spacing: .02em;
  padding: 8px 0 6px; transition: color var(--dur);
}
.navbtn svg { width: 22px; height: 22px; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.navbtn.active { color: var(--teal-ink); }
.navbtn-new {
  flex: 0 0 auto; width: 54px; height: 54px; margin: 0 6px; border-radius: 50%;
  background: var(--teal); color: var(--on-teal); display: flex; align-items: center;
  justify-content: center; transform: translateY(-10px);
  box-shadow: 0 8px 22px rgba(201,88,119,0.45);
  transition: transform var(--dur) var(--ease), background var(--dur);
}
.navbtn-new svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; fill: none; }
.navbtn-new:active { transform: translateY(-10px) scale(0.94); }

/* ---------- headings & sections ---------- */
h1.page { font-family: var(--display); font-style: italic; font-weight: 500;
  font-size: 28px; letter-spacing: -0.01em; margin: 10px 0 2px; }
.page-sub { color: var(--sec); font-size: 13.5px; margin: 0 0 18px; }
.sect { font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--sec); font-weight: 500; margin: 26px 2px 10px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sect .sect-aside { letter-spacing: .06em; color: var(--ter); text-transform: none; }

/* ---------- hero ---------- */
.hero { padding: 18px 2px 6px; }
.hero-label { font-family: var(--display); font-style: italic; font-weight: 500;
  font-size: 19px; color: var(--sec); }
.hero-amount { font-family: var(--mono); font-weight: 500; font-size: clamp(38px, 11vw, 46px);
  letter-spacing: -0.02em; line-height: 1.1; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.hero-amount .cents { font-size: 0.55em; color: var(--sec); }
.hero-sub { color: var(--sec); font-size: 13px; }
.hero-spark { margin: 14px 0 4px; }
.hero-spark svg { width: 100%; height: 44px; }

/* ---------- cards & rows ---------- */
.card {
  background: var(--elev-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 16px;
}
.card + .card { margin-top: 10px; }
.tap { cursor: pointer; transition: transform var(--dur) var(--ease), background var(--dur); }
.tap:active { transform: scale(0.985); }

.row {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 10px; border-radius: 12px; cursor: pointer;
  transition: background var(--dur), transform var(--dur) var(--ease);
}
.row:active { transform: scale(0.985); background: var(--teal-softer); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14.5px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 12.5px; color: var(--sec); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-amt { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 14.5px;
  white-space: nowrap; text-align: right; color: var(--text); }
.row-amt.in { color: var(--teal-ink); }
.row-amt .row-amt-sub { display: block; font-size: 11px; color: var(--ter); }
.row.minor .row-title { font-weight: 400; color: var(--sec); font-size: 13.5px; }
.row.minor .avatar { opacity: 0.55; }

.feed-day { font-family: var(--mono); font-size: 10px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ter); margin: 18px 10px 6px; }
.feed-block { background: var(--elev-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 4px; }
.feed-block .row + .row { border-top: 1px solid var(--hairline); border-radius: 0; }
.feed-block .row:first-child { border-radius: 10px 10px 0 0; }
.feed-block .row:last-child { border-radius: 0 0 10px 10px; }
.feed-block .row:only-child { border-radius: 10px; }

/* ---------- avatar ---------- */
.avatar {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--teal-ink);
  background: var(--teal-softer);
  box-shadow: inset 0 0 0 1.5px var(--teal);
  position: relative;
}
.avatar.sm { width: 32px; height: 32px; font-size: 11.5px; box-shadow: inset 0 0 0 1.2px var(--teal); }
.avatar.lg { width: 64px; height: 64px; font-size: 21px; box-shadow: inset 0 0 0 2px var(--teal); }
.avatar.icon { color: var(--sec); background: var(--elev-2); box-shadow: inset 0 0 0 1px var(--hairline-2); }
.avatar.icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono);
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; padding: 3px 9px;
  border-radius: 999px; border: 1px solid var(--hairline-2); color: var(--sec); white-space: nowrap; }
.chip.active { border-color: var(--teal); color: var(--teal-ink); background: var(--teal-soft); }
.chip.waiting { border-color: var(--warning); color: var(--warning); background: var(--warning-soft); }
.chip.repaid { border-color: transparent; color: var(--on-teal); background: var(--teal); }
.chip.closed { border-color: var(--hairline-2); color: var(--ter); }
.chip.gift { border-color: var(--text); color: var(--text); }
.chip.late { border-color: var(--warning); color: var(--warning); }
.chip.v { border-color: var(--hairline-2); color: var(--sec); text-transform: none; letter-spacing: .04em; }

/* ---------- insight cards ---------- */
.insight {
  display: flex; gap: 12px; align-items: flex-start;
  background: linear-gradient(135deg, var(--teal-softer), transparent 60%), var(--elev-1);
  border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 14px 16px; margin: 10px 0;
}
.insight-ring { flex: 0 0 auto; margin-top: 1px; }
.insight-ring svg { width: 18px; height: 18px; }
.insight-text { font-size: 14px; line-height: 1.45; color: var(--text); }
.insight.gentle { background: linear-gradient(135deg, var(--warning-soft), transparent 55%), var(--elev-1); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: 14.5px; padding: 11px 20px; border-radius: 999px;
  background: var(--teal); color: var(--on-teal); border: 1px solid var(--teal);
  transition: transform var(--dur) var(--ease), background var(--dur), opacity var(--dur);
  text-decoration: none; cursor: pointer;
}
.btn:active { transform: scale(0.97); }
.btn.ghost { background: transparent; color: var(--teal-ink); border-color: var(--teal); }
.btn.quiet { background: var(--elev-2); color: var(--text); border-color: var(--hairline-2); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { font-size: 13px; padding: 8px 14px; }
.btn.big { width: 100%; padding: 15px 20px; font-size: 16px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ---------- key-value & balance blocks ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 14px; }
.kv dt { color: var(--sec); } .kv dd { margin: 0; text-align: right; }
.kv dd.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.balance-big { font-family: var(--mono); font-weight: 500; font-size: 32px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin: 2px 0 10px; }
.bal-rows { border-top: 1px solid var(--hairline); margin-top: 10px; padding-top: 10px;
  display: grid; gap: 7px; }
.bal-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--sec); }
.bal-row .num { color: var(--text); }
.bal-row.total { border-top: 1px double var(--teal); padding-top: 8px; margin-top: 3px;
  color: var(--text); font-weight: 600; }

/* ---------- journey (status steps) ---------- */
.journey { display: flex; align-items: center; gap: 0; margin: 12px 0 4px; }
.j-step { display: flex; align-items: center; flex: 1; min-width: 0; }
.j-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--elev-3);
  box-shadow: inset 0 0 0 1.5px var(--hairline-2); flex: 0 0 auto; }
.j-step.done .j-dot { background: var(--teal); box-shadow: none; }
.j-step.now .j-dot { background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }
.j-line { height: 1.5px; background: var(--hairline-2); flex: 1; margin: 0 3px; }
.j-step.done .j-line { background: var(--teal); }
.j-labels { display: flex; justify-content: space-between; margin-top: 6px; }
.j-labels span { font-family: var(--mono); font-size: 9px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ter); flex: 1; text-align: center; }
.j-labels span:first-child { text-align: left; } .j-labels span:last-child { text-align: right; }
.j-labels span.on { color: var(--teal-ink); }

/* ---------- timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 9px 0 9px 20px; border-left: 1.5px solid var(--hairline-2);
  margin-left: 8px; font-size: 13.5px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 15px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.timeline li.minor::before { background: var(--ter); width: 6px; height: 6px; left: -4px; top: 16px; }
.timeline .who { color: var(--ter); font-family: var(--mono); font-size: 10.5px; margin-top: 2px; }

/* ---------- forms (kept light — sheets do the heavy lifting) ---------- */
label.f { display: block; font-family: var(--mono); font-size: 10px; font-weight: 500;
  color: var(--sec); margin: 0 0 5px 2px; letter-spacing: .14em; text-transform: uppercase; }
input, select, textarea {
  width: 100%; padding: 12px 13px; border: 1px solid var(--hairline-2); border-radius: 12px;
  font-family: var(--body); font-size: 15px; background: var(--elev-2); color: var(--text);
}
input.num { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
textarea { resize: vertical; min-height: 64px; }
select option { background: var(--elev-2); color: var(--text); }
.field { margin-bottom: 12px; min-width: 0; }
.hint { font-size: 12px; color: var(--sec); margin-top: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 10px; }
.grid2 > * { min-width: 0; }
select { min-width: 0; }

/* choice chips (one decision per step) */
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--elev-2); border: 1px solid var(--hairline-2); border-radius: 12px;
  padding: 14px; font-size: 15px; font-weight: 500; color: var(--text);
  transition: border-color var(--dur), background var(--dur), transform var(--dur) var(--ease);
}
.choice:active { transform: scale(0.98); }
.choice.on { border-color: var(--teal); background: var(--teal-softer); }
.choice .c-sub { display: block; font-size: 12.5px; color: var(--sec); font-weight: 400; margin-top: 1px; }
.choices.wrap { flex-direction: row; flex-wrap: wrap; }
.choices.wrap .choice { width: auto; flex: 0 0 auto; padding: 9px 14px; font-size: 13.5px; border-radius: 999px; }

/* ---------- bottom sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60; background: rgba(4,6,8,0.55);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-sheet);
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  margin: 0 auto; max-width: 640px; max-height: calc(100dvh - 48px);
  background: var(--elev-1); border: 1px solid var(--hairline-2); border-bottom: none;
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow-sheet);
  transform: translateY(105%); transition: transform var(--dur-sheet) var(--ease);
  display: flex; flex-direction: column;
}
.sheet.open { transform: translateY(0); }
.sheet-grab { width: 40px; height: 4px; border-radius: 2px; background: var(--hairline-2);
  margin: 10px auto 2px; flex: 0 0 auto; }
.sheet-head { display: flex; align-items: center; gap: 6px; padding: 8px 14px 10px; flex: 0 0 auto; }
.sheet-title { flex: 1; text-align: center; font-family: var(--display); font-style: italic;
  font-weight: 500; font-size: 18px; }
.sheet-btn { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: var(--sec); background: var(--elev-2); flex: 0 0 auto; }
.sheet-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2;
  fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sheet-btn.hidden { visibility: hidden; }
.sheet-body { padding: 6px 18px 14px; overflow-y: auto; flex: 1 1 auto; }
.sheet-foot { padding: 10px 18px calc(14px + env(safe-area-inset-bottom, 0px)); flex: 0 0 auto;
  border-top: 1px solid var(--hairline); }
.sheet-steps { display: flex; gap: 4px; justify-content: center; padding: 0 0 8px; }
.sheet-steps i { width: 16px; height: 3px; border-radius: 2px; background: var(--elev-3); }
.sheet-steps i.on { background: var(--teal); }

/* confirm restatement */
.confirm-story { font-size: 16px; line-height: 1.65; padding: 4px 2px; }
.confirm-story .num { color: var(--teal-ink); }
.confirm-story .quiet { color: var(--sec); font-size: 13.5px; }

/* ---------- numpad ---------- */
.amount-display { text-align: center; padding: 14px 0 6px; }
.amount-display .val { font-family: var(--mono); font-weight: 500; font-size: 42px;
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.amount-display .val.empty { color: var(--ter); }
.amount-display .ctx { font-size: 12.5px; color: var(--sec); margin-top: 4px; min-height: 18px; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px 0 2px; }
.numpad button {
  font-family: var(--mono); font-size: 22px; font-weight: 500; color: var(--text);
  padding: 14px 0; border-radius: 12px; background: var(--elev-2);
  transition: background var(--dur), transform var(--dur) var(--ease);
}
.numpad button:active { background: var(--teal-soft); transform: scale(0.96); }
.numpad button svg { width: 22px; height: 22px; margin: 0 auto; stroke: currentColor;
  stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.quick-amounts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding: 6px 0; }

/* ---------- segmented control ---------- */
.seg { display: flex; background: var(--elev-2); border: 1px solid var(--hairline);
  border-radius: 999px; padding: 3px; gap: 2px; margin: 4px 0 14px; }
.seg button { flex: 1; font-size: 13px; font-weight: 600; color: var(--sec);
  padding: 8px 4px; border-radius: 999px; transition: background var(--dur), color var(--dur); }
.seg button.on { background: var(--elev-1); color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25); }
html[data-theme="light"] .seg button.on { box-shadow: 0 1px 4px rgba(17,22,27,0.12); }

/* ---------- book: bars & tables ---------- */
.bars { display: grid; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, auto) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .bar-label { color: var(--sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; border-radius: 4px; background: var(--elev-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--teal); min-width: 2px;
  transition: width var(--dur) var(--ease); }
.bar-fill.warn { background: var(--warning); }
.bar-row .num { font-size: 12.5px; }

.evsa { display: grid; gap: 6px; }
.evsa-row { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; }
.evsa-month { font-family: var(--mono); font-size: 10.5px; color: var(--ter); text-transform: uppercase; }
.evsa-tracks { display: grid; gap: 3px; }
.evsa-tracks .t { height: 6px; border-radius: 3px; background: var(--elev-2); position: relative; overflow: hidden; }
.evsa-tracks .t i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; }
.evsa-tracks .t.exp i { background: var(--ter); opacity: 0.75; }
.evsa-tracks .t.act i { background: var(--teal); }
.evsa-legend { display: flex; gap: 14px; font-size: 11px; color: var(--ter); margin-top: 8px; }
.evsa-legend i { display: inline-block; width: 14px; height: 5px; border-radius: 3px; vertical-align: middle; margin-right: 5px; }

.seal { font-size: 13.5px; color: var(--sec); line-height: 1.6; }
.seal .seal-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); margin-right: 8px; vertical-align: baseline; }
.seal.broken .seal-dot { background: var(--danger); }
.seal .num { color: var(--text); }

table.ledger { width: 100%; border-collapse: collapse; font-size: 13px; }
table.ledger th { text-align: left; font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--sec); font-weight: 500; padding: 8px 8px;
  border-bottom: 1px solid var(--teal); }
table.ledger td { padding: 9px 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
table.ledger tr:last-child td { border-bottom: none; }
table.ledger td.num, table.ledger th.num { text-align: right; font-family: var(--mono);
  font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- message / document preview ---------- */
.msgbox { font-family: var(--mono); font-size: 13px; background: var(--elev-2);
  border: 1px solid var(--hairline-2); border-radius: 12px; padding: 14px;
  white-space: pre-wrap; line-height: 1.6; }
.doc-preview { background: #FCF4F6; color: #3B1523; border-radius: 12px; padding: 20px 18px;
  border: 1px solid var(--hairline-2); font-size: 13px; line-height: 1.55; }
.doc-preview h4 { font-family: var(--display); font-weight: 800;
  font-size: 18px; margin: 0 0 4px; color: #3B1523; }
.doc-preview .d-label { font-family: var(--mono); font-size: 9px; letter-spacing: .14em;
  text-transform: uppercase; color: #A94060; margin: 12px 0 3px; font-weight: 700; }
.doc-preview .d-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0;
  border-bottom: 1px solid #F1CCD6; }
.doc-preview .d-row b { font-family: var(--mono); font-weight: 500; white-space: nowrap; }
.doc-preview .d-vers { font-size: 11px; color: #4A5158; margin-top: 10px; }

/* ---------- skeletons ---------- */
.skel { position: relative; overflow: hidden; background: var(--elev-2); border-radius: 8px; }
.skel::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--hairline-2), transparent);
  animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.skel-hero { height: 120px; border-radius: var(--radius-lg); margin: 16px 0; }
.skel-row { height: 64px; border-radius: var(--radius); margin: 10px 0; }

/* ---------- login ---------- */
.login { max-width: 340px; margin: 10vh auto 0; text-align: center; padding: 0 6px; }
.login .lockup-big svg { width: 52px; height: 52px; margin: 0 auto 12px; }
.login-mark { font-weight: 700; letter-spacing: -0.02em; font-size: 30px; color: var(--text); }
.login-mark span { color: var(--teal); }
.login-sub { font-family: var(--display); font-style: italic; font-weight: 500;
  font-size: 17px; color: var(--sec); margin: 4px 0 30px; }
.login input { text-align: center; font-size: 16px; margin: 6px 0 12px; padding: 14px; }
.login input.pin { font-family: var(--mono); font-size: 30px; letter-spacing: .38em;
  padding-left: calc(14px + .38em); font-variant-numeric: tabular-nums; }
.login .login-note { font-size: 13px; color: var(--sec); line-height: 1.6; margin-top: 14px; }
.login .login-err { color: var(--danger); font-size: 13px; min-height: 20px; margin-top: 12px; }
.login .login-alt { margin-top: 16px; font-size: 13px; color: var(--ter); }
.linklike { color: var(--teal-ink); font-size: 13px; font-weight: 600; }
.linklike[disabled] { color: var(--ter); cursor: default; }
body.logged-out .bottomnav { display: none; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 14px); transform: translate(-50%, 12px);
  z-index: 80; background: var(--elev-3); border: 1px solid var(--hairline-2); color: var(--text);
  padding: 11px 18px; border-radius: 999px; font-size: 13.5px; box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transition: opacity var(--dur), transform var(--dur) var(--ease);
  max-width: min(92vw, 480px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- empty states ---------- */
.empty { padding: 36px 20px; text-align: center; color: var(--sec); font-size: 14px;
  background: var(--elev-1); border: 1px dashed var(--hairline-2); border-radius: var(--radius); }
.empty .e-title { font-family: var(--display); font-style: italic; font-size: 18px;
  color: var(--text); margin-bottom: 4px; }

/* ---------- view transitions ---------- */
.view-enter { animation: viewIn var(--dur) var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- profile header ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; padding: 14px 2px 6px; }
.profile-head .p-name { font-family: var(--display); font-style: italic; font-weight: 500;
  font-size: 26px; line-height: 1.15; }
.profile-head .p-sub { color: var(--sec); font-size: 13px; margin-top: 2px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.stat { background: var(--elev-1); border: 1px solid var(--hairline); border-radius: 12px;
  padding: 10px 12px; }
.stat .s-label { font-family: var(--mono); font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ter); margin-bottom: 4px; }
.stat .s-val { font-family: var(--mono); font-size: 14.5px; font-variant-numeric: tabular-nums; }

/* ---------- desktop: a companion, not the primary ---------- */
.detailpane { display: none; }
@media (min-width: 1000px) {
  body { padding-left: 0; }
  .app { max-width: 1080px; display: grid; grid-template-columns: 480px 1fr;
    gap: 28px; align-items: start; padding-bottom: 40px; }
  .topbar, .full { grid-column: 1 / -1; }
  .pane-list { grid-column: 1; }
  .detailpane { display: block; grid-column: 2; position: sticky; top: 64px;
    max-height: calc(100vh - 84px); overflow-y: auto; padding: 4px 2px 24px;
    border-left: 1px solid var(--hairline); padding-left: 28px;
    scrollbar-width: thin; scrollbar-color: var(--elev-3) transparent; }
  .detailpane::-webkit-scrollbar { width: 8px; }
  .detailpane::-webkit-scrollbar-thumb { background: var(--elev-3); border-radius: 4px; }
  .detailpane::-webkit-scrollbar-track { background: transparent; }
  .detailpane .empty { margin-top: 40px; }
  .bottomnav { bottom: auto; top: 0; right: 0; left: auto; width: auto; border: none;
    background: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 10px 18px 0 0;
    z-index: 35; }
  .bottomnav-inner { height: auto; gap: 4px; }
  .topbar-tag { display: none; }
  .navbtn { flex-direction: row; gap: 7px; font-size: 13px; padding: 8px 12px; border-radius: 999px; }
  .navbtn svg { width: 17px; height: 17px; }
  .navbtn.active { background: var(--teal-soft); }
  .navbtn-new { width: 40px; height: 40px; transform: none; margin-left: 14px; order: 99;
    box-shadow: 0 3px 10px rgba(201,88,119,0.35); }
  .navbtn-new svg { width: 20px; height: 20px; }
  .navbtn-new:active { transform: scale(0.94); }
  .app { padding-top: 8px; }
  :root { --nav-h: 0px; }
  .toast { bottom: 28px; }
  .sheet { max-width: 520px; border-radius: 22px; bottom: 24px; border-bottom: 1px solid var(--hairline-2); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- eLalini voice: one warm family, heavy & rounded, no italic/serif ---------- */
h1.page, .hero-label, .sheet-title, .profile-head .p-name, .empty .e-title,
.login-sub, .sheet-title, .confirm-story { font-style: normal; }
h1.page, .profile-head .p-name, .empty .e-title, .sheet-title {
  font-weight: 800; letter-spacing: -0.02em; }
.hero-amount, .balance-big, .amount-display .val { font-weight: 900; letter-spacing: -0.03em; }
.wordmark, .login-mark { font-weight: 900; }
.hero-label { font-weight: 700; }

/* the dot-flower mark — six petals of the one rose, light→deep clockwise from the
   top on white; inverted to light-on-dark after sunset. Theme-aware via --pet-*. */
:root { --pet-1:#FCF4F6; --pet-2:#F8E5EA; --pet-3:#F1CCD6;
        --pet-4:#E5A8B9; --pet-5:#D97F97; --pet-6:#C95877; }
html[data-theme="light"] { --pet-1:#E5A8B9; --pet-2:#D97F97; --pet-3:#C95877;
        --pet-4:#A94060; --pet-5:#86304B; --pet-6:#5E2236; }
.flower .p1{fill:var(--pet-1)} .flower .p2{fill:var(--pet-2)} .flower .p3{fill:var(--pet-3)}
.flower .p4{fill:var(--pet-4)} .flower .p5{fill:var(--pet-5)} .flower .p6{fill:var(--pet-6)}

/* money in vs out — told by fill + sign, never by colour alone (dignity) */
.avatar.out { color: var(--teal); background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--r-300); }
.avatar.out.lg { box-shadow: inset 0 0 0 2px var(--r-300); }
.avatar.in { color: var(--teal-ink); background: var(--teal-softer);
  box-shadow: inset 0 0 0 1.5px var(--teal); }

/* overdue is a calm fact — a soft rose chip, never a red alarm */
.duechip { display: inline-block; font-size: 11px; font-weight: 800; color: var(--warning);
  background: var(--warning-soft); border-radius: 999px; padding: 2px 9px; letter-spacing: 0; }
.chip.late { border-color: transparent; color: var(--warning); background: var(--warning-soft); }

/* settled — quiet completeness, a sprout, no celebration */
.chip.repaid { border-color: transparent; color: var(--on-teal); background: var(--teal); }

/* ---------- notifications: bell + centre ---------- */
.bell { position: relative; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; color: var(--sec);
  background: var(--elev-2); flex: 0 0 auto; }
.bell svg { width: 19px; height: 19px; stroke: currentColor; fill: none;
  stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.bell .badge { position: absolute; top: -3px; right: -3px; min-width: 17px; height: 17px;
  padding: 0 4px; border-radius: 999px; background: var(--teal); color: var(--on-teal);
  font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg); }
.notif { display: flex; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--hairline);
  align-items: flex-start; }
.notif:last-child { border-bottom: none; }
.notif.unread { background: var(--teal-softer); border-radius: 12px; padding: 13px 12px;
  border-bottom: none; margin-bottom: 2px; }
.notif .n-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal);
  margin-top: 6px; flex: 0 0 auto; }
.notif.read .n-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--hairline-2); }
.notif .n-body b { font-size: 14px; font-weight: 800; display: block; }
.notif .n-body span { font-size: 12.5px; color: var(--sec); }
.notif .n-time { font-size: 11px; color: var(--ter); white-space: nowrap; margin-left: auto; }

/* ---------- dual approval ---------- */
.approval { background: var(--elev-1); border: 1px solid var(--hairline);
  border-radius: var(--radius); padding: 14px 16px; margin: 10px 0; }
.approval .a-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--r-400); }
.approval .a-who { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; }
.approval .a-who .tick { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; background: var(--teal);
  color: var(--on-teal); font-size: 12px; font-weight: 800; }
.approval .a-who.pending .tick { background: transparent; color: var(--ter);
  box-shadow: inset 0 0 0 1.5px var(--hairline-2); }
.approval .a-note { font-size: 12.5px; color: var(--sec); margin-top: 6px; }

/* ---------- print (agreement handled separately) ---------- */
@media print { .bottomnav, .topbar, .toast { display: none !important; } }
