/* Журнал моноблоков — мини-апп. «Пульт поста»: номер моноблока как шильдик,
   цвет = газ, крупные цели под палец. Тема — светлая/тёмная, как у Telegram. */

:root {
  --bg: #f0f1f3;
  --surface: #ffffff;
  --surface-2: #f6f7f8;
  --surface-3: #e3e6ea;
  --line: #e1e4e8;
  --line-2: #d5d9de;
  --ink: #14171a;
  --ink-2: #4f5862;
  --ink-3: #6b7480;
  --muted: #8a929b;
  --scrim: rgba(20, 23, 26, 0.48);
  --red: #b42318;
  --red-ink: #9a1b12;
  --red-tint: #fde7e4;
  --red-line: #f3b8b0;
  --amber-tint: #fbebd3;
  --amber-ink: #6b3b00;
  --ok: #1e6b35;
  --ok-tint: #e6f4ea;
  --primary: #14171a;
  --on-primary: #ffffff;
  --shadow: 0 1px 2px rgba(20, 23, 26, 0.06), 0 8px 24px rgba(20, 23, 26, 0.08);
  --font: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f1215;
  --surface: #181c20;
  --surface-2: #1f242a;
  --surface-3: #2a3037;
  --line: #262b31;
  --line-2: #343a41;
  --ink: #eceff2;
  --ink-2: #a9b1ba;
  --ink-3: #8a939d;
  --muted: #6b747e;
  --scrim: rgba(0, 0, 0, 0.62);
  --red: #f26b5e;
  --red-ink: #ffb4ab;
  --red-tint: #3a1714;
  --red-line: #6b2a24;
  --amber-tint: #3a2a12;
  --amber-ink: #f2c27e;
  --ok: #8bd3a5;
  --ok-tint: #173022;
  --primary: #eceff2;
  --on-primary: #14171a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* Газы. --g заливка, --g-on текст на заливке, --g-tint подложка, --g-ink текст на подложке. */
.gas-CO2 { --g: #a15c07; --g-on: #fff; --g-tint: #fbebd3; --g-ink: #7a4300; --g-line: #e7b877; }
.gas-Ar { --g: #0e7064; --g-on: #fff; --g-tint: #d5f0eb; --g-ink: #0a5249; --g-line: #86cfc3; }
.gas-O2 { --g: #1f5fbf; --g-on: #fff; --g-tint: #dce8fa; --g-ink: #174a94; --g-line: #9dbdef; }
.gas-N2 { --g: #5b3fb0; --g-on: #fff; --g-tint: #e8e2f8; --g-ink: #45308a; --g-line: #bfb0ec; }
.gas-other { --g: #4f5862; --g-on: #fff; --g-tint: #e9ebee; --g-ink: #2c3238; --g-line: #c9ced4; }
[data-theme="dark"] .gas-CO2 { --g: #e0a04a; --g-on: #1a1206; --g-tint: #3a2a12; --g-ink: #f2c27e; --g-line: #7a5a26; }
[data-theme="dark"] .gas-Ar { --g: #3dbba8; --g-on: #06201c; --g-tint: #12332e; --g-ink: #86dccd; --g-line: #2a6b61; }
[data-theme="dark"] .gas-O2 { --g: #6ea6f5; --g-on: #08172e; --g-tint: #16243a; --g-ink: #a9c8f8; --g-line: #33517f; }
[data-theme="dark"] .gas-N2 { --g: #a58bf0; --g-on: #16102c; --g-tint: #231c3d; --g-ink: #c9b8f7; --g-line: #4f3f87; }
[data-theme="dark"] .gas-other { --g: #a9b1ba; --g-on: #0f1215; --g-tint: #1f242a; --g-ink: #c9d0d7; --g-line: #3a4148; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
.mono { font-family: var(--mono); font-feature-settings: "tnum"; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hstack { display: flex; align-items: center; gap: 12px; min-width: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.hidden { display: none !important; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--g, #3b82f6); outline-offset: 2px; }

#view { padding-bottom: calc(24px + var(--safe-b)); }
body.has-tabs #view { padding-bottom: calc(var(--tabs-h) + 24px + var(--safe-b)); }
body.sheet-open { overflow: hidden; }

/* ——— загрузка и пустые экраны ——— */

.boot { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--ink-2); }
.boot__mark { width: 44px; height: 44px; border-radius: 12px; border: 3px solid var(--line-2); border-top-color: var(--ink); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.fullmsg { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 32px 24px; text-align: center; }
.fullmsg h1 { font-size: 22px; }
.fullmsg p { color: var(--ink-2); max-width: 320px; text-wrap: pretty; }
.fullmsg__icon { width: 64px; height: 64px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-2); }

.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.skeleton i { display: block; height: 72px; border-radius: 16px; background: linear-gradient(90deg, var(--surface) 20%, var(--surface-2) 50%, var(--surface) 80%); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
.skeleton i:first-child { height: 96px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.empty { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; border: 1.5px dashed var(--line-2); color: var(--ink-2); font-size: 15px; }
.empty svg { flex-shrink: 0; color: var(--ink-3); }

/* ——— шапка экрана ——— */

.head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.head__icon { width: 48px; height: 48px; border-radius: 14px; background: var(--g); color: var(--g-on); display: grid; place-items: center; flex-shrink: 0; }
.head__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.head__title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.head__sub { font-size: 14px; color: var(--ink-2); }
.head__side { flex-shrink: 0; }
.head--stack { flex-direction: column; align-items: stretch; gap: 12px; }
.head__row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.backbtn { width: 40px; height: 40px; margin-left: -8px; border: 0; border-radius: 12px; background: transparent; display: grid; place-items: center; flex-shrink: 0; }

/* ——— секции ——— */

.section { display: flex; flex-direction: column; gap: 10px; padding: 20px 16px 4px; }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; }
.h2 { font-size: 18px; font-weight: 700; }
.h2 .count { color: var(--ink-3); font-weight: 600; margin-left: 4px; }
.hint { font-size: 14px; color: var(--ink-2); line-height: 1.4; text-wrap: pretty; }
.linkbtn { align-self: flex-start; min-height: 40px; padding: 0 4px; border: 0; background: transparent; color: var(--g-ink, var(--ink)); font-weight: 600; font-size: 15px; }

/* ——— шильдик моноблока ——— */

.plate { display: inline-flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 76px; height: 36px; padding: 0 9px; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--surface); color: var(--ink); font: 800 19px/1 var(--mono); letter-spacing: 0.02em; flex-shrink: 0; white-space: nowrap; }
.plate::before, .plate::after { content: ""; width: 4px; height: 4px; border-radius: 2px; background: var(--muted); flex-shrink: 0; }
.plate--s { min-width: 64px; height: 30px; font-size: 15px; padding: 0 7px; border-radius: 7px; }
.plate--xl { min-width: 0; height: 64px; padding: 0 16px; gap: 10px; border-width: 2px; border-radius: 12px; font-size: 40px; }
.plate--xl::before, .plate--xl::after { width: 6px; height: 6px; border-radius: 3px; }
button.plate { cursor: pointer; }

/* ——— газ ——— */

.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 7px; background: var(--g-tint); color: var(--g-ink); font-size: 13px; font-weight: 700; white-space: nowrap; }
.chip--fill { background: var(--g); color: var(--g-on); }
.chip--wait { background: var(--g-tint); color: var(--g-ink); border: 1.5px dashed var(--g); }
.chip--neutral { background: var(--surface-3); color: var(--ink-2); }
.chip--lg { height: 28px; font-size: 14px; padding: 0 10px; border-radius: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Эстафета: залитый газ — заливкой, ждущий — пунктиром. Ширина — по килограммам. */
.relay { display: flex; gap: 3px; height: 30px; font-size: 13px; font-weight: 600; }
.relay .seg { flex-basis: 0; min-width: 72px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 10px; white-space: nowrap; overflow: hidden; }
.relay .seg:first-child { border-radius: 8px 3px 3px 8px; }
.relay .seg:last-child { border-radius: 3px 8px 8px 3px; }
.relay .seg:only-child { border-radius: 8px; }
.relay .seg--done, .relay .seg--now { background: var(--g); color: var(--g-on); }
.relay .seg--wait { background: var(--g-tint); color: var(--g-ink); border: 1.5px dashed var(--g); }
.relay .seg--now { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--g); }
.relay .seg small { font-size: 12px; font-weight: 500; opacity: 0.9; }

/* ——— карточки и списки ——— */

.card { display: flex; flex-direction: column; gap: 11px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; text-align: left; width: 100%; }
button.card { cursor: pointer; }
button.card:active, .row:active, .tile:active { transform: scale(0.99); }
.card__top { display: flex; align-items: center; gap: 12px; }
.card__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.card__title { font-size: 15px; font-weight: 600; }
.card__sub { font-size: 13px; color: var(--ink-2); }
.card__chev { color: var(--muted); flex-shrink: 0; }

.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; width: 100%; }
.row:last-child { border-bottom: 0; }
.row__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.row__title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.row__sub { font-size: 13px; color: var(--ink-2); }
.row__side { font-size: 13px; color: var(--ink-2); flex-shrink: 0; text-align: right; }
.row--sel { background: var(--g-tint); }

.alert { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--red-tint); color: var(--red-ink); font-size: 13px; font-weight: 600; line-height: 1.35; }
.alert svg, .warn svg, .note svg { flex-shrink: 0; }
.warn { display: flex; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--amber-tint); color: var(--amber-ink); font-size: 14px; line-height: 1.4; }
.note { display: flex; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); font-size: 13px; line-height: 1.35; }

/* ——— кнопки ——— */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn--sm { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.btn--lg { min-height: 56px; border-radius: 14px; font-size: 17px; font-weight: 700; }
.btn--block { display: flex; width: 100%; }
.btn--primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn--gas { background: var(--g); color: var(--g-on); border-color: var(--g); }
.btn--tint { background: var(--g-tint); color: var(--g-ink); border-color: transparent; }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--danger { background: transparent; border-color: var(--red-line); color: var(--red); }
.btn:disabled { opacity: 0.45; }
.btn .sub { display: block; font-size: 13px; font-weight: 500; opacity: 0.85; }
.btn--stack { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 10px 16px; min-height: 64px; text-align: left; white-space: normal; }
.iconbtn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--g-tint); color: var(--g-ink); display: grid; place-items: center; flex-shrink: 0; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.actions .wide { grid-column: span 2; }

/* ——— плитки: позиции и моноблоки ——— */

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ptile { display: flex; flex-direction: column; gap: 10px; min-height: 96px; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; }
.ptile__name { font-size: 16px; font-weight: 700; }
.ptile__pass { font-size: 13px; color: var(--ink-2); }
.ptile__gases { display: flex; align-items: center; gap: 6px; margin-top: auto; }
.ptile__gases .chip { height: 22px; font-size: 12px; }

.tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: 76px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--line-2); color: var(--ink); }
.tile__num { font: 800 21px/1 var(--mono); letter-spacing: 0.02em; }
.tile__note { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-3); max-width: 100%; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile--recent { background: var(--g-tint); border-color: var(--g-line); }
.tile--recent .tile__note { color: var(--g-ink); }
.tile--mine { border-color: var(--g); border-style: solid; }
.tile--mine .tile__note { color: var(--g-ink); }
.tile--busy { background: var(--surface-3); border-style: dashed; opacity: 0.75; }
.tile--off { background: var(--surface-3); border-style: dashed; opacity: 0.6; }
.tile--sel { box-shadow: 0 0 0 3px var(--g); border-color: var(--g); }
.tile--dim { opacity: 0.35; }
.tile__check { position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 6px; background: var(--g); color: var(--g-on); display: grid; place-items: center; }
.tile__flag { position: absolute; top: 6px; left: 8px; width: 8px; height: 8px; border-radius: 4px; background: var(--red); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--line-2); background: var(--surface); }
.legend i.l-recent { background: var(--g-tint); border-color: var(--g-line); }
.legend i.l-busy { background: var(--surface-3); border-style: dashed; }

/* ——— поиск, фильтры, переключатели ——— */

.search { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; background: var(--surface-2); border: 1.5px solid transparent; border-radius: 12px; }
.search:focus-within { border-color: var(--line-2); background: var(--surface); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; }
.search svg { color: var(--ink-3); flex-shrink: 0; }
.search .clear { border: 0; background: transparent; width: 32px; height: 32px; display: grid; place-items: center; color: var(--ink-3); }

.pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.pills::-webkit-scrollbar { display: none; }
.pill { height: 36px; padding: 0 12px; border-radius: 18px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: 14px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.pill[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pill.gas-CO2[aria-pressed="true"], .pill.gas-Ar[aria-pressed="true"], .pill.gas-O2[aria-pressed="true"], .pill.gas-N2[aria-pressed="true"] { background: var(--g); border-color: var(--g); color: var(--g-on); }

.segmented { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 12px; }
.segmented button { height: 38px; border-radius: 9px; border: 0; background: transparent; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(20, 23, 26, 0.14); }
.segmented button.gas-CO2[aria-selected="true"], .segmented button.gas-Ar[aria-selected="true"], .segmented button.gas-O2[aria-selected="true"], .segmented button.gas-N2[aria-selected="true"] { background: var(--g); color: var(--g-on); }

/* ——— нижние вкладки ——— */

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--surface); border-top: 1px solid var(--line); }
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--ink-3); font-size: 12px; font-weight: 600; }
.tabs button[aria-current="page"] { color: var(--g, var(--ink)); font-weight: 700; }

/* ——— нижний лист (ввод кг, вопросы, формы) ——— */

.scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); animation: fade 0.18s ease-out; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 94vh; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; padding: 10px 16px calc(18px + var(--safe-b)); background: var(--bg); border-radius: 22px 22px 0 0; box-shadow: var(--shadow); animation: rise 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); }
.sheet__grab { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); flex-shrink: 0; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet__title { font-size: 20px; font-weight: 700; line-height: 1.25; }
.sheet__close { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink-2); flex-shrink: 0; }
.sheet__text { font-size: 16px; line-height: 1.45; color: var(--ink-2); text-wrap: pretty; }
.sheet__text b { color: var(--ink); }
.sheet__icon { width: 48px; height: 48px; border-radius: 14px; background: var(--g-tint); color: var(--g); display: grid; place-items: center; flex-shrink: 0; }
.sheet__error { padding: 10px 12px; border-radius: 12px; background: var(--red-tint); color: var(--red-ink); font-size: 14px; font-weight: 600; }
@keyframes rise { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.kp-display { display: flex; align-items: baseline; justify-content: center; gap: 8px; min-height: 60px; padding-top: 2px; }
.kp-display .v { font: 800 54px/1 var(--mono); letter-spacing: -0.02em; }
.kp-display .v.is-empty { color: var(--muted); }
.kp-display .u { font-size: 22px; font-weight: 600; color: var(--ink-2); }
.kp-result { text-align: center; font-size: 15px; color: var(--ink-2); min-height: 20px; }
.kp-result b { color: var(--ink); }
.kp-doses { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kp-doses > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.dose { height: 42px; min-width: 64px; padding: 0 14px; border-radius: 12px; border: 1.5px solid var(--g-line); background: var(--surface); color: var(--g-ink); font: 700 16px/1 var(--mono); }
.dose[aria-pressed="true"] { background: var(--g); border-color: var(--g); color: var(--g-on); }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.key { height: 54px; border-radius: 14px; border: 0; background: var(--surface); color: var(--ink); font-size: 26px; font-weight: 600; display: grid; place-items: center; box-shadow: 0 1px 0 var(--line-2); touch-action: manipulation; }
.key--alt { background: var(--surface-3); }
.key:active { transform: translateY(1px); box-shadow: none; }

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: 16px; }
.field textarea { min-height: 96px; resize: vertical; }
.field small { font-size: 13px; color: var(--ink-3); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--ink-3); }

