/* tpanel — дизайн-система TSHELL. Описание компонентов и приёмы вёрстки: docs/design-system.md.
   Правила: слои тоном + промежутки, а не рамками; латунь только для действий и выбора;
   бирюза только для «живого» (в сети, идут сеансы); красный только для проблем;
   без неона, свечения и градиентов; вес шрифта 400/500 (300 для крупных цифр);
   кольцо фокуса только с клавиатуры. */

@font-face { font-family: "Rubik"; font-weight: 300; font-style: normal; font-display: swap; src: url("../fonts/rubik-300.woff2") format("woff2"); }
@font-face { font-family: "Rubik"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/rubik-400.woff2") format("woff2"); }
@font-face { font-family: "Rubik"; font-weight: 500 900; font-style: normal; font-display: swap; src: url("../fonts/rubik-500.woff2") format("woff2"); }

:root {
  /* поверхности: фон < слой 1 < слой 2 < слой 3 < нажатие */
  --bg: #0F1011; --l1: #1C1D20; --l2: #27282C; --l3: #34353A; --press: #404147;
  --line: rgba(255, 255, 255, .09); --line-2: rgba(255, 255, 255, .16);
  --tx: #DCDAD4; --tx2: #9A9893; --tx3: #6E6C68;
  --brass: #C9A970; --on-brass: #1A150C; --brass-hover: #D6B983; --brass-press: #B89A62; --brass-soft: rgba(201, 169, 112, .14);
  --teal: #7DB8B0; --teal-soft: rgba(125, 184, 176, .14);
  --danger: #E2918C; --danger-soft: rgba(226, 145, 140, .14);
  --warn: #D4A15E; --warn-soft: rgba(212, 161, 94, .14);
  --scrim: rgba(8, 9, 10, .66);

  /* радиусы */
  --r-ctl: 10px; --r-sm: 8px; --r-card: 16px; --r-float: 20px; --r-pill: 999px;
  /* высоты контролов */
  --h-sm: 32px; --h-md: 40px; --h-lg: 48px;
  /* шаг отступов */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  /* точки перелома (в @media писать числом): телефон <=760, планшет 761-1100, ноутбук 1101-1599, широкий >=1600, 4K >=2200 */
  --font: "Rubik", "Segoe UI", system-ui, sans-serif;
  --sidebar-w: 248px; --rail-w: 72px; --top-h: 64px; --bottom-h: 64px;
  --gutter: clamp(16px, 2.2vw, 40px);
  --t: 120ms;
  --shadow-float: 0 16px 40px rgba(0, 0, 0, .45);

  /* --- старые имена: страницы, которые ещё не переписаны, держатся на них --- */
  --canvas: var(--bg); --page: var(--bg); --sidebar: var(--l1); --surface: var(--l1); --surface-muted: var(--l2);
  --surface-blue: var(--l2); --selected: var(--brass-soft);
  --text: var(--tx); --text-2: var(--tx2); --text-3: var(--tx3);
  --primary: var(--brass); --primary-hover: var(--brass-hover); --primary-pressed: var(--brass-press);
  --primary-soft: var(--brass-soft); --primary-soft-text: var(--brass);
  --border: var(--line); --border-strong: var(--line-2); --focus: var(--brass);
  --success: var(--teal); --success-soft: var(--teal-soft); --warning: var(--warn); --warning-soft: var(--warn-soft);
  --violet: var(--tx2); --violet-soft: var(--l3); --backdrop: var(--scrim);
  --st-off: var(--tx3); --st-free: var(--teal); --st-busy: var(--brass); --st-locked: var(--warn); --st-error: var(--danger); --st-reserved: var(--tx2);
  --r-md: var(--r-ctl); --r-lg: var(--r-card); --r-full: var(--r-pill);
  --shadow-card: none; --shadow-panel: var(--shadow-float); --shadow-modal: var(--shadow-float);
  --row-h: 52px;
}
@media (prefers-reduced-motion: reduce) { :root { --t: 0ms; } * { animation-duration: 0ms !important; } }

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body { font: 400 14px/20px var(--font); color: var(--tx); background: var(--bg); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; font-synthesis: none; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
b, strong { font-weight: 500; }
h1, h2, h3, h4 { font-weight: 500; }
a { color: var(--brass); text-decoration: none; }
a:hover { color: var(--brass-hover); }
::selection { background: var(--brass-soft); }
.ico { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.s { width: 18px; height: 18px; } .ico.xs { width: 16px; height: 16px; } .ico.l { width: 24px; height: 24px; }
.muted { color: var(--tx3); } .sec { color: var(--tx2); } .num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sp { flex: 1; }
.nowrap { white-space: nowrap; }
.big-num { font-weight: 300; font-size: 40px; line-height: 48px; letter-spacing: -.01em; }
:focus { outline: 0; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: var(--r-sm); }
* { scrollbar-width: thin; scrollbar-color: var(--l3) transparent; }

/* ================= каркас ================= */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100vh; height: 100dvh; grid-template-rows: minmax(0, 1fr); overflow: hidden; background: var(--bg); }
.side { background: var(--l1); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: var(--s4) var(--s3); overflow-y: auto; overflow-x: hidden; gap: var(--s1); z-index: 30; }
.logo { display: flex; align-items: center; gap: 12px; font-weight: 500; font-size: 18px; height: 40px; padding: 0 var(--s2); margin-bottom: var(--s3); color: var(--tx); letter-spacing: .01em; white-space: nowrap; }
.logo i { width: 32px; height: 32px; border-radius: var(--r-ctl); background: var(--brass); color: var(--on-brass); display: grid; place-items: center; font-style: normal; font-size: 14px; font-weight: 500; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-grp { font-size: 12px; line-height: 16px; color: var(--tx3); padding: var(--s4) var(--s3) var(--s2); font-weight: 500; white-space: nowrap; }
.nav-grp:first-child { padding-top: var(--s2); }
.nav a { position: relative; display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 var(--s3); border-radius: var(--r-ctl); color: var(--tx2); transition: background var(--t), color var(--t); white-space: nowrap; }
.nav a:hover { background: var(--l2); color: var(--tx); }
.nav a:active { background: var(--l3); }
.nav a.on { background: var(--l2); color: var(--tx); font-weight: 500; }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brass); }
.nav a.on .ico { color: var(--brass); }
.nav .cnt, .bottom-nav .cnt { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--brass); color: var(--on-brass); font-size: 12px; font-weight: 500; display: inline-grid; place-items: center; line-height: 1; }
.side-foot { margin-top: auto; padding: var(--s3); font-size: 12px; color: var(--tx3); display: flex; flex-direction: column; gap: var(--s1); }
.side-foot .live-line { display: flex; align-items: center; gap: var(--s2); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.top { height: var(--top-h); display: flex; align-items: center; gap: var(--s3); padding: 0 var(--gutter); border-bottom: 1px solid var(--line); background: var(--bg); flex: none; position: relative; z-index: 20; }
.top .clock { font-weight: 300; font-size: 22px; letter-spacing: .01em; } .top .date { color: var(--tx3); font-size: 13px; }
.top .menu-btn { display: none; }
.content { flex: 1; min-height: 0; overflow: auto; padding: var(--s5) var(--gutter) var(--s7); min-width: 0; scroll-padding: var(--s5) 0 var(--s5); overflow-anchor: none; }
.content :target, .content [id] { scroll-margin-top: var(--s5); }
.page { animation: page-in var(--t) ease-out; width: 100%; }
@keyframes page-in { from { opacity: 0; } }
.page-stack { display: flex; flex-direction: column; gap: var(--s5); }

.gsearch { position: relative; width: min(360px, 34vw); }
.gsearch .search { width: 100%; min-width: 0; }
.pop { position: absolute; z-index: 60; background: var(--l2); border: 1px solid var(--line-2); border-radius: var(--r-card); box-shadow: var(--shadow-float); padding: var(--s2); min-width: 240px; }
.pop.right { right: 0; } .pop.below { top: calc(100% + 8px); }
.pop a, .pop button.item { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 40px; padding: 0 var(--s3); border: 0; background: none; border-radius: var(--r-ctl); color: var(--tx); cursor: pointer; text-align: left; }
.pop a:hover, .pop button.item:hover, .pop .item.on { background: var(--l3); color: var(--tx); }
.pop .pop-h { padding: var(--s3); border-bottom: 1px solid var(--line); margin: calc(var(--s2) * -1) calc(var(--s2) * -1) var(--s2); }
.pop .pop-h small { display: block; color: var(--tx3); }
.pop .pop-empty { padding: var(--s4); color: var(--tx3); text-align: center; }
.pop-wrap { position: relative; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--l3); color: var(--brass); display: grid; place-items: center; font-weight: 500; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; } .avatar.lg { width: 48px; height: 48px; font-size: 18px; }
.user-btn { display: flex; align-items: center; gap: var(--s3); border: 0; background: none; padding: 4px 12px 4px 4px; border-radius: var(--r-pill); cursor: pointer; text-align: left; }
.user-btn:hover { background: var(--l1); }
.user-btn .who { line-height: 18px; } .user-btn .who small { display: block; color: var(--tx3); font-size: 12px; }
.bottom-nav { display: none; }
.side-scrim { display: none; }

