/* TotalControl — общая тема интерфейса */
:root {
  --bg: #0a0f1c;
  --bg-soft: #101728;
  --panel: #141d31;
  --panel-2: #1a2540;
  --line: #223151;
  --text: #e8eefc;
  --muted: #93a3c4;
  --accent: #3b82f6;
  --accent-2: #22d3ee;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --purple: #a855f7;
  --radius: 14px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .35);
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box }

html, body { height: 100% }

body {
  margin: 0;
  font-family: var(--sans);
  background: radial-gradient(1200px 700px at 15% -10%, #16233f 0%, var(--bg) 55%) fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

a { color: var(--accent-2); text-decoration: none }
h1, h2, h3, h4 { margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em }
h1 { font-size: 1.5rem }
h2 { font-size: 1.15rem }
h3 { font-size: 1rem }
p { margin: .3em 0; color: var(--muted) }

.hidden { display: none !important }

/* ---------------------------------------------------------------- каркас */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: rgba(10, 15, 28, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700 }
.brand img { width: 30px; height: 30px; border-radius: 8px }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .7rem }

.topbar .spacer { flex: 1 }
.topbar .who { text-align: right; line-height: 1.25; font-size: .85rem }
.topbar .who span { color: var(--muted); font-size: .74rem; display: block }

.layout { display: flex; min-height: calc(100vh - 53px) }
.sidebar {
  width: 216px;
  flex: 0 0 216px;
  padding: 16px 10px;
  border-right: 1px solid var(--line);
  background: rgba(16, 23, 40, .6);
}
.sidebar button {
  display: flex; width: 100%; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 4px;
  background: transparent; border: 0; border-radius: 10px;
  color: var(--muted); font: inherit; cursor: pointer; text-align: left;
}
.sidebar button:hover { background: var(--panel); color: var(--text) }
.sidebar button.active { background: linear-gradient(90deg, rgba(59, 130, 246, .22), transparent); color: #fff; box-shadow: inset 2px 0 0 var(--accent) }
.sidebar .group { padding: 14px 12px 6px; font-size: .7rem; text-transform: uppercase; color: #5f7099; letter-spacing: .08em }

.content { flex: 1; padding: 18px; min-width: 0 }

/* ------------------------------------------------------------- компоненты */
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card h2 { display: flex; align-items: center; gap: 8px; font-size: 1rem; color: #cfe0ff }
.card .card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap }
.card .card-head .spacer { flex: 1 }

.grid { display: grid; gap: 14px }
.grid.kpi { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)) }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)) }
.grid.qr { grid-template-columns: minmax(280px, 340px) 1fr }
.stack { display: grid; gap: 14px }