/* ——— тост ——— */

#toast-root { position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 60; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
body.has-tabs #toast-root { bottom: calc(var(--tabs-h) + 12px + var(--safe-b)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 10px 10px 16px; border-radius: 14px; background: #14171a; color: #fff; font-size: 15px; box-shadow: var(--shadow); animation: rise 0.2s ease-out; }
[data-theme="dark"] .toast { background: #eceff2; color: #14171a; }
.toast__text { flex: 1; line-height: 1.35; }
.toast--error { background: var(--red); color: #fff; }
.toast button { border: 0; border-radius: 10px; min-height: 36px; padding: 0 12px; background: rgba(255, 255, 255, 0.16); color: inherit; font-weight: 700; }
[data-theme="dark"] .toast button { background: rgba(20, 23, 26, 0.12); }

/* ——— нижняя панель выбора (несколько сразу) ——— */

.selbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; flex-direction: column; gap: 10px; padding: 12px 16px calc(14px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); }
.selbar__info { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--ink-2); }
.selbar__info b { color: var(--ink); }
body.has-selbar #view { padding-bottom: calc(150px + var(--safe-b)); }

.check { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line-2); display: grid; place-items: center; flex-shrink: 0; color: var(--g-on); }
.row--sel .check { background: var(--g); border-color: var(--g); }