/* 761–1100: узкая рейка с иконками */
@media (max-width: 1100px) and (min-width: 761px) {
  .app { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .side { padding: var(--s4) var(--s2); align-items: center; }
  .logo { padding: 0; margin-bottom: var(--s3); } .logo span { display: none; }
  .nav { width: 100%; align-items: center; }
  .nav a { width: 48px; height: 48px; padding: 0; justify-content: center; }
  .nav a span.lbl { display: none; }
  .nav a.on::before { left: -8px; }
  .nav a .cnt { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }
  .nav-grp { height: 1px; padding: 0; margin: var(--s3) 0; background: var(--line); font-size: 0; width: 32px; }
  .nav-grp:first-child { display: none; }
  .side-foot { display: none; }
  .gsearch { width: min(300px, 32vw); }
  .user-btn .who { display: none; }
  .top .date { display: none; }
}
/* до 760: боковая панель — шторка, внизу панель основных разделов */
@media (max-width: 760px) {
  :root { --top-h: 56px; --gutter: 16px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform 180ms ease-out; border-right: 1px solid var(--line-2); box-shadow: var(--shadow-float); }
  .app.nav-open .side { transform: none; }
  .app.nav-open .side-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 25; }
  .top .menu-btn { display: inline-grid; }
  .top .clock, .top .date, .top .club-chip { display: none; }
  .gsearch { flex: 1; width: auto; } .top .sp { display: none; }
  .user-btn .who { display: none; } .user-btn { padding: 0; }
  .content { padding-bottom: calc(var(--bottom-h) + var(--s6)); }
  .bottom-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottom-h); background: var(--l1); border-top: 1px solid var(--line); z-index: 24; padding-bottom: env(safe-area-inset-bottom); box-sizing: content-box; }
  .bottom-nav a, .bottom-nav button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 0; background: none; color: var(--tx3); font-size: 11px; line-height: 14px; min-height: 48px; cursor: pointer; }
  .bottom-nav .on { color: var(--brass); }
  .bottom-nav .cnt { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--bottom-h) + 12px) !important; }
  .toast { min-width: 0; max-width: none; }
}
@media (min-width: 1100px) and (max-width: 1280px) { :root { --sidebar-w: 232px; } }
@media (min-width: 2200px) { html { font-size: 118%; } }
@media (min-width: 3000px) { html { font-size: 150%; } }

