/* Макет: телефон Telegram Mini App — тёмный «закулисный» фон, золото только для главного действия и статусов; таблицы цифр спокойные */
:root {
  color-scheme: dark;
  --desk: #050506;
  --bg: #0b0b0c;
  --surface: #16161a;
  --surface-2: #1f1f24;
  --line: #2a2a30;
  --text: #f2f0ea;
  --muted: #a6a39b;
  --accent: #d4af37;
  --accent-ink: #111111;
  --accent-soft: rgba(212,175,55,.14);
  --ok: #3fae6a;
  --ok-soft: rgba(63,174,106,.15);
  --bad: #e5534b;
  --bad-soft: rgba(229,83,75,.15);
  --warn: #e0a43a;
  --warn-soft: rgba(224,164,58,.15);
  --scrim: rgba(0,0,0,.55);
  --glass: rgba(22,22,26,.78);
  --f-display: "Noto Serif", Georgia, serif;
  --f-body: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --desk: #dcd8cf; --bg: #f5f5f5; --surface: #ffffff; --surface-2: #ececec; --line: #dedad2;
    --text: #141414; --muted: #6b6860; --accent: #d4af37; --accent-ink: #111111; --accent-soft: #f3e9c8;
    --ok: #2b7d4c; --ok-soft: #e4f3ea; --bad: #b8402f; --bad-soft: #fbe9e5; --warn: #94650f; --warn-soft: #fbf0d9;
    --scrim: rgba(0,0,0,.35); --glass: rgba(255,255,255,.82);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --desk: #dcd8cf; --bg: #f5f5f5; --surface: #ffffff; --surface-2: #ececec; --line: #dedad2;
  --text: #141414; --muted: #6b6860; --accent: #d4af37; --accent-ink: #111111; --accent-soft: #f3e9c8;
  --ok: #2b7d4c; --ok-soft: #e4f3ea; --bad: #b8402f; --bad-soft: #fbe9e5; --warn: #94650f; --warn-soft: #fbf0d9;
  --scrim: rgba(0,0,0,.35); --glass: rgba(255,255,255,.82);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
body { background: var(--desk); color: var(--text); font-family: var(--f-body); font-size: 15px; line-height: 1.45; }
.viewport { position: relative; flex: 1; overflow: hidden; }
.view { position: absolute; inset: 0; overflow-y: auto; padding: 16px 16px 96px; background: var(--bg); transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .32s; will-change: transform; }
.view.off-right { transform: translateX(100%); }
.view.off-left { transform: translateX(-28%); opacity: .4; }
.view.hidden { display: none; }

.tabs { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--glass); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 5; }
.tab { background: none; border: 0; color: var(--muted); font: inherit; font-size: 11.5px; padding: 8px 0 10px; display: grid; justify-items: center; gap: 3px; cursor: pointer; min-height: 52px; }
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--accent); }
/* фирменная строка студии над заголовком «Ведомости» (логотип как в PDF-ведомости) */
.brandbar { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.brandbar img { width: 44px; height: 44px; border-radius: 12px; background: #0d0d0f; flex: none; }
.brandbar .org { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
h2.hd { font-family: var(--f-display); font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; text-wrap: balance; }
.sub { color: var(--muted); font-size: 13px; }
.sec { margin-top: 22px; }
.sec > .lbl { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px 4px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 0; border-top: 1px solid var(--line); background: none; width: 100%; color: inherit; font: inherit; text-align: left; cursor: pointer; min-height: 56px; }
.list > .item:first-child { border-top: 0; }
.item:active { background: var(--surface-2); }
.item .main { flex: 1; min-width: 0; }
.item .t { font-weight: 500; overflow-wrap: anywhere; }
.item .s { color: var(--muted); font-size: 12.5px; }
.item .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item .r .v { font-weight: 600; }
.chev { color: var(--muted); flex: none; }
/* в списке со стрелками у строк без стрелки — пустое место той же ширины, чтобы суммы стояли ровно */
.list:has(.chev) > .item:not(:has(.chev))::after { content: ""; width: 16px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.chip.final { background: var(--accent-soft); color: var(--accent); }
.chip.draft { background: var(--surface-2); color: var(--muted); }
.chip.none { border: 1px dashed var(--line); color: var(--muted); }
.chip.prelim { background: var(--warn-soft); color: var(--warn); }
.chip.plus { background: var(--ok-soft); color: var(--ok); }
.chip.minus { background: var(--bad-soft); color: var(--bad); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.num { font-variant-numeric: tabular-nums; }
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 12px; }
.hero .big { font-family: var(--f-display); font-size: 32px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hero .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 999px; font: inherit; font-weight: 600; padding: 13px 18px; cursor: pointer; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .1s ease-out; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .item:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* фокус с клавиатуры виден и внутри шторок: поля, сегменты, чипы, галочки, «ручка» */
.sheet:focus-visible, .sheet button:focus-visible, .sheet summary:focus-visible, .seg button:focus-visible,
.chips button:focus-visible, .tog:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .datepick input:focus-visible,
.daybar input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btns { display: grid; gap: 10px; }
.progress { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }
.alert { border-radius: 14px; padding: 12px 14px; font-size: 13.5px; display: grid; gap: 4px; }
.alert.bad { background: var(--bad-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.alert.warn { background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.alert b { font-weight: 600; }
.delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.rowtbl { display: grid; gap: 0; }
.rowtbl .item .t small { color: var(--muted); font-weight: 400; }
.normtag { font-size: 11px; color: var(--accent); border: 1px solid var(--accent-soft); background: var(--accent-soft); border-radius: 6px; padding: 0 6px; margin-left: 6px; white-space: nowrap; }
.datepick { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; }
.datepick input { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; }
.new { box-shadow: inset 3px 0 0 var(--warn); }
.scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 10; }
.scrim.on { opacity: 1; pointer-events: auto; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88%; background: var(--surface); border-radius: 22px 22px 0 0; border-top: 1px solid var(--line); z-index: 11; transform: translateY(105%); transition: transform .34s cubic-bezier(.2,.9,.25,1); display: flex; flex-direction: column; touch-action: none; }
.sheet.on { transform: translateY(0); }
.grab { padding: 10px 0 4px; display: grid; justify-items: center; cursor: grab; flex: none; }
.grab i { width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet .in { overflow-y: auto; padding: 6px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; touch-action: pan-y; }
.sheet h3 { font-family: var(--f-display); font-size: 20px; margin: 0; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; max-width: 100%; }
.field input[type="date"] { -webkit-appearance: none; appearance: none; }
.sheet .in { overflow-x: hidden; }
.sheet .in > * { min-width: 0; }
.field label { font-size: 12.5px; color: var(--muted); }
.field input, .field select, .field textarea { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; font: inherit; min-height: 46px; }
.field .hint { font-size: 12px; color: var(--muted); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { background: none; border: 0; color: var(--muted); font: inherit; font-size: 14px; border-radius: 9px; min-height: 40px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 0 var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 13.5px; border-radius: 999px; padding: 8px 12px; min-height: 38px; cursor: pointer; transition: transform .1s ease-out; }
.chips button:active { transform: scale(.96); }
.chips button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.filgrid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 6px; }
.tog { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font: inherit; font-size: 13.5px; border-radius: 10px; padding: 0 10px; min-height: 40px; cursor: pointer; text-align: left; min-width: 0; }
.tog span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tog .ck { width: 18px; height: 18px; flex: none; border-radius: 5px; border: 1.5px solid var(--line); display: grid; place-items: center; }
.tog[aria-pressed="true"] { border-color: var(--accent); }
.tog[aria-pressed="true"] .ck { background: var(--accent); border-color: var(--accent); }
.tog[aria-pressed="true"] .ck::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px,-1px); }
.tog.allf { grid-column: 1 / -1; }
.lessons { display: grid; gap: 6px; }
.lessons .tog { min-height: 52px; padding: 8px 10px; }
.lessons .tog .lt { display: grid; min-width: 0; flex: 1; }
.lessons .tog .lt b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lessons .tog .lt small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lessons .tog .lp { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); padding-left: 6px; }
.daybar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.daybar input { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font: inherit; min-width: 0; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 14px; list-style: none; padding: 4px 0; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { margin-bottom: 10px; }
.scopebox { display: grid; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.scopebox .ttl2 { font-size: 12.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; align-items: start; }
.effect { background: var(--surface-2); border-radius: 12px; padding: 12px; font-size: 13.5px; display: grid; gap: 6px; }
.effect .ln { display: flex; justify-content: space-between; gap: 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.toast { position: absolute; left: 16px; right: 16px; bottom: 76px; background: var(--text); color: var(--bg); border-radius: 14px; padding: 12px 14px; font-size: 14px; z-index: 20; transform: translateY(20px); opacity: 0; transition: transform .25s, opacity .25s; pointer-events: none; }
.toast.on { transform: none; opacity: 1; }
.btn.danger { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.grp { background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 2px 12px; }
.grp .ttl3 { font-size: 12.5px; color: var(--muted); padding: 10px 0 2px; }
.swrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-height: 52px; }
.grp .ttl3 + .swrow { border-top: 0; }
.swrow .tx { min-width: 0; }
.swrow .tx b { display: block; font-weight: 500; font-size: 14px; }
.swrow .tx small { display: block; color: var(--muted); font-size: 12px; }
.sw { position: relative; width: 48px; height: 30px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); flex: none; cursor: pointer; transition: background .2s, border-color .2s; padding: 0; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.sw[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent); }
.sw[aria-checked="true"]::after { transform: translateX(18px); background: var(--accent); }
.sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.empty { text-align: center; padding: 72px 18px 24px; display: grid; gap: 10px; justify-items: center; }
.empty svg { width: 52px; height: 52px; color: var(--muted); }
.empty h3 { font-family: var(--f-display); font-size: 21px; margin: 0; }
.empty p { color: var(--muted); margin: 0; max-width: 300px; }
.lock { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.lock svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.mline { font-variant-numeric: tabular-nums; }
/* Оболочка Mini App: в Telegram рамка телефона и шапка родные — приложение занимает весь экран */
html, body { margin: 0; height: 100%; }
body { background: var(--bg); overflow: hidden; }
.app { position: relative; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
/* без нижнего меню (одна вкладка) — запас снизу под меню не нужен */
.app.notabs .view { padding-bottom: 32px; }
/* «Уменьшить движение»: никаких сдвигов и масштабов — экраны, шторки, тост и кнопки только проявляются */
@media (prefers-reduced-motion: reduce) {
  .view, .sheet, .scrim, .toast { transition: opacity .18s !important; }
  .view.off-right, .view.off-left { transform: none; opacity: 0; }
  .sheet { transform: none; opacity: 0; pointer-events: none; }
  .sheet.on { opacity: 1; pointer-events: auto; }
  .toast { transform: none; }
  .btn:active, .chips button:active { transform: none; }
  .progress > i { transition: none; }
}