.kpi-value { font-size: 1.85rem; font-weight: 700; line-height: 1.1 }
.kpi-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em }
.kpi-note { font-size: .78rem; color: #6f81a6; margin-top: 4px }
.kpi.ok .kpi-value { color: var(--ok) }
.kpi.warn .kpi-value { color: var(--warn) }
.kpi.info .kpi-value { color: var(--accent-2) }
.kpi.purple .kpi-value { color: var(--purple) }

button, .btn {
  font: inherit;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
button:hover:not(:disabled), .btn:hover { border-color: #35507f }
button:active:not(:disabled) { transform: translateY(1px) }
button:disabled { opacity: .45; cursor: not-allowed }
.btn-primary { background: linear-gradient(135deg, var(--accent), #1d4ed8); border-color: transparent; font-weight: 600 }
.btn-ok { background: linear-gradient(135deg, #16a34a, #15803d); border-color: transparent; font-weight: 600 }
.btn-danger { background: linear-gradient(135deg, #dc2626, #991b1b); border-color: transparent }
.btn-ghost { background: transparent }
.btn-lg { padding: 14px 22px; font-size: 1.05rem; border-radius: 12px }
.btn-sm { padding: 5px 10px; font-size: .82rem; border-radius: 8px }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap }

input, select, textarea {
  font: inherit;
  background: #0d1526;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 11px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(59, 130, 246, .4); outline-offset: 0 }
label { display: block; font-size: .8rem; color: var(--muted); margin: 0 0 4px }
.field { display: grid; gap: 4px; min-width: 140px }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) }
.inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap }
.checkbox { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .9rem }
.checkbox input { width: auto }
.field-check { align-content: end }
.field-check .checkbox { margin-top: 6px }

.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--line) }
table { width: 100%; border-collapse: collapse; font-size: .88rem; white-space: nowrap }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left }
th { position: sticky; top: 0; background: #16203a; color: #b9c9ea; font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; z-index: 2 }
tbody tr:hover { background: rgba(59, 130, 246, .07) }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums }
tfoot td { background: #16203a; font-weight: 600 }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600;
  background: #223151; color: #cfe0ff;
}
.badge.ok { background: rgba(34, 197, 94, .16); color: #6ee7a8 }
.badge.warn { background: rgba(245, 158, 11, .16); color: #fcd34d }
.badge.danger { background: rgba(239, 68, 68, .16); color: #fca5a5 }
.badge.info { background: rgba(34, 211, 238, .16); color: #67e8f9 }
.badge.idle { background: #1c2740; color: #8ea0c4 }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor }

.muted { color: var(--muted) }
.small { font-size: .8rem }
.mono { font-family: var(--mono) }
.right { text-align: right }
.nowrap { white-space: nowrap }
.empty { padding: 26px; text-align: center; color: var(--muted) }

/* ------------------------------------------------------------ QR / кабинет */
.qr-box {
  display: grid; gap: 12px; justify-items: center; text-align: center;
  padding: 18px; border-radius: 18px;
  background: linear-gradient(180deg, #fff, #e8eefc);
  color: #0b1220;
}
.qr-box img { width: 100%; max-width: 268px; image-rendering: pixelated; border-radius: 10px }
.qr-box .code { font-family: var(--mono); font-size: 1.35rem; letter-spacing: .18em; font-weight: 700 }
.qr-box .timer { font-family: var(--mono); font-size: 2.1rem; font-weight: 700; color: #1d4ed8 }
.qr-box .timer.low { color: #b91c1c }
.qr-box .hint { font-size: .8rem; color: #4b5a75 }
.qr-placeholder {
  width: 100%; max-width: 268px; aspect-ratio: 1; border-radius: 12px;
  border: 2px dashed #94a3b8; display: grid; place-items: center; color: #475569; padding: 16px;
}

.state-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(59, 130, 246, .16), rgba(20, 29, 49, .3));
}
.state-banner.present { border-color: rgba(34, 197, 94, .45); background: linear-gradient(90deg, rgba(34, 197, 94, .18), rgba(20, 29, 49, .3)) }
.state-banner.away { border-color: rgba(148, 163, 184, .3) }
.state-banner .big { font-size: 1.4rem; font-weight: 700 }

/* ----------------------------------------------------------------- сканер */
.scanner-stage { display: grid; gap: 14px; grid-template-columns: minmax(300px, 1fr) minmax(280px, 380px) }
.video-shell { position: relative; border-radius: 18px; overflow: hidden; background: #000; min-height: 320px }
.video-shell video, .video-shell canvas.debug { width: 100%; display: block; object-fit: cover }
.video-shell .overlay {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
}
.video-shell .frame {
  width: min(66%, 260px); aspect-ratio: 1; border: 3px solid rgba(255, 255, 255, .55);
  border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .28);
}
.scan-result {
  border-radius: var(--radius); padding: 18px; text-align: center;
  border: 1px solid var(--line); background: var(--panel);
}
.scan-result.in { border-color: rgba(34, 197, 94, .6); background: radial-gradient(circle at 50% 0%, rgba(34, 197, 94, .25), var(--panel) 70%) }
.scan-result.out { border-color: rgba(239, 68, 68, .55); background: radial-gradient(circle at 50% 0%, rgba(239, 68, 68, .22), var(--panel) 70%) }
.scan-result.err { border-color: rgba(245, 158, 11, .6); background: radial-gradient(circle at 50% 0%, rgba(245, 158, 11, .2), var(--panel) 70%) }
.scan-result .action { font-size: 1.9rem; font-weight: 800; letter-spacing: .04em }
.scan-result .name { font-size: 1.2rem; font-weight: 650; margin-top: 4px }
.scan-log { max-height: 46vh; overflow: auto }
.scan-log .row { display: flex; gap: 10px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line) }

.feed { max-height: 340px; overflow: auto }
.feed .row { display: flex; gap: 10px; align-items: center; padding: 7px 2px; border-bottom: 1px dashed var(--line); font-size: .87rem }

/* ------------------------------------------------------------------ модал */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(4, 8, 18, .72); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 16px;
}
.modal { width: min(680px, 100%); max-height: 90vh; overflow: auto }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px }

#toasts { position: fixed; right: 14px; bottom: 14px; display: grid; gap: 8px; z-index: 200 }
.toast {
  min-width: 240px; max-width: 380px; padding: 11px 14px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: slide .18s ease;
}
.toast.ok { border-color: rgba(34, 197, 94, .6) }
.toast.err { border-color: rgba(239, 68, 68, .6) }
.toast.warn { border-color: rgba(245, 158, 11, .6) }
@keyframes slide { from { transform: translateY(8px); opacity: 0 } }

/* ------------------------------------------------------------------ login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 18px }
.login-card { width: min(420px, 100%); display: grid; gap: 14px; padding: 26px }
.login-card .logo { display: grid; place-items: center; gap: 6px; margin-bottom: 6px }
.login-card .logo img { width: 60px; height: 60px; border-radius: 16px }
.login-hint { font-size: .78rem; line-height: 1.5; color: #7f90b4 }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px }
.tabs button { padding: 7px 13px; border-radius: 999px }
.tabs button.active { background: var(--accent); border-color: transparent; color: #fff }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--muted) }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px }

.ts-cell { text-align: right; font-variant-numeric: tabular-nums; font-size: .82rem }
.ts-cell.absent { background: rgba(239, 68, 68, .13); color: #fca5a5 }
.ts-cell.weekend { background: rgba(148, 163, 184, .08); color: #64748b }
.ts-cell.partial { background: rgba(245, 158, 11, .12); color: #fcd34d }
.ts-cell.working { background: rgba(34, 211, 238, .14); color: #67e8f9 }
.ts-cell.complete { background: rgba(34, 197, 94, .12); color: #86efac }
.ts-sticky { position: sticky; left: 0; background: #131c30; z-index: 1 }
.ts-cell.future { background: rgba(148, 163, 184, .05); color: #64748b }
.ts-cell.no_plan { background: rgba(148, 163, 184, .06); color: #64748b }

/* Табель: фильтры и легенда зафиксированы, прокручивается только таблица. */
.timesheet-view { display: flex; flex-direction: column; height: calc(100vh - 53px - 36px) }
.timesheet-view .timesheet-card {
  display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto;
}
.timesheet-view .card-head, .timesheet-view .legend { flex: 0 0 auto }
.ts-scroll { flex: 1 1 auto; min-height: 0; margin-top: 12px; overflow: auto; border-radius: 12px }
.ts-scroll .table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: visible }
.ts-scroll table { border-collapse: separate; border-spacing: 0 }
/* Липкие шапка и первый столбец, чтобы форма читалась при прокрутке. */
.ts-scroll thead th { position: sticky; top: 0; z-index: 3 }
.ts-scroll .ts-sticky { z-index: 2 }
.ts-scroll thead th.ts-sticky { z-index: 4 }

/* «Отделы и центры»: блок «Центры» показывается целиком, без внутренней прокрутки. */
.no-scroll .table-wrap { overflow: visible }
.no-scroll table { white-space: normal }

/* Ячейка Т-12: код сверху, часы под ним (как в печатном бланке). */
.ts-cell.ts-t12 { padding: 0; text-align: center; min-width: 34px }
.ts-t12 .ts-code, .ts-t12 .ts-hours { display: block; line-height: 1.35 }
.ts-t12 .ts-code { font-weight: 600; font-size: .8rem }
.ts-t12 .ts-hours { font-size: .72rem; color: #cbd5e1 }
.ts-t12.weekend .ts-code { color: #94a3b8 }

/* ------------------------------------------------- карточка сотрудника */
.modal.modal-wide { width: min(1000px, 100%) }
.detail-head {
  display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-soft); padding: 10px 14px;
}
.detail-now { display: flex; gap: 8px; align-items: center }
.detail-block { display: grid; gap: 8px }
.detail-block h3 { margin: 0; font-size: .92rem; color: #cfe0ff }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px }
.fact { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); padding: 9px 12px }
.fact-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted) }
.fact-value { font-size: 1.12rem; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0 }
.fact-note { font-size: .76rem; color: var(--muted); line-height: 1.35 }
.day-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 5px }
.day-cell {
  border-radius: 9px; border: 1px solid var(--line); background: #131c30; padding: 4px 6px;
  display: grid; gap: 1px; justify-items: center; font-variant-numeric: tabular-nums; cursor: help;
}
.day-cell .day-num { font-size: .7rem; color: var(--muted) }
.day-cell .day-val { font-size: .82rem; font-weight: 700 }
.day-cell.absent { background: rgba(239, 68, 68, .13); border-color: rgba(239, 68, 68, .3) }
.day-cell.partial { background: rgba(245, 158, 11, .12); border-color: rgba(245, 158, 11, .3) }
.day-cell.working { background: rgba(34, 211, 238, .14); border-color: rgba(34, 211, 238, .32) }
.day-cell.complete { background: rgba(34, 197, 94, .12); border-color: rgba(34, 197, 94, .3) }
.day-cell.weekend, .day-cell.no_plan { background: rgba(148, 163, 184, .08) }
.day-cell.future { opacity: .55 }

/* --------------------------------------------------------------- responsive */
@media (max-width: 980px) {
  .scanner-stage, .grid.qr { grid-template-columns: 1fr }
  .layout { flex-direction: column }
  .sidebar { width: auto; flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line) }
  .sidebar .group { display: none }
  .sidebar button { margin: 0; white-space: nowrap; width: auto }
}

/* ==================================================== упрощённый кабинет */
/* Экран подгоняется под любой устройство: шапка, статус, матрица и кнопка
   всегда помещаются целиком, масштабирование жестом не требуется. */
body.cabinet {
  overflow: hidden;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.cabinet-wrap {
  --gap: clamp(6px, 1.5vh, 14px);
  --chrome: 355px;                    /* высота всего, кроме самой матрицы */
  --qr: min(320px, 88vw, calc(100vh - var(--chrome)));
  --qr: min(320px, 88vw, calc(100dvh - var(--chrome)));
  height: 100vh;
  height: 100dvh;
  max-width: 460px;
  margin: 0 auto;
  padding: clamp(8px, 1.8vh, 16px) clamp(10px, 4vw, 20px)
           calc(clamp(8px, 1.8vh, 16px) + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "user"
    "status"
    "qr"
    "action";
  gap: var(--gap);
  overflow: hidden;
}

.cabinet-user {
  grid-area: user;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: clamp(.8rem, 2.2vh, .92rem);
  color: var(--muted);
}

.status-panel {
  grid-area: status;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  padding: clamp(8px, 1.6vh, 16px) clamp(10px, 3vw, 18px);
  text-align: center;
}
.status-panel.present {
  border-color: rgba(34, 197, 94, .5);
  background: linear-gradient(180deg, rgba(34, 197, 94, .16), var(--bg-soft));
}
.status-panel.away { border-color: rgba(148, 163, 184, .28) }

.status-title { font-size: clamp(1rem, 3.2vh, 1.2rem); font-weight: 700; letter-spacing: .01em }
.status-panel.present .status-title { color: #6ee7a8 }
.status-panel.away .status-title { color: #b6c4e2 }

.status-clock {
  font-family: var(--mono);
  font-size: clamp(1.7rem, 8.5vh, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 2px 0 4px;
  font-variant-numeric: tabular-nums;
}

.status-line { font-size: clamp(.72rem, 2vh, .84rem); color: var(--muted); line-height: 1.4 }

/* Подпись под крупными часами: что именно они показывают. */
.status-caption {
  font-size: clamp(.66rem, 1.9vh, .78rem);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: -2px 0 6px;
}

/* Выход из аккаунта в шапке кабинета. */
.cabinet-exit {
  border: 1px solid var(--line);
  background: #1c2740;
  color: #cfe0ff;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: clamp(.76rem, 2vh, .84rem);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}
.cabinet-exit:hover { background: #26324f; color: #fff }

.qr-panel {
  grid-area: qr;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(4px, 1vh, 10px);
  overflow: hidden;
}
.qr-panel .qr-box {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: center;
  justify-items: center;
  gap: clamp(4px, 1vh, 10px);
  padding: clamp(8px, 1.4vh, 14px);
  cursor: pointer;
  touch-action: manipulation;
}
.qr-panel .qr-box img,
.qr-panel .qr-placeholder {
  width: var(--qr);
  height: var(--qr);
  max-width: 100%;
  max-height: 100%;
}
.qr-panel .qr-box img { object-fit: contain }
.qr-panel .qr-placeholder {
  border-radius: 12px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: clamp(.8rem, 2.2vh, .95rem);
  line-height: 1.35;
}
.qr-panel .timer { font-size: clamp(1.25rem, 5.5vh, 2.2rem) }

/* Подсказка: матрица и пустое место под неё — активные (тап = выдать/обновить код). */
.qr-hint {
  font-size: clamp(.68rem, 1.9vh, .78rem);
  color: var(--muted);
  text-align: center;
}
.qr-box:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px }
.qr-box.refresh { animation: qr-refresh .3s ease }
@keyframes qr-refresh {
  from { transform: scale(.985); filter: brightness(1.4) }
  to { transform: none; filter: none }
}

.code {
  font-family: var(--mono);
  font-size: clamp(.85rem, 2.4vh, 1.05rem);
  letter-spacing: .16em;
  color: var(--accent-2);
  background: #0d1526;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 5px 12px;
}

.btn-block {
  grid-area: action;
  width: 100%;
  padding: clamp(9px, 1.9vh, 14px) 16px;
  font-size: clamp(.9rem, 2.6vh, 1rem);
  touch-action: manipulation;
}

/* Телефон в ландшафте: статус слева, пропуск справа — всё влезает без зума. */
@media (orientation: landscape) and (max-height: 640px) {
  .cabinet-wrap {
    --chrome: 80px;
    --qr: min(240px, 62vh, 34vw);
    max-width: 920px;
    grid-template-columns: minmax(240px, 1fr) minmax(200px, 42vw);
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "user user"
      "status qr"
      "action qr";
    align-items: center;
  }
  .btn-block { max-width: 460px; justify-self: center }
}

/* Низкие экраны в портрете: уплотняем запасы, матрица уменьшается первой. */
@media (orientation: portrait) and (max-height: 700px) {
  .cabinet-wrap { --chrome: 330px }
}
@media (orientation: portrait) and (max-height: 560px) {
  .cabinet-wrap { --chrome: 300px; --gap: 6px }
  .status-line { display: none }
}

