/* =============================================================================
 * variant-2-clean-saas / theme.css  —  "Чистый продукт"
 * -----------------------------------------------------------------------------
 * Light, product-register UI at the Linear / Stripe / Notion bar. The tool
 * disappears into the task. Indigo is RESTRAINED: it marks the primary action,
 * the current selection, and live state — never decoration.
 *
 * Deliberate anti-AI-slop choices (see report):
 *   - TRUE off-white body (oklch 98.4% 0 0), zero warm tint, no gradient blobs.
 *   - No side-stripe card borders. No gradient text. No 5-up hero-metric row.
 *   - No tiny-uppercase eyebrow on every section; sentence-case headers.
 *   - FIXED rem type scale (ratio ~1.2), hierarchy by weight + size.
 *   - Body text never muted-gray on a tint; placeholders >= 4.5:1.
 *   - Full state vocabulary on every control; skeletons; teaching empties.
 *   - Motion 150-250ms ease-out, with a prefers-reduced-motion path.
 * ========================================================================== */

/* ---------------------------------------------------------------------------
 * 1. Tokens — drive BOTH this theme and the shared ph-core widgets.
 *    OKLCH for the brand ramp; verified-contrast neutrals.
 * ------------------------------------------------------------------------- */
:root {
  /* --- shared ph-core tokens (bell / modal / dropzone / toast / camera) --- */
  --ph-accent: oklch(0.51 0.20 277);     /* indigo, actions + selection only */
  --ph-bg: oklch(0.984 0 0);             /* true off-white, chroma 0          */
  --ph-surface: #ffffff;
  --ph-text: oklch(0.23 0.02 270);       /* near-black ink, >=12:1 on white   */
  --ph-border: oklch(0.92 0.004 270);
  --ph-radius: 12px;
  --ph-muted: oklch(0.46 0.02 270);      /* secondary text, 4.9:1 on white    */
  --ph-danger: oklch(0.55 0.20 27);
  --ph-warn: oklch(0.56 0.13 70);
  --ph-ok: oklch(0.55 0.14 150);
  /* CSS-2: severity=info is ONE hue (blue 250) everywhere. Previously this was
   * indigo (277), so the bell's info dot diverged from the feed / status bar /
   * journal blue. Bind it to --info so the bell matches. Do NOT move --info to
   * 277, or "печатает" (printing) would collide with accent/selection. */
  --ph-info: var(--info);
  --ph-shadow: 0 12px 32px -16px oklch(0.23 0.05 270 / 0.30);
  --ph-overlay: oklch(0.23 0.03 270 / 0.42);

  /* --- accent ramp (OKLCH; one hue, restrained use) --- */
  --accent: oklch(0.51 0.20 277);
  --accent-hover: oklch(0.47 0.20 277);
  --accent-active: oklch(0.43 0.19 277);
  --accent-700: oklch(0.45 0.19 277);
  --accent-text: oklch(0.40 0.18 277);   /* indigo text on white, 7:1         */
  --accent-soft: oklch(0.965 0.018 277); /* selection wash, very light        */
  --accent-soft-2: oklch(0.93 0.035 277);
  --accent-line: oklch(0.86 0.06 277);
  --accent-ring: oklch(0.51 0.20 277 / 0.32);
  /* C-11: indigo accent legible on the dark login panel (mirrors --accent-line);
   * replaces the hardcoded #c7d2fe so brand "Hub" stays on a token. */
  --accent-on-dark: oklch(0.86 0.06 277);

  /* --- ink + neutral text (all verified on white) --- */
  --ink: oklch(0.23 0.02 270);           /* primary text                       */
  --ink-2: oklch(0.34 0.02 270);         /* strong secondary, 8:1              */
  --muted: oklch(0.46 0.02 270);         /* secondary text, 4.9:1              */
  --muted-strong: oklch(0.42 0.02 270);  /* small print that must stay legible */
  --faint: oklch(0.58 0.015 270);        /* >=3:1 — decoration / icons ONLY    */

  /* --- surfaces + lines --- */
  --bg: oklch(0.984 0 0);
  --surface: #ffffff;
  --surface-2: oklch(0.975 0.002 270);   /* recessed panel                     */
  --surface-3: oklch(0.962 0.003 270);
  --line: oklch(0.92 0.004 270);
  --line-soft: oklch(0.95 0.003 270);
  --line-strong: oklch(0.87 0.006 270);

  /* --- status (text-on-soft pairs are all >= 4.5:1) --- */
  --ok: oklch(0.55 0.14 150);     --ok-text: oklch(0.43 0.13 150);  --ok-soft: oklch(0.96 0.03 150);  --ok-line: oklch(0.86 0.07 150);
  --warn: oklch(0.62 0.14 70);    --warn-text: oklch(0.47 0.11 65); --warn-soft: oklch(0.965 0.03 80); --warn-line: oklch(0.86 0.08 75);
  --danger: oklch(0.55 0.20 27);  --danger-text: oklch(0.47 0.19 27); --danger-soft: oklch(0.965 0.02 27); --danger-line: oklch(0.87 0.08 27);
  --info: oklch(0.52 0.16 250);   --info-text: oklch(0.43 0.16 255);  --info-soft: oklch(0.965 0.025 250); --info-line: oklch(0.85 0.07 250);

  /* --- radii --- */
  --r-xs: 7px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* --- elevation: tight, neutral, low-contrast (no colored glow as default) --- */
  --shadow-xs: 0 1px 1.5px oklch(0.23 0.03 270 / 0.05);
  --shadow-sm: 0 1px 2px oklch(0.23 0.03 270 / 0.06), 0 1px 1px oklch(0.23 0.03 270 / 0.04);
  --shadow-md: 0 6px 16px -8px oklch(0.23 0.04 270 / 0.16), 0 2px 5px -3px oklch(0.23 0.04 270 / 0.10);
  --shadow-lg: 0 20px 44px -22px oklch(0.23 0.05 270 / 0.28), 0 6px 14px -10px oklch(0.23 0.04 270 / 0.14);

  /* --- type --- */
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  /* FIXED rem scale, ratio ~1.2 (no fluid clamp in product UI) */
  --t-root: 16px;
  --fs-50: 0.6875rem;   /* 11px  micro labels        */
  --fs-75: 0.75rem;     /* 12px  meta / sub          */
  --fs-100: 0.8125rem;  /* 13px  controls / table    */
  --fs-200: 0.875rem;   /* 14px  body                */
  --fs-300: 1rem;       /* 16px  emphasis            */
  --fs-400: 1.1875rem;  /* 19px  card / section head */
  --fs-500: 1.4375rem;  /* 23px  page title          */
  --fs-600: 1.75rem;    /* 28px  display / login     */
  --fs-700: 2.0625rem;  /* 33px  login hero          */

  /* --- weight scale (hierarchy by weight, one family; against rhythm drift) ---
   * CSS-17 / C-2: with the Inter variable axis loaded (index.html wght@400..800),
   * these weights no longer round to {400,500,600,700,800}. Same-role elements now
   * share one TOKEN instead of matching by coincidence. The four contract names
   * (medium/semi/bold/display) stay valid; the two extra steps below are each used,
   * so no weight token is dead. */
  --fw-medium: 540;     /* nav / chips / quiet controls */
  --fw-emph: 580;       /* buttons (label emphasis) */
  --fw-semi: 620;       /* contract step: semibold UI emphasis */
  --fw-strong: 650;     /* section heads / card titles / names / brand */
  --fw-num: 680;        /* instrument values (summary/tele/fact) */
  --fw-bold: 700;       /* page titles / strong numerals */
  --fw-display: 720;    /* donut % / login hero / display */
  --fw-display-2: 750;  /* brand emphasis "Hub" */

  /* --- motion: 150-250ms, ease-out --- */
  --t-fast: 130ms;
  --t-base: 180ms;
  --t-slow: 240ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);   /* quint-ish */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* z-index scale (semantic; never 999/9999) */
  --z-sticky: 100;
  --z-dropdown: 200;
  --z-sheet: 300;
  --z-modal: 400;

  --nav-h: 60px;
  --content-max: 1200px;

  color-scheme: light;
}

/* ---------------------------------------------------------------------------
 * 2. Base
 * ------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html { font-size: var(--t-root); -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-200);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);            /* flat true off-white — no tint, no blob */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv05", "ss01", "calt";
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; color: inherit; }

/* Иконки — flex-глифы с заданными атрибутами размера (PH.icons: width/height 20x20
 * по умолчанию, компонентные правила задают точный размер). Inline-SVG по умолчанию
 * стоит на baseline, из-за чего в "align-items:center"-контейнерах иконка всплывала
 * над текстом, а подпись казалась ниже. display:block убирает baseline-зазор и
 * центрирует иконку с подписью ВЕЗДЕ (табы/кнопки/чипы/нав/карточки/…).
 * Безопасно: донат и прогресс-бары — CSS, не SVG; SVG-графиков в макете нет. */
svg { display: block; }

::selection { background: var(--accent-soft-2); color: var(--accent-700); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 5px;
}

/* thin neutral scrollbars */
* { scrollbar-width: thin; scrollbar-color: oklch(0.85 0.005 270) transparent; }
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: oklch(0.88 0.005 270); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: oklch(0.80 0.006 270); background-clip: padding-box; }

.app-root { min-height: 100%; }

/* utilities */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tnum { font-variant-numeric: tabular-nums; }

/* tabular figures on every number that count-ups each tick (theme.css owns this;
 * app.js is NOT touched). Without it the glyph width of "1" vs "8" differs and the
 * value jitters horizontally on each update — the classic cheap-UI tell. */
