/* The Mini App: Telegram's own colours (themeParams, set by telegram-web-app.js as --tg-theme-*) with the VIS ART
   accent; the fallbacks are the approved mock's light and dark themes for a browser outside Telegram. */
:root {
  --accent: #0369B4;
  --accent-ink: #ffffff;
  --lime: #C8E643;
  --navy: #173d65;
  --bg: var(--tg-theme-secondary-bg-color, #f4f7fa);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #173d65);
  --muted: var(--tg-theme-hint-color, #5f6f80);
  --line: var(--tg-theme-section-separator-color, #dce4ea);
  --tile: #EAF3FA;
  --warn-bg: #FFF3BF;
  --warn-ink: #7A5B00;
  --ok-bg: #E6F6D0;
  --ok-ink: #4B6B0A;
  --low-bg: #FFE8D6;
  --low-ink: #8A3B00;
  --danger: #C9373C;
  --top: max(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px), env(safe-area-inset-top));
  --bottom: max(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px),
                env(safe-area-inset-bottom));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--tg-theme-secondary-bg-color, #0f1720);
    --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #18232f));
    --text: var(--tg-theme-text-color, #eef3f8);
    --muted: var(--tg-theme-hint-color, #9fb0c2);
    --line: var(--tg-theme-section-separator-color, #273544);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: var(--tg-theme-secondary-bg-color, #0f1720);
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #18232f));
  --text: var(--tg-theme-text-color, #eef3f8);
  --muted: var(--tg-theme-hint-color, #9fb0c2);
  --line: var(--tg-theme-section-separator-color, #273544);
  color-scheme: dark;
}
:root[data-theme="dark"], :root[data-theme="dark"] * { --accent: #3d9be0; --tile: #1d3247; --warn-bg: #4a3d0a;
  --warn-ink: #ffe28a; --ok-bg: #26381a; --ok-ink: #c8e98f; --low-bg: #4a2a12; --low-ink: #ffc59a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --accent: #3d9be0; --tile: #1d3247; --warn-bg: #4a3d0a; --warn-ink: #ffe28a;
    --ok-bg: #26381a; --ok-ink: #c8e98f; --low-bg: #4a2a12; --low-ink: #ffc59a; }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%;
  overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, p { margin: 0; }
.icon { width: 22px; height: 22px; flex-shrink: 0; }
.icon.small { width: 18px; height: 18px; }
.icon.big { width: 36px; height: 36px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.app { min-height: 100vh; display: flex; flex-direction: column; padding-top: var(--top); }
.top { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; min-height: 56px; position: sticky; top: 0;
  background: var(--bg); z-index: 2; }
.top h1 { font-size: 18px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.top p { font-size: 12px; font-weight: 600; }
.titles { flex: 1; min-width: 0; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: #0369B4; color: var(--lime); display: flex;
  align-items: center; justify-content: center; margin-left: 4px; }
.icon-btn { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; }
.screen { flex: 1; padding: 4px 16px calc(84px + var(--bottom)); display: flex; flex-direction: column; gap: 12px;
  max-width: 560px; width: 100%; margin: 0 auto; }
.screen.no-nav { padding-bottom: calc(24px + var(--bottom)); }

.nav { position: fixed; left: 0; right: 0; bottom: 0; display: flex; padding: 4px 8px calc(8px + var(--bottom));
  border-top: 1px solid var(--line); background: var(--card); z-index: 3; }
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted); min-height: 52px; text-align: center; }
.nav-btn.on { color: var(--accent); }

.card { background: var(--card); border-radius: 16px; }
.list { padding: 4px 0; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 16px; }
.row + .row { border-top: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .label { display: block; font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.row .sub { display: block; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.row .count { font-size: 16px; font-weight: 800; white-space: nowrap; text-align: right; }
.row .accent { color: var(--accent); display: flex; }
.row .chev { color: var(--muted); }
.section { font-size: 13px; font-weight: 800; letter-spacing: 0.04em; color: var(--accent); text-transform: uppercase;
  margin-top: 4px; }
.section-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.note { font-size: 12px; color: var(--muted); }
.text { padding: 14px 16px; font-size: 14px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }

.recount { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; width: 100%; }
.recount .head { display: flex; align-items: center; gap: 10px; }
.recount .grow { flex: 1; min-width: 0; }
.recount .label { display: block; font-size: 16px; font-weight: 700; }
.recount .sub { display: block; font-size: 13px; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row .tags { align-items: center; justify-content: flex-end; }
.tile { width: 40px; height: 40px; border-radius: 12px; background: var(--tile); color: var(--accent); display: flex;
  align-items: center; justify-content: center; flex-shrink: 0; font-weight: 800; }
.tile.round { border-radius: 50%; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 7px; background: var(--tile);
  color: var(--accent); white-space: nowrap; }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); }
.tag.ok { background: var(--ok-bg); color: var(--ok-ink); }
.tag.low { background: var(--low-bg); color: var(--low-ink); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 8px 14px; min-height: 36px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.photo { position: relative; border-radius: 16px; overflow: hidden; background: #4a5560; min-height: 120px; }
.photo img { display: block; width: 100%; height: auto; }
.photo .missing { color: #eef3f8; padding: 40px 16px; text-align: center; font-size: 14px; }
.viewer { position: fixed; inset: 0; background: rgba(5, 10, 16, 0.94); z-index: 10; overflow: auto;
  touch-action: pinch-zoom pan-x pan-y; display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: none; width: 200%; height: auto; }
.viewer .icon-btn { position: fixed; top: calc(8px + var(--top)); right: 8px; color: #fff;
  background: rgba(0, 0, 0, 0.4); }

.remark { align-items: flex-start; }
.remark .accent { color: var(--warn-ink); }
.empty { padding: 28px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .title { font-size: 16px; font-weight: 700; }
.empty .icon.big { color: var(--accent); }
.main-btn, .ghost-btn { width: 100%; min-height: 48px; border-radius: 12px; font-size: 15px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.main-btn { background: var(--accent); color: var(--accent-ink); }
.ghost-btn { border: 1px solid var(--line); background: var(--card); }
.field { font: inherit; font-size: 16px; width: 100%; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; background: var(--card); color: var(--text); }
.toast { position: fixed; left: 16px; right: 16px; top: calc(64px + var(--top)); background: var(--navy); color: #fff;
  border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 600; display: flex; gap: 10px;
  align-items: center; z-index: 11; max-width: 528px; margin: 0 auto; }
.toast .icon { color: var(--lime); }
.skeleton { height: 76px; border-radius: 16px; background: var(--card); opacity: 0.6; }
.delta-plus { color: var(--ok-ink); }
.delta-minus { color: var(--danger); }
