/* =====================================================================
   РРМ.Ключи — дизайн Nordic Calm (brandbook/out/preview.pdf).
   Тёплый off-white, slate как основной, sage как бренд-акцент,
   terra только для проблем (не сдан вовремя, ошибки).
   Шрифты лежат у нас — CSP не пускает внешние.
   ===================================================================== */

/* --- Inter (текст), variable 100–900 --- */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-cyrillic.de93fdc85e3d.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin.260c81a4759b.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* --- Inter Tight (заголовки, цифры, логотип) --- */
@font-face {
  font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-tight-cyrillic.d5a5f7694fd9.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter Tight"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-tight-latin.f5af7a761c2b.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* --- JetBrains Mono (штрих-коды, время, подписи-лейблы) --- */
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("../fonts/jetbrains-mono-cyrillic.615bf869ebeb.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.b058178d7f30.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #F7F7F4;
  --surface: #FFFFFF;
  --surface-2: #FBFBF9;
  --ink: #1A1F1D;
  --slate: #2F4F4F;
  --slate-2: #264040;
  --sage: #7B9E89;
  --sage-ink: #4F7560;
  --sage-dim: #C2D3C9;
  --sage-bg: #EEF3EF;
  --terra: #D17A47;
  --terra-ink: #A9552A;
  --terra-line: #EBC3AA;
  --terra-bg: #FBEDE4;
  --amber: #B8862E;
  --amber-ink: #8A6420;
  --amber-line: #E6D2A6;
  --amber-bg: #F7EFDC;
  --line: #E6E4DC;
  --line-soft: #EFEDE5;
  --muted: #6B7370;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(26,31,29,.04), 0 1px 1px rgba(26,31,29,.03);
  --shadow-md: 0 8px 24px rgba(26,31,29,.06), 0 2px 6px rgba(26,31,29,.04);
  --font-disp: "Inter Tight", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font-body); font-size: 14px; line-height: 1.5;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: var(--font-disp); letter-spacing: -.015em; }
h1 { font-weight: 600; font-size: 26px; line-height: 1.2; margin: 0 0 12px; }
h2 { font-weight: 600; font-size: 16px; margin: 0 0 12px; }
a { color: var(--slate); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--font-mono); font-size: .92em; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 22px; }

.container { max-width: 1240px; margin: 0 auto; padding: 32px 28px 64px; }

/* Демо-стенд: плашка над всеми страницами, чтобы не спутать с боевым сайтом. */
.env-banner {
  background: var(--amber-ink);
  color: #fff;
  font: 600 12px/1.4 var(--font-body);
  letter-spacing: .04em;
  text-align: center;
  padding: 6px 16px;
}

/* --- Шапка --- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  height: 60px; padding: 0 28px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { color: var(--ink); display: inline-flex; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { color: var(--ink); background: var(--bg); text-decoration: none; }
.nav a.active { color: var(--ink); background: var(--sage-bg); }
.who { display: flex; align-items: center; gap: 14px; }
.who form { margin: 0; }
.who-block { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.who-name { font-weight: 600; color: var(--ink); }
.who-meta { color: var(--muted); font-size: 11.5px; }
.org-switch {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); padding-right: 14px; border-right: 1px solid var(--line);
}
.org-switch:hover { color: var(--slate); text-decoration: none; }

/* --- Логотип: знак «ключ-штрихкод» + «РРМ.Ключи» --- */
.logo { display: inline-flex; align-items: center; gap: 9px; color: inherit; white-space: nowrap; }
.logo-mark { width: 24px; height: 24px; flex: none; color: var(--slate); }
.logo-wm { font-family: var(--font-disp); font-weight: 700; font-size: 16px; letter-spacing: -.02em; line-height: 1; color: var(--ink); }
.logo-accent { color: var(--sage); }
.logo-lg .logo-mark { width: 32px; height: 32px; }
.logo-lg .logo-wm { font-size: 21px; }
.logo-shine { animation: logo-shine 9s cubic-bezier(.4, 0, .2, 1) infinite; }
.logo-lg .logo-shine { animation-delay: .8s; }
@keyframes logo-shine {
  0% { transform: translateX(-70px); }
  12% { transform: translateX(110px); }
  100% { transform: translateX(110px); }
}
@media (prefers-reduced-motion: reduce) { .logo-shine { animation: none; } }