/* ——— журнал ——— */

.day { display: flex; flex-direction: column; gap: 8px; padding: 18px 16px 2px; }
.day__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.day__title { font-size: 16px; font-weight: 700; }
.jrow { display: grid; grid-template-columns: 48px 58px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; width: 100%; }
.jrow:last-child { border-bottom: 0; }
.jrow__num { font: 800 17px/1 var(--mono); }
.jrow__mix { display: flex; flex-direction: column; font-size: 14px; font-weight: 700; line-height: 1.2; }
.jrow__mix small { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.jrow__gases { display: flex; gap: 4px; flex-wrap: wrap; }
.jrow__gases .chip { height: 26px; }
.jrow__time { font-size: 13px; color: var(--ink-2); }

/* ——— моноблок ——— */

.hero { display: flex; flex-direction: column; gap: 14px; padding: 8px 16px 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.hero__top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.facts div { display: flex; flex-direction: column; gap: 2px; }
.facts dt { font-size: 12px; color: var(--ink-2); }
.facts dd { margin: 0; font-size: 15px; font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 8px; font-size: 13px; font-weight: 700; background: var(--ok-tint); color: var(--ok); align-self: flex-start; }
.status--off { background: var(--red-tint); color: var(--red-ink); }
.status--wait { background: var(--amber-tint); color: var(--amber-ink); }
.meter { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
.meter__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 700; }
.meter__head span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.meter__bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter__bar i { display: block; height: 100%; border-radius: 4px; background: var(--ink); }
.meter--soon .meter__bar i { background: #c27a12; }
.meter--over { background: var(--red-tint); }
.meter--over .meter__bar i { background: var(--red); }
.meter--over .meter__head, .meter--over .meter__head span { color: var(--red-ink); }
.meter small { font-size: 12px; color: var(--ink-2); }
.hist { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: left; width: 100%; }
.hist__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 700; }
.hist__head span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.hist__who { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--ink-2); }

/* ——— реестр и сводка ——— */

.counters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.counter { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; height: 62px; padding: 8px 10px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); text-align: left; }
.counter b { font: 800 22px/1 var(--mono); }
.counter span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.counter--alert { background: var(--red-tint); border-color: var(--red-line); color: var(--red-ink); }
.counter--alert span { color: var(--red-ink); }
.counter[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); }
.group-title { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; }
.group-title i { width: 10px; height: 10px; border-radius: 5px; background: var(--ink-3); }
.group-title .count { color: var(--ink-3); font-weight: 600; }
.group-title--attention { color: var(--red-ink); }
.group-title--attention i { background: var(--red); }
.group-title--work i { background: var(--ok); }
.state-red { color: var(--red-ink); font-weight: 600; }