/* ================= заголовок страницы ================= */
.ph { display: flex; align-items: flex-end; gap: var(--s4); margin-bottom: var(--s5); flex-wrap: wrap; }
.ph > div:first-child { flex: 1; min-width: 200px; }
.ph h1 { font-size: 28px; line-height: 36px; font-weight: 500; letter-spacing: -.005em; }
.ph p { color: var(--tx2); margin-top: var(--s1); }
.ph .actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
@media (max-width: 760px) { .ph { margin-bottom: var(--s4); } .ph h1 { font-size: 24px; line-height: 32px; } .ph .actions { width: 100%; } .ph .actions .btn { flex: 1; } }

.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); margin-bottom: var(--s5); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { border: 0; background: none; padding: 0 var(--s4); height: 44px; display: inline-flex; align-items: center; color: var(--tx2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; transition: color var(--t); }
.tabs a:hover, .tabs button:hover { color: var(--tx); }
.tabs .on { color: var(--tx); border-bottom-color: var(--brass); font-weight: 500; }

.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { border: 0; background: none; height: var(--h-sm); padding: 0 var(--s3); border-radius: var(--r-sm); cursor: pointer; color: var(--tx2); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: background var(--t), color var(--t); }
.seg button:hover { color: var(--tx); }
.seg button.on { background: var(--l3); color: var(--tx); font-weight: 500; }
.seg.lg button { height: 40px; padding: 0 var(--s4); }

/* ================= кнопки ================= */
.btn { height: var(--h-md); padding: 0 var(--s4); border-radius: var(--r-ctl); border: 1px solid transparent; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); cursor: pointer; transition: background var(--t), border-color var(--t), color var(--t); white-space: nowrap; text-decoration: none; background: var(--l2); color: var(--tx); }
.btn:hover { background: var(--l3); color: var(--tx); } .btn:active { background: var(--press); }
.btn.sm { height: var(--h-sm); padding: 0 var(--s3); font-size: 13px; border-radius: var(--r-sm); }
.btn.lg { height: var(--h-lg); padding: 0 var(--s5); font-size: 15px; }
.btn.block { width: 100%; }
.btn.p, .btn.primary { background: var(--brass); color: var(--on-brass); } .btn.p:hover, .btn.primary:hover { background: var(--brass-hover); color: var(--on-brass); } .btn.p:active, .btn.primary:active { background: var(--brass-press); }
.btn.o, .btn.secondary { background: transparent; border-color: var(--line-2); } .btn.o:hover, .btn.secondary:hover { background: var(--l2); } .btn.o:active, .btn.secondary:active { background: var(--l3); }
.btn.g, .btn.ghost { background: transparent; color: var(--tx2); } .btn.g:hover, .btn.ghost:hover { background: var(--l2); color: var(--tx); } .btn.g:active, .btn.ghost:active { background: var(--l3); }
.btn.d, .btn.danger { background: var(--danger-soft); color: var(--danger); } .btn.d:hover, .btn.danger:hover { background: rgba(226, 145, 140, .24); color: var(--danger); } .btn.d:active, .btn.danger:active { background: rgba(226, 145, 140, .32); }
.btn:disabled, .btn[disabled], .ibtn:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn .ico, .btn .ico.s, .btn .ico.xs, .btn .ico.l, .btn svg { width: 16px; height: 16px; margin: 0; display: block; flex: none; align-self: center; }
.btn.lg .ico, .btn.lg .ico.s, .btn.lg .ico.xs, .btn.lg .ico.l, .btn.lg svg { width: 18px; height: 18px; }
.chip .ico, .seg button .ico, .pill .ico, .badge .ico { width: 16px; height: 16px; margin: 0; display: block; flex: none; }
.ibtn { width: 40px; height: 40px; border-radius: var(--r-ctl); border: 0; background: none; display: inline-grid; place-items: center; color: var(--tx2); cursor: pointer; position: relative; flex: none; transition: background var(--t), color var(--t); }
.ibtn:hover { background: var(--l2); color: var(--tx); } .ibtn:active { background: var(--l3); }
.ibtn .dot-n { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--brass); outline: 2px solid var(--bg); }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