/* --- Кнопки --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: var(--radius); border: 1px solid transparent;
  font: 500 14px/1 var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--slate); color: #fff; }
.btn-primary:hover { background: var(--slate-2); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--sage-dim); background: var(--surface-2); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-block { width: 100%; height: 44px; font-weight: 600; margin-top: 18px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary:disabled:hover { background: var(--slate); }
.btn-ghost:disabled:hover { border-color: var(--line); background: var(--surface); }

/* --- Сообщения --- */
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.msg {
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 8px; font-size: 13.5px;
  background: var(--sage-bg); border: 1px solid var(--sage-dim);
}
.msg-error { background: var(--terra-bg); border-color: var(--terra-line); color: var(--terra-ink); }
.msg-warning { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }
.form-error {
  background: var(--terra-bg); color: var(--terra-ink); border-radius: var(--radius);
  padding: 10px 14px; margin: 10px 0 14px; font-size: 13px;
}

/* --- Вход --- */
body.auth .container { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }
.auth-shell {
  width: min(920px, 100%); min-height: 520px; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-md); overflow: hidden;
}
.auth-brand { background: var(--bg); border-right: 1px solid var(--line); padding: 40px; display: flex; flex-direction: column; }
.auth-logo { margin: 0; font-size: inherit; }
.auth-tagline {
  font-family: var(--font-disp); font-weight: 500; font-size: 28px; line-height: 1.18;
  letter-spacing: -.02em; margin: auto 0 14px;
}
.auth-tagline em { font-style: normal; color: var(--sage); }
.auth-sub { color: var(--muted); font-size: 13px; max-width: 300px; margin: 0; }
.auth-form { padding: 40px 48px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h2 { font-size: 22px; margin: 0 0 4px; }
.auth-hint { color: var(--muted); font-size: 12.5px; margin: 0 0 22px; }
.auth-note { margin: 18px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.auth-form label, .auth-card label { display: block; margin: 14px 0 6px; font-size: 12.5px; font-weight: 500; }
.auth-form input[type=text], .auth-form input[type=password] { width: 100%; }
.auth-card {
  width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-md); padding: 36px;
}
.auth-card h1 { font-size: 20px; }

/* --- Поля ввода --- */
input[type=text], input[type=search], input[type=password], input[type=time], input[type=number],
input[type=date], input[type=file], select, textarea {
  font: 400 14px var(--font-body); color: var(--ink); min-width: 0;
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2);
}
input[type=file] { height: auto; padding: 7px 10px; }
textarea { height: auto; padding: 8px 12px; }
input::placeholder { color: #9AA19E; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--sage); background: #fff;
  box-shadow: 0 0 0 3px rgba(123,158,137,.18);
}
input[type=checkbox] { accent-color: var(--slate); width: 16px; height: 16px; }