.kpi { display: flex; flex-direction: column; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.kpi__big { display: flex; align-items: baseline; gap: 8px; }
.kpi__big b { font: 800 42px/1.05 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.kpi__big span { font-size: 18px; font-weight: 600; color: var(--ink-2); }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: grid; grid-template-columns: 40px minmax(0, 1fr) 84px; align-items: center; gap: 10px; }
.bar__label { font-size: 15px; font-weight: 700; color: var(--g-ink); }
.bar__track { height: 14px; border-radius: 7px; background: var(--surface-3); overflow: hidden; }
.bar__track i { display: block; height: 100%; border-radius: 7px; background: var(--g); min-width: 4px; }
.bar__val { text-align: right; font: 700 15px/1 var(--mono); }
.callout { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); text-align: left; width: 100%; }
.callout--alert { background: var(--red-tint); border: 1.5px solid var(--red-line); color: var(--red-ink); }
.callout__text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.callout__text b { font-size: 15px; }
.callout__text span { font-size: 13px; opacity: 0.9; }
.avatar { width: 36px; height: 36px; border-radius: 18px; background: var(--g-tint); color: var(--g-ink); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }

@media (min-width: 560px) {
  #view, .tabs, .selbar, .sheet { max-width: 560px; margin-left: auto; margin-right: auto; }
  .sheet { left: 0; right: 0; }
}
@media (max-height: 720px) {
  .sheet { gap: 10px; padding-top: 8px; }
  .key { height: 46px; font-size: 22px; border-radius: 12px; }
  .keypad { gap: 6px; }
  .kp-display { min-height: 48px; }
  .kp-display .v { font-size: 44px; }
  .dose { height: 38px; }
  .sheet .card { padding: 10px 12px; gap: 8px; }
  .sheet .note { display: none; }
  .btn--lg { min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