.summary__v,
.statuslegend__n,
.tele__v,
.fact__v,
.pcard__meta,
.errcard__code,
.tbl__sub { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===========================================================================
 * 3. APP SHELL — quiet top bar (solid, NOT glass)
 * ========================================================================= */
.shell { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--nav-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.brand__mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  color: #fff; background: var(--accent);
  /* same recessed-chip material as the AMS swatches: a thin white inset bezel +
   * 1px line ring, so the mark reads as a seated tile, not a flat fill. */
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.brand__mark svg { width: 17px; height: 17px; }
.brand__name { font-weight: var(--fw-strong); font-size: var(--fs-200); letter-spacing: -0.015em; line-height: 1.1; }
.brand__name b { color: var(--accent-text); font-weight: var(--fw-display-2); }
.brand__sub { display: block; font-size: var(--fs-50); font-weight: 500; color: var(--muted); margin-top: 1px; letter-spacing: 0; text-transform: none; }

/* primary horizontal nav */
.nav { display: flex; align-items: center; gap: 2px; margin-left: 4px; }
.nav__link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-weight: 500;
  font-size: var(--fs-100);
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.nav__link svg { width: 16px; height: 16px; color: var(--faint); transition: color var(--t-fast) var(--ease); }
.nav__link:hover { background: var(--surface-2); color: var(--ink); }
.nav__link:hover svg { color: var(--muted); }
.nav__link.is-active { color: var(--accent-text); background: var(--accent-soft); }
.nav__link.is-active svg { color: var(--accent); }

.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: 10px; }

/* persistent global print action in the header */
.topbar__print { flex: none; }
.topbar__print svg { color: #fff; }
/* CSS-4: app.js sets .is-dropping while a file is dragged over the header print
 * button — show the same accent ring/border the dropzones use as a drop target. */
.topbar__print.is-dropping { box-shadow: 0 0 0 3px var(--accent-ring); border-color: var(--accent); }

/* health chip */
.health {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 9px;
  border-radius: var(--r-pill);
  background: var(--ok-soft);
  border: 1px solid var(--ok-line);
  color: var(--ok-text);
  font-size: var(--fs-75); font-weight: 600; white-space: nowrap;
}
.health.is-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.health__pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  animation: pulse-ok 2.4s infinite var(--ease-out);
}
.health.is-warn .health__pulse { background: var(--warn); animation-name: pulse-warn; }
@keyframes pulse-ok { 0% { box-shadow: 0 0 0 0 oklch(0.55 0.14 150 / 0.45);} 70%{box-shadow:0 0 0 6px oklch(0.55 0.14 150 / 0);}100%{box-shadow:0 0 0 0 oklch(0.55 0.14 150 / 0);} }
@keyframes pulse-warn { 0% { box-shadow: 0 0 0 0 oklch(0.62 0.14 70 / 0.45);} 70%{box-shadow:0 0 0 6px oklch(0.62 0.14 70 / 0);}100%{box-shadow:0 0 0 0 oklch(0.62 0.14 70 / 0);} }

/* role switcher (shared base) */
.ph-roleswitch { background: var(--surface-2); border-color: var(--line); }
.ph-roleswitch__btn { font-size: var(--fs-75); font-weight: 550; border-radius: var(--r-xs); color: var(--muted); }
.ph-roleswitch__btn:hover { color: var(--ink); }
.ph-roleswitch__btn.is-active { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm); }

/* bell (shared base) */
.ph-bell__btn { border-radius: var(--r-sm); border-color: var(--line); transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-out); }
.ph-bell__btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
.ph-bell__btn:active { transform: scale(.94); }
.ph-bell.has-unread .ph-bell__btn { color: var(--accent); border-color: var(--accent-line); }
/* badge "pops" in when the unread count changes (subtle scale, no bounce) */
.ph-bell__badge { background: var(--danger); box-shadow: 0 0 0 2px var(--surface); animation: bell-pop var(--t-base) var(--ease-out); }
@keyframes bell-pop { from { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); } to { transform: scale(1); opacity: 1; } }
/* dropdown slides + fades down from the bell, never a hard flash */
.ph-bell__dropdown { border-radius: var(--r-md); border-color: var(--line); box-shadow: var(--shadow-lg); z-index: var(--z-dropdown); transform-origin: top right; }
.ph-bell.is-open .ph-bell__dropdown { animation: bell-drop var(--t-base) var(--ease-out) both; }
@keyframes bell-drop { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }
.ph-bell__item { transition: background var(--t-fast) var(--ease); }
.ph-bell__item.is-unread { background: var(--accent-soft); }
/* C-4: a notification that carries a printer_id is a LINK to that printer (app.js
 * adds role=link + handlers). Make it read as clickable — cursor, hover wash, and
 * an inset focus ring (the dropdown clips an outer ring). */
.ph-bell__item--link { cursor: pointer; }
.ph-bell__item--link:hover { background: var(--surface-2); }
.ph-bell__item--link.is-unread:hover { background: var(--accent-soft-2); }
.ph-bell__item--link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ph-bell__item-top strong { font-size: var(--fs-100); }
.ph-bell__readall, .ph-bell__mark { color: var(--accent-text); }

/* shared toast: replace the side-stripe (banned) with a full border + leading
 * status dot, and ease the enter/exit on our own curve. */
.ph-toast { border-left: 1px solid var(--ph-border) !important; border-radius: var(--r-md); padding-left: 32px; position: relative; box-shadow: var(--shadow-lg); transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out); }
.ph-toast::before { content: ""; position: absolute; left: 14px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: var(--accent); }
.ph-toast--error::before { background: var(--danger); }
.ph-toast--warn::before { background: var(--warn); }

/* who / role pill */
.who { display: inline-flex; align-items: center; gap: 8px; padding: 3px 9px 3px 3px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); }
.who__av { width: 28px; height: 28px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 650; font-size: var(--fs-75); background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.who__meta { line-height: 1.2; }
.who__name { font-size: var(--fs-75); font-weight: 600; }
.who__role { font-size: var(--fs-50); color: var(--muted); }

.iconbtn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.iconbtn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.iconbtn:active { background: var(--surface-3); }
.iconbtn svg { width: 17px; height: 17px; }

/* page container + breadcrumbs (varied vertical rhythm, not uniform) */
.main { flex: 1; width: 100%; }
.page { max-width: var(--content-max); margin: 0 auto; padding: 28px 24px 72px; }

.crumbs { display: flex; align-items: center; gap: 6px; font-size: var(--fs-75); color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); transition: color var(--t-fast) var(--ease); }
.crumbs a:hover { color: var(--accent-text); }
.crumbs__sep { color: var(--faint); }
.crumbs__cur { color: var(--ink-2); font-weight: 600; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title { font-size: var(--fs-500); font-weight: 700; letter-spacing: -0.022em; line-height: 1.12; }
/* CSS-14 prose step (1.55) + CSS-15 measure: a wider 66ch reads less cramped for a
 * one/two-line page subtitle without running past a comfortable line length. */
.page-subtitle { color: var(--muted); font-size: var(--fs-200); margin-top: 5px; max-width: 66ch; line-height: 1.55; }
.page-head__actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* section heading — sentence case, weight-led (NOT an uppercase eyebrow) */
.section-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 30px 0 14px; }
.section-h__t { font-size: var(--fs-400); font-weight: var(--fw-strong); letter-spacing: -0.015em; }
.section-h__meta { font-size: var(--fs-75); color: var(--muted); }
.section-h:first-child { margin-top: 0; }

/* in-card subheading — sentence case, modest weight (not a tracked kicker) */
.subhead { font-size: var(--fs-100); font-weight: 650; letter-spacing: -0.005em; color: var(--ink); margin: 0 0 12px; }
.subhead--danger { color: var(--danger-text); }

/* ===========================================================================
 * 4. BUTTONS — full state vocabulary, restrained accent (flat, no gradient)
 * ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 13px; border-radius: var(--r-sm);
  font-size: var(--fs-100); font-weight: var(--fw-emph); line-height: 1; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn { transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform 90ms var(--ease); }
.btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
/* press feedback: a small, instant depress (< 100ms) — tactile, not bouncy */
.btn:active { background: var(--surface-3); transform: translateY(1px); }
.btn:disabled, .btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; background: var(--surface); border-color: var(--line); }
.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent; color: var(--ink-2);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* a single NEUTRAL glass micro-highlight along the top edge gives the brand button
 * dimension (Stripe/Linear move). NO colored shadow/halo under it — on off-white a
 * tinted shadow reads as a neon glow, exactly the flashy tell we refuse. */
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.16), var(--shadow-xs); }
.btn--primary svg { color: #fff; }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.16), var(--shadow-sm); }
.btn--primary:active { background: var(--accent-active); border-color: var(--accent-active); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.16), var(--shadow-xs); }
.btn--primary.is-loading::after { color: #fff; }

.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn--ghost:active { background: var(--surface-3); }

.btn--danger { color: var(--danger-text); border-color: var(--danger-line); background: var(--danger-soft); }
.btn--danger:hover { background: oklch(0.94 0.04 27); border-color: oklch(0.82 0.10 27); }

.btn--ok { color: var(--ok-text); border-color: var(--ok-line); background: var(--ok-soft); }
.btn--ok:hover { background: oklch(0.94 0.05 150); }

.btn--warn { color: var(--warn-text); border-color: var(--warn-line); background: var(--warn-soft); }
.btn--warn:hover { background: oklch(0.94 0.05 80); }

.btn--sm { padding: 6px 10px; font-size: var(--fs-75); border-radius: var(--r-xs); }
.btn--sm svg { width: 14px; height: 14px; }
.btn--block { width: 100%; }
.btn--icon { padding: 7px; width: 34px; height: 34px; }

/* CSS-13: on touch devices the dense desktop icon/small targets (34–36px) are
 * below a comfortable tap target. Floor them to 40px ONLY under a coarse pointer,
 * so desktop density is untouched while tablet taps land reliably. */
@media (pointer: coarse) {
  .btn--sm, .iconbtn, .iconbtn--sm, .btn--icon { min-height: 40px; min-width: 40px; }
}

/* ===========================================================================
 * 5. CARDS / PANELS — used only where a bounded surface is the best affordance
 * ========================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  /* hairline of reflected light along the top edge — simulated material, not a
   * glow or gradient; on white it reads as a crisper, slightly lifted surface. */
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.6), var(--shadow-xs);
}
.card--pad { padding: 18px; }
.card--flush { box-shadow: none; }
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
}
.card__title { font-size: var(--fs-200); font-weight: var(--fw-strong); letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 8px; }
.card__title svg { width: 16px; height: 16px; color: var(--muted); }
.card__body { padding: 16px 18px; }
.card__foot { padding: 13px 18px; border-top: 1px solid var(--line-soft); }

/* subtle interactive lift (no translate jump that causes CLS) */
.lift { transition: border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out); }
.lift:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }

/* ===========================================================================
 * 6. SUMMARY STRIP (replaces the 5-up hero-metric cliche)
 *    One compact band of facts, varied emphasis — not identical big-number tiles.
 * ========================================================================= */
