/* Launch Console (ops/LAUNCH_CONSOLE_SPEC.md §1). Telegram's own theme first (--tg-theme-*), with
   light and dark fallbacks for a browser preview. System fonts only: nothing loads from outside. */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #efeff4);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #0b0c0e);
  --hint: var(--tg-theme-hint-color, #81868f);
  --sub: var(--tg-theme-subtitle-text-color, var(--hint));
  --link: var(--tg-theme-link-color, #2481cc);
  --accent: var(--tg-theme-button-color, #2481cc);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --head: var(--tg-theme-header-bg-color, var(--card));
  --line: var(--tg-theme-section-separator-color, rgba(128, 134, 145, .22));
  --bad: var(--tg-theme-destructive-text-color, #d03a3a);
  --needs: #b86a00; --needs-bg: rgba(255, 166, 0, .16);
  --good: #1b9150; --good-bg: rgba(27, 145, 80, .14);
  --bad-bg: rgba(208, 58, 58, .13);
  --chip: rgba(128, 134, 145, .14);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --safe-top: var(--tg-content-safe-area-inset-top, 0px);
  --safe-bottom: max(var(--tg-safe-area-inset-bottom, 0px), env(safe-area-inset-bottom, 0px));
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not(.tg) { --bg: #0e1621; --card: #17212b; --text: #f1f3f5; --hint: #7e8c9a; --link: #6ab3f3; --accent: #4f86c6; --head: #17212b; --line: rgba(255,255,255,.08); }
}
:root.dark { --needs: #f1ad45; --needs-bg: rgba(241, 173, 69, .14); --good: #4cc383; --good-bg: rgba(76, 195, 131, .14); --bad-bg: rgba(238, 107, 107, .14); --chip: rgba(255,255,255,.08); }
@media (prefers-color-scheme: dark) { :root:not(.tg) { --needs: #f1ad45; --needs-bg: rgba(241,173,69,.14); --good: #4cc383; --good-bg: rgba(76,195,131,.14); --chip: rgba(255,255,255,.08); } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { container-type: inline-size; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.top { display: flex; align-items: center; gap: 10px; padding: calc(12px + var(--safe-top)) 16px 10px; background: var(--head); border-bottom: 1px solid var(--line); min-width: 0; }
.top h1 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .back { all: unset; cursor: pointer; color: var(--link); font-weight: 600; padding: 2px 4px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--hint); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hint); display: inline-block; flex: none; }
.live.on .dot { background: var(--good); }
.live.old .dot { background: var(--needs); }
.live.off .dot { background: var(--bad); }
@media (prefers-reduced-motion: no-preference) { .live.on .dot { animation: pulse 2s infinite; } .spinner { animation: spin 1s linear infinite; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
.body { overflow-y: auto; min-height: 0; padding: 12px 12px 24px; -webkit-overflow-scrolling: touch; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); background: var(--head); border-top: 1px solid var(--line); padding: 6px 4px calc(8px + var(--safe-bottom)); }
.tabs button { all: unset; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--hint); padding: 4px 0; position: relative; }
.tabs button[aria-current="page"] { color: var(--accent); }
.tabs svg { width: 24px; height: 24px; }
.badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 17px; height: 17px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.state { min-height: 60vh; display: grid; place-content: center; justify-items: center; gap: 12px; text-align: center; color: var(--hint); padding: 24px; }
.state h2 { margin: 0; color: var(--text); font-size: 18px; }
.state p { margin: 0; max-width: 32ch; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); }
.group { margin-top: 18px; }
.group:first-child { margin-top: 2px; }
.gh { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 0 6px 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--hint); }
.gh b { color: var(--needs); }
.box { background: var(--card); border-radius: 14px; overflow: hidden; }
.row { display: flex; gap: 11px; align-items: center; padding: 11px 12px; border-top: 1px solid var(--line); min-width: 0; }
.row:first-child { border-top: 0; }
button.row { all: unset; box-sizing: border-box; display: flex; gap: 11px; align-items: center; width: 100%; padding: 11px 12px; border-top: 1px solid var(--line); cursor: pointer; min-width: 0; }
.box > button.row:first-child { border-top: 0; }
.main { flex: 1; min-width: 0; }
.t1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t2 { font-size: 13px; color: var(--hint); margin-top: 1px; overflow-wrap: anywhere; }
.end { font-size: 13px; color: var(--hint); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.end.v { color: var(--text); font-weight: 600; }
.tick { font-family: var(--mono); font-size: 12px; color: var(--hint); font-weight: 400; }
.chev { color: var(--hint); flex: none; }
.ico { width: 26px; text-align: center; flex: none; font-size: 17px; }
.av { flex: none; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 13px; background: linear-gradient(140deg, hsl(var(--h) 70% 55%), hsl(calc(var(--h) + 38) 68% 40%)); }
.needcard { background: var(--card); border-radius: 14px; padding: 12px; display: grid; gap: 9px; border-left: 4px solid var(--needs); }
.needcard + .needcard { margin-top: 8px; }
.needcard .head { display: flex; gap: 11px; align-items: center; min-width: 0; }
.waited { font-size: 12px; color: var(--needs); font-weight: 600; }
.rich { font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.rich a { color: var(--link); }
.rich code, .rich pre { font-family: var(--mono); font-size: 12.5px; }
.rich pre { margin: 6px 0; white-space: pre-wrap; }
.rich blockquote { margin: 6px 0; padding: 2px 0 2px 10px; border-left: 3px solid var(--accent); color: var(--text); }
.btn { all: unset; box-sizing: border-box; cursor: pointer; padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; background: var(--chip); text-align: center; }
.btn.p { background: var(--accent); color: var(--accent-text); }
.btn.full { display: block; width: 100%; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--hint); white-space: nowrap; }
.pill.needs { background: var(--needs-bg); color: var(--needs); }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.blue { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.money { font-size: 10px; font-weight: 800; letter-spacing: .06em; color: var(--needs); border: 1px solid currentColor; border-radius: 5px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; }
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 12px; border-radius: 12px; background: var(--needs-bg); color: var(--needs); font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner .main { font-weight: 600; }
.banner small { display: block; font-weight: 400; opacity: .9; margin-top: 2px; }
.empty { padding: 16px 14px; text-align: center; color: var(--hint); font-size: 14px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters button { all: unset; cursor: pointer; flex: none; padding: 6px 12px; border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 600; color: var(--hint); }
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.big { font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.hero { background: var(--card); border-radius: 14px; padding: 14px; }
.hero .k { font-size: 13px; color: var(--hint); }
.hrow { display: flex; gap: 12px; align-items: center; }
.hrow .name { font-size: 18px; font-weight: 700; white-space: normal; }
.hero .t2 + .t2, .hero .btns + .t2 { margin-top: 6px; }
.age { font-size: 12px; color: var(--hint); }
.age.old { color: var(--needs); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.stat { background: var(--bg); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.stat .k { font-size: 12px; color: var(--hint); } .stat .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.meter { height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--good); }
.meter i.warn { background: var(--needs); } .meter i.full { background: var(--bad); }
.search { width: 100%; border: 0; border-radius: 10px; padding: 9px 12px; background: var(--card); color: var(--text); font: inherit; margin-bottom: 10px; }
.note { color: var(--hint); font-size: 13px; padding: 10px 6px 0; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; z-index: 5; }
.sheet { width: 100%; max-height: 90%; overflow-y: auto; background: var(--card); border-radius: 18px 18px 0 0; padding: 14px 16px calc(20px + var(--safe-bottom)); display: grid; gap: 12px; }
.sheet h2 { margin: 0; font-size: 18px; }
.sheet .grab { justify-self: center; width: 36px; height: 4px; border-radius: 2px; background: var(--line); }
.kv { display: grid; grid-template-columns: minmax(84px, max-content) minmax(0, 1fr); gap: 7px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--hint); } .kv dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.toast { position: absolute; left: 12px; right: 12px; bottom: calc(76px + var(--safe-bottom)); background: var(--text); color: var(--bg); border-radius: 12px; padding: 11px 14px; font-size: 14px; font-weight: 600; z-index: 6; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.view-only { margin-top: 18px; text-align: center; font-size: 12px; color: var(--hint); }
/* On a computer: a side rail instead of tabs, and two columns on Today. */
@container (min-width: 760px) {
  .app { grid-template-columns: 210px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .top { grid-column: 1 / -1; }
  .tabs { grid-row: 2; grid-column: 1; display: flex; flex-direction: column; gap: 2px; border-top: 0; border-right: 1px solid var(--line); padding: 10px 8px; }
  .tabs button { flex-direction: row; gap: 10px; font-size: 14px; padding: 9px 10px; border-radius: 9px; }
  .tabs button[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); }
  .tabs svg { width: 20px; height: 20px; }
  .badge { position: static; margin-left: auto; }
  .body { grid-row: 2; grid-column: 2; padding: 18px 22px 28px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .scrim { align-items: center; justify-content: center; }
  .sheet { width: min(560px, 92%); border-radius: 16px; max-height: 86%; }
  .toast { left: auto; right: 20px; bottom: 20px; width: 360px; }
}