/* ================= поля ================= */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; color: var(--tx2); font-weight: 500; }
.field small { color: var(--tx3); font-size: 12px; line-height: 16px; }
.input, select.input, textarea.input { height: var(--h-md); padding: 0 var(--s3); border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--bg); outline: 0; width: 100%; color: var(--tx); transition: border-color var(--t), background var(--t); }
.input::placeholder { color: var(--tx3); }
.input:hover { border-color: rgba(255, 255, 255, .26); }
.input:focus { border-color: var(--brass); }
.input:disabled { opacity: .5; cursor: not-allowed; background: var(--l1); }
.input.err { border-color: var(--danger); }
.input.lg { height: var(--h-lg); } .input.sm { height: var(--h-sm); border-radius: var(--r-sm); }
select.input { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239A9893' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select.input option { background: var(--l2); color: var(--tx); }
textarea.input { height: auto; min-height: 96px; padding: var(--s3); resize: vertical; line-height: 20px; }
input[type=file].input { padding: 6px; }
input[type=checkbox], input[type=radio] { accent-color: var(--brass); width: 16px; height: 16px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .04em; }
.keybox { display: flex; align-items: center; justify-content: center; min-height: 72px; padding: var(--s4); background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-card); font-weight: 300; font-size: 32px; letter-spacing: .12em; word-break: break-all; text-align: center; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s4); }
.kv dt { color: var(--tx3); } .kv dd { margin: 0; word-break: break-word; }

