/* ═══════════════════════════════════════
   ProfiTest — Master Stylesheet (Bundled)
   ═══════════════════════════════════════ */

/* ── 1. Variables ──────────────────────── */
:root {
  --bg:           #ffffff;
  --bg2:          #f3f7fa;
  --bg3:          #edf3ff;
  --bg-card:      #ffffff;
  --text:         #2f3441;
  --text2:        #606981;
  --text3:        #9eadd4;
  --accent:       #3261ec;
  --accent-h:     #1e4bd2;
  --accent-dim:   rgba(50, 97, 236, .10);
  --accent-glow:  rgba(50, 97, 236, .22);
  --border:       #e4e9f0;
  --border-h:     #c8d3e8;
  --danger:       #f04438;
  --danger-dim:   rgba(240, 68, 56, .10);
  --success:      #15803d;
  --success-dim:  rgba(22, 163, 74, .12);
  --warning:      #b45309;
  --warning-dim:  rgba(245, 158, 11, .16);
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  /* ── Text: one family, levels differ by size, weight and colour ──────
     page title   --fs-page   700  --text   (top bar)
     section      --fs-title  700  --text   (h2 of a tab, card heading)
     body         --fs-body   400  --text   (tables, lists, forms)
     secondary    --fs-small  400  --text2  (the line under a name, hints)
     caption      --fs-caption 600 --text3  (labels over numbers, table heads)
     Numbers that line up in columns use tabular figures. */
  --fs-page:      1.05rem;
  --fs-title:     .95rem;
  --fs-body:      .875rem;
  --fs-small:     .8rem;
  --fs-caption:   .72rem;
  --r-pill:       100px;
  --r-card:       16px;
  --r-input:      10px;
  --r-sm:         8px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:    0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg:    0 12px 40px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.06);
  --shadow-modal: 0 24px 64px rgba(0,0,0,.14);
  --tr:           .2s ease;
}

[data-theme="dark"] {
  --bg:           #0d1421;
  --bg2:          #131d2e;
  --bg3:          #192036;
  --bg-card:      #141d2e;
  --text:         #e8edf5;
  --text2:        #8b96b2;
  --text3:        #3d4f72;
  --accent:       #4b74f0;
  --accent-h:     #6389f5;
  --accent-dim:   rgba(75, 116, 240, .15);
  --accent-glow:  rgba(75, 116, 240, .30);
  --border:       #1e2d45;
  --border-h:     #2a3d5e;
  --danger:       #f87171;
  --danger-dim:   rgba(248, 113, 113, .12);
  --success:      #4ade80;
  --success-dim:  rgba(74, 222, 128, .14);
  --warning:      #fbbf24;
  --warning-dim:  rgba(251, 191, 36, .14);
  --shadow-sm:    0 1px 3px rgba(0,0,0,.30);
  --shadow-md:    0 4px 16px rgba(0,0,0,.40);
  --shadow-lg:    0 12px 40px rgba(0,0,0,.50);
  --shadow-modal: 0 24px 64px rgba(0,0,0,.55);
}

/* ── Accent Color Themes ────────────────── */
html[data-accent="emerald"] {
  --accent:       #0d9488;
  --accent-h:     #0f766e;
  --accent-dim:   rgba(13, 148, 136, .10);
  --accent-glow:  rgba(13, 148, 136, .22);
}
html[data-theme="dark"][data-accent="emerald"] {
  --accent:       #2dd4bf;
  --accent-h:     #0d9488;
  --accent-dim:   rgba(45, 212, 191, .15);
  --accent-glow:  rgba(45, 212, 191, .30);
}

html[data-accent="violet"] {
  --accent:       #7c3aed;
  --accent-h:     #6d28d9;
  --accent-dim:   rgba(124, 58, 237, .10);
  --accent-glow:  rgba(124, 58, 237, .22);
}
html[data-theme="dark"][data-accent="violet"] {
  --accent:       #a78bfa;
  --accent-h:     #8b5cf6;
  --accent-dim:   rgba(167, 139, 250, .15);
  --accent-glow:  rgba(167, 139, 250, .30);
}

html[data-accent="sunset"] {
  --accent:       #f43f5e;
  --accent-h:     #e11d48;
  --accent-dim:   rgba(244, 63, 94, .10);
  --accent-glow:  rgba(244, 63, 94, .22);
}
html[data-theme="dark"][data-accent="sunset"] {
  --accent:       #fb7185;
  --accent-h:     #f43f5e;
  --accent-dim:   rgba(251, 113, 133, .15);
  --accent-glow:  rgba(251, 113, 133, .30);
}

/* ── 2. Components ─────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Computers get a denser page (15px base): more fits on a 13" laptop.
   Phones keep their own size (see the max-width: 768px block). */
html { font-size: 15px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  transition: background var(--tr), color var(--tr);
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--text); }

/* ── Button system ───────────────────────────────────────────────────────────
   Типы:   btn-primary | btn-secondary | btn-ghost | btn-danger
   Размеры: (default 36px) | btn-sm 28px | btn-lg 44px | btn-icon 28px квадрат
────────────────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font); font-size: .84rem; font-weight: 600;
  padding: 0 16px; border-radius: var(--r-input);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background var(--tr), border-color var(--tr), color var(--tr),
              transform .1s, box-shadow var(--tr);
  user-select: none; outline: none; height: 34px; gap: 6px;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }

/* Главное действие — акцент, тень */
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent-h); box-shadow: 0 4px 14px var(--accent-glow); }

/* Второстепенное — нейтральный фон, рамка */
.btn-secondary {
  background: var(--bg2); color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg3, var(--border)); border-color: var(--border-h); }

/* Утилитарное — прозрачное, почти невидимо, появляется при наведении */
.btn-ghost {
  background: none; color: var(--text2);
  border-color: transparent; font-weight: 500;
}
.btn-ghost:hover { background: var(--bg2); color: var(--text); border-color: var(--border); }

/* Деструктивное — красный акцент */
.btn-danger {
  background: var(--danger-dim); color: var(--danger);
  border-color: transparent;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

/* ── Размеры ── */
/* sm: тулбары, таблицы, inline-действия */
.btn-sm { height: 28px; padding: 0 10px; font-size: .78rem; border-radius: var(--r-sm); gap: 4px; }

/* lg: hero, крупные CTA */
.btn-lg { height: 40px; padding: 0 20px; font-size: .95rem; gap: 8px; }

/* icon: квадратная кнопка только с иконкой */
.btn-icon { width: 28px; height: 28px; padding: 0 !important; flex-shrink: 0; }
.btn-icon svg, .btn-icon i { width: 14px; height: 14px; stroke-width: 2px; }

.input, .form-input {
  width: 100%; height: 36px; padding: 6px 12px;
  font-family: var(--font); font-size: var(--fs-body);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-input); color: var(--text);
  outline: none; transition: border-color var(--tr), box-shadow var(--tr), background var(--tr);
}
.input:hover, .form-input:hover { border-color: var(--border-h); }
.input:focus, .form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--bg);
}
.input:disabled, .form-input:disabled { background: var(--bg2); opacity: .7; cursor: not-allowed; }
/* Phones zoom the page into a field whose text is smaller than 16px
   (iPhone does it on every tap); 16px keeps the page as it is */
@media (max-width: 768px), (pointer: coarse) {
  input, select, textarea, .input, .form-input { font-size: 16px !important; }
}
.input.input-invalid, .form-input.input-invalid,
.input.input-invalid:focus, .form-input.input-invalid:focus {
  border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-dim);
}

select.input, select.form-input {
  max-width: 100%; text-overflow: ellipsis;   /* long option names never widen the page */
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23606981' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  padding-right: 36px;
}

