/* The look, in one mode: warm paper for reading, ink for the frame and for the
   one thing on a screen that matters most, marigold for the single accent.
   Loaded last, so it restyles the stage and controls defined in styles.css. */
:root {
  --ink: #16171a; --ink-2: #1f2125; --ink-3: #2b2e34;
  --paper: #f4f3ef; --surface: #ffffff;
  --line: rgba(22, 23, 26, 0.09);
  --hair: rgba(22, 23, 26, 0.08); --dash: rgba(22, 23, 26, 0.14);
  --accent: #ecb22a; --accent-ink: #3a2a00;
  --on-dark: #f1f1ee; --on-dark-dim: #a3a5ad; --on-dark-line: rgba(255, 255, 255, 0.09);
  --ok: #1c8a55; --ok-bg: #e2f3e9;
  --wait: #a86a00; --wait-bg: #fdf1d2;
  --bad: #c0392b; --bad-bg: #fde9e6;
  --card: #ffffff;
  --shadow: 0 1px 0 rgba(22, 23, 26, 0.03), 0 10px 28px rgba(60, 50, 20, 0.06);
  --red-bg: var(--bad-bg); --red-ink: var(--bad);
}
body { background: var(--paper); }
::selection { background: #f6d77d; color: var(--ink); }

/* ---------- surfaces and controls ---------- */
.card { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 22px; }
.card.ink { background: var(--ink); border-color: var(--ink); color: var(--on-dark); box-shadow: 0 18px 40px rgba(22, 23, 26, 0.22); }
.card.ink h2, .card.ink .sub, .card.ink .stat-label, .card.ink .stat-note { color: var(--on-dark-dim); }
.card h2 { color: var(--ink); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.card .sub { color: var(--muted); }
.entries { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
a.entry:hover, button.entry:hover { background: rgba(22, 23, 26, 0.03); }
.inset { border-color: var(--line); }
.pill { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.pill:hover { background: #fbfaf7; }
.pill.dark { background: var(--ink); color: var(--on-dark); box-shadow: none; }
.pill.dark:hover { background: var(--ink-3); }
.pill.accent { background: var(--accent); color: var(--accent-ink); box-shadow: none; font-weight: 600; }
.glass { background: var(--surface); border: 1px solid var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 12px 30px rgba(22, 23, 26, 0.14); }
.chip { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.seg { background: rgba(22, 23, 26, 0.06); }
.field { box-shadow: inset 0 0 0 1px rgba(22, 23, 26, 0.16); }
.field:focus { box-shadow: inset 0 0 0 2px var(--ink); }
.tag.green { background: var(--ok-bg); color: var(--ok); }
.tag.yellow { background: var(--wait-bg); color: var(--wait); }
.tag.red { background: var(--bad-bg); color: var(--bad); }
dialog.sheet { background: var(--paper); }
.sheet-head { background: var(--paper); }
.stat .fig { font-size: clamp(21px, 6vw, 25px); }
.fig, .hero-fig { letter-spacing: -0.04em; }

/* ---------- top of every screen ---------- */
.app { display: block; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 14px 10px; background: var(--paper); }
.top-mark { flex: none; display: grid; place-items: center; }
.top-status { flex: 1; min-width: 0; display: grid; gap: 1px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.top-status b { font-size: 15.5px; font-weight: 600; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-status span { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.top-status em { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-status i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--wait); }
.top-status[data-state="ok"] i { background: var(--ok); }
.top-status[data-state="bad"] i { background: var(--bad); }
.top-status[data-state="bad"] span { color: var(--bad); font-weight: 500; }
.top-status[data-state="busy"] i { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
/* several companies: the name is also the way to another one */
.top-status.several { cursor: pointer; }
.top-status.several b { justify-self: start; max-width: 100%; padding-right: 18px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' stroke='%2316171a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 1px center / 12px 12px; }
.top-icon { position: relative; flex: none; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.top-icon:active { transform: scale(0.96); }
.pip { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--surface); }
.top-search { display: none; }

/* what is wrong, said once, in the colour it deserves */
.alert { display: flex; align-items: flex-start; gap: 11px; margin: 0 14px 10px; padding: 12px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.45; background: var(--wait-bg); color: #5c3c00; }
.alert.bad { background: var(--bad); color: #fff; }
.alert svg { flex: none; margin-top: 1px; }
.alert div { flex: 1; min-width: 0; }
.alert b { display: block; font-weight: 600; }
.alert a, .alert button { flex: none; align-self: center; height: 32px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; background: rgba(255, 255, 255, 0.92); color: var(--ink); display: inline-flex; align-items: center; }

.subnav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 14px 10px; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px; font-size: 14px; color: var(--muted); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.subnav a[aria-current="page"] { background: var(--ink); color: var(--on-dark); font-weight: 500; box-shadow: none; }
.subnav small { font-size: 11.5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; background: var(--bad); color: #fff; font-weight: 600; }

.page { padding: 2px 14px calc(108px + env(safe-area-inset-bottom, 0px)); }
.page-head { margin-bottom: 12px; align-items: center; }
.page-head .kicker { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.page-head .kicker::before { display: none; }
.page-title { font-size: 25px; font-weight: 600; letter-spacing: -0.035em; margin-top: 0; }
.page-sub { font-size: 13px; }
.back { display: inline-flex; align-items: center; gap: 6px; height: 34px; margin: 0 0 8px -4px; padding: 0 12px 0 8px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.back:hover { background: rgba(22, 23, 26, 0.05); color: var(--ink); }

/* ---------- phones: the dark bar with four places and one action ---------- */
.tabbar { position: fixed; inset: auto 10px calc(10px + env(safe-area-inset-bottom, 0px)) 10px; z-index: 20; border: 0; border-radius: 26px; padding: 0; background: var(--ink); box-shadow: 0 16px 36px rgba(22, 23, 26, 0.32); --mark: var(--on-dark); }
.tabbar div { max-width: 520px; margin: 0 auto; height: 66px; display: grid; grid-template-columns: 1fr 1fr 64px 1fr 1fr; align-items: center; padding: 0 6px; }
.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 100%; font-size: 11px; color: var(--on-dark-dim); border: 0; background: none; cursor: pointer; padding: 0; position: relative; }
.tabbar span { display: grid; place-items: center; width: auto; height: auto; border-radius: 0; background: none; }
.tabbar [aria-current="page"] { color: #fff; font-weight: 500; }
.tabbar [aria-current="page"] span { background: none; color: var(--accent); }
.tabbar .tab-new { justify-self: center; width: 52px; height: 52px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px rgba(236, 178, 42, 0.35); }
.tabbar .tab-new:active { transform: scale(0.95); }
.tabbar .badge { position: absolute; top: 9px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: var(--bad); color: #fff; }
.toast { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
.stickybar { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }

/* ---------- the "New" and "More" sheets ---------- */
.choices { display: grid; gap: 8px; }
.choices a, .choices button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; border: 0; border-radius: 18px; cursor: pointer; text-align: left; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.choices a:active, .choices button:active { transform: scale(0.99); }
.choices b { display: block; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.choices small { display: block; font-size: 13px; color: var(--muted); margin-top: 1px; }
.choices .chev { margin-left: auto; }
.choices .first { background: var(--ink); color: var(--on-dark); box-shadow: none; }
.choices .first small { color: var(--on-dark-dim); }
.choices .first .ico { background: var(--accent); color: var(--accent-ink); }
/* the list of companies: initials for each, and a tick on the one in hand */
.choices .ico.mono { font-size: 13.5px; font-weight: 600; letter-spacing: 0.01em; }
.choices .here { margin-left: auto; display: grid; color: var(--accent); }
.choices.companies div { min-width: 0; }
.choices.companies b, .choices.companies small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choices .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--bad); color: #fff; }
.sheet-note { font-size: 12.5px; color: var(--muted); line-height: 1.5; }

/* ---------- Home ---------- */
.home { display: grid; gap: 12px; }
/* on a phone the two columns dissolve and the cards fall into reading order */
.home-col { display: contents; }
.hero-card { order: 1; } .tiles { order: 2; } .todo-card { order: 3; } .map-card { order: 4; } .latest-card { order: 5; }
.hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 2px 2px 2px; }
.hello small { display: block; font-size: 13px; color: var(--muted); }
.hello h1 { font-size: 25px; font-weight: 600; letter-spacing: -0.035em; line-height: 1.15; }
/* (the card is a container so its figure can be sized to the card's own width) */
.hero-card { padding: 20px 18px 16px; display: grid; gap: 14px; overflow: hidden; container-type: inline-size; }
.hero-card .label { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; color: var(--on-dark-dim); }
/* The figure is shown to the paisa and never cut off: its size is what fits the card for the
   number of characters it has (--chars, set where it is drawn; each takes about 0.56 of the size). */
.hero-card .big { font-family: var(--mono); font-weight: 500; letter-spacing: -0.055em; font-size: max(22px, min(clamp(38px, 11vw, 52px), calc(100cqw / (var(--chars, 12) * 0.56)))); line-height: 1; white-space: nowrap; }
.hero-card .big .dim { color: #6f727b; }
.hero-card .under { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; color: var(--on-dark-dim); }
.hero-card .tag.green { background: rgba(56, 196, 128, 0.16); color: #63d99f; }
.hero-card .tag.red { background: rgba(240, 100, 84, 0.18); color: #ff8f80; }
.hero-card .tag.plain { background: rgba(255, 255, 255, 0.1); color: var(--on-dark-dim); }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 74px; }
.spark i { flex: 1; min-width: 3px; border-radius: 4px 4px 2px 2px; background: #3a3d45; min-height: 3px; position: relative; }
.spark i.now { background: var(--accent); }
.spark-axis { display: flex; justify-content: space-between; font-size: 11.5px; color: #7c7f88; margin-top: -6px; }
.hero-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--on-dark-line); margin: 0 -18px -16px; }
.hero-split a { padding: 13px 18px 15px; display: grid; gap: 2px; }
.hero-split a + a { border-left: 1px solid var(--on-dark-line); }
.hero-split small { font-size: 12.5px; color: var(--on-dark-dim); }
.hero-split b { font-family: var(--mono); font-weight: 500; font-size: 17px; letter-spacing: -0.04em; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { display: grid; gap: 8px; padding: 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0; }
.tile-top { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.tile-top span:not(.ico) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-top svg.go { margin-left: auto; flex: none; color: var(--faint); }
.tile b { font-family: var(--mono); font-weight: 500; font-size: clamp(20px, 5.6vw, 24px); letter-spacing: -0.045em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.tile.warn { border-color: rgba(192, 57, 43, 0.35); }
.tile.warn small { color: var(--bad); font-weight: 500; }

.todo { display: grid; }
.todo a { display: flex; align-items: center; gap: 12px; padding: 12px 0; min-width: 0; }
.todo a + a { border-top: 1px solid var(--hair); }
.todo .t { flex: 1; min-width: 0; }
.todo b { display: block; font-weight: 500; font-size: 14px; }
.todo small { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the map: every state, darker where little is sold, marigold where most is */
.map-card { padding: 18px 16px 16px; display: grid; gap: 12px; }
.map-card .card-head { margin-bottom: 0; }
.map-card h2 { color: var(--on-dark); }
.map-wrap { position: relative; display: grid; place-items: center; }
.map-wrap svg { width: 100%; max-width: 430px; height: auto; display: block; }
.map-wrap path { fill: color-mix(in srgb, var(--accent) calc(var(--p, 0) * 1%), #30333a); stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: fill 200ms; cursor: default; outline: none; }
.map-wrap path[data-on] { cursor: pointer; }
.map-wrap path:hover, .map-wrap path:focus-visible, .map-wrap path.sel { stroke: #fff; }
.map-key { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--on-dark-dim); }
.map-key i { flex: 1; max-width: 120px; height: 6px; border-radius: 999px; background: linear-gradient(90deg, #30333a, var(--accent)); }
.places { display: grid; gap: 2px; }
.place { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 0; border: 0; background: none; color: inherit; text-align: left; width: 100%; cursor: pointer; }
.place + .place { border-top: 1px solid var(--on-dark-line); }
.place .n { font-family: var(--mono); font-size: 12px; color: #7c7f88; }
.place .nm { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place .nm small { font-weight: 400; color: var(--on-dark-dim); font-size: 12.5px; margin-left: 6px; }
.place .v { font-family: var(--mono); font-size: 13.5px; letter-spacing: -0.03em; }
.place .bar { grid-column: 2 / 4; height: 5px; border-radius: 999px; background: #30333a; overflow: hidden; }
.place .bar i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.place.sel .nm { color: var(--accent); }
.card.ink .seg { background: rgba(255, 255, 255, 0.08); }
.card.ink .seg button { color: var(--on-dark-dim); height: 30px; font-size: 13px; }
.card.ink .seg button[aria-pressed="true"] { background: var(--on-dark); color: var(--ink); }
.card.ink .empty, .card.ink .hint { color: var(--on-dark-dim); }
.credit { font-size: 11px; color: #6f727b; }

/* ---------- add to home screen ---------- */
.install-card { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 20px; background: var(--surface); border: 1px dashed rgba(22, 23, 26, 0.22); }
.install-card img { flex: none; width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 4px 12px rgba(22, 23, 26, 0.12); }
.install-card div { flex: 1; min-width: 0; }
.install-card b { display: block; font-weight: 600; font-size: 14.5px; }
.install-card small { display: block; font-size: 12.5px; color: var(--muted); }
.install-card .x { flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; cursor: pointer; display: grid; place-items: center; color: var(--dim); }
.steps { display: grid; gap: 10px; counter-reset: step; margin: 0; padding: 0; list-style: none; }
.steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: 14.5px; line-height: 1.45; }
.steps li::before { content: counter(step); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--ink); color: var(--on-dark); }
.steps b { font-weight: 600; }
.steps .key { display: inline-flex; align-items: center; gap: 5px; vertical-align: -5px; height: 26px; padding: 0 9px; border-radius: 8px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 500; white-space: nowrap; }

/* ---------- smaller pieces restyled ---------- */
.kinds { margin-bottom: 10px; }
.toolbar { margin-bottom: 10px; }
.month-head h2 { font-weight: 600; }
.tabs { border-bottom: 0; gap: 6px; margin-bottom: 12px; }
.tabs button, .tabs a { height: 34px; padding: 0 12px; border-radius: 999px; border: 0; margin: 0; font-size: 13.5px; background: rgba(22, 23, 26, 0.05); }
.tabs [aria-selected="true"] { background: var(--ink-3); color: #fff; border: 0; }
.tabs [aria-selected="true"] small { background: rgba(255, 255, 255, 0.18); }
.list-rows { display: grid; }
.list-rows a { display: flex; align-items: center; gap: 12px; padding: 13px 4px; min-width: 0; }
.list-rows a + a { border-top: 1px solid var(--hair); }
.list-rows b { display: block; font-weight: 500; font-size: 14.5px; }
.list-rows small { display: block; font-size: 12.5px; color: var(--muted); }
.list-rows .t { flex: 1; min-width: 0; }
.summary-line { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 2px 12px; font-size: 13.5px; color: var(--muted); }
.summary-line b { font-family: var(--mono); font-weight: 500; letter-spacing: -0.03em; color: var(--ink); margin-right: 5px; }
details.more-options { border-top: 1px solid var(--hair); margin-top: 12px; padding-top: 4px; }
details.more-options summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; cursor: pointer; font-size: 14px; font-weight: 500; }
details.more-options summary::-webkit-details-marker { display: none; }
details.more-options summary small { font-weight: 400; color: var(--muted); font-size: 12.5px; }
details.more-options summary::after { content: ""; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); transform: rotate(45deg); transition: transform 200ms; margin-right: 4px; }
details.more-options[open] summary::after { transform: rotate(-135deg); }
details.more-options > div { display: grid; gap: 14px; padding: 6px 0 4px; }
@keyframes pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .top-status[data-state="busy"] i { animation: none; } }

/* ---------- wide screens: a dark rail beside light content ---------- */
.side { display: none; }
@media (min-width: 700px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .page { padding-left: 22px; padding-right: 22px; }
  .topbar { padding-left: 22px; padding-right: 22px; }
  .alert { margin-left: 22px; margin-right: 22px; }
  .subnav { padding-left: 22px; padding-right: 22px; }
}
@media (min-width: 1000px) {
  .tabbar, .only-phone { display: none !important; }
  .app { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 0; padding: 0; min-height: 100dvh; }
  .side { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; border-radius: 0; border: 0; padding: 20px 12px 14px; background: var(--ink); color: var(--on-dark); box-shadow: none; overflow: hidden; --mark: var(--on-dark); }
  .side .logo { padding: 0 10px 14px; color: var(--on-dark); }
  .side-new { display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; margin: 0 4px 12px; border: 0; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14.5px; background: var(--accent); color: var(--accent-ink); }
  .side-new:hover { filter: brightness(1.05); }
  .side-scroll { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 0 4px; scrollbar-width: none; }
  .side .nav a, .side .nav button { color: var(--on-dark-dim); min-height: 40px; }
  .side .nav a:hover, .side .nav button:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
  .side .nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.1); color: #fff; }
  .side .nav a[aria-current="page"] svg { color: var(--accent); }
  .side .nav .count { background: var(--bad); color: #fff; }
  .side .nav-label { color: #6f727b; margin: 16px 10px 4px; }
  .side-foot { display: grid; gap: 6px; padding: 10px 4px 0; }
  .side-status { border-radius: 16px; background: var(--ink-2); padding: 12px; display: grid; gap: 8px; font-size: 12.5px; line-height: 1.45; color: var(--on-dark-dim); }
  .side-status b { display: flex; align-items: center; gap: 7px; color: #fff; font-weight: 600; font-size: 13.5px; }
  .side-status b i { width: 8px; height: 8px; border-radius: 50%; background: var(--wait); }
  .side-status[data-state="ok"] b i { background: #3ecf8e; }
  .side-status[data-state="bad"] { background: var(--bad); color: #ffe1dc; }
  .side-status[data-state="bad"] b i { background: #fff; }
  .side-status button { justify-self: start; height: 30px; padding: 0 12px; border: 0; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600; background: rgba(255, 255, 255, 0.12); color: #fff; display: inline-flex; align-items: center; gap: 6px; }
  .side-status button.busy svg { animation: spin 0.9s linear infinite; }
  .topbar { position: sticky; padding: 14px 28px 12px; gap: 14px; }
  .top-status { flex: 0 1 auto; max-width: 300px; cursor: default; }
  .top-status b { font-size: 16px; }
  .top-search { flex: 1; min-width: 0; max-width: 520px; margin-left: auto; display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 12px 0 14px; border: 0; border-radius: 999px; cursor: text; text-align: left; font-size: 14px; color: var(--dim); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
  .top-search span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-search kbd { font: 500 11px var(--mono); padding: 2px 6px; border-radius: 6px; background: rgba(22, 23, 26, 0.06); color: var(--muted); }
  #moreBtn { display: none; }
  .alert, .subnav { margin-left: 28px; margin-right: 28px; }
  .subnav { padding-left: 0; padding-right: 0; }
  .page { padding: 4px 28px 48px; max-width: 1480px; }
  .page-title { font-size: 28px; }
  .hello h1 { font-size: 30px; }
  .home { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .home > * { grid-column: span 12; }
  .home > .c7 { grid-column: span 7; }
  .home > .c5 { grid-column: span 5; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 16px; }
  .home-col { display: grid; gap: 16px; align-content: start; min-width: 0; }
  .map-card { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: start; gap: 18px; padding: 22px; }
  .map-card > .card-head, .map-card > .credit { grid-column: 1 / -1; }
  .hero-card { padding: 24px 24px 18px; }
  .hero-split { margin: 0 -24px -18px; }
  .hero-split a { padding: 14px 24px 16px; }
  .spark { height: 96px; gap: 6px; }
  .toast { bottom: 28px; }
  .stickybar { bottom: auto; }
  dialog.sheet { max-width: 30rem; }
}
.page-head .lead { flex: 1 1 150px; }
.wg .hero-card { align-content: start; }
.wg > .hero-card { align-self: start; }

/* ---------- while a screen loads ---------- */
.sk { display: grid; gap: 14px; padding-top: 6px; }
.sk > *, .sk-tiles i { border-radius: 20px; background: linear-gradient(100deg, rgba(22, 23, 26, 0.06) 40%, rgba(22, 23, 26, 0.11) 50%, rgba(22, 23, 26, 0.06) 60%); background-size: 220% 100%; }
.sk-title { height: 34px; width: min(260px, 60%); border-radius: 12px; }
.sk-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: none !important; }
.sk-tiles i { height: 104px; display: block; }
.sk-block { height: 280px; }
.sk-block.low { height: 180px; }
@media (prefers-reduced-motion: no-preference) {
  .sk > *:not(.sk-tiles), .sk-tiles i { animation: shimmer 1.2s linear infinite; }
  .stage { animation: stage-in 220ms var(--ease); }
}
@keyframes shimmer { to { background-position: -220% 0; } }
@keyframes stage-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (min-width: 700px) { .sk-tiles { grid-template-columns: repeat(4, 1fr); } }

/* the dark bar sits flat: no glow under it or under the New button */
.tabbar { box-shadow: 0 6px 18px rgba(22, 23, 26, 0.18); }
.tabbar .tab-new { box-shadow: none; }

/* custom dates inside the period list */
.menu .menu-form .fld span { font-size: 12px; color: var(--muted); }
.menu { max-height: calc(100dvh - 16px); overflow-y: auto; }

@media (min-width: 1000px) {
  /* use the whole window */
  .page { max-width: none; }
  /* People and Insights open in the rail, so the row of pills is not repeated */
  .subnav { display: none !important; }
  .side .tree { margin: 2px 0 6px 21px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, 0.12); display: grid; gap: 1px; }
  .side .tree a { min-height: 34px; font-size: 13.5px; padding: 0 10px; }
  .side .tree a[aria-current="true"] { color: #fff; font-weight: 500; background: rgba(255, 255, 255, 0.07); }
  .side .nav a[aria-current="page"]:has(+ .tree) { background: none; }
}

/* ---------- dates that hold nothing: say so, and offer ones that do ---------- */
.empty-period { display: grid; justify-items: center; text-align: center; gap: 12px; padding: 30px 20px; margin-bottom: 12px; border-style: dashed; border-color: rgba(22, 23, 26, 0.2); box-shadow: none; }
.empty-period .ico.lg { width: 46px; height: 46px; border-radius: 15px; }
.empty-period .ico.lg svg { width: 23px; height: 23px; }
.empty-period b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.empty-period p { font-size: 14px; color: var(--muted); max-width: 46ch; margin: 4px auto 0; text-wrap: pretty; }
.empty-period .actions { justify-content: center; margin-top: 4px; }
.empty-period.slim { grid-template-columns: auto minmax(0, 1fr); justify-items: start; align-items: center; text-align: left; gap: 10px 14px; padding: 14px 16px; }
.empty-period.slim .ico.lg { width: 38px; height: 38px; border-radius: 12px; }
.empty-period.slim .ico.lg svg { width: 20px; height: 20px; }
.empty-period.slim b { font-size: 15px; }
.empty-period.slim p { margin: 2px 0 0; max-width: none; font-size: 13px; }
.empty-period.slim .actions { grid-column: 1 / -1; justify-content: flex-start; margin: 0; }
.home .empty-period { order: 1; margin-bottom: 0; }
.grid > .empty-period { margin-bottom: 0; }
@media (min-width: 700px) {
  .empty-period { padding: 44px 24px; margin-bottom: 14px; }
  .empty-period.slim { padding: 14px 18px; }
}
@media (min-width: 900px) {
  .empty-period.slim { grid-template-columns: auto minmax(0, 1fr) auto; }
  .empty-period.slim .actions { grid-column: auto; }
}

/* ---------- cards fitted into full rows (see fit in views/analytics.js) ---------- */
.wgrid.fitted { grid-auto-flow: row; }
.wgrid.fitted > .wg { grid-column: span var(--phone, 2); }
@media (min-width: 700px) { .wgrid.fitted > .wg { grid-column: span var(--mid, 4); } }
@media (min-width: 1280px) { .wgrid.fitted > .wg { grid-column: span var(--span, 12); } }

/* ---------- rows: the name takes the room, the figure sits at the right edge ---------- */
.row > .row-main, .row > .who { flex: 1 1 auto; min-width: 0; }
.who > .row-main { flex: 1 1 auto; }
.row-meta.wrap { white-space: normal; }
.month-head h2 { flex: none; white-space: nowrap; }
.month-head span { min-width: 0; text-align: right; }
.toolbar.between { justify-content: space-between; }

/* ---------- GST: one column on a phone; on a wide screen the figure beside
   its tax heads, then the months beside what to fix ---------- */
.gst-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "owe" "fix" "heads" "months" "rates"; }
.gst-grid > * { min-width: 0; }
.gst-owe { grid-area: owe; }
.gst-heads { grid-area: heads; }
.gst-months { grid-area: months; }
.gst-fix { grid-area: fix; }
.gst-rates { grid-area: rates; }
.hero-split.three { grid-template-columns: repeat(3, 1fr); }
table.data th.tight { width: 1%; }
table.data .field.gstin { width: 210px; font-family: var(--mono); }
table.data .field.code { width: 132px; }
table.data input.field.code { font-family: var(--mono); }
.phone-list { display: none; }
@media (min-width: 700px) { .gst-grid { gap: 14px; } }
@media (min-width: 1180px) {
  .gst-grid { grid-template-columns: minmax(0, 1.7fr) minmax(340px, 1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "owe heads" "months fix" "rates fix"; align-items: start; }
  .gst-owe, .gst-heads { align-self: stretch; }
  .gst-owe { grid-template-rows: auto auto 1fr auto; }
}
@media (min-width: 1700px) { .gst-grid { gap: 18px; } }

/* ---------- Data health: one answer, then a list that opens ---------- */
.health-top { display: grid; gap: 16px; margin-bottom: 12px; }
.health-top .who b { display: block; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.health-top .checks { padding-top: 16px; border-top: 1px solid var(--hair); }
.issues { display: grid; }
.issue + .issue { border-top: 1px solid var(--hair); }
.issue > summary, div.issue { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; list-style: none; }
.issue > summary { cursor: pointer; border-radius: 12px; }
.issue > summary::-webkit-details-marker { display: none; }
.issue .t { flex: 1; min-width: 0; }
.issue .t b { display: block; font-weight: 500; font-size: 14.5px; }
.issue .t small { display: block; margin-top: 2px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.issue .tag { margin-top: 4px; }
.issue .chev { margin-top: 7px; transition: transform 200ms; }
.issue[open] .chev { transform: rotate(90deg); }
.issue-more { padding: 0 0 12px 42px; }
.issue-more .line > span:first-child { color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.issue-more .line > span:last-child { white-space: normal; text-align: right; }

/* ---------- phones ---------- */
@media (max-width: 699px) {
  /* 16px in every field, so an iPhone does not zoom the page when one is tapped */
  .field.sm { font-size: 16px; }
  /* a title with one control beside it keeps them on a line; the words under it get the full width */
  .page-head:has(.actions > .pill:only-child) { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: dense; align-items: center; gap: 4px 12px; }
  .page-head:has(.actions > .pill:only-child) .lead { display: contents; }
  .page-head:has(.actions > .pill:only-child) .kicker { grid-column: 1 / -1; }
  .page-head:has(.actions > .pill:only-child) .page-title { grid-column: 1; }
  .page-head:has(.actions > .pill:only-child) .actions { grid-column: 2; }
  .page-head:has(.actions > .pill:only-child) .page-sub { grid-column: 1 / -1; margin-top: 0; }
}
@media (max-width: 519px) {
  .phone-list { display: grid; }
  .not-phone { display: none; }
  .toolbar > .seg { display: grid; flex: 1 1 100%; }
  .toolbar.between > .setting { margin-left: auto; }
  .card-head { flex-wrap: wrap; }
  .card-head > div:first-child { flex: 1 1 200px; min-width: 0; }
  /* a figure with its change beside the label: the icon shrinks to a dot of its colour, so the label is not cut */
  .stat-top { gap: 7px; }
  .stat-top:has(> .tag) > .ico { width: 8px; height: 8px; border-radius: 50%; background: var(--tone, var(--c-plain)); }
  .stat-top:has(> .tag) > .ico svg { display: none; }
  .stat-top > .tag { height: 20px; padding: 0 6px; font-size: 11px; }
  /* four columns of figures fit without sliding sideways */
  table.data th, table.data td { padding-left: 10px; }
  table.data th:first-child, table.data td:first-child { min-width: 76px; }
  /* a table of fields becomes one block for each row, each field the full width */
  table.data.stack, table.data.stack tbody { display: block; }
  table.data.stack thead { display: none; }
  table.data.stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 0; border-top: 1px dashed var(--dash); }
  table.data.stack tr:first-child { border-top: 0; padding-top: 2px; }
  table.data.stack td { display: block; min-width: 0; padding: 0; border: 0; white-space: normal; }
  table.data.stack td:first-child, table.data.stack td.full { grid-column: 1 / -1; }
  table.data.stack td.wide { display: none; }
  table.data.stack .field { width: 100%; }
  .issue-more { padding-left: 0; }
}
@media (max-width: 419px) { .tile-top svg.go { display: none; } }

@media (max-width: 519px) { .pair.stack-narrow { grid-template-columns: 1fr; } }

/* a name being typed (a report, a segment) gets the whole line on a phone */
@media (max-width: 699px) { .page-head .lead:has(input.page-title) { flex-basis: 100%; } }

/* one entry: its inner edges line up with the cards around it */
.doc-head { padding: 18px 16px 14px; }
.doc-body { padding: 0 16px 6px; }
.doc-sum { padding: 4px 16px 14px; }
.words { padding: 0 16px 16px; }
@media (min-width: 700px) {
  .doc-head { padding: 20px 20px 14px; }
  .doc-body { padding: 0 20px 6px; }
  .doc-sum { padding: 4px 20px 14px; }
  .words { padding: 0 20px 16px; }
}
@media (min-width: 1700px) {
  .doc-head { padding: 24px 24px 14px; }
  .doc-body { padding: 0 24px 6px; }
  .doc-sum { padding: 4px 24px 14px; }
  .words { padding: 0 24px 16px; }
  .scroll-x { margin: 0 -24px; padding: 0 24px; }
}

/* ---------- forms for a party and for an entry that is not a bill ---------- */
textarea.field { height: auto; min-height: 88px; padding: 11px 14px; line-height: 1.45; resize: vertical; font-family: inherit; }
.field:disabled { opacity: 0.55; }
.sheet-body .pair { gap: 10px; }
/* where the map's outlines come from, said on the map when asked */
.map-credit { position: absolute; right: 0; bottom: 0; width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: rgba(255, 255, 255, 0.07); color: #8b8e97; }
.map-credit:hover, .map-credit:focus-visible { background: rgba(255, 255, 255, 0.14); color: var(--on-dark); }
@media (min-width: 700px) { .choice:has(> :nth-child(4)) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* a screen being drawn again in place: dimmed while its figures are on the way (after a moment, so a quick answer does not flicker) */
.stage.busy { opacity: 0.55; transition: opacity 160ms ease 140ms; }