.form-row { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 480px); gap: var(--s5); padding: var(--s4) 0; border-top: 1px solid var(--line); align-items: start; }
.form-row:first-child { border-top: 0; }
.form-row .lbl b { display: block; font-weight: 500; } .form-row .lbl small { color: var(--tx3); display: block; margin-top: 2px; }
.switch { position: relative; width: 44px; height: 24px; flex: none; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--l3); border-radius: 24px; transition: background var(--t); }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--tx2); transition: transform var(--t), background var(--t); }
.switch input:checked + i { background: var(--brass); } .switch input:checked + i::after { transform: translateX(20px); background: var(--on-brass); }
.switch input:focus-visible + i { outline: 2px solid var(--brass); outline-offset: 2px; }
.switch input:disabled + i { opacity: .45; }
.toggle-row { display: flex; gap: var(--s4); align-items: flex-start; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.toggle-row:first-child { border-top: 0; } .toggle-row b { display: block; font-weight: 500; } .toggle-row small { color: var(--tx3); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--bg); }
.stepper button { width: 40px; height: 38px; border: 0; background: none; cursor: pointer; color: var(--tx2); } .stepper button:hover { color: var(--tx); }
.stepper input { width: 56px; text-align: center; border: 0; outline: 0; background: none; }
@media (max-width: 1100px) { .form-row { grid-template-columns: minmax(0, 1fr); gap: var(--s2); } }