.summary {
  display: flex; flex-wrap: wrap; align-items: stretch;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.6), var(--shadow-xs);
  overflow: hidden;
}
/* renders correctly with 3-4 cells: each grows to an equal share without one cell
 * ballooning, and the band never stretches past its natural rhythm. */
.summary__cell {
  flex: 1 1 0; min-width: 150px;
  padding: 14px 16px;
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 4px;
}
.summary__cell:last-child { border-right: none; }
.summary__k { font-size: var(--fs-75); color: var(--muted); font-weight: var(--fw-medium); line-height: 1.4; display: inline-flex; align-items: center; gap: 6px; }
.summary__k svg { width: 14px; height: 14px; color: var(--faint); }
.summary__klbl { white-space: nowrap; }
.summary__v { font-size: var(--fs-400); font-weight: var(--fw-num); letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); }
.summary__v small { font-size: var(--fs-100); font-weight: 550; color: var(--muted); letter-spacing: 0; }
.summary__cell.is-flag .summary__v { color: var(--warn-text); }
.summary__cell.is-good .summary__v { color: var(--ok-text); }
.summary__bar { margin-top: 4px; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.summary__bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* DRILL-DOWN KPI (Grafana/Linear/Stripe): a KPI cell that is an <a> into the
 * filtered context. It must LOOK clickable — cursor, a subtle wash + inset accent
 * rail on hover, a focus-visible ring, and a "→" hint that slides in on hover/focus.
 * The lift is background/inset only (no translate) so the band never shifts (CLS). */
.summary__cell--link { cursor: pointer; color: inherit; position: relative; isolation: isolate;
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
.summary__cell--link::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--accent); border-radius: 0 2px 2px 0;
  opacity: 0; transform: scaleY(.4); transform-origin: center;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-out);
}
.summary__cell--link:hover { background: var(--accent-soft); }
.summary__cell--link:hover::before { opacity: 1; transform: scaleY(1); }
.summary__cell--link:active { background: var(--accent-soft-2); }
.summary__cell--link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--r-sm); z-index: 1; }
/* the "→" affordance hint: reserved, hidden, slides in — never causes reflow */
.summary__go { margin-left: auto; padding-left: 8px; color: var(--accent-text); font-weight: 700;
  opacity: 0; transform: translateX(-3px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-out); }
.summary__cell--link:hover .summary__go,
.summary__cell--link:focus-visible .summary__go { opacity: 1; transform: none; }
.summary__cell--link.is-flag:hover { background: var(--warn-soft); }
.summary__cell--link.is-flag::before { background: var(--warn); }
.summary__cell--link.is-flag .summary__go { color: var(--warn-text); }
@media (prefers-reduced-motion: reduce) {
  .summary__cell--link::before, .summary__go { transition: none; }
}

/* ===========================================================================
 * 7. ALERTS / BED-CLEAR GATE — border all around (NO side-stripe)
 * ========================================================================= */
.alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.alert {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 15px; border-radius: var(--r-md);
  border: 1px solid var(--warn-line); background: var(--warn-soft);
}
.alert__ic { width: 34px; height: 34px; border-radius: var(--r-sm); flex: none; display: grid; place-items: center; background: var(--surface); color: var(--warn); border: 1px solid var(--warn-line); }
.alert__ic svg { width: 18px; height: 18px; }
.alert__body { flex: 1; min-width: 0; }
.alert__title { font-weight: 650; font-size: var(--fs-100); color: var(--warn-text); }
.alert__msg { font-size: var(--fs-75); color: var(--warn-text); opacity: .92; margin-top: 1px; }
.alert__actions { display: flex; gap: 7px; flex: none; flex-wrap: wrap; }
.alert.is-danger { border-color: var(--danger-line); background: var(--danger-soft); }
.alert.is-danger .alert__ic { color: var(--danger); border-color: var(--danger-line); }
.alert.is-danger .alert__title, .alert.is-danger .alert__msg { color: var(--danger-text); }

/* bed-clear gate banner — full border, no gradient, no stripe.
 * Reveals with a left-to-right clip-path wipe (premium material, conveys "a gate
 * just engaged") instead of appearing abruptly. */
.bedgate {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 18px; border-radius: var(--r-md);
  background: var(--warn-soft); border: 1px solid var(--warn-line);
  animation: bedgate-reveal 360ms var(--ease-out) both;
}
@keyframes bedgate-reveal {
  from { clip-path: inset(0 100% 0 0); opacity: .4; }
  to { clip-path: inset(0 0 0 0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { .bedgate { animation: none; clip-path: none; } }
.bedgate__ic { width: 42px; height: 42px; border-radius: var(--r-md); flex: none; display: grid; place-items: center; background: var(--surface); color: var(--warn); border: 1px solid var(--warn-line); }
.bedgate__ic svg { width: 21px; height: 21px; }
.bedgate__body { flex: 1; min-width: 220px; }
.bedgate__title { font-weight: 680; font-size: var(--fs-300); color: var(--warn-text); }
.bedgate__msg { font-size: var(--fs-100); color: var(--warn-text); opacity: .9; margin-top: 2px; }

/* ===========================================================================
 * 8. BADGES / PILLS
 * ========================================================================= */
/* CSS-16: the status dots in badges/feed/triage/health/queue are DECORATIVE —
 * every one is paired with a text label, so they carry no independent meaning and
 * are marked aria-hidden in the markup (J-19). They must never become the sole
 * carrier of a status; the text duplicate is the source of truth for AT. */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: var(--r-pill);
  font-size: var(--fs-50); font-weight: 600; line-height: 1.5; white-space: nowrap;
  border: 1px solid transparent;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge--ok { color: var(--ok-text); background: var(--ok-soft); border-color: var(--ok-line); }
.badge--warn { color: var(--warn-text); background: var(--warn-soft); border-color: var(--warn-line); }
.badge--danger { color: var(--danger-text); background: var(--danger-soft); border-color: var(--danger-line); }
.badge--info { color: var(--info-text); background: var(--info-soft); border-color: var(--info-line); }
.badge--accent { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); }
.badge--muted { color: var(--muted); background: var(--surface-2); border-color: var(--line); }
.badge--live { color: var(--danger-text); background: var(--danger-soft); border-color: var(--danger-line); }
.badge--live .dot { animation: blink 1.4s infinite var(--ease); }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:.25;} }

/* job state badges */
.jbadge { display:inline-flex; align-items:center; gap:5px; padding:2px 8px; border-radius:var(--r-pill); font-size:var(--fs-50); font-weight:600; border:1px solid transparent; }
.jbadge .dot { width:6px; height:6px; border-radius:50%; background:currentColor; }
.jstate-printing { color:var(--info-text); background:var(--info-soft); border-color:var(--info-line); }
.jstate-queued { color:var(--muted); background:var(--surface-2); border-color:var(--line); }
.jstate-uploading { color:var(--accent-text); background:var(--accent-soft); border-color:var(--accent-line); }
.jstate-paused { color:var(--warn-text); background:var(--warn-soft); border-color:var(--warn-line); }
.jstate-done { color:var(--ok-text); background:var(--ok-soft); border-color:var(--ok-line); }
.jstate-failed { color:var(--danger-text); background:var(--danger-soft); border-color:var(--danger-line); }
.jstate-cancelled { color:var(--muted); background:var(--surface-2); border-color:var(--line); }

/* ===========================================================================
 * 9. FLEET CARDS — status shown by header dot + badge, NO colored side stripe
 * ========================================================================= */
.fleet { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.pcard {
  position: relative;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 16px 15px;
  box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.6), var(--shadow-xs); cursor: pointer;
  transition: border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}
/* subtle hover lift by elevation — translate is tiny so it never causes layout shift */
.pcard:hover { box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.6), var(--shadow-md); border-color: var(--line-strong); transform: translateY(-2px); }
.pcard:active { transform: translateY(0); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.6), var(--shadow-sm); }
.pcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* attention cards read as warm, not loud — a soft tint + warmer line, no stripe */
.pcard.is-flag { border-color: var(--warn-line); background: var(--warn-soft); }
.pcard.is-flag:hover { border-color: oklch(0.80 0.10 75); }
/* C-7: an offline printer must read as offline, not a green "В норме". Dim the card
 * and grey the status dot; app.js renders a badge--muted "Офлайн" alongside. */
.pcard.is-offline { opacity: 0.72; }
.pcard.is-offline .pcard__statusdot { background: var(--faint); }
.pcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pcard__id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pcard__statusdot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--faint); margin-top: 5px; }
.pcard.is-running .pcard__statusdot { background: var(--info); }
.pcard.is-idle .pcard__statusdot { background: var(--faint); }
.pcard.is-attention .pcard__statusdot { background: var(--warn); }

/* the running fleet "breathes" — a slow, calm ring on the most frequent
 * "work in progress" indicator (matches the 2.4s health pulse, never a blink) */
.pcard.is-running .pcard__statusdot { animation: pulse-info 2.4s infinite var(--ease-out); }
@keyframes pulse-info { 0% { box-shadow: 0 0 0 0 oklch(0.52 0.16 250 / 0.40); } 70% { box-shadow: 0 0 0 5px oklch(0.52 0.16 250 / 0); } 100% { box-shadow: 0 0 0 0 oklch(0.52 0.16 250 / 0); } }

/* "the printer just woke up": a SINGLE accent-ring pulse on the dot of a card that
 * just transitioned IDLE/PREPARE -> RUNNING. app.js adds .is-waking for one pass
 * (removed on animationend / timeout). Diegetic, not a decorative loop. */
@keyframes ph-wake {
  0% { box-shadow: 0 0 0 0 var(--accent-ring); }
  55% { box-shadow: 0 0 0 7px oklch(0.51 0.20 277 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.51 0.20 277 / 0); }
}
.pcard__statusdot.is-waking { animation: ph-wake 0.9s var(--ease-out) 1; }
/* C-5 + C-8: the printer name is the card's stretched-link anchor (replaces the
 * invalid article[role=link] with nested interactives). Its ::after covers the whole
 * card, so a click anywhere on the card opens the printer, while the real action
 * buttons / "open error" link sit on z-index:1 above the overlay and stay separately
 * clickable. Ellipsis + min-width:0 keep a long name from distending the card. */