textarea.input, textarea.form-input { height: auto; min-height: 72px; resize: vertical; padding: 8px 12px; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { font-size: var(--fs-small); font-weight: 600; color: var(--text2); }
.field-hint { font-size: var(--fs-caption); color: var(--text3); line-height: 1.4; }
/* Text levels as classes, for places without their own rule */
.t-secondary { font-size: var(--fs-small); color: var(--text2); }
.t-caption { font-size: var(--fs-caption); font-weight: 600; color: var(--text3); letter-spacing: .02em; }
/* Form error under the fields: one line is always reserved, so the form
   and its buttons do not jump when a message appears */
.form-err {
  color: var(--danger); font-size: .82rem; font-weight: 500; line-height: 1.35;
  min-height: 1.35em; margin-top: 6px;
}

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 18px 20px;
  box-shadow: var(--shadow-sm); transition: border-color var(--tr), box-shadow var(--tr);
}
.card:hover { border-color: var(--border-h); box-shadow: var(--shadow-md); }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .72rem; font-weight: 700; padding: 3px 8px;
  border-radius: var(--r-pill); white-space: nowrap; line-height: 1;
}
.badge-pass    { background: var(--accent-dim);  color: var(--accent); }
.badge-fail    { background: var(--danger-dim);  color: var(--danger); }
.badge-none    { background: var(--bg2); color: var(--text3); border: 1px solid var(--border); }
.badge-info    { background: var(--accent-dim);  color: var(--accent); }
.badge-done    { background: var(--accent-dim);  color: var(--accent); }
.badge-overdue { background: var(--danger-dim);  color: var(--danger); }
.badge-warn    { background: var(--danger-dim);  color: var(--danger); }
.badge-blue    { background: var(--accent-dim);  color: var(--accent); }
.badge-green   { background: var(--success-dim); color: var(--success); }
.badge-orange  { background: var(--warning-dim); color: var(--warning); }
.badge-red     { background: var(--danger-dim);  color: var(--danger); }
.badge-gray    { background: var(--bg2);         color: var(--text2); border: 1px solid var(--border); }
/* Test type badges */
.badge-learning { background: var(--accent-dim); color: var(--accent); }
.badge-exam     { background: var(--bg2);        color: var(--text2);  border: 1px solid var(--border); }
.badge-strict   { background: var(--danger-dim); color: var(--danger); }

.tbl-wrap {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--r-card); margin-bottom: 16px;
  background: var(--bg-card);
}
table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
thead { background: var(--bg2); }
th {
  padding: 7px 10px; text-align: left; font-weight: 600; font-size: var(--fs-small);
  color: var(--text2); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg2); }
td button + button, td .btn + .btn, td .btn-sm + .btn-sm {
  margin-left: 8px !important;
}

.modal-bg, .overlay {
  position: fixed; top: var(--banner-h, 0px); left: 0; right: 0; bottom: 0;
  background: rgba(13,20,33,0.4);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; transition: opacity .2s ease;
}
.modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-card); width: 100%; max-width: 480px;
  box-shadow: var(--shadow-modal); display: flex; flex-direction: column;
  animation: modalEnter .2s ease; max-height: 90vh;
}
@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { font-size: var(--fs-title); font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  color: var(--text3); transition: color var(--tr); width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.modal-close:hover { color: var(--text); background: var(--bg2); }

.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-footer, .modal-actions {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 12px; background: var(--bg2);
  border-bottom-left-radius: var(--r-card); border-bottom-right-radius: var(--r-card);
}

.modal-err { color: var(--danger); font-size: .82rem; margin-top: 8px; text-align: center; }

.spinner {
  display: inline-block; width: 24px; height: 24px;
  border: 3px solid var(--accent-dim); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
.spinner-sm {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--accent-dim); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
.spinner-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; color: var(--text2); }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--border) 50%, var(--bg2) 75%);
  background-size: 200% 100%; animation: skeletonPulse 1.5s infinite;
  border-radius: 4px;
}
@keyframes skeletonPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-h); }

.top-tab-panel, .tab-panel { display: none; }
.top-tab-panel.active, .tab-panel.active { display: block; }

.hidden { display: none !important; }
/* Inline Lucide icon next to text (see ico() in utils.js) */
.ico { display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
.modal-close svg, .support-close svg, .modal-close-btn svg { width: 18px; height: 18px; }
.ico-spin { animation: ico-spin .8s linear infinite; }
@keyframes ico-spin { to { transform: rotate(360deg); } }
/* A button that shows its own progress keeps its size in every state */
.btn[aria-busy="true"], .btn.btn-done { cursor: default; opacity: 1; }
.btn.btn-done { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Motion: short (≤ .2s) and calm, no bounce. People who turned on
   «reduce motion» in their phone or computer settings get none, except
   the loading spinners that tell something is going on. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
  .ico-spin, .spinner, .spinner-sm, .spinner-lg {
    animation-duration: 1.2s !important; animation-iteration-count: infinite !important;
  }
}
.text-muted { color: var(--text2); font-size: var(--fs-small); }

/* ── 3. Layout & Grids ──────────────────── */
/* --banner-h: height of the SITE_BANNER strip of a test copy (0 on the real site) */
.dashboard {
  display: flex; min-height: calc(100vh - var(--banner-h, 0px)); background: var(--bg2);
}

.sidebar {
  width: 220px; background: var(--bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: calc(100vh - var(--banner-h, 0px));
  flex-shrink: 0; transition: width var(--tr), background var(--tr), border-color var(--tr);
  z-index: 10;
}

.sidebar-brand {
  height: 52px; padding: 0 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border); font-weight: 700; font-size: 1rem;
}
.sidebar-logo-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--accent);
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-weight: 800; font-size: .9rem; flex-shrink: 0;
}

.sidebar-menu {
  flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.sidebar-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px;
  border-radius: var(--r-sm); font-size: .83rem; font-weight: 500;
  color: var(--text2); cursor: pointer; transition: all var(--tr);
  background: none; border: none; width: 100%; text-align: left;
}
.sidebar-item:hover {
  background: var(--bg2); color: var(--text);
}
.sidebar-item.active {
  background: var(--accent-dim); color: var(--accent); font-weight: 600;
}
.sidebar-item svg, .sidebar-item i {
  flex-shrink: 0; width: 16px; height: 16px; stroke-width: 2px;
  opacity: .7; transition: opacity var(--tr);
}
.sidebar-item.active svg, .sidebar-item.active i { opacity: 1; color: var(--accent); }
a.sidebar-item { text-decoration: none; }
#panel-nav .sidebar-item { line-height: 1.4; font-family: inherit; }

/* Menu blocks: «Обзор», «Люди и результаты», «Тесты и материалы», «Система» */
.sidebar-section { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section + .sidebar-section { margin-top: 14px; }
.sidebar-section-title {
  padding: 0 12px 4px; font-size: var(--fs-caption); font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text3);
}
.brand-name { font-weight: 700; font-size: .95rem; color: var(--text); }

/* Section toolbar: filters and search on the left, actions on the right.
   The section title is the top bar; nothing repeats it here. */
.page-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px;
  flex-wrap: wrap; margin-bottom: 14px; min-height: 34px;
}
.page-toolbar-main { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; min-width: 0; flex: 1; }
.page-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.page-toolbar select.input, .page-toolbar .page-search { height: 34px; margin-bottom: 0; width: auto; }
.page-toolbar select.input { min-width: 170px; max-width: 300px; padding: 4px 32px 4px 10px; }
.page-search { width: 260px !important; max-width: 100%; }
.page-hint { font-size: var(--fs-small); color: var(--text2); }
.panel-count { font-size: var(--fs-small); color: var(--text2); font-weight: 500; }
/* A caption and its list stay together when a bar wraps */
.flt { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.flt > span { font-size: var(--fs-small); font-weight: 600; color: var(--text2); }
@media (max-width: 768px) {
  .page-toolbar-main, .page-toolbar-actions { flex: 1 1 100%; }
  .page-toolbar .flt { flex-direction: column; align-items: stretch; gap: 4px; flex: 1 1 100%; }
  .page-toolbar select.input, .page-search { max-width: none; width: 100% !important; }
}

.sidebar-footer {
  padding: 10px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}

.sidebar-user {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: var(--r-sm); background: var(--bg2);
}
.sidebar-user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--accent-dim);
  color: var(--accent); font-weight: 700; display: flex; align-items: center;
  justify-content: center; font-size: .78rem; flex-shrink: 0;
}
.sidebar-user-info {
  display: flex; flex-direction: column; min-width: 0; flex: 1;
}
.sidebar-user-name {
  font-weight: 600; font-size: .78rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: .67rem; color: var(--text2);
}

.main-content {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  height: calc(100vh - var(--banner-h, 0px)); overflow-y: auto;
}

.top-bar {
  height: 52px; padding: 0 24px; background: var(--bg);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; flex-shrink: 0;
  transition: background var(--tr), border-color var(--tr);
}
.top-bar-title { font-weight: 700; font-size: var(--fs-page); color: var(--text); }
.top-bar-actions { display: flex; align-items: center; gap: 12px; }

.content-body {
  flex: 1; padding: 16px 20px; overflow-y: auto;
}

/* One width for every section of the panel: full on a laptop, capped on a
   wide monitor so lines and tables stay readable */
