/* Siloam Sauna — mobile first. Eucalyptus mist, pine, and the ember glow of hot stones. */

@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/schibsted-grotesk-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/schibsted-grotesk-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #eaefe9;
  --surface: #ffffff;
  --sunk: #f2f6f1;
  --ink: #142b25;
  --muted: #566b62;
  --line: #d3ddd5;
  --pine: #1c3a31;
  --primary: #1c3a31;
  --primary-ink: #ffffff;
  --ember: #eaa23c;
  --ember-ink: #2b1a05;
  --ember-tint: #fbefd9;
  --sauna: #d7832e;
  --remedies: #3c8c6c;
  --others: #7186b0;
  --good: #24704e;
  --good-tint: #dcebe2;
  --danger: #b23f2c;
  --danger-tint: #f8e1dc;
  --shadow: 0 10px 30px -18px rgba(20, 43, 37, .45);
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1915;
    --surface: #14231e;
    --sunk: #1a2c26;
    --ink: #e3ebe6;
    --muted: #96aaa1;
    --line: #2a3f37;
    --primary: #dfeae3;
    --primary-ink: #0d1915;
    --ember-tint: #3a2a12;
    --good: #6cc59a;
    --good-tint: #183429;
    --danger: #f08a76;
    --danger-tint: #3b1d17;
    --shadow: 0 10px 30px -18px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ember); outline-offset: 2px; }

.icon { width: 22px; height: 22px; flex: none; }
.muted { color: var(--muted); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------------------------------------------------------------- shell */

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 18px; letter-spacing: -0.02em; text-decoration: none;
}
.brand img { border-radius: 8px; }
.who {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--pine); color: #fff; font-weight: 700; text-decoration: none;
}