.pcard__name {
  font-weight: var(--fw-strong); font-size: var(--fs-200); letter-spacing: -0.01em;
  display: block; min-width: 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pcard__name::after { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: var(--r-lg); }
.pcard__act, .pcard a.pcard__open-error, .pcard .pcard__open-error { position: relative; z-index: 1; }
.pcard__host { font-size: var(--fs-75); color: var(--muted); margin-top: 1px; line-height: 1.4; }
.pcard__stat { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 7px; }
.pcard__pct { font-size: var(--fs-500); font-weight: 700; letter-spacing: -0.025em; line-height: 1; }
.pcard.is-idle .pcard__pct { color: var(--muted); }
.pcard__statlabel { font-size: var(--fs-75); color: var(--muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard__meta { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 12px; font-size: var(--fs-75); color: var(--muted); align-items: center; }
.pcard__meta b { color: var(--ink-2); font-weight: 600; }

/* glance-able non-running stat: ONE word + ONE supporting metric, no redundant % */
.pcard__stat--word { flex-direction: column; align-items: flex-start; gap: 2px; margin: 16px 0 4px; }
.pcard__word { font-size: var(--fs-400); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); }
.pcard__stat--word.is-attention .pcard__word { color: var(--warn-text); }
.pcard__act { margin-top: 12px; }
.pcard__act .btn { width: 100%; }

/* drop affordance: a quiet hint that becomes a clear target while a file hovers */
.pcard__drop {
  position: absolute; inset: 0; border-radius: var(--r-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: oklch(0.51 0.20 277 / 0.06); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  border: 2px dashed var(--accent); color: var(--accent-text);
  font-size: var(--fs-75); font-weight: 650; text-align: center; padding: 14px;
  opacity: 0; pointer-events: none; transform: scale(.99);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-out);
}
.pcard__drop-ic { display: grid; place-items: center; }
.pcard__drop-ic svg { width: 26px; height: 26px; }
.pcard.is-dropping { border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.pcard.is-dropping .pcard__drop { opacity: 1; transform: scale(1); }

/* progress bar — solid accent fill (no gradient) */
.bar { height: 7px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width var(--t-slow) var(--ease-out); }
.bar.is-warn > span { background: var(--warn); }
.bar.is-idle > span { background: var(--faint); }
.bar.is-danger > span { background: var(--danger); }
.bar--lg { height: 10px; }

/* ===========================================================================
 * 10. EVENT FEED
 * ========================================================================= */
.feed { display: flex; flex-direction: column; }
.feed__row { display: flex; align-items: flex-start; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); }
.feed__row:last-child { border-bottom: none; }
.feed__rail { display: flex; flex-direction: column; align-items: center; flex: none; }
/* CSS-11: centre the dot on the FIRST line of the message (line-height 1.5 on a
 * 9px dot) so it stays put when the message wraps to two lines — the rail no longer
 * jitters between single- and multi-line rows. */
.feed__dot { width: 9px; height: 9px; border-radius: 50%; margin-top: calc((1.5em - 9px) / 2); flex: none; box-shadow: 0 0 0 3px var(--surface); }
.feed__line { width: 2px; flex: 1; background: var(--line-soft); margin: 4px 0 -11px; }
.feed__row:last-child .feed__line { display: none; }
.feed__body { flex: 1; min-width: 0; }
.feed__msg { font-size: var(--fs-100); color: var(--ink-2); }
.feed__when { font-size: var(--fs-75); color: var(--muted); margin-top: 1px; }

/* CLICKABLE LOG ROW (Задача 3): a log entry is a link to the entity it is about
 * (Grafana/Linear/Stripe). It must read as clickable — cursor, a hover wash that
 * bleeds to the card edge, a focus-visible ring, and a "→" hint that slides in.
 * The whole <a> is the hit target; keyboard-activatable via real anchor semantics. */
/* widen the hit/wash area by 8px each side WITHOUT shifting inner content (the
 * negative margin cancels the added padding), so the rail dot stays aligned with
 * any non-link rows in the same feed. */
.feed__row--link { cursor: pointer; color: inherit; border-radius: var(--r-sm);
  margin-left: -8px; margin-right: -8px; padding-left: 10px; padding-right: 10px;
  transition: background var(--t-fast) var(--ease); }
.feed__row--link:hover { background: var(--surface-2); }
.feed__row--link:hover .feed__msg { color: var(--ink); }
.feed__row--link:active { background: var(--surface-3); }
.feed__row--link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* the "→" affordance: reserved space, hidden until hover/focus, slides in (no reflow) */
.feed__go { align-self: center; flex: none; margin-left: 4px; color: var(--accent-text); font-weight: 700;
  opacity: 0; transform: translateX(-3px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-out); }
.feed__row--link:hover .feed__go,
.feed__row--link:focus-visible .feed__go { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .feed__go { transition: none; } }
.sev-info .feed__dot { background: var(--info); }
.sev-warning .feed__dot { background: var(--warn); }
.sev-error .feed__dot { background: var(--danger); }
.sev-critical .feed__dot { background: var(--danger); box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--danger-soft); }

/* ===========================================================================
 * 11. LAYOUT GRIDS
 * ========================================================================= */
.grid-2 { display: grid; gap: 18px; grid-template-columns: 1.7fr 1fr; align-items: start; }
.grid-detail { display: grid; gap: 18px; grid-template-columns: 1.55fr 1fr; align-items: start; }
/* CSS-7: on 1041–1200px the telemetry column was cramped next to a near-empty
 * events column. Collapse the detail grid to a single column already at 1200px so
 * telemetry gets full width instead of fighting for it. */
@media (max-width: 1200px) { .grid-detail { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ===========================================================================
 * 12. PRINTER DETAIL — header + tabs
 * ========================================================================= */
/* CSS-8: row-gap gives the command pad vertical breathing room once it wraps below
 * the name/switcher (the `gap` shorthand also seeds column-gap at 16px). */
.pdhead { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.pdhead__main { flex: 1 1 240px; min-width: 240px; }
.pdhead__title { font-size: var(--fs-500); font-weight: 700; letter-spacing: -0.022em; display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.pdhead__sub { color: var(--muted); font-size: var(--fs-75); margin-top: 6px; display: flex; gap: 13px; flex-wrap: wrap; }
.pdhead__sub span { display: inline-flex; align-items: center; gap: 5px; }
.pdhead__sub svg { width: 13px; height: 13px; color: var(--faint); }
.pdhead__nav { flex: none; align-self: flex-start; }
/* the command pad (Задача 1): primary + contextual print controls live opposite the
 * name. align right of the header, wrap on narrow widths so no button gets clipped. */
.pdhead__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; align-self: flex-start; }
/* CSS-8: drop the pad below the name/switcher already at 900px — on 700–900px the
 * print controls used to collide with the prev/next select. The pad stretches its
 * buttons full-row so the primary "Загрузить и печать" stays the obvious target. */
@media (max-width: 900px) {
  .pdhead__nav, .pdhead__actions { flex: 1 1 100%; justify-content: stretch; }
  .pdhead__actions .btn { flex: 1 1 auto; }
}
@media (max-width: 680px) {
  .pdswitch, .pdswitch__sel, .pdswitch .select-wrap { width: 100%; }
}

/* prev / next quick-switch between printers (fewer round-trips to the list) */
.pdswitch { display: inline-flex; align-items: center; gap: 6px; }
.pdswitch__sel { min-width: 150px; }
.pdswitch__sel .select { padding: 7px 34px 7px 12px; font-size: var(--fs-100); font-weight: 600; }
.iconbtn--sm { width: 32px; height: 32px; border-radius: var(--r-xs); }
/* CSS chevrons so the switcher matches the icon vocabulary without new SVGs */
.chev { width: 8px; height: 8px; border-top: 2px solid var(--ink-2); border-right: 2px solid var(--ink-2); display: block; }
.chev--r { transform: rotate(45deg); margin-left: -2px; }
.chev--l { transform: rotate(-135deg); margin-right: -2px; }

.tabs {
  display: flex; gap: 2px; padding: 4px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tab {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 7px 12px; border-radius: var(--r-xs); border: none; background: transparent;
  font-size: var(--fs-100); font-weight: 550; color: var(--muted); cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.tab svg { width: 15px; height: 15px; opacity: .9; }
.tab:hover { background: var(--surface-2); color: var(--ink-2); }
.tab.is-active { background: var(--accent-soft); color: var(--accent-text); }
.tab.is-active svg { color: var(--accent); }
.tab__count { font-size: var(--fs-50); font-weight: 700; padding: 0 5px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.tab.is-active .tab__count { background: var(--surface); color: var(--accent-text); }

/* telemetry grid */
/* CSS-12: 6 telemetry cells laid out with auto-fill produced ragged 4+2 / 3+3
 * tails depending on width. Pin to a clean 3-up (6 -> 3+3), dropping to 2-up on
 * the narrowest screens, so the grid never leaves an orphan cell. */
.tele { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 520px) { .tele { grid-template-columns: repeat(2, 1fr); } }
.tele__cell { padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.tele__k { font-size: var(--fs-75); color: var(--muted); font-weight: 550; display: inline-flex; align-items: center; gap: 5px; }
.tele__k svg { width: 13px; height: 13px; color: var(--faint); }
.tele__v { font-size: var(--fs-400); font-weight: 680; letter-spacing: -0.02em; margin-top: 6px; color: var(--ink); }
.tele__v small { font-size: var(--fs-75); font-weight: 550; color: var(--muted); }
.tele__sub { font-size: var(--fs-75); color: var(--muted); margin-top: 2px; line-height: 1.4; }
.tmeter { margin-top: 8px; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.tmeter > span { display: block; height: 100%; background: var(--warn); border-radius: 999px; }
.tmeter.is-hot > span { background: var(--danger); }

/* donut progress (solid accent ring) */
.donut { --p: 0; --c: var(--accent); width: 124px; height: 124px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0);
  display: grid; place-items: center; position: relative; }
.donut.is-idle { --c: var(--faint); }
.donut::before { content:""; position:absolute; inset:11px; border-radius:50%; background:var(--surface); }
.donut__in { position: relative; text-align: center; }
.donut__pct { font-size: var(--fs-500); font-weight: var(--fw-display); letter-spacing: -0.025em; }
.donut__lbl { font-size: var(--fs-50); color: var(--muted); font-weight: 600; }

.overview-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.overview-hero__facts { flex: 1; min-width: 220px; display: grid; gap: 9px; grid-template-columns: 1fr 1fr; }
.fact { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.fact__k { font-size: var(--fs-75); color: var(--muted); font-weight: 550; }
.fact__v { font-size: var(--fs-200); font-weight: var(--fw-strong); margin-top: 2px; letter-spacing: -0.01em; }

/* ===========================================================================
 * 13. CAMERA wrap + snapshot strip
 * ========================================================================= */
.camera-wrap { display: grid; gap: 14px; grid-template-columns: 1.5fr 1fr; align-items: start; }
.snapshot-shelf { display: flex; flex-direction: column; gap: 9px; }
.snapshot-thumb { border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); background: #000; }
.snapshot-thumb img { display: block; width: 100%; }
.snapshot-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: var(--fs-75); border: 1px dashed var(--line); border-radius: var(--r-md); }
/* camera canvas crossfades in over its skeleton */
.cam-reveal { animation: cam-reveal var(--t-slow) var(--ease-out) both; }
@keyframes cam-reveal { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cam-reveal { animation: none; } }

/* ===========================================================================
 * 14. TABLES (jobs, users, events)
 * ========================================================================= */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-100); }
.tbl th {
  text-align: left; font-size: var(--fs-75); font-weight: var(--fw-semi);
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
  letter-spacing: 0; text-transform: none;     /* sentence case, not uppercase */
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background var(--t-fast) var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
/* tactility on an expandable row: the "Детали" disclosure button nudges + scales a
 * touch on row hover (the same live micro-move proven on .swatch-pick:hover), so the
 * row reads as openable, not just tinted. transform-only; reduced-motion drops it. */
.tbl tbody tr .tbl__actions .btn--ghost { transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-out); }
.tbl tbody tr:hover .tbl__actions .btn--ghost svg { transform: scale(1.08); transition: transform var(--t-fast) var(--ease-out); }
/* C-8: a long file name must truncate, not blow out the column and shove the rest
 * of the row. The flex name wrapper gets min-width:0 so its child can shrink; the
 * file name itself ellipsises (app.js sets title= with the full name for tooltip). */
.tbl__name { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tbl__name > div { min-width: 0; }
.tbl__thumb { width: 38px; height: 38px; border-radius: var(--r-xs); object-fit: cover; border: 1px solid var(--line); flex: none; background: var(--surface-3); }
.tbl__fname { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tbl__sub { font-size: var(--fs-75); color: var(--muted); }
.tbl__actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.tbl-scroll { overflow-x: auto; }

/* job detail expander */
.jobdetail { background: var(--surface-2); border-radius: var(--r-md); border: 1px solid var(--line); padding: 15px; margin-top: 4px; }
.jobdetail__grid { display: flex; gap: 15px; flex-wrap: wrap; align-items: stretch; }
.jobdetail__thumb { width: 92px; height: 92px; border-radius: var(--r-sm); border: 1px solid var(--line); object-fit: cover; flex: none; background: var(--surface-3); }
.jobdetail__info { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.preview-soon {
  flex: 1; min-width: 180px; min-height: 92px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--r-sm); color: var(--muted);
  background: repeating-linear-gradient(45deg, var(--surface-2) 0 10px, var(--surface) 10px 20px);
  font-size: var(--fs-75);
}
.preview-soon svg { width: 20px; height: 20px; color: var(--faint); }

/* ===========================================================================
 * 15. AMS slots + inline "load a spool" form (REQUESTED DELTA 1)
 * ========================================================================= */
/* slot-centric AMS (Bambu Studio / Handy school): all four bays always shown,
 * compact loaded chip vs dashed empty placeholder, one inline editor at a time. */
.ams-unit-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 0 10px; }
/* CSS-10: tighten the external-spool header's vertical offset so a single card under
 * a wide heading no longer reads as a half-empty section. */
.ams-unit-h--ext { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.ams-unit-h__t { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-200); font-weight: 680; letter-spacing: -0.01em; color: var(--ink); }
.ams-unit-h__t svg { width: 16px; height: 16px; color: var(--faint); }
.ams-unit-h__meta { font-size: var(--fs-75); color: var(--muted); font-variant-numeric: tabular-nums; }

.ams-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
/* the external bay is a single spool — keep it from stretching full-width */
.ams-grid--ext { grid-template-columns: repeat(auto-fit, minmax(190px, 220px)); }
.ams-slot { border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px; background: var(--surface); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.6), var(--shadow-xs); transition: border-color var(--t-base) var(--ease-out), box-shadow var(--t-base) var(--ease-out); display: flex; flex-direction: column; }
/* CSS-9: the inline editor spans the row, but its inner form is capped at 720px so
 * the fields don't stretch to an unreadable width and the slot keeps its place. */
.ams-slot.is-editing { border-color: var(--accent-line); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.6), var(--shadow-md); grid-column: 1 / -1; }
.ams-slot.is-editing .spool-form { max-width: 720px; }
.ams-slot__top { display: flex; align-items: center; gap: 11px; }
.ams-swatch { width: 30px; height: 30px; border-radius: var(--r-sm); flex: none; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.ams-slot__idx { font-size: var(--fs-75); color: var(--muted); font-weight: 550; }
.ams-slot__mat { font-weight: 680; font-size: var(--fs-200); letter-spacing: -0.01em; }
.ams-slot__brand { font-size: var(--fs-75); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ams-slot__grams { margin-top: 11px; font-size: var(--fs-75); color: var(--muted); }
.ams-slot__grams .mono { color: var(--ink-2); }
.ams-meter { margin-top: 6px; height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ams-meter > span { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
/* loaded-bay actions: quiet ghost buttons in a row under the meter */
.ams-slot__act { display: flex; gap: 7px; margin-top: 12px; }
.ams-slot__act .btn { flex: 1; }
.ams-slot__clear { color: var(--muted); }
.ams-slot__clear:hover { color: var(--danger); border-color: var(--danger-line); }

/* EMPTY bay — dashed, recessed, muted; same cell footprint as a loaded bay */
.ams-slot.is-empty { border-style: dashed; border-color: var(--line-strong); background: var(--surface-2); box-shadow: none; }
.ams-slot.is-empty:hover { border-color: var(--accent-line); }
.ams-slot__empty-top { display: flex; align-items: center; gap: 11px; }
.ams-swatch--empty { background:
  repeating-linear-gradient(45deg, var(--surface) 0 5px, var(--surface-2) 5px 10px);
  box-shadow: 0 0 0 1px var(--line-strong); border-color: var(--surface-2); }
.ams-slot__mat--empty { color: var(--faint); font-weight: 600; }
.ams-slot.is-empty .ams-slot__act { margin-top: auto; padding-top: 14px; }

/* per-slot spool-entry form (inline, obvious) */
.spool-form { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 11px; }
.spool-form__lead { display: flex; align-items: center; gap: 7px; font-size: var(--fs-75); font-weight: 600; color: var(--accent-text); }
.spool-form__lead svg { width: 14px; height: 14px; }
.spool-grid { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.spool-grid .field--full { grid-column: 1 / -1; }
/* material swatch picker */
.swatch-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.swatch-pick { width: 26px; height: 26px; border-radius: var(--r-xs); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease); }
.swatch-pick:hover { transform: scale(1.08); }
.swatch-pick.is-active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.swatch-native { width: 36px; height: 30px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--r-xs); background: var(--surface); cursor: pointer; }
.swatch-native::-webkit-color-swatch-wrapper { padding: 0; }
.swatch-native::-webkit-color-swatch { border: none; border-radius: 4px; }
.swatch-native::-moz-color-swatch { border: none; border-radius: 4px; }
.swatch-native:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.spool-temps { display: flex; gap: 10px; }
.spool-temps .field { flex: 1; }
.spool-form__act { margin-top: 4px; gap: 8px; }

/* ===========================================================================
 * 16. ERRORS panel
 * ========================================================================= */
.errcard { border: 1px solid var(--danger-line); border-radius: var(--r-md); overflow: hidden; }
.errcard__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--danger-soft); }
.errcard__ic { width: 38px; height: 38px; border-radius: var(--r-sm); flex:none; display: grid; place-items: center; background: var(--surface); color: var(--danger); border: 1px solid var(--danger-line); }
.errcard__body { padding: 16px; }
.errcard__code { font-size: var(--fs-75); color: var(--muted); }
.errcard__title { font-weight: 680; font-size: var(--fs-300); }
.errcard__desc { color: var(--ink-2); font-size: var(--fs-100); margin: 8px 0 14px; }
.hms-list { display: flex; flex-direction: column; gap: 8px; }
.hms-item { display: flex; gap: 11px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
.hms-item__ic { color: var(--faint); flex: none; margin-top: 1px; }
.hms-item__ic svg { width: 15px; height: 15px; }

/* C-3: raw-status block as a LIGHT code surface. Replaces the dark #0f172a <pre>
 * (a direct violation of the light-only theme) with a recessed neutral panel on
 * tokens — terminal feel via --surface-3 + mono, never a dark slab. */
.codeblock {
  background: var(--surface-3);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: var(--fs-75);
  line-height: 1.5;
  padding: 12px 14px;
  margin: 0;
  overflow: auto;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

/* HMS as a collapsed fold (Задача 3): info-only, sits at the bottom of tabControl,
 * closed by default so diagnostic codes never crowd the actionable top of the tab.
 * The summary is a quiet card header; the body uses the same hms-list as before. */
.hms-fold { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.6), var(--shadow-xs); overflow: hidden; }
.hms-fold__sum {
  display: flex; align-items: center; gap: 9px; cursor: pointer; list-style: none;
  padding: 13px 16px; font-size: var(--fs-200); font-weight: 650; letter-spacing: -0.01em; color: var(--ink-2);
  transition: background var(--t-fast) var(--ease);
}
.hms-fold__sum::-webkit-details-marker { display: none; }
.hms-fold__sum:hover { background: var(--surface-2); }
.hms-fold__sum svg { width: 16px; height: 16px; color: var(--muted); }
.hms-fold__lbl { color: var(--ink); }
/* a CSS chevron that rotates on open — matches the .select-wrap chevron vocabulary */
.hms-fold__chev { width: 7px; height: 7px; flex: none; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform var(--t-fast) var(--ease-out); }
.hms-fold[open] .hms-fold__chev { transform: rotate(45deg); }
.hms-fold[open] .hms-fold__sum { border-bottom: 1px solid var(--line-soft); }
.hms-fold__body { padding: 14px 16px; animation: adv-open var(--t-base) var(--ease-out) both; }
@media (prefers-reduced-motion: reduce) {
  .hms-fold__chev { transition: none; }
  .hms-fold__body { animation: none; }
}

/* ===========================================================================
 * 17. FORMS — custom controls (no default browser look)
 * ========================================================================= */
.form-grid { display: grid; gap: 15px; grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field--full { grid-column: 1 / -1; }
/* CSS-17: the small "label" tier (field labels, table headers, filter labels) shares
 * one semibold token so identical-by-role labels match by token, not by chance. */
.field__label { font-size: var(--fs-75); font-weight: var(--fw-semi); color: var(--ink-2); transition: color var(--t-fast) var(--ease); }
/* CSS-14: tighten small meta to a single deliberate step (1.4) instead of inheriting
 * the body's airy 1.5, which read as loose at 11–12px. */
.field__hint { font-size: var(--fs-75); color: var(--muted); line-height: 1.4; }
/* a quiet "you are here" — the label sharpens to accent ink while its input is
 * focused (the expensive-form micro-signal; reduced-motion drops the transition). */
.field:focus-within .field__label { color: var(--accent-text); }

.input, .select, .textarea {
  font: inherit; font-size: var(--fs-100); color: var(--ink);
  padding: 9px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  width: 100%;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-strong); opacity: 1; }  /* >=4.5:1 */
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.input:disabled, .select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 3px oklch(0.55 0.20 27 / 0.18); }
.textarea { resize: vertical; min-height: 84px; }

.select-wrap { position: relative; }
.select { appearance: none; -webkit-appearance: none; -moz-appearance: none; padding-right: 36px; cursor: pointer; }
.select-wrap::after {
  content: ""; position: absolute; right: 13px; top: 50%; width: 8px; height: 8px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg); pointer-events: none;
}

/* custom checkbox */
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: var(--fs-100); user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box { width: 19px; height: 19px; border-radius: var(--r-xs); border: 1.5px solid var(--line-strong); background: var(--surface); display: grid; place-items: center; flex: none; transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
.check__box svg { width: 12px; height: 12px; color: #fff; opacity: 0; transform: scale(.6); transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check__box svg { opacity: 1; transform: scale(1); }
.check input:focus-visible + .check__box { box-shadow: 0 0 0 3px var(--accent-ring); }
.check:hover .check__box { border-color: var(--accent); }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 42px; height: 24px; border-radius: 999px; background: var(--line-strong); flex: none; position: relative; transition: background var(--t-base) var(--ease); }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t-base) var(--ease-out); }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--accent-ring); }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); flex-wrap: wrap; }
.seg__opt { position: relative; }
.seg__opt input { position: absolute; opacity: 0; }
.seg__opt span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-xs); font-size: var(--fs-75); font-weight: 550; color: var(--muted); cursor: pointer; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.seg__opt input:checked + span { background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-sm); }
.seg__opt:hover span { color: var(--ink-2); }
.seg__opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-ring); }