.layout-container {
  max-width: 1440px; margin: 0 auto; width: 100%;
}

.split-layout {
  display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start;
}
@media (min-width: 768px) {
  .split-layout { grid-template-columns: 1fr 1fr; }
}

/* Responsive grids for dashboards: KPI cards wrap, two columns become one */
.grid-kpi { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.grid-2 > *, .grid-kpi > * { min-width: 0; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

.catalog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.menu-btn {
  display: none; background: none; border: none; cursor: pointer;
  width: 40px; height: 40px; border-radius: var(--r-sm);
  align-items: center; justify-content: center; color: var(--text);
}
.menu-btn:hover { background: var(--bg2); }

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
  .sidebar {
    position: fixed; left: -260px;
    top: var(--banner-h, 0px); height: calc(100vh - var(--banner-h, 0px));
    z-index: 1001;
  }
  .sidebar.open {
    left: 0; box-shadow: var(--shadow-lg);
  }
  /* Dimmed page behind the open menu; a tap on it closes the menu */
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(13,20,33,.4);
  }
  .menu-btn { display: flex; }
  .top-bar { padding: 0 16px; height: 56px; }
  /* Long section names wrap to two lines instead of «Пользовател…» */
  .top-bar-title {
    font-size: .9rem; line-height: 1.2; min-width: 0; flex: 1; margin: 0 8px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .top-bar-actions { gap: 6px; }
  .btn-header-pill { white-space: nowrap; }
  .btn-header-pill span { display: none; }   /* icon only on phones */
  .content-body { padding: 16px 12px; }
  
  .btn {
    height: 38px;
    padding: 8px 14px;
    font-size: .84rem;
  }
  .btn-sm {
    height: 30px;
    padding: 4px 10px;
    font-size: .75rem;
  }
  .accent-menu-trigger {
    width: 22px;
    height: 22px;
  }
  .accent-dot {
    width: 18px;
    height: 18px;
  }
  th, td {
    padding: 8px 10px;
  }
}

/* ── 4. Pico CSS Overrides ──────────────── */
:root {
  --pico-primary: var(--accent);
  --pico-primary-hover: var(--accent-h);
  --pico-primary-focus: var(--accent-dim);
  --pico-primary-inverse: #fff;
  --pico-border-radius: var(--r-input);
  --pico-font-family: var(--font);
}

/* ── 5. Utility Classes ──────────────────── */
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }

/* ── 6. Accent Dots Menu, Lang Toggle, Theme Toggle ── */
.accent-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}
.accent-menu-trigger {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; position: relative; transition: transform .18s ease, box-shadow .18s ease;
  outline: none; padding: 0; background: none;
}
.accent-menu-trigger::before {
  content: ''; position: absolute; inset: 1px; border-radius: 50%;
  background: var(--accent);
  background-image: radial-gradient(circle at 35% 30%, rgba(255,255,255,.55) 0%, rgba(255,255,255,.15) 40%, transparent 70%),
                     radial-gradient(circle at 65% 75%, rgba(0,0,0,.18) 0%, transparent 50%);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.15), inset 0 2px 3px rgba(255,255,255,.25);
  transition: background var(--tr);
}
.accent-menu-trigger:hover { transform: scale(1.18); }
.accent-menu-trigger.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent), 0 2px 8px rgba(0,0,0,.18);
}

.accent-dots-list {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-width .2s cubic-bezier(0.4, 0, 0.2, 1), opacity .2s ease;
}
.accent-menu.open .accent-dots-list {
  max-width: 150px;
  opacity: 1;
  pointer-events: auto;
}