/* ================= карточки, KPI ================= */
.card { background: var(--l1); border: 1px solid var(--line); border-radius: var(--r-card); min-width: 0; }
.card.pad { padding: var(--s5); }
.card.raised { background: var(--l2); }
.card-h { display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); min-height: 60px; }
.card-h h3 { font-size: 16px; line-height: 24px; font-weight: 500; }
.card-h .sub { color: var(--tx3); font-size: 13px; }
.card-b { padding: var(--s5); }
.grid { display: grid; gap: var(--s4); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.fit { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.grid.fit-s { grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
.grid.fit-l { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.split { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
@media (max-width: 1280px) { .split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1100px) { .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } .card.pad, .card-b { padding: var(--s4); } .card-h { padding: var(--s3) var(--s4); } }

.kpi { display: flex; flex-direction: column; gap: var(--s1); }
.kpi > span { color: var(--tx2); font-size: 13px; display: flex; align-items: center; gap: var(--s2); }
.kpi > b { display: block; font-size: 40px; line-height: 48px; font-weight: 300; margin-top: var(--s2); letter-spacing: -.01em; }
.kpi > small { color: var(--tx3); font-size: 13px; line-height: 18px; }
.kpi .unit { font-size: 18px; color: var(--tx3); margin-left: 4px; font-weight: 400; }
.kpi.live > b { color: var(--teal); }
.progress { height: 6px; border-radius: 6px; background: var(--l3); overflow: hidden; margin-top: var(--s3); }
.progress > i { display: block; height: 100%; background: var(--brass); border-radius: 6px; }
.progress.live > i { background: var(--teal); }

.toolbar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.search { display: inline-flex; align-items: center; gap: var(--s2); height: var(--h-md); padding: 0 var(--s3); border: 1px solid var(--line-2); border-radius: var(--r-ctl); background: var(--bg); color: var(--tx3); min-width: 240px; transition: border-color var(--t); }
.search:hover { border-color: rgba(255, 255, 255, .26); } .search:focus-within { border-color: var(--brass); }
.search input { border: 0; outline: 0; background: none; width: 100%; color: var(--tx); min-width: 0; }
.search kbd { font: 400 11px var(--font); color: var(--tx3); border: 1px solid var(--line-2); border-radius: 6px; padding: 1px 6px; }

/* ================= внимание: список того, что требует решения ================= */
.attn { display: flex; flex-direction: column; }
.attn-i { display: flex; align-items: center; gap: var(--s4); padding: var(--s4) var(--s5); border-top: 1px solid var(--line); color: var(--tx); }
.attn-i:first-child { border-top: 0; }
a.attn-i:hover { background: var(--l2); color: var(--tx); }
.attn-i .ico { color: var(--brass); }
.attn-i.danger .ico { color: var(--danger); } .attn-i.live .ico { color: var(--teal); }
.attn-i .t { flex: 1; min-width: 0; } .attn-i .t small { display: block; color: var(--tx3); }
.attn-ok { display: flex; align-items: center; gap: var(--s3); padding: var(--s5); color: var(--tx2); }
.attn-ok .ico { color: var(--teal); }

/* ================= таблицы ================= */
.tbl-wrap { overflow: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--tx3); text-align: left; padding: 0 var(--s4); height: 40px; border-bottom: 1px solid var(--line); background: var(--l1); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tbl td { height: var(--row-h); padding: var(--s2) var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--l2); }
.tbl tbody tr.sel td { background: var(--brass-soft); } .tbl tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--brass); }
.tbl tbody tr[data-href], .tbl tbody tr.click, .tbl tbody tr.hm-row { cursor: pointer; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl td:empty::before { content: "—"; color: var(--tx3); }
.tbl.dense td { height: 40px; }
/* телефон: таблица .stack превращается в список карточек; у ячейки нужен data-l="Подпись" */
@media (max-width: 760px) {
  .tbl.stack thead { display: none; }
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
  .tbl.stack tbody tr:last-child { border-bottom: 0; }
  .tbl.stack td { height: auto !important; border: 0 !important; padding: 2px 0; display: flex; justify-content: space-between; gap: var(--s4); text-align: right; background: none !important; box-shadow: none !important; }
  .tbl.stack td::before { content: attr(data-l); color: var(--tx3); text-align: left; flex: none; }
  .tbl.stack td:not([data-l])::before, .tbl.stack td:empty::before { content: none; }
  .tbl.stack td:first-child { font-weight: 500; font-size: 15px; justify-content: flex-start; text-align: left; padding-bottom: var(--s1); } .tbl.stack td:first-child::before { content: none; }
  .tbl.stack td:empty { display: none; }
}

/* ================= бейджи, пилюли, статусы ================= */
.badge, .pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--l3); color: var(--tx2); }
.pill.lg { height: 32px; padding: 0 var(--s3); font-size: 13px; }
.b-ok, .pill.live { background: var(--teal-soft); color: var(--teal); }
.b-warn, .pill.warn { background: var(--warn-soft); color: var(--warn); }
.b-err, .pill.danger { background: var(--danger-soft); color: var(--danger); }
.b-n, .pill.neutral { background: var(--l3); color: var(--tx2); }
.b-blue, .pill.brass { background: var(--brass-soft); color: var(--brass); }
.b-violet { background: var(--l3); color: var(--tx); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--tx3); }
.dot.live { background: var(--teal); } .dot.warn { background: var(--warn); } .dot.danger { background: var(--danger); } .dot.brass { background: var(--brass); }
.chip { display: inline-flex; align-items: center; gap: var(--s2); height: var(--h-sm); padding: 0 var(--s3); border: 1px solid var(--line-2); border-radius: var(--r-pill); background: transparent; color: var(--tx2); cursor: pointer; transition: background var(--t); }
.chip:hover { background: var(--l2); color: var(--tx); } .chip.on { background: var(--brass-soft); border-color: var(--brass); color: var(--brass); }