/* notif settings row */
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 0; border-bottom: 1px solid var(--line-soft); }
.setrow:last-child { border-bottom: none; }
.setrow__main { display: flex; align-items: center; gap: 12px; }
.setrow__ic { width: 36px; height: 36px; border-radius: var(--r-sm); flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.setrow__ic svg { width: 17px; height: 17px; }
.setrow__title { font-weight: 600; font-size: var(--fs-100); }
.setrow__sub { font-size: var(--fs-75); color: var(--muted); margin-top: 1px; }

/* ===========================================================================
 * 18. LOGIN — solid accent panel (no gradient blobs)
 * ========================================================================= */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr; }
.login__aside {
  position: relative; overflow: hidden; color: #fff; padding: 52px 48px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background: var(--accent-active);
}
/* a single restrained dot-grid texture, masked — not a gradient blob */
.login__aside::after {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: radial-gradient(oklch(1 0 0 / 0.16) 1px, transparent 1.4px);
  background-size: 22px 22px;
  mask-image: radial-gradient(120% 100% at 30% 20%, #000 35%, transparent 80%);
  -webkit-mask-image: radial-gradient(120% 100% at 30% 20%, #000 35%, transparent 80%);
}
.login__brand { display: inline-flex; align-items: center; gap: 11px; position: relative; z-index: 1; }
.login__brand .brand__mark { background: oklch(1 0 0 / 0.16); border-color: oklch(1 0 0 / 0.22); box-shadow: 0 0 0 1px oklch(1 0 0 / 0.12); }
.login__brand-name { font-size: var(--fs-300); font-weight: var(--fw-bold); }
/* C-11: brand emphasis on the dark login panel via a token (--accent-on-dark),
 * replacing the hardcoded #c7d2fe so login matches the rest of the accent system. */
.login__brand-name b { color: var(--accent-on-dark); }
.login__pitch { position: relative; z-index: 1; max-width: 32ch; }
.login__pitch h1 { font-size: var(--fs-700); font-weight: 720; letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 14px; }
.login__pitch p { font-size: var(--fs-300); color: oklch(1 0 0 / 0.86); line-height: 1.6; }
.login__chips { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.login__chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; background: oklch(1 0 0 / 0.13); border: 1px solid oklch(1 0 0 / 0.20); font-size: var(--fs-75); font-weight: 500; }
.login__chip svg { width: 14px; height: 14px; }

.login__panel { display: grid; place-items: center; padding: 40px 28px; background: var(--bg); }
.login__card { width: min(408px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 32px 30px; box-shadow: var(--shadow-lg); }
.login__title { font-size: var(--fs-600); font-weight: 720; letter-spacing: -0.02em; }
.login__lead { color: var(--muted); font-size: var(--fs-100); margin: 5px 0 24px; }
.login__form { display: flex; flex-direction: column; gap: 15px; }
.login__divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 15px; color: var(--muted); font-size: var(--fs-75); }
.login__divider::before, .login__divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.quick-roles { display: grid; gap: 9px; grid-template-columns: repeat(3, 1fr); }
.quick-role {
  display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 13px 8px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface);
  cursor: pointer; text-align: center;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.quick-role:hover { border-color: var(--accent-line); background: var(--accent-soft); box-shadow: var(--shadow-sm); }
.quick-role:active { background: var(--accent-soft-2); }
.quick-role__ic { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.quick-role__ic svg { width: 17px; height: 17px; }
.quick-role__label { font-size: var(--fs-75); font-weight: 650; }
.quick-role__role { font-size: var(--fs-50); color: var(--muted); }
.login__hint { margin-top: 16px; text-align: center; font-size: var(--fs-75); color: var(--muted); }

.input-ic { position: relative; }
/* icon() оборачивает SVG в <span>, поэтому целимся в обёртку-span, а не в > svg */
.input-ic > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); display: flex; color: var(--muted); pointer-events: none; }
.input-ic > span svg { width: 16px; height: 16px; }
.input-ic .input { padding-left: 38px; }

/* ===========================================================================
 * 19. EMPTY STATES (teach the interface) + skeletons
 * ========================================================================= */
.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty__ic { width: 50px; height: 50px; border-radius: var(--r-lg); margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty__ic svg { width: 24px; height: 24px; }
.empty__title { font-size: var(--fs-300); font-weight: 680; color: var(--ink); }
.empty__sub { font-size: var(--fs-100); margin: 6px auto 0; max-width: 42ch; line-height: 1.55; }
.empty__cta { margin-top: 16px; display: inline-flex; gap: 8px; }

.guard { max-width: 460px; margin: 56px auto; }
.guard .empty__ic { background: var(--danger-soft); color: var(--danger); }

/* skeleton loaders (shimmer, reduced-motion safe) */
.skel { position: relative; overflow: hidden; background: var(--surface-3); border-radius: var(--r-xs); }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, oklch(1 0 0 / 0.6), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.25s infinite var(--ease);
}
.skel-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; background: var(--surface); }
.skel-line { height: 11px; border-radius: 999px; }
.skel-line + .skel-line { margin-top: 9px; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

.discover-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.discover-item__name { font-weight: 600; font-size: var(--fs-100); }
.discover-item__meta { font-size: var(--fs-75); color: var(--muted); }

.filters { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-label { font-size: var(--fs-75); font-weight: var(--fw-semi); color: var(--muted); margin-right: 2px; text-transform: none; letter-spacing: 0; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: var(--fs-75); font-weight: 540;
  cursor: pointer; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease-out);
}
/* echo the .swatch-pick:hover micro-scale so chips feel selectable, not flat */
.filter-chip:hover { border-color: var(--line-strong); background: var(--surface-2); transform: scale(1.04); }
.filter-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* C-10: AMS-mapping chips join the system instead of ad-hoc inline styling. A
 * swatch variant carries a 16px material chip (the recessed --ams-swatch material:
 * white inset bezel + 1px line ring); colour is supplied via --sw on the element.
 * Active state reuses .is-active (accent fill), and the swatch keeps a readable ring
 * when selected. role=checkbox/aria-checked stays in the markup. */
.filter-chip--swatch::before {
  content: ""; width: 16px; height: 16px; border-radius: 5px; flex: none;
  background: var(--sw, var(--line-strong));
  border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line);
}
.filter-chip--swatch.is-active::before { border-color: oklch(1 0 0 / 0.75); box-shadow: 0 0 0 1px oklch(1 0 0 / 0.45); }
.filter-chip--swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* printer filter as a <select> (chips overflow with many printers). Sits in the
 * same .filter-group as the chip rows, so size + chevron match .input / .select. */