.main {
  display: flex; flex-direction: column; gap: 16px;
  width: 100%; max-width: 640px; margin: 0 auto;
  padding: 6px 16px calc(100px + env(safe-area-inset-bottom));
}

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.nav-link {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 60px; padding: 6px 0;
  font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none;
}
.nav-link.is-current { color: var(--ink); font-weight: 700; }
.nav-link.is-current::before {
  content: ""; position: absolute; top: -1px; left: 30%; right: 30%;
  height: 3px; border-radius: 0 0 3px 3px; background: var(--ember);
}
.nav-brand, .nav-foot { display: none; }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
  .topbar { display: none; }
  .nav {
    position: sticky; top: 0; height: 100vh;
    flex-direction: column; gap: 2px;
    padding: 24px 14px;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .nav-brand { display: inline-flex; margin: 0 8px 24px; }
  .nav-link {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 12px;
    min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 15px;
  }
  .nav-link:hover { background: var(--sunk); color: var(--ink); }
  .nav-link.is-current { background: var(--sunk); }
  .nav-link.is-current::before { inset: 10px auto 10px 0; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .nav-foot {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: auto; padding: 12px; border-top: 1px solid var(--line);
    font-size: 14px; font-weight: 600;
  }
  .main { max-width: 1120px; margin: 0; padding: 36px 44px 56px; gap: 20px; }
}

/* ---------------------------------------------------------------- type & page furniture */

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-title { font-size: 28px; font-weight: 800; letter-spacing: -0.025em; }
.page-sub { color: var(--muted); margin-top: -10px; }
.back {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start;
  margin-bottom: -6px; padding: 6px 8px 6px 0;
  color: var(--muted); font-weight: 600; text-decoration: none;
}
.back .icon { width: 18px; height: 18px; }
.small-link { font-size: 14px; font-weight: 600; color: var(--muted); }
.optional { font-weight: 400; color: var(--muted); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
}
.panel > h2 { margin-bottom: 8px; }
.panel > .hint { display: block; margin-top: 8px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }

/* ---------------------------------------------------------------- the stone: today's takings */

.stone {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px 20px 20px;
  border-radius: 26px;
  color: #f4ece0;
  background:
    radial-gradient(110% 85% at 8% 112%, rgba(234, 162, 60, .55), rgba(234, 162, 60, 0) 58%),
    radial-gradient(70% 50% at 100% 0%, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 70%),
    #1c3a31;
  box-shadow: var(--shadow);
}
/* steam rising off the stones */
.stone::after {
  content: ""; position: absolute; z-index: -1; right: 14px; top: 10px; width: 92px; height: 74px; opacity: .16;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 92 74' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M20 72c-10-12 10-18 0-32S20 14 14 2M46 72c-10-12 10-18 0-32s10-26 4-38M72 72c-10-12 10-18 0-32s10-26 4-38'/%3E%3C/svg%3E") no-repeat center / contain;
}
.stone-date { font-size: 15px; font-weight: 600; color: rgba(244, 236, 224, .78); }
.stone-total {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 52px; font-weight: 800; line-height: 1; letter-spacing: -0.035em;
}
.cur { font-size: .38em; font-weight: 700; letter-spacing: 0; opacity: .75; }
.stone-sub { color: rgba(244, 236, 224, .82); }
.stone-empty { font-size: 26px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; max-width: 16ch; }
.stone-note { font-size: 14px; color: rgba(244, 236, 224, .7); }
.stone .btn { margin-top: 8px; }
.stone .split { background: rgba(255, 255, 255, .12); }

/* ---------------------------------------------------------------- dashboard */

.glance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
}
.tile-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.tile-num { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.tile-foot { font-size: 13px; color: var(--muted); }
.tile-result {
  grid-column: 1 / -1;
  background: var(--good-tint); border-color: transparent;
  padding: 18px;
}
.tile-result .tile-label, .tile-result .tile-foot { color: var(--ink); opacity: .75; }
.tile-result .tile-num { display: flex; align-items: baseline; gap: 6px; font-size: 40px; color: var(--good); }
.tile-result.is-loss { background: var(--danger-tint); }
.tile-result.is-loss .tile-num { color: var(--danger); }

@media (min-width: 960px) {
  .glance-grid { grid-template-columns: 1.35fr 1fr 1fr; }
  .tile-result { grid-column: 1; grid-row: span 2; justify-content: center; }
  .tile-result .tile-num { font-size: 48px; }
  .tile-num { font-size: 28px; }
}
.today-grid, .today-col { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 960px) {
  .today-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
}

/* ---------------------------------------------------------------- equation (sales − expenses = profit) */

.equation {
  display: flex; flex-direction: column; gap: 6px;
  padding: 18px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
}
/* phones: a stacked statement, figures right-aligned */
.eq-term { display: grid; grid-template-columns: 20px 1fr auto; align-items: baseline; gap: 8px; }
.eq-term > .eq-label { grid-column: 2; }
.eq-term > .eq-num { grid-column: 3; text-align: right; }
.eq-term.eq-result { margin-top: 4px; padding-top: 10px; border-top: 1.5px solid var(--ink); }
.eq-label { font-size: 15px; font-weight: 500; color: var(--muted); }
.eq-num { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.eq-op { grid-column: 1; font-size: 20px; color: var(--muted); }
.eq-result .eq-label { color: var(--ink); font-weight: 700; }
.eq-result .eq-num { font-size: 28px; color: var(--good); }
.eq-result.is-loss .eq-num { color: var(--danger); }
/* desktop: one line, sales − expenses = profit */
@media (min-width: 960px) {
  .equation { flex-direction: row; align-items: flex-end; gap: 28px; padding: 24px 28px; }
  .eq-term { grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 20px; row-gap: 0; align-items: end; }
  .eq-term > .eq-op { grid-row: 2; font-size: 36px; line-height: 1.25; }
  .eq-term > .eq-label { grid-row: 1; grid-column: 2; font-size: 13px; }
  .eq-term > .eq-num, .eq-result .eq-num { grid-row: 2; grid-column: 2; text-align: left; font-size: 36px; }
  .eq-term:first-child > * { grid-column: 1; }
  .eq-term.eq-result { margin: 0; padding: 0; border: 0; }
}

.summary-strip { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.summary-strip > div { display: flex; flex-direction: column; }
.summary-strip .eq-label { font-size: 13px; }
.summary-strip .eq-num { font-size: 20px; }

/* ---------------------------------------------------------------- category split */

.split { display: flex; gap: 2px; height: 8px; border-radius: 99px; overflow: hidden; background: var(--sunk); }
.split span { display: block; min-width: 3px; }
.split-sauna { background: var(--sauna); }
.split-remedies { background: var(--remedies); }
.split-others { background: var(--others); }
.row .split { height: 5px; max-width: 220px; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-sauna { background: var(--sauna); }
.dot-remedies { background: var(--remedies); }
.dot-others { background: var(--others); }

.legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; }
.legend dt { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.legend dd { margin: 2px 0 0; font-size: 18px; font-weight: 700; }
.legend dd small { margin-left: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.legend-on-dark { margin-top: 2px; }
.legend-on-dark dt { color: rgba(244, 236, 224, .7); }

/* ---------------------------------------------------------------- lists */

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li + li { border-top: 1px solid var(--line); }
.rows-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 12px;
  min-height: 62px; padding: 12px 16px;
  text-decoration: none; color: inherit;
}
a.row:active { background: var(--sunk); }
@media (hover: hover) { a.row:hover { background: var(--sunk); } }
.panel .row { padding-inline: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row-title { font-weight: 600; }
.row-meta { font-size: 13px; color: var(--muted); }
.row-note { font-size: 13px; color: var(--muted); font-style: italic; }
.row-amount { font-weight: 700; white-space: nowrap; }
.row > .icon { color: var(--muted); }
.row-missing .row-title { color: var(--muted); }
.row-missing .datebox b { color: var(--sauna); }
.row-missing .row-amount { color: var(--sauna); }
.datebox { display: flex; flex-direction: column; align-items: center; width: 40px; flex: none; line-height: 1.1; }
.datebox b { font-size: 21px; font-weight: 800; }
.datebox small { font-size: 12px; color: var(--muted); }
.is-hidden { opacity: .6; }

.day-head {
  display: flex; justify-content: space-between;
  margin: 6px 4px -8px; font-size: 14px; font-weight: 600; color: var(--muted);
 
}
.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 36px 16px; text-align: center; color: var(--muted); }

.month-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.month-name { font-size: 18px; font-weight: 700; }
.month-step {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line); text-decoration: none;
}
.month-step.is-disabled { opacity: .35; }
@media (min-width: 960px) { .month-nav { justify-content: flex-start; } .month-name { min-width: 170px; text-align: center; } }

/* ---------------------------------------------------------------- sales page */

.sales-summary { display: grid; gap: 18px; }
.sales-summary-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sales-total { display: flex; align-items: baseline; gap: 6px; font-size: 36px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.sales-summary .legend { margin-top: 4px; }
.sales-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin: 0;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.sales-stats dt { font-size: 13px; font-weight: 500; color: var(--muted); }
.sales-stats dd { margin: 2px 0 0; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.sales-stats small { font-size: 12px; color: var(--muted); }

/* phones: a card per day */
.sales-cols { display: none; }
.sale-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-areas: "date cust total" "date bar bar" "date meta meta";
  align-items: center; gap: 4px 12px;
  min-height: 62px; padding: 12px 16px;
  color: inherit; text-decoration: none;
}
a.sale-row:active { background: var(--sunk); }
@media (hover: hover) { a.sale-row:hover { background: var(--sunk); } }
.sale-row .datebox { grid-area: date; }
.sr-customers { grid-area: cust; font-weight: 600; }
.sr-total { grid-area: total; justify-self: end; font-weight: 700; white-space: nowrap; }
.sr-bar { grid-area: bar; }
.sr-bar .split { height: 5px; max-width: 220px; }
.sr-meta { grid-area: meta; display: flex; flex-wrap: wrap; font-size: 13px; color: var(--muted); min-width: 0; }
.sr-num, .sr-by-label { display: none; }
.sr-cats + .sr-by::before { content: "\00a0·\00a0"; }
.sr-note { flex-basis: 100%; font-style: italic; }
.sale-row.is-missing .sr-customers { color: var(--muted); }
.sale-row.is-missing .datebox b, .sale-row.is-missing .sr-total { color: var(--sauna); }

/* desktop: aligned columns under a header */
@media (min-width: 960px) {
  .sales-summary { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; padding: 22px 24px; }
  .sales-total { font-size: 44px; }
  .sales-stats { align-content: center; padding: 0 0 0 28px; border-top: 0; border-left: 1px solid var(--line); }

  .sales-cols, .sale-row {
    grid-template-columns: 56px minmax(110px, 1fr) repeat(3, minmax(90px, 130px)) minmax(100px, 140px);
    column-gap: 16px;
  }
  .sales-cols {
    display: grid; padding: 0 20px 8px;
    font-size: 13px; font-weight: 600; color: var(--muted);
  }
  .sales-cols .num { text-align: right; }
  .sale-row {
    grid-template-areas: "date cust sauna rem oth total" "date meta meta meta meta meta";
    padding: 12px 20px;
  }
  .sr-num { display: block; text-align: right; }
  .sr-sauna { grid-area: sauna; }
  .sr-remedies { grid-area: rem; }
  .sr-others { grid-area: oth; }
  .sr-total { text-align: right; }
  .sr-bar, .sr-cats, .sr-unit { display: none; }
  .sr-by-label { display: inline; }
  .sr-cats + .sr-by::before { content: none; }
  .sr-meta { gap: 0 16px; }
  .sr-note { flex-basis: auto; }
}

/* ---------------------------------------------------------------- report */

.report-grid { display: grid; gap: 16px; }
@media (min-width: 960px) { .report-grid { grid-template-columns: 1fr 1fr; gap: 20px; } }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.bars li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.bar-label { font-weight: 500; }
.bar-value { font-weight: 700; }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: 99px; background: var(--pine); }
@media (prefers-color-scheme: dark) { .bar-track span { background: var(--remedies); } }

.missing { margin-top: 16px; padding: 12px 14px; border-radius: 14px; background: var(--ember-tint); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px;
  border-radius: 99px; border: 1px solid var(--line); background: var(--surface);
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
}

.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.table thead th { font-size: 13px; font-weight: 600; color: var(--muted); }
.table tbody th { font-weight: 600; }
.table tbody th a { text-decoration: none; }
.table tbody th a:hover { text-decoration: underline; }
.table .num { text-align: right; }
.table .strong { font-weight: 700; }
.table tr.is-missing th a { color: var(--sauna); }
.table tfoot th, .table tfoot td { font-weight: 800; border-bottom: 0; }
@media (max-width: 599px) {
  .table { min-width: 0; }
  .table .wide { display: none; }
}

/* ---------------------------------------------------------------- forms */

.form { display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 560px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
fieldset[disabled] { opacity: .7; }
legend { padding: 0; margin-bottom: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.hint { font-size: 13px; color: var(--muted); }

.input {
  width: 100%; min-height: 52px; padding: 12px 14px;
  font-size: 17px;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ember) 45%, transparent); }
@media (prefers-color-scheme: dark) { .input:focus { border-color: var(--ember); } }
textarea.input { min-height: 0; resize: vertical; line-height: 1.4; }
input[type="date"].input { appearance: none; -webkit-appearance: none; }
.input-select { padding-right: 36px; }
.input-plain { min-height: 44px; border-color: transparent; background: transparent; font-weight: 600; padding-inline: 8px; }
.input-plain:hover { border-color: var(--line); }

.money { position: relative; }
.money > span {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 15px; font-weight: 600; color: var(--muted); pointer-events: none;
}
.money .input { padding-left: 54px; font-size: 21px; font-weight: 700; }
.money-lg .input { min-height: 62px; font-size: 28px; }

.stepper { display: grid; grid-template-columns: 58px 1fr 58px; gap: 8px; }
.stepper .input { text-align: center; font-size: 26px; font-weight: 800; }
.step {
  display: grid; place-items: center;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer;
}
.step:active { background: var(--sunk); }
.chip-fill { align-self: flex-start; margin-top: 2px; background: var(--ember-tint); border-color: transparent; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  border: 1.5px solid var(--line); border-radius: 99px; background: var(--surface);
  font-weight: 500; cursor: pointer;
}
.choice input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); font-weight: 600; }
.choice input:focus-visible + span { outline: 3px solid var(--ember); outline-offset: 2px; }

.savebar {
  position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow);
}
.savebar-total { display: flex; flex-direction: column; line-height: 1.2; }
.savebar-total span { font-size: 13px; color: var(--muted); }
.savebar-total strong { font-size: 22px; font-weight: 800; }
/* the expense form is short: its buttons sit at the end instead of floating */
.savebar-split { position: static; flex-wrap: wrap; padding: 0; background: none; border: 0; box-shadow: none; }
.savebar-split .btn { flex: 1 1 auto; }
@media (min-width: 960px) { .savebar { bottom: 20px; } }