/* ================= баннеры, пустые состояния, скелетоны ================= */
.alert, .banner { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-card); margin-bottom: var(--s4); background: var(--l2); border: 1px solid var(--line); color: var(--tx); }
.banner > .ico, .alert > .ico { margin-top: 1px; }
.alert.warn, .banner.warn { background: var(--warn-soft); border-color: rgba(212, 161, 94, .3); } .alert.warn > .ico, .banner.warn > .ico { color: var(--warn); }
.alert.err, .banner.err { background: var(--danger-soft); border-color: rgba(226, 145, 140, .3); } .alert.err > .ico, .banner.err > .ico { color: var(--danger); }
.alert.info, .banner.info { background: var(--l2); } .alert.info > .ico, .banner.info > .ico { color: var(--tx2); }
.banner.offline { background: var(--l3); border-color: var(--line-2); }
.banner .btn { margin-left: auto; }
.empty { padding: var(--s7) var(--s5); text-align: center; color: var(--tx2); display: flex; flex-direction: column; align-items: center; gap: var(--s1); }
.empty > .ico { width: 40px; height: 40px; color: var(--tx3); margin-bottom: var(--s3); stroke-width: 1.4; }
.empty b { display: block; color: var(--tx); font-size: 16px; font-weight: 500; }
.empty > div { max-width: 420px; }
.skel { background: var(--l2); border-radius: var(--r-sm); height: 16px; animation: sk 1.4s ease-in-out infinite; }
.skel.h2 { height: 32px; } .skel.block { height: 120px; border-radius: var(--r-card); }
@keyframes sk { 50% { opacity: .45; } }
.soon { border: 1px dashed var(--line-2); border-radius: var(--r-ctl); padding: var(--s3) var(--s4); color: var(--tx2); background: transparent; font-size: 13px; }

/* ================= диалоги, тосты ================= */
.modal-bg { position: fixed; inset: 0; background: var(--scrim); display: grid; place-items: center; z-index: 80; padding: var(--s5); animation: fade-in 120ms ease-out; }
.modal { background: var(--l2); border: 1px solid var(--line-2); border-radius: var(--r-float); box-shadow: var(--shadow-float); width: min(520px, 100%); max-height: min(90vh, 900px); max-height: min(90dvh, 900px); display: flex; flex-direction: column; animation: pop 120ms ease-out; overflow: hidden; }
.modal.sm { width: min(400px, 100%); }
.modal.md { width: min(600px, 100%); }
.modal.lg, .modal.wide { width: min(860px, 100%); }
.modal.xl { width: min(1120px, 100%); }
@keyframes pop { from { opacity: 0; transform: scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .modal, .modal-bg { animation: none; } }
.modal-h { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s4) var(--s4) var(--s3) var(--s5); flex: none; border-bottom: 1px solid var(--line); }
.modal-t { flex: 1; min-width: 0; }
.modal-h h2 { font-size: 20px; line-height: 28px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-sub { color: var(--tx2); font-size: 13px; line-height: 18px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-pill { flex: none; display: flex; gap: var(--s2); align-items: center; min-height: 28px; flex-wrap: wrap; justify-content: flex-end; }
.modal-h > .ibtn { flex: none; margin-top: -2px; }
.modal-b { padding: var(--s4) var(--s5) var(--s5); overflow: auto; display: flex; flex-direction: column; gap: var(--s4); flex: 1; min-height: 0; overscroll-behavior: contain; }
.modal-f { display: flex; justify-content: flex-end; gap: var(--s2); padding: var(--s4) var(--s5); border-top: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.modal-f[hidden], .modal-sub[hidden], .modal-pill[hidden] { display: none; }
.toasts { position: fixed; right: var(--s5); bottom: var(--s5); display: flex; flex-direction: column; gap: var(--s2); z-index: 90; }
.toast { background: var(--l3); border: 1px solid var(--line-2); border-left: 3px solid var(--brass); box-shadow: var(--shadow-float); border-radius: var(--r-ctl); padding: var(--s3) var(--s4); min-width: 280px; max-width: 420px; animation: page-in 140ms; }
.toast.ok { border-left-color: var(--teal); } .toast.err { border-left-color: var(--danger); } .toast.warn { border-left-color: var(--warn); }
@media (max-width: 760px) {
  .modal-bg { padding: 0; place-items: stretch; }
  .modal, .modal.sm, .modal.md, .modal.lg, .modal.wide, .modal.xl { width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; border: 0; }
  .modal-b { flex: 1; padding: var(--s3) var(--s4) var(--s4); }
  .modal-f { padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom)); } .modal-f .btn { flex: 1; }
  .modal-h { padding: var(--s3) var(--s3) var(--s3) var(--s4); }
}

/* ================= графики: чистый SVG/CSS, без библиотек ================= */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--tx3); font: 400 11px var(--font); }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--l3); transition: fill var(--t); } .chart .bar.on { fill: var(--brass); } .chart g:hover .bar { fill: var(--brass); }
.chart .ln { fill: none; stroke: var(--brass); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ln.prev { stroke: var(--tx3); stroke-dasharray: 3 4; stroke-width: 1.5; }
.chart .area { fill: var(--brass-soft); stroke: none; }
.chart .pt { fill: var(--brass); }
.hbars { display: flex; flex-direction: column; gap: var(--s3); }
.hbar { display: grid; grid-template-columns: minmax(80px, 160px) 1fr max-content; gap: var(--s3); align-items: center; }
.hbar .tr { height: 8px; border-radius: 8px; background: var(--l3); overflow: hidden; } .hbar .tr > i { display: block; height: 100%; background: var(--brass); border-radius: 8px; }
.hbar .v { color: var(--tx2); }
.heat { display: grid; grid-template-columns: 28px repeat(24, minmax(0, 1fr)); gap: 3px; align-items: center; font-size: 11px; color: var(--tx3); }
.heat .c { aspect-ratio: 1 / 1; border-radius: 4px; background: var(--l2); }
.heat .c[data-v="1"] { background: rgba(201, 169, 112, .22); } .heat .c[data-v="2"] { background: rgba(201, 169, 112, .42); }
.heat .c[data-v="3"] { background: rgba(201, 169, 112, .66); } .heat .c[data-v="4"] { background: var(--brass); }
.heat .hh { text-align: center; }
@media (max-width: 760px) { .heat { font-size: 9px; grid-template-columns: 22px repeat(24, minmax(0, 1fr)); gap: 2px; } }

/* ================= вход ================= */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s5); background: var(--bg); }
.login .card { width: min(420px, 100%); padding: var(--s6); background: var(--l1); border-radius: var(--r-float); }
.login h1 { font-size: 24px; line-height: 32px; margin-bottom: var(--s1); }