.filter-select .select { padding: 7px 34px 7px 12px; font-size: var(--fs-100); font-weight: 550; }

/* ---------------------------------------------------------------------------
 * 19a2. FILTER TOOLBAR (Задача 2) — one aligned row of label-above-control groups
 *   Queue + Journal share this. Every group: a tiny label, then a control of the
 *   SAME height (chips row / select / search). Groups align on the control's top
 *   edge and wrap as whole units on narrow screens (no orphaned label/control).
 * ------------------------------------------------------------------------- */
.filter-toolbar {
  /* CSS-5: align groups on their TOP edge. Labels already sit above each control,
   * so when the status/severity chip row wraps to two lines the neighbouring
   * select/search no longer slide down into a ragged toolbar. */
  display: flex; flex-wrap: wrap; align-items: flex-start;
  gap: 14px 22px; margin-bottom: 14px;
}
/* CSS-5: from 1000px down let the chip row claim its own full first line, so the
 * select + search line up as a tidy second row instead of crowding beside it. */
@media (max-width: 1000px) {
  .filter-toolbar .filter-group--grow { flex-basis: 100%; }
}
.filter-group--stacked { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.filter-group--stacked .filter-label { margin: 0; }
/* the status / severity chip row grows to take the slack so the select + search
 * sit tidily to its right; on wrap it claims the full first line. */
.filter-group--grow { flex: 1 1 auto; min-width: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
/* a control wrapper that matches the chip-row height exactly (uniform baseline).
 * .input/.select inside it carry the standard 9px padding; we just normalise the
 * min-height so a single-line select lines up with a wrapped chip row's first line. */
.filter-control { display: flex; align-items: stretch; }
.filter-control .select,
.filter-control .input { min-height: 36px; font-size: var(--fs-100); }
.filter-control.input-ic .input { padding-left: 36px; }
.filter-control.input-ic > span { left: 12px; }
.filter-control.input-ic > span svg { width: 15px; height: 15px; }
/* removable filter pills row (queue/journal), same component as #/printers */
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 14px; }
@media (max-width: 640px) {
  .filter-toolbar { gap: 12px 14px; }
  .filter-group--stacked { flex: 1 1 100%; }
  .filter-control { width: 100%; }
  .filter-control .select, .filter-control .input { width: 100%; }
}
/* CSS-18: at 320–360px the queue/journal filter controls overflowed the viewport.
 * Let them shrink (min-width:0) and fill the row so nothing spills past the edge. */
@media (max-width: 360px) {
  .filter-toolbar .select,
  .filter-toolbar .input,
  .filter-control .select,
  .filter-control .input,
  .filter-select .select { min-width: 0; width: 100%; }
}

/* ---------------------------------------------------------------------------
 * 19b. LIST TOOLBAR — live search above a grid (printers); no pagination there
 * ------------------------------------------------------------------------- */
.list-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
/* reuse the .input-ic leading-glyph pattern; cap width so it never spans the row */
.list-search { flex: 1 1 280px; max-width: 380px; }
.list-search .input { padding-left: 38px; }
.list-search svg { width: 16px; height: 16px; }

/* ---------------------------------------------------------------------------
 * 19c. FEED PAGINATION — "Показать ещё" under the events list
 * ------------------------------------------------------------------------- */
.feed-more {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-top: 1px solid var(--line-soft);
}
.feed-more__count { font-size: var(--fs-75); color: var(--muted); }

/* ---------------------------------------------------------------------------
 * 19d. HEALTH OVERFLOW LINK — "ещё N принтеров ->" on the dashboard health card
 * ------------------------------------------------------------------------- */
.health-more {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  margin-top: 4px; padding: 4px 2px;
  font-size: var(--fs-100); font-weight: 600; color: var(--accent-text);
  transition: gap var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease);
}
.health-more:hover { color: var(--accent); gap: 9px; }
.health-more__arrow { transition: transform var(--t-fast) var(--ease-out); }
.health-more:hover .health-more__arrow { transform: translateX(2px); }
@media (prefers-reduced-motion: reduce) {
  .health-more, .health-more:hover { gap: 6px; }
  .health-more__arrow, .health-more:hover .health-more__arrow { transition: none; transform: none; }
}