/* --- Общие элементы страниц --- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.count { font-family: var(--font-mono); font-size: 14px; font-weight: 400; margin-left: 4px; }
.crumbs { margin: 0 0 10px; font-size: 13px; }
.crumbs a { color: var(--muted); }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 22px 24px; margin-top: 20px; box-shadow: var(--shadow-sm);
}
.grid-2 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.grid-2 > * { min-width: 0; }
.grid-2 > .panel { margin-top: 0; }

/* --- Таблицы --- */
.table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.table th {
  text-align: left; font-family: var(--font-mono); font-weight: 500; font-size: 10.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.table th, .table td { padding: 12px 16px; vertical-align: top; }
.table td { border-bottom: 1px solid var(--line-soft); }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table td a { color: var(--slate); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { margin-left: 4px; }
.table .actions form { display: inline; margin: 0; }
.table .empty { text-align: center; color: var(--muted); padding: 28px; }
.row-muted td, .row-muted td a { color: #A4AAA7; }
.row-current td { background: var(--sage-bg); }
.row-error td { background: var(--terra-bg); }
.row-warn td { background: var(--amber-bg); }
.table .warn { color: var(--amber-ink); font-size: 12.5px; }
.table .error { color: var(--terra-ink); font-size: 12.5px; }
.table-compact { box-shadow: none; border-radius: var(--radius); margin: 10px 0 14px; }
.table-compact th, .table-compact td { padding: 8px 10px; font-size: 13px; }

/* --- Бейджи статусов: сдержанно, без «светофора» --- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px; vertical-align: middle;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  line-height: 1.7; white-space: nowrap; background: var(--line-soft); color: var(--muted);
}
.badge-ok { background: var(--sage-bg); color: var(--sage-ink); }
.badge-accent { background: #E4ECEC; color: var(--slate); }
.badge-warn { background: var(--amber-bg); color: var(--amber-ink); }
.badge-danger { background: var(--terra-bg); color: var(--terra-ink); }
.table .badge-danger { margin: 1px 0; }

/* --- Фильтры --- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search], .filters select { min-width: 180px; }
.filters input[type=date] { min-width: 0; }
label.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.print-bar {
  justify-content: space-between; background: var(--surface); border: 1px dashed var(--sage-dim);
  border-radius: var(--radius); padding: 10px 14px; font-size: 13px;
}
.input-narrow { width: 80px; min-width: 0 !important; }

/* --- Формы --- */
.form { max-width: 600px; }
.grid-2 .form { max-width: none; }
.form .field { margin-bottom: 16px; }
.form .field > label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.form .field input:not([type=checkbox]), .form .field select, .form .field textarea { width: 100%; }
.form .field-check label { font-size: 14px; font-weight: 400; display: flex; gap: 8px; align-items: center; }
.form .help, .help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.form .error { color: var(--terra-ink); font-size: 12.5px; margin-top: 4px; }
.form .has-error input, .form .has-error select { border-color: var(--terra-line); }
.req { color: var(--terra); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 20px; }
.form-actions form { margin: 0; }
.form .field ul {
  list-style: none; padding: 4px 0; margin: 0; max-height: 280px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.form .field ul li { padding: 6px 12px; }
.form .field ul label { display: flex; gap: 8px; align-items: center; font-size: 13.5px; margin: 0; }
.form .field ul input[type=checkbox] { width: 16px; accent-color: var(--terra); }
/* Django 5 рисует CheckboxSelectMultiple блоками div (группы ключей, временный пропуск) */
.form .field > div:has(input[type=checkbox]) {
  padding: 4px 0; max-height: 280px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.form .field > div:has(input[type=checkbox]) > div { padding: 6px 12px; }
.form .field > div:has(input[type=checkbox]) label { display: flex; gap: 8px; align-items: center; font-size: 13.5px; margin: 0; }

/* --- Алерты --- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin: 12px 0; border: 1px solid; font-size: 13.5px; }
.alert-ok { background: var(--sage-bg); border-color: var(--sage-dim); }
.alert-warn { background: var(--amber-bg); border-color: var(--amber-line); }
.alert-danger { background: var(--terra-bg); border-color: var(--terra-line); }
.help-list { padding-left: 18px; color: var(--muted); font-size: 13px; }
.help-list li { margin-bottom: 4px; }

.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 16px 0; font-size: 13px; }
.pagination a, .pagination span {
  padding: 5px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.pagination span { color: var(--muted); }
.pagination a:hover { border-color: var(--sage-dim); text-decoration: none; }

/* --- Карточки сущностей --- */
.props { display: grid; grid-template-columns: 170px 1fr; gap: 12px 16px; margin: 0; }
.props dt { color: var(--muted); font-size: 13px; }
.props dd { margin: 0; }
.barcode-panel { text-align: center; }
.barcode-panel h2, .barcode-panel .help { text-align: left; }
.barcode-panel .form-actions { justify-content: center; }
.barcode {
  display: block; max-width: 100%; height: auto; margin: 12px auto 16px; padding: 18px;
  background: #fff; border: 1px dashed var(--sage-dim); border-radius: var(--radius);
}
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.plain-list li:last-child { border-bottom: 0; }

/* --- Главная --- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 24px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; min-height: 110px; padding: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
.tile:hover { text-decoration: none; border-color: var(--sage-dim); box-shadow: var(--shadow-md); }
.tile strong { font-family: var(--font-disp); font-size: 17px; font-weight: 600; }
.tile span { color: var(--muted); font-size: 13px; }
.tile-ws { background: var(--slate); border-color: var(--slate); color: #fff; }
.tile-ws:hover { border-color: var(--slate-2); background: var(--slate-2); }
.tile-ws span { color: var(--sage-dim); }
.tile-soon { opacity: .6; }

/* --- Временные пропуска --- */
.temp-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--sage-bg); border: 1px solid var(--sage-dim); border-radius: var(--radius-lg);
  padding: 18px 22px; margin-bottom: 20px;
}
.temp-banner strong { font-family: var(--font-disp); font-size: 17px; }
.temp-until { font-family: var(--font-disp); font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.temp-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }

/* --- Отчёты --- */
.tabs { display: flex; gap: 22px; box-shadow: inset 0 -1px 0 var(--line); margin: 4px 0 22px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { padding: 10px 0; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--slate); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 26px; }
.kpi {
  display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.kpi span { font-family: var(--font-disp); font-size: 32px; font-weight: 600; letter-spacing: -.02em; line-height: 1; }
.kpi small { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kpi-danger { background: #FFFBF8; border-color: var(--terra-line); }
.kpi-danger span { color: var(--terra); }
.bar-col { width: 32%; }
.bar { display: flex; align-items: center; gap: 10px; }
.bar-track { flex: 1; height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.bar-fill { height: 100%; background: var(--sage); border-radius: 4px; }
.bar span { font-family: var(--font-mono); font-size: 12.5px; min-width: 28px; text-align: right; }
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

/* --- Дорожная карта / история выдач --- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 18px 16px; font-size: 13.5px; }
.timeline li:last-child { padding-bottom: 2px; }
.timeline li::before {
  content: ""; position: absolute; left: -25px; top: 5px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--sage-dim); border: 2px solid var(--surface);
}
.timeline li.t-on_hands::before { background: var(--slate); }
.timeline li.t-overdue::before { background: var(--terra); }
.timeline li.t-late::before { background: var(--amber); }
.timeline li.t-cancelled::before { background: #D5D3CC; }
.timeline li.muted::before { display: none; }
.timeline li > div { margin-bottom: 3px; }
.timeline .t-time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-right: 8px; }

/* --- Рабочее место ключника --- */
body.ws .container { max-width: 1400px; }
.ws-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.ws-main { display: flex; flex-direction: column; gap: 14px; }
.ws-counters { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ws-counter {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 20px; display: flex; align-items: baseline; gap: 12px; box-shadow: var(--shadow-sm);
}
.ws-counter span { font-family: var(--font-disp); font-size: 36px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.ws-counter small { color: var(--muted); font-size: 14px; }
.ws-counter-danger.is-alert { background: #FFFBF8; border-color: var(--terra-line); }
.ws-counter-danger.is-alert span { color: var(--terra); }

.ws-mode {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px 30px; box-shadow: var(--shadow-sm);
}
.ws-mode-title {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.ws-mode-title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sage-dim); }
.ws-mode-lead { font-family: var(--font-disp); font-size: 30px; font-weight: 500; letter-spacing: -.02em; line-height: 1.2; }
.ws-mode-hint { color: var(--muted); font-size: 15px; margin-top: 8px; }
.ws-ways { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.ws-way { border: 1px dashed var(--sage-dim); border-radius: var(--radius); padding: 16px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.ws-way strong { display: block; font-family: var(--font-disp); font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.ws-mode-issue { border-color: var(--sage-dim); }
.ws-mode-issue .ws-mode-title { color: var(--slate); }
.ws-mode-issue .ws-mode-title::before { background: var(--sage); box-shadow: 0 0 0 4px var(--sage-bg); }
.ws-employee { font-family: var(--font-disp); font-size: 32px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.ws-employee-meta { color: var(--muted); font-size: 16px; margin: 4px 0 0; }
.ws-timer { height: 6px; background: var(--line-soft); border-radius: 3px; margin-top: 18px; overflow: hidden; }
.ws-timer-bar { height: 100%; width: 100%; background: var(--sage); transition: width .2s linear; }
.ws-held-title {
  margin-top: 20px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.ws-held { list-style: none; padding: 0; margin: 6px 0 0; font-size: 16px; }
.ws-held li { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.ws-held li:last-child { border-bottom: 0; }
.ws-held-time { font-family: var(--font-mono); font-size: 13px; color: var(--muted); margin-right: 6px; }

.ws-result { border-radius: var(--radius-lg); padding: 16px 22px; font-size: 20px; font-weight: 500; border: 1px solid; }
.ws-result-ok { background: var(--sage-bg); border-color: var(--sage-dim); color: #3E6450; }
.ws-result-info { background: var(--surface); border-color: var(--line); color: var(--ink); }
.ws-result-warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }
.ws-result-error { background: var(--terra-bg); border-color: var(--terra-line); color: var(--terra-ink); }

.ws-scan input {
  width: 100%; height: 60px; padding: 0 20px; font-family: var(--font-mono); font-size: 22px; letter-spacing: .06em;
  background: #fff; border: 1px solid var(--sage-dim); border-radius: var(--radius-lg);
}
.ws-scan input:focus { border-color: var(--sage); box-shadow: 0 0 0 4px rgba(123,158,137,.2); }
.ws-foot { margin: 0; }

.ws-feed {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px 22px; box-shadow: var(--shadow-sm); max-height: calc(100vh - 120px); overflow-y: auto;
}
.ws-feed h2 { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ws-feed ul { list-style: none; padding: 0; margin: 0; }
.ws-feed li { padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.ws-feed li:last-child { border-bottom: 0; }
.ws-feed-time { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.ws-feed li strong {
  display: inline-block; margin: 0 6px; padding: 1px 7px; border-radius: 6px; vertical-align: 1px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
  background: var(--line-soft); color: var(--muted);
}
.ws-feed-issued strong { background: #E4ECEC; color: var(--slate); }
.ws-feed-returned strong { background: var(--sage-bg); color: var(--sage-ink); }
.ws-feed-who { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* --- Адаптив --- */
@media (max-width: 1000px) {
  .ws-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .grid-2, .auth-shell { grid-template-columns: 1fr; }
  .auth-brand { border-right: 0; border-bottom: 1px solid var(--line); padding: 28px; }
  .auth-tagline { font-size: 22px; margin-top: 24px; }
  .auth-form { padding: 28px; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; gap: 8px 16px; padding: 10px 16px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .who-meta, .org-switch { display: none; }
  .container { padding: 24px 16px 48px; }
  .table { display: block; overflow-x: auto; }
  .props { grid-template-columns: 1fr; gap: 2px 0; }
  .props dd { margin-bottom: 10px; }
  .ws-counters, .ws-ways { grid-template-columns: 1fr; }
}

/* --- Выбор площадки (карточки + «Подтвердить») --- */
.choose { max-width: 760px; margin: 48px auto; text-align: center; }
.choose h1 { margin-bottom: 8px; }
.choose .muted { margin-bottom: 24px; }
.site-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 28px; text-align: left; }
.site-card {
  position: relative; display: flex; flex-direction: column; gap: 6px; min-height: 104px; padding: 22px 22px 22px 52px;
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s;
}
.site-card:hover { border-color: var(--sage-dim); box-shadow: var(--shadow-md); }
.site-card input { position: absolute; left: 20px; top: 25px; width: 18px; height: 18px; margin: 0; accent-color: var(--slate); }
.site-card:has(input:checked) { border-color: var(--slate); background: var(--sage-bg); }
.site-card:has(input:focus-visible) { outline: 2px solid var(--sage); outline-offset: 2px; }
.site-card-name { font-family: var(--font-disp); font-size: 18px; font-weight: 600; color: var(--ink); }
.site-card-meta { font-size: 13px; color: var(--muted); }
.btn-lg { height: 48px; padding: 0 36px; font-size: 16px; font-weight: 600; }
.ws-site { margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.ws-site strong { color: var(--ink); }