/* ================= планшеты и телефоны: цели касания не меньше 44 px ================= */
@media (pointer: coarse), (max-width: 1100px) {
  .btn, .btn.sm { min-height: 44px; }
  .ibtn { width: 44px; height: 44px; }
  .input, select.input { height: 44px; }
  .seg button { height: 40px; }
  .nav a { min-height: 44px; }
  .tbl td { height: 56px; }
  .chip { height: 40px; }
  .switch { width: 48px; height: 28px; } .switch i::after { width: 22px; height: 22px; } .switch input:checked + i::after { transform: translateX(20px); }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; }
}

/* Печатная версия Z-отчёта: касса и статистика собирают её в #zprint и зовут window.print() */
#zprint { display: none; }
@media print {
  body > *:not(#zprint) { display: none !important; }
  #zprint { display: block; font: 12px/1.45 Arial, Helvetica, sans-serif; color: #000; background: #fff; max-width: 190mm; margin: 0 auto; }
  #zprint h1 { font-size: 18px; margin: 0 0 2px; } #zprint h2 { font-size: 13px; margin: 14px 0 4px; border-bottom: 1px solid #000; padding-bottom: 2px; }
  #zprint .zp-sub { color: #444; margin-bottom: 10px; }
  #zprint table { width: 100%; border-collapse: collapse; } #zprint td { padding: 2px 0; } #zprint td:last-child { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
  #zprint .zp-total td { border-top: 1px solid #000; font-weight: 700; padding-top: 4px; }
  #zprint .zp-sign { margin-top: 28px; display: flex; gap: 30px; } #zprint .zp-sign div { flex: 1; border-top: 1px solid #000; padding-top: 3px; color: #444; }
  @page { size: A4; margin: 14mm; }
}

/* длинные подписи сегментов переносятся на телефоне */
@media (max-width: 760px) { .seg.lg { display: flex; width: 100%; } .seg.lg button { flex: 1; white-space: normal; height: auto; min-height: 44px; padding: 8px 12px; line-height: 18px; } }