/* modal head title sizing inside shared overlay */
.ph-modal { border-radius: var(--r-lg); z-index: var(--z-modal); }
.ph-modal-overlay { z-index: var(--z-modal); }
/* C-9: modal title shares the slide-over's title typography (mirror of
 * .slideover__title) so create-user/upload and confirm/delete read as one family,
 * replacing the ad-hoc inline 15.5px. */
.ph-modal__title { font-size: var(--fs-400); font-weight: var(--fw-bold); letter-spacing: -0.015em; }

/* ===========================================================================
 * 21. SLIDE-OVER PANEL (preferred over a modal for upload / create-user)
 *  Enters from the right with an eased translate; backdrop carries a PURPOSEFUL
 *  blur (focus pull, not decorative glass) that fades in with the panel.
 * ========================================================================= */
.slideover-overlay {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: flex; justify-content: flex-end;
  background: oklch(0.23 0.03 270 / 0); backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px);
  transition: background var(--t-base) var(--ease), backdrop-filter var(--t-base) var(--ease), -webkit-backdrop-filter var(--t-base) var(--ease);
}
.slideover-overlay.is-open { background: oklch(0.23 0.03 270 / 0.34); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.slideover-overlay.is-leaving { background: oklch(0.23 0.03 270 / 0); backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }
.slideover {
  width: min(480px, 100%); height: 100%; background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: inset 0 1px 0 oklch(1 0 0 / 0.6), var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform var(--t-slow) var(--ease-out);
  will-change: transform;
}
.slideover-overlay.is-open .slideover { transform: translateX(0); }
.slideover-overlay.is-leaving .slideover { transform: translateX(100%); transition-duration: var(--t-base); }
.slideover__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line-soft); flex: none;
}
.slideover__title { font-size: var(--fs-400); font-weight: 700; letter-spacing: -0.015em; }
.slideover__sub { font-size: var(--fs-75); color: var(--muted); margin-top: 3px; max-width: 42ch; }
.slideover__body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.slideover__foot { padding: 14px 20px; border-top: 1px solid var(--line-soft); flex: none; }