.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .input { flex: 1; min-width: 0; }

.notice {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: 12px; background: var(--sunk); color: var(--muted); font-weight: 500;
}
.alert { padding: 12px 14px; border-radius: 12px; background: var(--danger-tint); color: var(--danger); font-weight: 500; }
.alert p + p { margin-top: 4px; }
.alert code { font-size: 14px; }

.filter { display: flex; gap: 8px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px;
  border: 1.5px solid transparent; border-radius: 14px;
  font-size: 16px; font-weight: 700; line-height: 1; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn .icon { width: 20px; height: 20px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-ember { background: var(--ember); color: var(--ember-ink); }
.btn-quiet { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.btn-block { width: 100%; }
.linkish { padding: 0; border: 0; background: none; color: var(--muted); font-weight: 600; cursor: pointer; text-decoration: underline; }

summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.danger { max-width: 560px; }
.danger > summary { display: inline-block; padding: 8px 0; color: var(--danger); font-weight: 600; }
.danger form { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 14px; border-radius: 14px; background: var(--danger-tint); }

/* categories & staff */
.row-static { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; padding: 10px 12px 12px 8px; }
.row-static > .row-meta { grid-column: 1; padding-left: 8px; }
.row-static > form:last-child { grid-column: 2; grid-row: 1 / span 2; }
.rename { display: flex; gap: 8px; align-items: center; }
.person-row .row-static { display: flex; padding: 12px 16px 6px; }
.person-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; padding: 6px 16px 14px 64px; }
.person-actions details[open] { flex-basis: 100%; }
.person-actions details[open] summary { margin-bottom: 8px; }
.avatar {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: var(--sunk); color: var(--ink); font-weight: 800; font-size: 17px;
}
.add-person > summary { width: 100%; }
.add-person[open] > summary { display: none; }
.add-person .form { max-width: none; }

/* ---------------------------------------------------------------- sign in */

body.bare {
  min-height: 100vh;
  background:
    radial-gradient(90% 55% at 15% 105%, rgba(234, 162, 60, .5), rgba(234, 162, 60, 0) 60%),
    #1c3a31;
}
.login {
  display: flex; flex-direction: column; justify-content: center; gap: 22px;
  min-height: 100vh; max-width: 440px; margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 16px 32px;
}
.login-head { color: #f4ece0; }
.login-head img { border-radius: 14px; margin-bottom: 14px; box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .5); }
.login-head h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
.login-head p { margin-top: 4px; color: rgba(244, 236, 224, .75); font-size: 17px; }
.login-form {
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px; border-radius: 24px; background: var(--surface); box-shadow: 0 24px 48px -24px rgba(0, 0, 0, .6);
}
.login-form legend { font-size: 14px; font-weight: 600; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.person { position: relative; }
.person input { position: absolute; opacity: 0; inset: 0; }
.person .avatar { width: 34px; height: 34px; font-size: 15px; }
.person {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer;
}
.person-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person:has(input:checked) { border-color: var(--ember); background: var(--ember-tint); box-shadow: 0 0 0 1px var(--ember); }
.person:has(input:checked) .avatar { background: var(--ember); color: var(--ember-ink); }
.person:has(input:focus-visible) { outline: 3px solid var(--ember); outline-offset: 2px; }
.input-secret { font-size: 22px; letter-spacing: .3em; text-align: center; }

/* ---------------------------------------------------------------- loading */

/* Covers the page while the next one loads: blocks taps straight away, shows
   the bar at once and the spinner only if loading takes a moment. */
.busy { position: fixed; inset: 0; z-index: 1000; display: none; cursor: progress; }
body.is-busy .busy { display: block; }
.busy::before {
  content: ""; position: absolute; inset: 0;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  opacity: 0; animation: busy-fade .2s .35s forwards;
}
.busy-bar {
  position: absolute; top: 0; left: 0; width: 100%; height: 3px;
  background: var(--ember); box-shadow: 0 0 10px var(--ember);
  transform-origin: left; transform: scaleX(0);
  animation: busy-bar 10s cubic-bezier(.1, .7, .2, 1) forwards;
}
.busy-box {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 12px;
  width: max-content; max-width: calc(100% - 32px);
  padding: 14px 20px; border-radius: 16px;
  background: var(--ink); color: var(--bg); font-weight: 600;
  box-shadow: var(--shadow);
  opacity: 0; animation: busy-fade .2s .35s forwards;
}
.spinner {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 3px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: var(--ember);
  animation: spin .8s linear infinite;
}
.btn.is-loading .icon { display: none; }
.btn.is-loading::before {
  content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes busy-bar { 0% { transform: scaleX(0); } 8% { transform: scaleX(.4); } 100% { transform: scaleX(.92); } }
@keyframes busy-fade { to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.login-apk { text-align: center; font-size: 13px; }
.login-apk a { color: rgba(244, 236, 224, .7); }
@media (display-mode: standalone) { .login-apk { display: none; } }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed; z-index: 50; left: 50%; top: calc(12px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 10px;
  width: max-content; max-width: calc(100% - 32px);
  padding: 12px 16px; border-radius: 14px;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 15px;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  animation: toast 4.5s ease forwards;
}
.toast .icon { color: var(--ember); }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, -10px); }
  6%, 85% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 0); visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .toast { animation-name: toast-still; }
  .busy-bar { animation: none; transform: scaleX(.6); }
  .spinner, .btn.is-loading::before { animation-duration: 2s; }
  @keyframes toast-still { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
}