.accent-dot {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent;
  cursor: pointer; position: relative; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  outline: none; padding: 0; background: none;
}
.accent-dot::before {
  content: ''; position: absolute; inset: 1px; border-radius: 50%;
  background: var(--dot-color);
  background-image: radial-gradient(circle at 35% 30%, rgba(255,255,255,.55) 0%, rgba(255,255,255,.15) 40%, transparent 70%),
                     radial-gradient(circle at 65% 75%, rgba(0,0,0,.18) 0%, transparent 50%);
  box-shadow: inset 0 -2px 4px rgba(0,0,0,.15), inset 0 2px 3px rgba(255,255,255,.25);
}
.accent-dot:hover { transform: scale(1.18); }
.accent-dot.active {
  border-color: var(--dot-color);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--dot-color), 0 2px 8px rgba(0,0,0,.18);
}
.accent-dot[data-accent="indigo"]  { --dot-color: #3261ec; }
.accent-dot[data-accent="emerald"] { --dot-color: #0d9488; }
.accent-dot[data-accent="violet"]  { --dot-color: #7c3aed; }
.accent-dot[data-accent="sunset"]  { --dot-color: #f43f5e; }
[data-theme="dark"] .accent-dot[data-accent="indigo"]  { --dot-color: #4b74f0; }
[data-theme="dark"] .accent-dot[data-accent="emerald"] { --dot-color: #2dd4bf; }
[data-theme="dark"] .accent-dot[data-accent="violet"]  { --dot-color: #a78bfa; }
[data-theme="dark"] .accent-dot[data-accent="sunset"]  { --dot-color: #fb7185; }

.lang-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; padding: 0 10px; border-radius: var(--r-pill);
  font-family: var(--font); font-size: .72rem; font-weight: 700;
  letter-spacing: .04em; color: var(--text2); background: var(--bg2);
  border: 1px solid var(--border); cursor: pointer;
  transition: background var(--tr), color var(--tr), border-color var(--tr);
  text-transform: uppercase;
}
.lang-toggle:hover { background: var(--bg3); color: var(--text); border-color: var(--border-h); }

.btn-header-pill {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; padding: 0 12px; border-radius: var(--r-pill);
  font-family: var(--font); font-size: .72rem; font-weight: 700;
  letter-spacing: .04em; color: var(--text2); background: var(--bg2);
  border: 1px solid var(--border); cursor: pointer;
  transition: background var(--tr), color var(--tr), border-color var(--tr);
  text-transform: uppercase;
  gap: 6px;
  outline: none;
}
.btn-header-pill:hover { background: var(--bg3); color: var(--text); border-color: var(--border-h); }
.btn-header-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-header-pill.active:hover { background: var(--accent-h); }
.btn-header-pill svg, .btn-header-pill i { width: 14px; height: 14px; stroke-width: 2.2px; }

.theme-toggle {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg2);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background var(--tr), border-color var(--tr), color var(--tr);
  color: var(--text2); padding: 0;
}
.theme-toggle:hover { background: var(--bg3); border-color: var(--border-h); color: var(--text); }
.icon-sun  { display: none !important; }
.icon-moon { display: inline-block !important; }
[data-theme="dark"] .icon-sun  { display: inline-block !important; }
[data-theme="dark"] .icon-moon { display: none !important; }

/* ── 7. Codes Grid & Panel Cards ──────────── */
.codes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 16px;
}
.codes-grid .code-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr), background var(--tr);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.codes-grid .code-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-h);
}
.codes-grid .code-card.inactive {
  opacity: 0.6;
  background: var(--bg2);
}
.codes-grid .code-card .code-val {
  font-family: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 1px;
}
.codes-grid .code-card .code-meta {
  font-size: 0.85rem;
  color: var(--text2);
}
.codes-grid .code-card .btn-ghost {
  border-color: var(--border);
  color: var(--text2);
}
.codes-grid .code-card .btn-ghost:hover {
  background: var(--bg2);
  color: var(--text);
  border-color: var(--border-h);
}

/* ── 8. Stat / Metric Cards ───────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-card-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text3);
}
.stat-card-value {
  font-size: 1.75rem; font-weight: 700; color: var(--text); line-height: 1.1;
}
.stat-card-sub {
  font-size: .75rem; color: var(--text2);
}
.stat-card-sub.positive { color: var(--accent); }
.stat-card-sub.negative { color: var(--danger); }

/* ── 9. Progress Bar ─────────────────────── */
.progress-bar-wrap {
  display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px;
}
.progress-bar-header {
  display: flex; justify-content: space-between;
  font-size: .8rem; color: var(--text2);
}
.progress-bar-track {
  height: 6px; background: var(--bg2);
  border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 3px; transition: width .4s ease;
}
.progress-bar-fill.success { background: var(--accent); }
.progress-bar-fill.danger  { background: var(--danger); }

/* ── 10. Toast ───────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 10000; pointer-events: none;
}
.toast-msg {
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: 12px 18px; border-radius: var(--r-input);
  font-size: .88rem; font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
  pointer-events: auto;
  min-width: 250px; max-width: 400px;
  animation: toastIn .2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity .2s ease, transform .2s ease;
}
.toast-msg.success { border-left-color: var(--accent); }
.toast-msg.error   { border-left-color: var(--danger); }
.toast-msg.warning { border-left-color: #f59e0b; }
.toast-msg.fadeOut { opacity: 0; transform: translateY(8px); }
@keyframes toastIn {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── 11. Confirm Dialog ──────────────────── */
.confirm-bg {
  position: fixed; inset: 0; background: rgba(13,20,33,.45);
  backdrop-filter: blur(4px); z-index: 10005;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: confirmFadeIn .2s ease forwards;
}
.confirm-box {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 24px; max-width: 400px; width: 100%;
  box-shadow: var(--shadow-modal);
  animation: confirmScaleIn .2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  color: var(--text);
}
.confirm-title  { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.confirm-body   { font-size: .9rem; margin-bottom: 20px; color: var(--text2); line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }
@keyframes confirmFadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes confirmScaleIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── 12. Empty State ─────────────────────── */
.tbl-empty { text-align: center; padding: 2rem 1rem; color: var(--text2); font-size: .88rem; }
td.tbl-empty, td.empty-state { text-align: center !important; }
.empty-state {
  text-align: center; padding: 3rem 1rem;
  color: var(--text2); font-size: .9rem;
}
.empty-state-icon {
  font-size: 2.5rem; margin-bottom: .75rem; opacity: .4;
}

/* ── 13. Section header ──────────────────── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.section-title {
  font-size: var(--fs-title); font-weight: 700; color: var(--text);
}

/* ── 14. Warn/info badge variants ────────── */
.badge-warn    { background: rgba(245,158,11,.12); color: #b45309; }
.badge-info    { background: var(--accent-dim); color: var(--accent); }
.badge-overdue { background: var(--danger-dim); color: var(--danger); }
.badge-pending { background: var(--accent-dim); color: var(--accent); }
.badge-done    { background: var(--accent-dim);  color: var(--accent);  }
[data-theme="dark"] .badge-warn { color: #fbbf24; }

/* ══ Dashboard (static/js/dashboard.js) ═══════════════════════════════════
   Chart colours are fixed status tokens, validated for colour-blind readers
   (blue / red, both themes); they do not follow the accent theme. */
:root {
  --chart-pass: #3261ec; --chart-fail: #f04438; --chart-wait: #c8d3e8;
  --chart-grid: #edf1f6;
}
[data-theme="dark"] {
  --chart-pass: #4b74f0; --chart-fail: #e85d5d; --chart-wait: #2a3d5e;
  --chart-grid: #1b2a40;
}
.dsh-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
/* summary, buttons and filters stay on top while the dashboard scrolls */
.dsh-sticky {
  /* top: minus the page padding — the strip covers it, nothing shows above */
  position: sticky; top: -16px; z-index: 6; background: var(--bg2);
  margin: -16px -20px 16px; padding: 12px 20px 12px; border-bottom: 1px solid transparent;
  transition: border-color var(--tr), box-shadow var(--tr);
}
.dsh-sticky.stuck { border-bottom-color: var(--border); box-shadow: 0 6px 12px -10px rgba(0,0,0,.25); }
/* phone: the filters take several lines there, so they scroll with the page */
@media (max-width: 768px) {
  .dsh-sticky { position: static; margin: 0 0 16px; padding: 0; }
}
.dsh-summary { font-size: .82rem; color: var(--text2); }
.dsh-actions { display: flex; gap: 6px; flex-wrap: wrap; }
#dash-root { display: flex; flex-direction: column; gap: 14px; transition: opacity .15s; }
#dash-root.dsh-loading { opacity: .55; pointer-events: none; }
.dsh-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 16px 18px; min-width: 0;
}
.dsh-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dsh-card-head h3 { font-size: var(--fs-title); font-weight: 700; color: var(--text); margin: 0; }
.dsh-muted { color: var(--text3); font-weight: 400; font-size: .8rem; }
.dsh-hint { font-size: .75rem; }
.dsh-empty { color: var(--text2); font-size: .88rem; padding: 18px 0; text-align: center; }
.dsh-fail-text { color: var(--danger); }

/* Filters: one row above everything they scope */
.dsh-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
select.input.dsh-select { height: 36px; width: auto; min-width: 150px; max-width: 200px; padding: 0 30px 0 12px; font-size: .84rem; }
.dsh-seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.dsh-seg button {
  border: 0; background: none; color: var(--text2); font: 600 .8rem var(--font);
  padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.dsh-seg button.on { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow-sm); }

/* Headline tiles: label on one line, the number, one line of context */
.dsh-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.dsh-kpi { padding: 14px 16px; }
.dsh-kpi-label, .dsh-kpi-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsh-kpi-label { font-size: var(--fs-small); font-weight: 600; color: var(--text2); }
.dsh-kpi-line { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.dsh-spark { width: 64px; height: 28px; flex-shrink: 0; margin-bottom: 8px; overflow: visible; }
.dsh-spark path { fill: none; stroke: var(--chart-pass); stroke-width: 2; vector-effect: non-scaling-stroke;
  stroke-linejoin: round; stroke-linecap: round; opacity: .8; }
.dsh-kpi.urgent .dsh-kpi-value, .dsh-kpi.urgent .dsh-kpi-sub { color: var(--danger); }
.dsh-kpi-value { font-size: 1.85rem; font-weight: 700; color: var(--text); line-height: 1.15; margin: 6px 0 4px; letter-spacing: -.02em; }
.dsh-kpi-sub { font-size: .76rem; color: var(--text3); }

.dsh-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dsh-stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1180px) { .dsh-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1000px) {
  .dsh-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dsh-row { display: flex; flex-direction: column; align-items: stretch; }
  .dsh-stack { display: contents; }
}
.dsh-cell { min-width: 0; }
@media (max-width: 600px) {
  select.input.dsh-select { flex: 1 1 100%; max-width: none; }
  .dsh-seg { width: 100%; }
  .dsh-seg button { flex: 1; padding: 6px 6px; }
  .dsh-kpi-value { font-size: 1.6rem; }
  .dsh-hint { display: none; }
}

/* Legend swatches */
.dsh-legend { display: flex; gap: 14px; font-size: .78rem; color: var(--text2); }
.dsh-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dsh-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.dsh-legend .dsh-sw { margin-right: 0; }
.dsh-sw.pass { background: var(--chart-pass); }
.dsh-sw.fail { background: var(--chart-fail); }
.dsh-sw.wait { background: var(--chart-wait); }

/* Ratings: vertical columns with a fixed plot height, names on the X axis */
#ratings-chart-container .dsh-legend { margin-bottom: 8px; }
.rt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.rt-plot { --rt-h: 200px; --rt-top: 20px; position: relative; display: flex; gap: 6px;
  padding: var(--rt-top) 0 0 34px; }
.rt-grid { position: absolute; left: 34px; right: 0; top: var(--rt-top); height: var(--rt-h);
  display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.rt-grid i { position: relative; display: block; border-top: 1px solid var(--chart-grid); }
.rt-grid i::before { content: attr(data-v); position: absolute; right: calc(100% + 6px); top: -.55em;
  font-size: var(--fs-caption); font-style: normal; color: var(--text3); }
.rt-threshold { position: absolute; left: 34px; right: 0; border-top: 1.5px dashed var(--text2);
  pointer-events: none; z-index: 1; }
.rt-threshold span { position: absolute; right: 0; top: -1.5em; font-size: var(--fs-caption);
  color: var(--text2); background: var(--bg-card); padding: 0 4px; border-radius: 4px; }
.rt-col { flex: 1 0 72px; max-width: 104px; display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.rt-bar { height: var(--rt-h); display: flex; align-items: flex-end; justify-content: center; position: relative; }
.rt-bar > div { position: relative; width: min(36px, 70%); border-radius: 6px 6px 2px 2px; }
.rt-bar > .pass { background: var(--chart-pass); }
.rt-bar > .fail { background: var(--chart-fail); }
.rt-val { position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%);
  font-size: var(--fs-caption); font-weight: 600; color: var(--text); white-space: nowrap; }
.rt-name { margin-top: 6px; text-align: center; font-size: var(--fs-caption); line-height: 1.25;
  color: var(--text2); overflow: hidden; }
.rt-name b { display: block; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-name span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) { .rt-plot { --rt-h: 160px; } }

/* Column chart: stacked «Сдали» (bottom) + «Не сдали», hairline grid */
.dsh-chart { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.dsh-yaxis { display: flex; flex-direction: column; justify-content: space-between; height: 160px;
  font-size: .7rem; color: var(--text3); text-align: right; font-variant-numeric: tabular-nums; }
.dsh-yaxis span { transform: translateY(-50%); }
.dsh-yaxis span:first-child { transform: none; }
.dsh-yaxis span:last-child { transform: translateY(0); }
.dsh-plot { position: relative; min-width: 0; }
.dsh-grid { position: absolute; inset: 0 0 22px 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.dsh-grid i { border-top: 1px solid var(--chart-grid); }
.dsh-grid i:last-child { border-top-color: var(--border-h); }
.dsh-cols { position: relative; display: flex; align-items: stretch; gap: 2px; }
.dsh-col { flex: 1; min-width: 0; display: flex; flex-direction: column; cursor: default; outline: none; }
.dsh-bar { height: 160px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.dsh-bar > div { width: min(70%, 28px); min-height: 2px; }
.dsh-bar > div:first-child { border-radius: 4px 4px 0 0; }
.dsh-seg-pass { background: var(--chart-pass); }
.dsh-seg-fail { background: var(--chart-fail); }
.dsh-col.hover .dsh-bar, .dsh-col:focus-visible .dsh-bar { background: var(--bg2); border-radius: 6px; }
.dsh-xlab { height: 22px; line-height: 22px; font-size: .68rem; color: var(--text3); white-space: nowrap; text-align: center; overflow: visible; }
.dsh-tip {
  position: absolute; top: 0; transform: translate(-50%, -8px); z-index: 5; pointer-events: none;
  background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-md);
  border-radius: 10px; padding: 8px 10px; font-size: .78rem; color: var(--text); white-space: nowrap;
}
.dsh-tip b { display: block; margin-bottom: 4px; }

/* Assignments meter */
.dsh-meter { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; background: var(--bg2); }
.dsh-meter i.pass { background: var(--chart-pass); }
.dsh-meter i.wait { background: var(--chart-wait); }
.dsh-meter i.fail { background: var(--chart-fail); }
.dsh-assign { margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.dsh-assign div { display: flex; justify-content: space-between; align-items: center; font-size: .86rem; }
.dsh-assign dt { color: var(--text2); }
.dsh-assign dd { margin: 0; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.dsh-assign-total { border-top: 1px solid var(--border); padding-top: 8px; }

/* Lists: attention and recent results */
.dsh-list { list-style: none; margin: 0; padding: 0; }
.dsh-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.dsh-list li:first-child { border-top: 0; padding-top: 2px; }
.dsh-status { display: inline-flex; flex-shrink: 0; }
.dsh-status.pass { color: var(--chart-pass); }
.dsh-status.fail { color: var(--chart-fail); }
.dsh-status.late { color: var(--warning); }
.dsh-list-main { flex: 1; min-width: 0; }
.dsh-list-sub { font-size: .78rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsh-list-side { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; }
.dsh-list-side b { font-size: .88rem; color: var(--text); }
.dsh-list-side span { font-size: .72rem; color: var(--text3); white-space: nowrap; }
.dsh-link { background: none; border: 0; padding: 0; font: 600 .88rem var(--font); color: var(--text); cursor: pointer; text-align: left;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dsh-link:hover { color: var(--accent); text-decoration: underline; }

/* Breakdown table */
.dsh-table { margin: 0; }
.dsh-table table { width: 100%; }
.dsh-table th, .dsh-table td { width: auto !important; text-align: left; }
.dsh-table th.num, .dsh-table td.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dsh-table th button { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.dsh-table tbody tr { cursor: pointer; }
.dsh-table tbody tr:hover, .dsh-table tbody tr:focus-visible { background: var(--bg2); outline: none; }
.dsh-table tbody tr.on { background: var(--accent-dim); }
.dsh-td-text { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-table td.nowrap { white-space: nowrap; }
.dsh-cellbar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.dsh-cellbar .num { width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.dsh-cellbar i { flex: 1; height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.dsh-cellbar b { display: block; height: 100%; background: var(--chart-pass); border-radius: 3px; }
.dsh-more { margin-top: 10px; }

/* Dashboard, second version: attention, attempts, distribution, topics */
.dsh-count { font-weight: 500; color: var(--text3); margin-left: 2px; }
.dsh-help { background: none; border: 0; color: var(--text3); cursor: help; padding: 2px; display: inline-flex; }
.dsh-help:hover { color: var(--text2); }
.dsh-note { font-size: .78rem; color: var(--text3); margin: -6px 0 6px; }
.dsh-list-title { line-height: 1.3; }
.dsh-reason { font-size: .75rem; color: var(--warning); margin-top: 2px; }
.dsh-reason.urgent { color: var(--danger); }
.dsh-rank { width: 20px; flex-shrink: 0; text-align: center; font-size: .8rem; font-weight: 700; color: var(--text3); }
.dsh-list li { align-items: flex-start; }
.dsh-status { margin-top: 2px; }
.dsh-attempt { display: inline-block; font-size: .68rem; font-weight: 600; padding: 1px 6px; border-radius: 6px;
  background: var(--bg2); color: var(--text2); vertical-align: 1px; white-space: nowrap; }
.dsh-attempt.down { background: var(--danger-dim); color: var(--danger); }
.dsh-attempt.flat { background: var(--warning-dim); color: var(--warning); }
.dsh-attempt.up { background: var(--success-dim); color: var(--success); }
.dsh-qtext { font-size: .84rem; font-weight: 600; color: var(--text); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Histogram of scores with the pass threshold */
.dsh-hist { position: relative; display: flex; gap: 3px; align-items: stretch; }
.dsh-hcol { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dsh-hbar { height: 84px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px solid var(--border-h); }
.dsh-hbar > div { width: 100%; border-radius: 4px 4px 0 0; }
.dsh-hbar .pass { background: var(--chart-pass); }
.dsh-hbar .fail { background: var(--chart-fail); }
.dsh-threshold { position: absolute; top: -4px; bottom: 22px; border-left: 2px solid var(--text); opacity: .55; }

/* Weak topics: label, bar, value */
.dsh-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dsh-bars li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: .84rem; }
.dsh-bars-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.dsh-bars-track { height: 6px; background: var(--bg2); border-radius: 3px; overflow: hidden; }
.dsh-bars-track b { display: block; height: 100%; background: var(--chart-pass); border-radius: 3px; }
.dsh-bars-val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.dsh-list-side b.dsh-reason { color: var(--warning); font-size: .8rem; margin: 0; white-space: nowrap; }
.dsh-list-side b.dsh-reason.urgent { color: var(--danger); }
.dsh-list li[title] { cursor: help; }

/* Which attempt a result is (utils.js → attemptChip) */
.attempt-chip { display: inline-block; font-size: .7rem; font-weight: 600; padding: 1px 6px; border-radius: 6px;
  background: var(--bg2); color: var(--text2); white-space: nowrap; vertical-align: 1px; margin-left: 4px; }
.attempt-chip.down { background: var(--danger-dim); color: var(--danger); }

/* Two fields side by side (one under the other on a phone) */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row > .field { margin-bottom: 0; min-width: 0; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

/* Shown on a computer only: things that do not work well on a phone */
@media (max-width: 768px) { .desk-only { display: none !important; } }

/* ── «Режим экрана»: full-screen slides for a wall screen or a projector ── */
body.scr-open { overflow: hidden; }
.scr { position: fixed; inset: 0; z-index: 3000; background: var(--bg2); color: var(--text);
  display: flex; flex-direction: column; font-size: clamp(16px, 1.25vw, 22px); }
.scr-progress { height: 4px; background: var(--border); flex-shrink: 0; }
.scr-progress i { display: block; height: 100%; width: 0; background: var(--accent); }
.scr.paused .scr-progress i { background: var(--text3); }
.scr-stage { flex: 1; min-height: 0; display: flex; padding: 3.5vh 4vw 2vh; cursor: pointer; }
.scr-slide { flex: 1; display: flex; flex-direction: column; gap: 3.5vh; min-width: 0; min-height: 0; overflow: hidden; }
.scr-fade { animation: scr-in .5s ease-out; }
@keyframes scr-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.scr-head { display: flex; align-items: baseline; gap: 1em; flex-wrap: wrap; }
.scr-head h2 { margin: 0; font-size: 2.2em; font-weight: 700; line-height: 1.15; }
.scr-head span { font-size: 1.1em; color: var(--text2); }
.scr-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2vh 1.6vw; }
.scr-kpis-4 { grid-template-columns: repeat(4, 1fr); }
.scr-kpi { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 2.4vh 1.6vw; }
.scr-kpi-label { font-size: 1em; color: var(--text2); }
.scr-kpi-value { font-size: 3.4em; font-weight: 700; line-height: 1.1; margin: .15em 0; font-variant-numeric: tabular-nums; }
.scr-kpis-4 .scr-kpi-value { font-size: 2.8em; }
.scr-kpi-sub { font-size: .95em; color: var(--text2); }
.scr-kpi.urgent .scr-kpi-value, .scr-kpi.urgent .scr-kpi-sub { color: var(--chart-fail); }
.scr-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 3vw; min-height: 0; }
.scr-cols h3 { margin: 0 0 .7em; font-size: 1.2em; color: var(--text2); font-weight: 600; }
.scr-list, .scr-rank, .scr-bars { list-style: none; margin: 0; padding: 0; }
.scr-list li { display: flex; align-items: center; gap: 1em; padding: .55em 0; border-bottom: 1px solid var(--border); }
.scr-dot { width: .7em; height: .7em; border-radius: 50%; flex-shrink: 0; background: var(--warning); }
.scr-dot.fail { background: var(--chart-fail); }
.scr-li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.scr-li-main b { font-size: 1.25em; }
.scr-li-main span { color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scr-li-side { font-weight: 600; white-space: nowrap; color: var(--warning); }
.scr-li-side.urgent { color: var(--chart-fail); }
.scr-rank { counter-reset: r; }
.scr-rank li { counter-increment: r; display: flex; gap: 1em; align-items: baseline; padding: .6em 0; border-bottom: 1px solid var(--border); font-size: 1.2em; }
.scr-rank li::before { content: counter(r); color: var(--text3); width: 1.2em; }
.scr-rank li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scr-rank b.pass { color: var(--chart-pass); }
.scr-rank b.fail { color: var(--chart-fail); }
.scr-bars li { margin-bottom: 1.1em; }
.scr-bar-label { display: flex; gap: 1em; justify-content: space-between; margin-bottom: .35em; }
.scr-bar-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scr-bar { height: .7em; border-radius: 99px; background: var(--border); overflow: hidden; }
.scr-bar i { display: block; height: 100%; border-radius: 99px; }
.scr-bar i.pass { background: var(--chart-pass); }
.scr-bar i.fail { background: var(--chart-fail); }
.scr-chart-wrap { flex: 1; min-height: 160px; display: flex; flex-direction: column; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--r-card); padding: 2.4vh 1.6vw; }
.scr-chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; margin-bottom: 1.5vh; }
.scr-chart-head h3 { margin: 0; font-size: 1.1em; color: var(--text2); font-weight: 600; }
.scr-chart-head span { font-size: .85em; color: var(--text2); display: inline-flex; align-items: center; gap: 4px; }
.scr-chart-head .dsh-sw { margin: 0 2px 0 10px; }
.scr-chart { flex: 1; min-height: 0; display: flex; align-items: stretch; gap: 3px; }
.scr-ccol { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.scr-cbar { flex: 1; display: flex; flex-direction: column-reverse; border-bottom: 1px solid var(--chart-grid); }
.scr-cbar i { display: block; }
.scr-cbar i.pass { background: var(--chart-pass); }
.scr-cbar i.fail { background: var(--chart-fail); }
.scr-ccol > span { height: 1.4em; padding-top: 4px; font-size: .7em; color: var(--text3); white-space: nowrap; overflow: visible; }
.scr-more, .scr-empty { color: var(--text2); margin: .6em 0 0; }
.scr-stage > .scr-empty { margin: auto; font-size: 1.3em; }
.scr-foot { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 10px 4vw 14px; font-size: 14px; color: var(--text2); }
.scr-dots { display: flex; gap: 6px; }
.scr-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-h); }
.scr-dots i.on { background: var(--accent); }
.scr-keys { margin-left: auto; margin-right: 8px; color: var(--text3); }

/* Phone notes: shown only where editing is hidden (see .desk-only) */
.phone-note { display: none; }
@media (max-width: 768px) {
  .phone-note { display: block; margin: 0 0 12px; padding: 10px 12px; border-radius: var(--r-input);
    background: var(--bg3); color: var(--text2); font-size: var(--fs-small); line-height: 1.45; }
  .phone-note-big { padding: 24px 16px; text-align: center; font-size: var(--fs-body); }
}
.phone-gate { position: fixed; inset: 0; z-index: 3000; background: var(--bg2); display: flex;
  align-items: center; justify-content: center; padding: 24px 16px; }
.phone-gate-box { max-width: 360px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text2); }
.phone-gate-box .ico { color: var(--accent); }
.phone-gate-box h2 { margin: 0; font-size: 1.25rem; color: var(--text); }
.phone-gate-box p { margin: 0 0 8px; line-height: 1.5; }
.phone-gate-box .btn { width: 100%; justify-content: center; }

/* Excel import: pictures that stayed links to other sites */
.upload-failed { margin-top: 10px; color: var(--text); font-size: var(--fs-small); line-height: 1.45; }
.upload-failed ul { margin: 6px 0 0; padding-left: 18px; max-height: 160px; overflow: auto; }
.upload-failed a { color: var(--accent); word-break: break-all; }

/* Excel import: the drop area */
.upload-area {
  border: 1.5px dashed var(--border-h); border-radius: var(--r-card); padding: 22px 16px;
  text-align: center; cursor: pointer; color: var(--text2); background: var(--bg2);
  transition: border-color var(--tr), background var(--tr);
}
.upload-area p { margin: 0 0 4px; font-weight: 600; color: var(--text); }
.upload-area small { font-size: var(--fs-caption); }
.upload-area.drag { border-color: var(--accent); background: var(--accent-dim); }
@media (hover: hover) { .upload-area:hover { border-color: var(--accent); } }

/* Tables: the same cells everywhere */
.cell-date { white-space: nowrap; font-size: var(--fs-small); color: var(--text2); }
.cell-name { font-weight: 600; min-width: 140px; }
.cell-muted { font-size: var(--fs-small); color: var(--text2); }
/* A long test name takes two lines at most; the full one is in the tooltip */
.cell-clamp {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-width: 160px; margin-bottom: 2px;
}
.cell-clamp:only-child { margin-bottom: 0; }
.cell-actions { text-align: right; white-space: nowrap; width: 1%; }
.cell-sub { display: block; font-size: var(--fs-caption); color: var(--text2); font-weight: 400; }
.act { width: 30px; height: 30px; padding: 0; color: var(--text2); }
.act + .act { margin-left: 2px; }
@media (hover: hover) { .act:hover { color: var(--accent); background: var(--accent-dim); } .act-danger:hover { color: var(--danger); background: var(--danger-dim); } }

/* Rows hidden by a search stay hidden whatever their own display is */
[hidden] { display: none !important; }

/* Side panel (drawer): forms to create or change something open on the
   right; the list stays visible on the left. Same markup as a window
   (.overlay / .modal-bg > .modal), plus the class «drawer». */
.overlay.drawer, .modal-bg.drawer {
  justify-content: flex-end; align-items: stretch;
  background: rgba(13,20,33,.28); backdrop-filter: none;
}
.drawer .modal {
  max-width: 480px; height: 100%; max-height: none; border-radius: 0;
  border-width: 0 0 0 1px; animation: drawerIn .2s ease;
}
.drawer .modal-head { padding: 16px 20px; }
.drawer .modal-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.drawer .modal-body > .s-field, .drawer .modal-body > .field { margin: 0; }
.drawer .modal-footer { border-radius: 0; }
@keyframes drawerIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 768px) { .drawer .modal { max-width: none; border-left: 0; } }

/* Steps of a form in a side panel */
.drawer-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.drawer-label { display: block; font-size: var(--fs-small); font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.drawer-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.drawer-label-row .drawer-label { margin: 0; }
.drawer-count { font-weight: 400; color: var(--text3); margin-left: 4px; }
.drawer-pair { display: grid; grid-template-columns: 1fr 120px; gap: 12px; }
.drawer-steps .input { width: 100%; margin: 0; }
.check-list {
  max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-input);
  background: var(--bg); padding: 4px;
}
.check-item { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; font-size: var(--fs-body); }
.check-item input { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
@media (hover: hover) { .check-item:hover { background: var(--bg2); } }
.check-list-empty { display: block; padding: 10px; color: var(--text3); font-size: var(--fs-small); }

/* Platform settings: one card per topic, the save bar always in view */
.stg-wrap { max-width: 760px; }
.stg-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-card); padding: 18px 20px; margin-bottom: 14px; }
.stg-card header { margin-bottom: 14px; }
.stg-card h3 { margin: 0; font-size: var(--fs-title); font-weight: 700; }
.stg-card header p { margin: 2px 0 0; font-size: var(--fs-small); color: var(--text2); }
.stg-fields { display: flex; flex-direction: column; gap: 14px; }
.stg-savebar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 -2px; padding: 12px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: 0 -4px 16px rgba(13,20,33,.06);
}
.stg-savebar span { font-size: var(--fs-small); color: var(--text2); }

/* ── Таблицы на телефоне: each row is a card, «caption — value» lines ──
   Captions come from the table head (utils.js → tableCaptions). The
   dashboard breakdown keeps its sortable table and scrolls sideways. */
@media (max-width: 768px) {
  .tbl-wrap:not(.dsh-table) { overflow: visible; border: 0; background: transparent; border-radius: 0; }
  .tbl-wrap:not(.dsh-table) table, .tbl-wrap:not(.dsh-table) tbody,
  table.results-table, table.results-table tbody { display: block; width: 100%; }
  .tbl-wrap:not(.dsh-table) thead, table.results-table thead { display: none; }
  .tbl-wrap:not(.dsh-table) tr, table.results-table tr {
    display: block; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 12px; padding: 8px 12px; margin-bottom: 8px;
  }
  .tbl-wrap:not(.dsh-table) td, table.results-table td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 5px 0; border: 0; text-align: right; min-width: 0; width: auto;
  }
  .tbl-wrap:not(.dsh-table) td::before, table.results-table td::before {
    content: attr(data-label); flex-shrink: 0; max-width: 45%; text-align: left;
    font-size: var(--fs-small); color: var(--text2); font-weight: 500;
  }
  /* the person or the name leads the card */
  .tbl-wrap:not(.dsh-table) td.cell-name, .tbl-wrap:not(.dsh-table) td:first-child:not([colspan]):not(.cell-date):not(.cell-rank) {
    display: block; text-align: left; font-size: var(--fs-body); font-weight: 600;
    padding-bottom: 6px; margin-bottom: 2px; border-bottom: 1px solid var(--border);
  }
  .tbl-wrap:not(.dsh-table) td.cell-name::before,
  .tbl-wrap:not(.dsh-table) td:first-child:not([colspan]):not(.cell-date):not(.cell-rank)::before { content: none; }
  .tbl-wrap:not(.dsh-table) td > .cell-clamp, .tbl-wrap:not(.dsh-table) td > div { min-width: 0; text-align: right; }
  /* actions: a row of buttons at the bottom right, no caption */
  .tbl-wrap:not(.dsh-table) td[data-label=""], table.results-table td[data-label=""] { justify-content: flex-end; padding-top: 6px; }
  .tbl-wrap:not(.dsh-table) td[data-label=""]::before, table.results-table td[data-label=""]::before { content: none; }
  .tbl-wrap:not(.dsh-table) td:empty, table.results-table td:empty { display: none; }
  /* «Нет данных», «Ничего не найдено» */
  .tbl-wrap:not(.dsh-table) td[colspan], table.results-table td[colspan] { display: block; text-align: center; }
  .tbl-wrap:not(.dsh-table) td[colspan]::before, table.results-table td[colspan]::before { content: none; }
  .tbl-wrap:not(.dsh-table) tr:hover td { background: none; }
}
.cell-rank { font-weight: 700; color: var(--text3); width: 1%; }
@media (max-width: 768px) {
  /* rating: the place is a small number in the corner, the name leads */
  .tbl-wrap:not(.dsh-table) tr { position: relative; }
  .tbl-wrap:not(.dsh-table) td.cell-rank {
    position: absolute; top: 8px; right: 12px; display: block; padding: 0; border: 0; width: auto;
    font-size: var(--fs-small);
  }
  .tbl-wrap:not(.dsh-table) td.cell-rank::before { content: '№ '; font-weight: 400; }
  .tbl-wrap:not(.dsh-table) td.cell-rank + td.cell-name { padding-right: 40px; }
  /* the results window of a test: the person leads the card too */
  table.results-table td:first-child:not([colspan]) {
    display: block; text-align: left; font-weight: 600; padding-bottom: 6px; margin-bottom: 2px;
    border-bottom: 1px solid var(--border); background: none;
  }
  table.results-table td:first-child:not([colspan])::before { content: none; }
  table.results-table td { background: none !important; }
  .tbl-wrap:not(.dsh-table) td[colspan], table.results-table td[colspan] { width: 100%; }
}
@media (max-width: 768px) {
  .tbl-wrap:not(.dsh-table) td, table.results-table td { width: auto !important; max-width: none; }
  .tbl-wrap:not(.dsh-table) td.cell-rank { width: auto !important; }
}

/* A protocol read on the site (HTML from services/pdf.py, «pr-» classes) */
.protocol-modal { max-width: 820px; }
.protocol-page { font-size: var(--fs-body); line-height: 1.55; color: var(--text); }
.protocol-page .pr-title { text-align: center; font-size: 1.05rem; letter-spacing: .04em; margin: 0 0 12px; }
.protocol-page h3 { font-size: var(--fs-title); margin: 18px 0 8px; }
.pr-meta { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.pr-meta th { text-align: left; width: 32%; padding: 5px 10px 5px 0; color: var(--text2); font-weight: 600; vertical-align: top; }
.pr-meta td { padding: 5px 0; }
.pr-meta tr:hover td { background: none; }
.pr-note, .pr-small { font-size: var(--fs-small); color: var(--text2); }
.pr-score { font-size: 1.05rem; font-weight: 700; margin: 10px 0 2px; }
.pr-score.pass { color: var(--success); }
.pr-score.fail { color: var(--danger); }
.pr-list { padding-left: 20px; margin: 0; }
.pr-list li { margin-bottom: 8px; }
ul.pr-list { list-style: none; padding-left: 0; }
.pr-wrong { color: var(--danger); }
.pr-right { color: var(--success); }
.pr-flag { color: var(--warning); font-size: var(--fs-small); }
.pr-conclusion { white-space: normal; }
@media (max-width: 768px) {
  .protocol-modal { max-height: 100%; height: 100%; border-radius: 0; }
  .pr-meta th, .pr-meta td { display: block; width: 100%; padding: 2px 0; }
  .pr-meta th { padding-top: 8px; }
}
.confirm-word { display: block; margin: 12px 0 4px; font-size: var(--fs-small); color: var(--text2); }
.confirm-word .input { margin-top: 6px; width: 100%; }
.confirm-list { margin: 8px 0; padding-left: 20px; }
.confirm-list li { margin: 2px 0; }
.archived-chip { display: inline-block; font-size: var(--fs-caption); color: var(--text2); background: var(--bg2);
  border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px; margin-left: 6px; font-weight: 500; }
.archive-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--text2);
  cursor: pointer; user-select: none; white-space: nowrap; }
.archive-toggle input { accent-color: var(--accent); }

/* ── Журнал действий (static/js/journal.js) ─────────────────────────── */
.jr-action { display: inline-block; font-size: var(--fs-small); font-weight: 600; white-space: nowrap; }
.jr-action.jr-ok { color: var(--accent); }
.jr-action.jr-warn { color: var(--warning); }
.jr-action.jr-danger { color: var(--danger); }
.jr-type { display: block; font-size: var(--fs-caption); color: var(--text2); }
.jr-details { font-size: var(--fs-small); max-width: 460px; overflow-wrap: anywhere; }
.jr-details b { font-weight: 600; }
.jr-none { color: var(--text2); font-style: italic; }
.jr-arrow { color: var(--text2); }
.jr-count { font-size: var(--fs-small); color: var(--text2); white-space: nowrap; }
.jr-more-wrap { text-align: center; margin-top: 12px; }
.jr-note { font-size: var(--fs-caption); color: var(--text2); margin-top: 12px; }
@media (max-width: 768px) {
  /* journal: the details are several lines, under their caption */
  .tbl-wrap:not(.dsh-table) td.jr-details { display: block; text-align: left; max-width: none; }
  .tbl-wrap:not(.dsh-table) td.jr-details::before { display: block; max-width: none; margin-bottom: 2px; }
  .tbl-wrap:not(.dsh-table) td.jr-details > div { text-align: left; }
}

/* ── Конструктор дашборда (static/js/builder.js) ────────────────────── */
.bld { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; align-items: start; }
.bld-main { position: relative; min-width: 0; }
.bld-canvas { position: relative; background: var(--bg); border: 1px dashed var(--border); border-radius: var(--r-card);
  padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.bld-bands { display: flex; flex-direction: column; gap: 12px; }
.bld-bands .dsh-row, .bld-bands .dsh-stack { gap: 12px; }
.bld-filters { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--r-sm);
  background: var(--bg2); color: var(--text2); font-size: var(--fs-small); }
.bld-empty { padding: 40px 16px; text-align: center; color: var(--text2); font-size: var(--fs-small); }
.bld-tile { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
  cursor: grab; user-select: none; touch-action: none; display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow var(--tr), opacity var(--tr); }
@media (hover: hover) { .bld-tile:hover { box-shadow: var(--shadow-sm); border-color: var(--accent-dim); } }
.bld-tile-head { display: flex; align-items: center; gap: 6px; font-size: var(--fs-small); min-width: 0; }
.bld-tile-head b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bld-tile-head > .ico { color: var(--accent); flex-shrink: 0; }
.bld-grip { color: var(--text3); display: inline-flex; flex-shrink: 0; }
.bld-tools { margin-left: auto; display: inline-flex; gap: 0; flex-shrink: 0; }
.bld-tools .btn-icon { width: 28px; height: 28px; }
.bld-tile-hint { font-size: var(--fs-caption); color: var(--text2); line-height: 1.35; }
.bld-sk-lines, .bld-sk-kpis, .bld-sk-bars { flex: 1; display: flex; gap: 6px; min-height: 0; }
.bld-sk-lines { flex-direction: column; justify-content: flex-start; padding-top: 4px; }
.bld-sk-lines i { display: block; height: 8px; border-radius: 4px; background: var(--bg2); }
.bld-sk-lines i:nth-child(2n) { width: 80%; } .bld-sk-lines i:nth-child(3n) { width: 60%; }
.bld-sk-kpis i { flex: 1; height: 22px; border-radius: 6px; background: var(--bg2); }
.bld-sk-bars { align-items: flex-end; min-height: 48px; }
.bld-sk-bars i { flex: 1; border-radius: 3px 3px 0 0; background: var(--bg2); }
.bld-dragging { opacity: .35; }
.bld-ghost { position: fixed; top: 0; left: 0; z-index: 1000; pointer-events: none; opacity: .92;
  box-shadow: 0 12px 30px rgba(13,20,33,.22); transform-origin: 0 0; }
body.bld-grabbing, body.bld-grabbing * { cursor: grabbing !important; }
.bld-drop { position: absolute; z-index: 5; height: 4px; border-radius: 2px; background: var(--accent);
  pointer-events: none; }
.bld-drop span { position: absolute; left: 50%; top: -6px; transform: translate(-50%, -100%); white-space: nowrap;
  background: var(--accent); color: #fff; font-size: var(--fs-caption); font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.bld-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0;
  border-radius: var(--r-card); transition: background var(--tr), outline-color var(--tr); outline: 2px dashed transparent; }
.bld-side.over { background: var(--accent-dim); outline-color: var(--accent); }
.bld-side h4 { font-size: var(--fs-small); font-weight: 600; color: var(--text2); margin: 4px 0 0; }
.bld-tray { display: flex; flex-direction: column; gap: 6px; }
.bld-chip { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 10px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 10px; font-size: var(--fs-small); cursor: grab; user-select: none; touch-action: none; }
.bld-chip-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bld-chip .btn { padding: 4px 8px; }
.bld-muted { font-size: var(--fs-small); color: var(--text2); margin: 0; }
.bld-help { font-size: var(--fs-small); color: var(--text2); background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r-card); padding: 12px 14px; }
.bld-help p { margin: 0 0 8px; line-height: 1.45; } .bld-help p:last-child { margin: 0; }
.bld-help b { color: var(--text); font-weight: 600; }
.bld-state { font-size: var(--fs-small); color: var(--text2); white-space: nowrap; }
.bld-state.warn { color: var(--warning); font-weight: 600; }
.bld-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warning);
  margin-left: 6px; vertical-align: middle; }
.bld-slides { display: flex; flex-direction: column; gap: 8px; }
.bld-slide { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 12px; cursor: grab; user-select: none; touch-action: none; }
.bld-slide > .ico { color: var(--accent); flex-shrink: 0; }
.bld-slide.off { opacity: .55; }
.bld-slide.off > .ico { color: var(--text3); }
.bld-slide-no { width: 22px; text-align: center; font-weight: 700; color: var(--text2); flex-shrink: 0; }
.bld-slide-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bld-slide-text b { font-weight: 600; font-size: var(--fs-body); }
.bld-slide-text span { font-size: var(--fs-caption); color: var(--text2); }
.bld-slide .bld-tools { margin-left: 0; }
.bld-switch { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-small); color: var(--text2);
  cursor: pointer; white-space: nowrap; }
.bld-switch input { accent-color: var(--accent); width: 16px; height: 16px; }
.bld-seconds { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: var(--fs-small); color: var(--text2); }
.bld-seconds .input { width: 90px; }
@media (max-width: 1180px) { .bld { grid-template-columns: minmax(0, 1fr) 230px; } }
/* an empty column of a two-column row: a place to drop a block */
.bld-bands .dsh-stack:empty { min-height: 90px; border: 1px dashed var(--border); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; }
.bld-bands .dsh-stack:empty::before { content: 'Пустая колонка — перетащите сюда блок'; font-size: var(--fs-caption); color: var(--text3); }

/* A column of check boxes (Результаты: выбрать и удалить) */
th.cell-check, td.cell-check { width: 1%; padding-right: 0; }
.cell-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }

/* Date picker dialog (pickDate in utils.js) */
.date-pick-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.date-pick-err   { color: var(--danger); font-size: var(--fs-small); margin-top: 6px; }
.confirm-box .date-pick-err + .confirm-actions,
.confirm-box .date-pick-quick + .confirm-actions { margin-top: 18px; }

/* ── Поле даты и календарь (utils.js → dateField) — вместо календаря браузера ── */
.date-wrap { position: relative; display: block; }
.date-wrap .date-input { padding-right: 38px; font-variant-numeric: tabular-nums; }
.date-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center; border: 0; background: none;
  color: var(--text2); border-radius: var(--r-sm); cursor: pointer; }
@media (hover: hover) { .date-btn:hover { background: var(--bg2); color: var(--accent); } }
.cal-pop { position: fixed; z-index: 10010; width: 284px; padding: 10px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(13,20,33,.18); }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.cal-head b { font-size: var(--fs-body); font-weight: 600; }
.cal-nav { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: none; border-radius: var(--r-sm); color: var(--text2); cursor: pointer; }
.cal-nav:disabled { opacity: .3; cursor: default; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week span { text-align: center; font-size: var(--fs-caption); color: var(--text3); padding: 4px 0; }
.cal-week span:nth-child(n+6) { color: var(--danger); opacity: .7; }
.cal-day { height: 34px; border: 0; background: none; border-radius: 8px; font-size: var(--fs-small);
  color: var(--text); cursor: pointer; font-variant-numeric: tabular-nums; }
.cal-day.off { color: var(--text3); }
.cal-day.today { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); font-weight: 600; }
.cal-day.on { background: var(--accent); color: #fff; font-weight: 600; }
.cal-day:disabled { color: var(--text3); opacity: .35; cursor: default; }
@media (hover: hover) {
  .cal-nav:not(:disabled):hover { background: var(--bg2); color: var(--text); }
  .cal-day:not(:disabled):not(.on):hover { background: var(--accent-dim); }
}
.cal-day:focus-visible, .cal-nav:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-foot { display: flex; justify-content: flex-end; margin-top: 6px; }

/* Hints on hover (utils.js) instead of the browser's own tooltip */
.ui-tip { position: fixed; z-index: 10020; max-width: 320px; padding: 6px 10px; border-radius: 8px;
  background: var(--text); color: var(--bg); font-size: var(--fs-caption); line-height: 1.4;
  box-shadow: 0 6px 18px rgba(13,20,33,.2); pointer-events: none; white-space: pre-line; }
@media (prefers-reduced-motion: no-preference) { .ui-tip:not([hidden]) { animation: ui-tip-in .12s ease-out; } }
@keyframes ui-tip-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