/* upload advanced settings — collapsed by default (operator confirms, not fills) */
.upload-adv { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.upload-adv__sum {
  display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  padding: 11px 14px; font-size: var(--fs-100); font-weight: 600; color: var(--ink-2);
  transition: background var(--t-fast) var(--ease);
}
.upload-adv__sum::-webkit-details-marker { display: none; }
.upload-adv__sum svg { width: 15px; height: 15px; color: var(--muted); }
.upload-adv__sum:hover { background: var(--surface-2); }
.upload-adv[open] .upload-adv__sum { border-bottom: 1px solid var(--line-soft); }
.upload-adv__body { padding: 16px 14px; animation: adv-open var(--t-base) var(--ease-out) both; }
@keyframes adv-open { from { opacity: 0; } to { opacity: 1; } }

/* created-job confirmation block inside the upload panel */
.jobdetail--created { border-color: var(--ok-line); background: var(--ok-soft); }
.jobdetail__ok { display: inline-flex; align-items: center; gap: 9px; font-size: var(--fs-200); }
.jobdetail__ok-ic { width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; background: var(--ok); }
.jobdetail__ok-ic svg { width: 14px; height: 14px; }

/* confirm button injected into a bell "стол ждёт" notification */
.bell-bedclear { margin-top: 9px; }
.ph-bell__item.is-resolved .bell-bedclear { display: none; }

/* gentle, NON-orchestrated route entrance: one eased section transition for the
 * whole page (a soft fade + small rise), never a flash, never staggered children. */
.fade-in { animation: fade-up var(--t-slow) var(--ease-out) both; }
@keyframes fade-up { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

/* the page wrapper crossfades on every route resolve (set in .page) */
.page.fade-in { animation: page-in 220ms var(--ease-out) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ===========================================================================
 * 21b. PREMIUM MOTION — confirm flash, success pulse, tweened ring
 *  Motion conveys state only: a confirmation after a committed action, a count-up
 *  on live numbers, an eased ring/bar. No decorative loops, no page-load ballet.
 * ========================================================================= */

/* register --p so the donut conic ring EASES toward its value instead of jumping */
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }
.donut { transition: --p var(--t-slow) var(--ease-out); }

/* centered check-mark confirmation for headline actions (< 1s, non-blocking) */
.confirm-flash {
  position: fixed; left: 50%; top: 22%; transform: translateX(-50%);
  z-index: var(--z-modal);
  display: inline-flex; align-items: center; gap: 11px;
  padding: 12px 18px 12px 13px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--ok-line);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-100); font-weight: 600; color: var(--ink);
  animation: cf-in 220ms var(--ease-out) both; pointer-events: none;
}
.confirm-flash.is-leaving { animation: cf-out 200ms var(--ease) both; }
.confirm-flash__ring {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff; background: var(--ok);
  animation: cf-ring 360ms var(--ease-out) both;
}
.confirm-flash__check svg { width: 15px; height: 15px; display: block; stroke-dasharray: 22; stroke-dashoffset: 22; animation: cf-draw 320ms 90ms var(--ease-out) forwards; }
.confirm-flash__msg { white-space: nowrap; }
@keyframes cf-in { from { opacity: 0; transform: translate(-50%, -8px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes cf-out { to { opacity: 0; transform: translate(-50%, -6px) scale(.98); } }
@keyframes cf-ring { from { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.06); } to { transform: scale(1); opacity: 1; } }
@keyframes cf-draw { to { stroke-dashoffset: 0; } }

/* a short success pulse on an icon node after an inline confirm */
.just-confirmed { animation: just-confirmed 700ms var(--ease-out) both; }
@keyframes just-confirmed {
  0% { transform: scale(.7); }
  45% { transform: scale(1.14); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .skel::after { display: none; }
  .health__pulse { animation: none; }
  .donut { transition: none; }
  .confirm-flash, .just-confirmed { animation: none; }
  /* "printer woke up" flash + running-dot breathing are decorative ring pulses —
   * fully off, not just sped up. */
  .pcard__statusdot.is-waking { animation: none; }
  .pcard.is-running .pcard__statusdot { animation: none; }
  /* drop the hover micro-scales (chip + row disclosure) to static state changes. */
  .filter-chip:hover { transform: none; }
  .tbl tbody tr:hover .tbl__actions .btn--ghost svg { transform: none; }
}

/* ===========================================================================
 * 20. RESPONSIVE
 * ========================================================================= */
@media (max-width: 1040px) {
  .grid-2, .grid-detail, .camera-wrap { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login__aside { display: none; }
}

/* C-1: the right action cluster (Печать / роль / колокол / аккаунт incl. "Выйти")
 * used to fall off-viewport between 821…~1654px because the horizontal nav held the
 * row hostage with no hamburger until 820px. Hand the nav to the mobile sheet far
 * earlier (1100px) and compact the cluster from 1024px down so nothing is clipped. */
@media (max-width: 1100px) {
  .nav { display: none; }
}
/* hamburger is hidden above the new threshold, shown (and tappable) at/below it. */
@media (min-width: 1101px) { .menu-toggle { display: none !important; } }
.menu-toggle.is-shown { display: inline-grid; }

/* 1024px and down: shrink the cluster to icons. Drop the health chip's text and the
 * "Печать" label (icons stay), and collapse the role switcher to its compact form —
 * the same trims already proven at <=600px, applied earlier so the row fits. */
@media (max-width: 1024px) {
  .topbar__actions.is-compact .health span:not(.health__pulse) { display: none; }
  .topbar__actions.is-compact .health { padding: 7px; }
  .topbar__actions.is-compact .topbar__print span { display: none; }
  .topbar__actions.is-compact .topbar__print { padding: 8px; width: 36px; }
  .topbar__actions.is-compact .topbar__print svg { width: 16px; height: 16px; }
  .topbar__actions.is-compact .ph-roleswitch__btn { padding-left: 8px; padding-right: 8px; }
  .topbar__actions.is-compact .who__meta { display: none; }
}

@media (max-width: 820px) {
  .form-grid { grid-template-columns: 1fr; }
  .overview-hero__facts { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .page { padding: 18px 14px 56px; }
  .who__meta { display: none; }
  .health span:not(.health__pulse) { display: none; }
  .health { padding: 7px; }
  .quick-roles { grid-template-columns: 1fr; }
  .spool-grid { grid-template-columns: 1fr; }
  .summary__cell { flex-basis: 50%; border-bottom: 1px solid var(--line-soft); }
  .brand__sub { display: none; }
  /* alerts + bed-gate: drop the decorative icon, full-width body, buttons below */
  .alert, .bedgate { flex-wrap: wrap; align-items: flex-start; row-gap: 8px; }
  .alert__ic, .bedgate__ic { display: none; }
  .alert__body, .bedgate__body { flex: 1 1 100%; min-width: 0; }
  .alert__actions { width: 100%; margin-top: 2px; }
  .alert__actions .btn, .bedgate .btn { flex: 1 1 auto; }
}

/* mobile nav sheet */
.menu-toggle { display: inline-grid; place-items: center; }
.sheet-overlay { position: fixed; inset: 0; z-index: var(--z-sheet); background: var(--ph-overlay); animation: ph-fade .15s ease; }
.sheet {
  position: fixed; z-index: calc(var(--z-sheet) + 1); top: 0; left: 0; bottom: 0; width: min(286px, 84vw);
  background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow-lg);
  padding: 16px; display: flex; flex-direction: column; gap: 5px;
  animation: slide-in var(--t-slow) var(--ease-out); overflow-y: auto;
}
@keyframes slide-in { from { transform: translateX(-100%); } to { transform: none; } }
.sheet__brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line-soft); }
.sheet__link { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: var(--r-md); font-weight: 540; color: var(--ink-2); }
.sheet__link svg { width: 18px; height: 18px; color: var(--faint); }
.sheet__link.is-active { background: var(--accent-soft); color: var(--accent-text); }
.sheet__link.is-active svg { color: var(--accent); }
.sheet__link:hover { background: var(--surface-2); }

/* ===========================================================================
 * DASHBOARD v2 — compact system state (status bar, triage, all-clear)
 * The overview never lists the fleet; it summarises it. Colours come straight
 * from the status tokens so the bar speaks the same language as the badges.
 * ========================================================================= */

/* 5-up KPI band: drop the per-cell min-width so five aggregates sit on one row
 * on desktop, and wrap cleanly to 2-up on narrow screens. */
.summary--5 .summary__cell { min-width: 118px; }
/* CSS-1: wrap the 5-up band BEFORE the nowrap labels ("Принтеры онлайн",
 * "Заданий в очереди") collide with the neighbour's icon. Five 118px cells stayed
 * in one row down to ~680px; force 3-up then 2-up, giving wrapped cells a bottom
 * rule (matching the <=600px block) so the band keeps its grid rhythm. */
@media (max-width: 860px) {
  .summary--5 .summary__cell { flex-basis: 33.33%; border-bottom: 1px solid var(--line-soft); }
}
@media (max-width: 620px) {
  .summary--5 .summary__cell { flex-basis: 50%; }
}

/* "Состояние парка" — one stacked segment bar + a counted legend. */
.statuspanel .card__body { padding: 18px 18px 16px; }
.statusbar {
  display: flex; width: 100%; height: 14px;
  border-radius: var(--r-pill); overflow: hidden;
  background: var(--surface-3); border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px oklch(0.23 0.03 270 / 0.05);
}
.statusbar__seg {
  display: block; min-width: 5px;
  transition: filter var(--t-fast) var(--ease), flex-grow var(--t-base) var(--ease-out);
}
.statusbar__seg + .statusbar__seg { box-shadow: inset 1px 0 0 oklch(1 0 0 / 0.55); }
.statusbar__seg:hover { filter: brightness(1.07) saturate(1.1); }
/* CSS-3: the bar clips overflow, so a text-less segment link's outer focus ring
 * was cut off. Pull the ring INWARD (inset surface line + accent halo) and lift
 * the focused segment above its neighbours so the indicator is fully visible. */
.statusbar__seg:focus-visible {
  outline: 2px solid var(--surface); outline-offset: -2px;
  box-shadow: 0 0 0 2px var(--accent); z-index: 1;
}
/* segment fills are scoped to the BAR only — the legend reuses .seg--* for its
 * dot colour but must keep a neutral chip background (text stays readable). */
.statusbar__seg.seg--printing { background: var(--info); }
.statusbar__seg.seg--idle     { background: oklch(0.83 0.01 270); }
.statusbar__seg.seg--offline  { background: var(--faint); }
.statusbar__seg.seg--attention{ background: var(--warn); }
/* a lone "attention" bucket should read as a problem, not a caution */
.statusbar .statusbar__seg.seg--attention:only-child { background: var(--danger); }

.statuslegend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 15px; }
.statuslegend__item {
  display: inline-flex; align-items: baseline; gap: 7px;
  font-size: var(--fs-100); color: var(--ink-2);
  padding: 3px 4px; margin: -3px -4px; border-radius: var(--r-xs);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
a.statuslegend__item:hover { background: var(--surface-2); color: var(--ink); }
.statuslegend__dot { width: 9px; height: 9px; border-radius: 3px; align-self: center; flex: none; }
.statuslegend__n { font-weight: 700; letter-spacing: -0.01em; }
.statuslegend__lbl { color: var(--muted); }
.statuslegend__item.seg--printing  .statuslegend__dot { background: var(--info); }
.statuslegend__item.seg--idle       .statuslegend__dot { background: oklch(0.83 0.01 270); }
.statuslegend__item.seg--offline    .statuslegend__dot { background: var(--faint); }
.statuslegend__item.seg--attention  .statuslegend__dot { background: var(--warn); }
.statuslegend__item.is-zero { opacity: 0.5; }
.statuslegend__item.is-zero .statuslegend__dot { background: var(--line-strong); }

/* "Требуют внимания" — short actionable triage list (max 5 rows). */
.triage { display: flex; flex-direction: column; }
.triage__row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft);
}
.triage__row:last-child { border-bottom: none; }
.triage__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; align-self: center; }
.triage__row.is-bed   .triage__dot { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.triage__row.is-error .triage__dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.triage__body { flex: 1 1 auto; min-width: 0; }
.triage__name { font-weight: 650; font-size: var(--fs-200); color: var(--ink); letter-spacing: -0.01em; }
.triage__name:hover { color: var(--accent-text); }
/* CSS-14 prose step: the triage reason is a short sentence, not meta — 1.55. */
.triage__reason { font-size: var(--fs-100); color: var(--muted); margin-top: 2px; line-height: 1.55; }
.triage__act { flex: none; }
.triage__more { padding: 12px 16px; border-top: 1px solid var(--line-soft); }

/* calm "all clear" empty state for the triage list */
.allclear { display: flex; align-items: center; gap: 14px; padding: 20px 18px; }
.allclear__ic {
  width: 40px; height: 40px; flex: none; border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--ok-text);
  background: var(--ok-soft); border: 1px solid var(--ok-line);
}
.allclear__ic svg { width: 22px; height: 22px; }
.allclear__t { font-weight: 650; font-size: var(--fs-200); color: var(--ink); letter-spacing: -0.01em; }
.allclear__s { font-size: var(--fs-100); color: var(--muted); margin-top: 2px; }

/* removable "filtered by status" pill on #/printers?status=… */
.active-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 8px 6px 11px; border-radius: var(--r-pill);
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  color: var(--accent-text); font-size: var(--fs-75); font-weight: 600;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.active-filter:hover { background: var(--accent-soft-2); border-color: var(--accent); }
.active-filter__x { display: inline-grid; place-items: center; }
.active-filter__x svg { width: 13px; height: 13px; }

/* ===========================================================================
 * QUEUE (#/queue) — global print-job showcase
 * ========================================================================= */
.filters--row { display: flex; flex-wrap: wrap; gap: 12px 22px; align-items: center; }
.tbl--queue td { vertical-align: middle; }
.tbl__thumb--ph { display: grid; place-items: center; color: var(--faint); }
.tbl__thumb--ph svg { width: 18px; height: 18px; }

/* printer cell: a small status dot + the printer name, linking to the printer */
.qprinter { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); }
.qprinter:hover { color: var(--accent-text); }
.qprinter__dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.qprinter__dot.is-running   { background: var(--info); }
.qprinter__dot.is-attention { background: var(--warn); }
.qprinter__dot.is-idle      { background: oklch(0.78 0.01 270); }
/* CSS-6: on desktop there is room — don't truncate the printer name by a magic
 * 180px. Cap it only where the column actually narrows (see the <=900/700px
 * media rules below); min-width:0 on the cell lets the ellipsis engage there. */
.qprinter__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: none; }
.tbl--queue td { min-width: 0; }

/* queue-position chip next to a "В очереди" badge (client-side rank) */
.qpos {
  display: inline-block; margin-left: 7px;
  font-size: var(--fs-50); font-weight: 700; color: var(--muted-strong);
  font-variant-numeric: tabular-nums;
  padding: 1px 6px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line);
}

/* CSS-6: re-introduce the cap only as the queue column narrows. */
@media (max-width: 900px) { .qprinter__name { max-width: 200px; } }
@media (max-width: 700px) {
  .triage__row { flex-wrap: wrap; row-gap: 9px; }
  .triage__act { width: 100%; }
  .triage__act .btn { width: 100%; }
  .qprinter__name { max-width: 120px; }
}
