/* MedGroup — стилі. Кольори задані змінними: темна тема за замовчуванням, світла — через data-theme="light". */

:root, :root[data-theme="dark"], .auth {
  --type-0: #ff8a5b; --type-1: #2fc7a9; --type-2: #a08cff; --type-3: #f06fa4; --type-4: #e3b341;
  --bg: #0a0a0c;
  --side: #0e0e11;
  --surface: #16171a;
  --surface-2: #202227;
  --surface-sunk: #0e0e11;
  --head: #131417;
  --border: #26282e;
  --border-strong: #363940;
  --text: #ecedef;
  --muted: #9ca2aa;
  --faint: #6e747c;
  --accent: #ff7a1a;
  --accent-text: #ffb070;
  --accent-soft: rgba(255, 122, 26, 0.12);
  --on-accent: #141414;
  --orange: #ff7a1a; --orange-fg: #ffb070; --orange-bg: rgba(255, 122, 26, 0.14);
  --red: #ff5e5e;    --red-fg: #ff9a9a;    --red-bg: rgba(255, 94, 94, 0.13);
  --blue: #5b9bff;   --blue-fg: #a9c8ff;   --blue-bg: rgba(91, 155, 255, 0.14);
  --green: #3fc17f;  --green-fg: #86ddae;  --green-bg: rgba(63, 193, 127, 0.14);
  --gray: #a3a9b1;   --gray-fg: #d5d8dc;   --gray-bg: rgba(163, 169, 177, 0.14);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

:root[data-theme="light"] {
  /* Світла тема: прохолодні сірі й блакитний акцент. */
  --type-0: #d4572a; --type-1: #0f8f76; --type-2: #6a55de; --type-3: #c63b77; --type-4: #a87700;
  --bg: #f2f5f9;
  --side: #ffffff;
  --surface: #ffffff;
  --surface-2: #e9eef5;
  --surface-sunk: #f6f8fb;
  --head: #f6f8fb;
  --border: #d8dfe8;
  --border-strong: #c2ccd8;
  --text: #121820;
  --muted: #52606f;
  --faint: #8591a0;
  --accent: #2f80ed;
  --accent-text: #1a62c4;
  --accent-soft: rgba(47, 128, 237, 0.11);
  --on-accent: #ffffff;
  --orange: #e2730c; --orange-fg: #9a4c00; --orange-bg: #fff0e0;
  --red: #d33a2f;    --red-fg: #b3261e;    --red-bg: #fde8e7;
  --blue: #4f5bd5;   --blue-fg: #3640a8;   --blue-bg: #e7e9fc;
  --green: #1f9d5c;  --green-fg: #157a46;  --green-bg: #dff5e9;
  --gray: #66717d;   --gray-fg: #434c56;   --gray-bg: #e9edf2;
  --shadow: 0 12px 40px rgba(20, 40, 70, 0.13);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", Inter, system-ui, -apple-system, Roboto, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 800; }
.h2 { font-size: 21px; font-weight: 800; }
p { margin: 0; }
.mono { font-family: "Cascadia Mono", "JetBrains Mono", Consolas, ui-monospace, monospace; font-size: 0.93em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.pre { white-space: pre-wrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.req { color: var(--accent-text); }

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

/* ---------- макет ---------- */

.app { display: flex; min-height: 100vh; }
.side {
  width: 236px; flex: none; background: var(--side); border-right: 1px solid var(--border);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; text-decoration: none; color: var(--text); }
/* Емблема на чорній плитці — однаково видно і в темній, і у світлій темі. */
.brand-mark {
  width: 40px; height: 40px; flex: none; border-radius: 11px; background: #060607;
  display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.brand-mark img { width: 20px; height: auto; filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.45)); }
.brand:hover .brand-mark { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16), 0 0 18px rgba(255, 255, 255, 0.12); }
/* Тонка кардіограма під назвою — відсилка до емблеми. */
.side-ecg { width: 100%; height: 18px; margin: -10px 0 8px; }
.side-ecg .ecg-base { fill: none; stroke: var(--border-strong); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text small { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-top: 2px; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: 0.04em; }
.brand-name b { color: var(--accent); }
.brand-name-lg { font-size: 30px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 12px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.nav-item svg { flex: none; opacity: 0.85; }
.nav-item.active svg { color: var(--accent); opacity: 1; }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.search-btn { flex: none; display: flex; align-items: center; gap: 8px; height: 36px; margin: 0 0 10px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-sunk); color: var(--faint); cursor: pointer; font-size: 13px; text-align: left; }
.search-btn:hover { border-color: var(--border-strong); color: var(--muted); }
kbd { font: 11px/1 ui-monospace, Consolas, monospace; padding: 3px 5px; border-radius: 4px; border: 1px solid var(--border-strong); color: var(--faint); background: var(--surface); }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav-group { margin: 14px 12px 4px; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.backup-hint { margin-top: 14px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.backup-hint b { color: var(--accent-text); font-size: 13px; }
.side-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.me { flex: 1; display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); padding: 4px; border-radius: 8px; min-width: 0; }
.me:hover { background: var(--surface); }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.me-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--muted); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12.5px; flex: none; }
.side-tools { display: flex; gap: 2px; }

.main { flex: 1; min-width: 0; padding: 22px 28px 40px; display: flex; flex-direction: column; gap: 14px; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.page-head > div:first-child { flex: 1 1 300px; min-width: 0; }
.page-head p { margin-top: 3px; font-size: 13px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13px; margin-bottom: 6px; }
.back:hover { color: var(--text); }
.h1-type { color: var(--muted); font-weight: 600; font-size: 20px; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); border-color: transparent; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger-soft { color: var(--red-fg); border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-bg); }
.btn-quiet { background: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { height: 32px; padding: 0 12px; border-radius: 8px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- пошук, вкладки, фільтри ---------- */

.search { flex: 0 1 340px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: none; color: var(--text); }
.search-lg { flex-basis: 440px; height: 44px; }

/* Плитки над таблицею заявок */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-align: left; transition: border-color 0.15s, background 0.15s; }
.tile:hover { border-color: var(--border-strong); }
.tile.active { border-color: var(--accent); background: var(--accent-soft); }
.tile-icon { width: 36px; height: 36px; flex: none; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--muted); }
.tile.active .tile-icon { background: var(--accent); color: var(--on-accent); }
.tile-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.tile-text b { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.tile-text span { font-size: 12.5px; color: var(--muted); line-height: 1.2; }
.tiles + * { margin-top: 4px; }
.tile-warn .tile-icon { background: var(--orange-bg); color: var(--orange-fg); }
.tile-warn b { color: var(--orange-fg); }
@media (max-width: 1280px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; } .tile { padding: 10px; gap: 9px; } .tile-icon { width: 30px; height: 30px; } .tile-text b { font-size: 20px; } }
.tile-red .tile-icon { background: var(--red-bg); color: var(--red-fg); }
.tile-red b { color: var(--red-fg); }

/* Картки заявок для заявника */
.rq-group { display: flex; flex-direction: column; gap: 10px; }
.rq-group + .rq-group { margin-top: 10px; }
.rq-group-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.rq-group-title .count { font-size: 11.5px; padding: 1px 7px; border-radius: 10px; background: var(--surface-2); color: var(--muted); letter-spacing: 0; }
.rq-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.rq-card { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.rq-bar { width: 5px; flex: none; background: var(--type, var(--faint)); }
.rq-body { flex: 1; min-width: 0; padding: 12px 14px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.rq-top { width: 100%; display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.rq-name { font-size: 16px; font-weight: 700; color: var(--text); text-decoration: none; }
.rq-name:hover { text-decoration: underline; }
.rq-status { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 9px; font-weight: 700; font-size: 13.5px; }
.rq-next { font-size: 13px; color: var(--muted); line-height: 1.45; }
.rq-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--green-fg); }
.rq-body .btn { margin-top: 4px; }
.rq-more { display: flex; justify-content: center; margin-top: 8px; }
.rq-archive-hint { text-align: center; margin-top: 12px; }

.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--border); }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.count { font-family: "Cascadia Mono", Consolas, monospace; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-weight: 500; }
.tab.active .count { background: var(--accent-soft); color: var(--accent-text); }
.count-alert, .tab.active .count-alert { background: var(--red-bg); color: var(--red-fg); }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 3px; flex-wrap: wrap; }
.seg-btn { height: 30px; padding: 0 12px; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.seg-btn.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.toggle { height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.toggle.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.switch { width: 28px; height: 16px; border-radius: 8px; background: var(--border-strong); position: relative; }
.toggle.on .switch { background: var(--accent); }
.knob { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.toggle.on .knob { left: 14px; }
.date-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-field { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.inline-field input { background: transparent; border: 0; outline: none; color: var(--text); }

.bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }

/* ---------- таблиця ---------- */

.split { display: flex; gap: 14px; align-items: flex-start; }
.split > .table-card { flex: 1; min-width: 0; }
/* Поки відкрита картка збоку, таблиця показує лише головне — щоб не стискалась. */
.split-open .col-optional { display: none; }
.table-card { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 11px 12px; background: var(--head); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th.sorted { color: var(--accent-text); }
.table td { padding: 10px 12px; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table tr.row-open { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.table tr.row-picked { background: var(--surface-2); }
.table tr.row-muted td { color: var(--faint); }
.table tr.row-warn { background: color-mix(in srgb, var(--orange-bg) 60%, transparent); }
.table-compact td { padding: 8px 12px; }
.table-compact tbody tr { cursor: default; }
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.col-check { width: 40px; }
.col-check input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.col-act { text-align: right; white-space: nowrap; }
.col-act .btn + .btn { margin-left: 6px; }
.col-facility { max-width: 240px; }
.table-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.kbd-hints kbd, kbd { font-family: "Cascadia Mono", Consolas, monospace; font-size: 11px; border: 1px solid var(--border-strong); border-radius: 4px; padding: 0 5px; }

/* ---------- статуси ---------- */

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill .dot, .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: inline-block; }
.small-pill { height: 20px; font-size: 11px; margin-left: 6px; }
.tone-orange { color: var(--orange-fg); background: var(--orange-bg); } .tone-orange .dot, .dot.tone-orange { background: var(--orange); }
.tone-red { color: var(--red-fg); background: var(--red-bg); } .tone-red .dot, .dot.tone-red { background: var(--red); }
.tone-blue { color: var(--blue-fg); background: var(--blue-bg); } .tone-blue .dot, .dot.tone-blue { background: var(--blue); }
.tone-green { color: var(--green-fg); background: var(--green-bg); } .tone-green .dot, .dot.tone-green { background: var(--green); }
.tone-gray { color: var(--gray-fg); background: var(--gray-bg); } .tone-gray .dot, .dot.tone-gray { background: var(--gray); }
.tone-muted { color: var(--muted); background: var(--surface-2); } .tone-muted .dot, .dot.tone-muted { background: var(--faint); }
.tone-text-orange { color: var(--orange-fg); }
.tone-text-red { color: var(--red-fg); }
.tone-text-blue { color: var(--blue-fg); }
.tone-text-green { color: var(--green-fg); }
.type-badge { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 5px; color: var(--type-0); background: color-mix(in srgb, var(--type-0) 15%, transparent); }
/* Кольори типів заявок: смужка в рядку таблиці, мітка в картці, крапка в списках. */
.type-color-0 { --type: var(--type-0); } .type-color-1 { --type: var(--type-1); } .type-color-2 { --type: var(--type-2); } .type-color-3 { --type: var(--type-3); } .type-color-4 { --type: var(--type-4); }
.type-badge[class*="type-color-"] { color: var(--type); background: color-mix(in srgb, var(--type) 15%, transparent); }
.type-text[class*="type-color-"] { color: var(--type) !important; }
.type-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--type, var(--faint)); }
.table tr[class*="type-color-"] > td:first-child, .split-open .table tr[class*="type-color-"] > td.col-num { box-shadow: inset 3px 0 0 var(--type); }

/* ---------- швидкий перегляд ---------- */

.quick { width: clamp(400px, 37vw, 560px); flex: none; position: sticky; top: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); padding: 14px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain; }
/* Картка в бічній панелі: в одну колонку, компактніше. */
.card-embedded { display: flex; flex-direction: column; gap: 12px; }
.card-embedded .card-layout { flex-direction: column; flex-wrap: nowrap; gap: 12px; }
.card-embedded .card-main, .card-embedded .card-side { flex: none; width: 100%; gap: 12px; }
.card-embedded .card-head h1 { font-size: 20px; margin-top: 6px; }
.card-embedded .card-head { gap: 10px; }
.card-embedded .head-actions { width: 100%; }
.card-embedded .stepper { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); padding: 10px 12px; }
.card-embedded .dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.device-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.device-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.device-list b { margin-right: 8px; }
.device-list small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.device-icon { width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--surface-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.person-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; text-decoration: none; color: var(--text); font-size: 13px; }
.person-row:hover { background: var(--surface-2); }
.person-row small { display: block; color: var(--muted); font-size: 11.5px; }
.panel-title svg { vertical-align: -2px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-btn { border: 1px solid var(--border-strong); background: var(--surface-sunk); color: var(--text); border-radius: 999px; padding: 5px 11px; font-size: 12.5px; cursor: pointer; text-align: left; }
.chip-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.row-new td { background: color-mix(in srgb, var(--red-bg) 55%, transparent); }
.quick-head { display: flex; align-items: flex-start; gap: 8px; }
.quick-head > div { flex: 1; min-width: 0; }
.quick-title { font-size: 19px; font-weight: 800; margin-top: 4px; line-height: 1.25; }
.quick .pill { align-self: flex-start; }
.kv { margin: 0; display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 9px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv.small { grid-template-columns: 150px minmax(0, 1fr); }
.row-fields { display: flex; flex-wrap: wrap; gap: 12px; }
.row-fields .field { flex: 1 1 160px; }
.input-narrow { max-width: 120px; }
.text-warn { color: var(--orange-fg); }
.quick-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border); }

/* ---------- панелі, повідомлення ---------- */

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel-title { font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; align-items: start; }
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: 10px; font-size: 13.5px; background: var(--surface-2); border: 1px solid var(--border); }
.notice svg { flex: none; margin-top: 2px; }
.notice-red { background: var(--red-bg); border-color: color-mix(in srgb, var(--red) 40%, transparent); color: var(--red-fg); }
.notice-red b { color: var(--text); }
.notice-blue { background: var(--blue-bg); border-color: color-mix(in srgb, var(--blue) 35%, transparent); color: var(--blue-fg); }
.notice-orange { background: var(--orange-bg); border-color: color-mix(in srgb, var(--orange) 35%, transparent); color: var(--orange-fg); }
.help-block { font-size: 13px; color: var(--muted); }
.help-block b { color: var(--text); }
.help-block p + p { margin-top: 8px; }
.empty { padding: 48px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); }
.empty b { font-size: 16px; color: var(--text); }
.empty p { margin: 0; }
.empty-ecg { width: 220px; max-width: 70%; height: 44px; margin-bottom: 6px; }
.empty-ecg path { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; opacity: 0.55; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- форми ---------- */

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea) {
  height: 42px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-sunk); color: var(--text); padding: 0 12px; width: 100%; min-width: 0;
}
:where(textarea) { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
:where(input, select, textarea):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:disabled { opacity: 0.6; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
.search input, .inline-field input { height: auto; padding: 0; border: 0; box-shadow: none; background: transparent; }
.search input:focus, .inline-field input:focus { box-shadow: none; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 500; }
.help { font-size: 12px; color: var(--muted); font-weight: 400; }
.field-error { font-size: 12.5px; color: var(--red-fg); min-height: 0; }
.field-error:empty { display: none; }
.field-warn { font-size: 12.5px; color: var(--orange-fg); }
.gs-safety { display: block; }
.gs-safety summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; }
.gs-safety summary::-webkit-details-marker { display: none; }
.gs-safety ol { margin: 10px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text); }
.field-warn:empty { display: none; }
.has-error input, .has-error textarea, .has-error .choice-btn { border-color: var(--red); }
.form-error { color: var(--red-fg); font-size: 13px; }
.form-error:empty { display: none; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }

.form-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.form-side { flex: 1 1 210px; max-width: 260px; position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.form-main { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-section { margin: 0; }
.section-title { padding: 0; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-bottom: 12px; float: left; width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; clear: both; }
.form-grid .wide { grid-column: 1 / -1; }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice-btn { flex: 1 1 140px; height: 42px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-sunk); cursor: pointer; }
.choice-btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.form-foot { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.foot-errors { color: var(--red-fg); font-size: 13px; }
.save-status { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.save-status.saved::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.toc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.toc-item { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.toc-item:hover { background: var(--surface); color: var(--text); }
.toc-dot { width: 22px; height: 22px; border-radius: 50%; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border-strong); }
.toc-done .toc-dot { background: var(--green); border-color: var(--green); color: #0e0f11; }
.toc-err .toc-dot { background: var(--red); border-color: var(--red); color: #fff; }
.toc-err { color: var(--red-fg); }

.files { display: flex; flex-direction: column; gap: 12px; }
.upload-row { display: flex; flex-wrap: wrap; gap: 10px; }
.dropzone { flex: 1 1 280px; min-height: 110px; border-radius: 12px; border: 1px dashed color-mix(in srgb, var(--accent) 50%, var(--border)); background: color-mix(in srgb, var(--accent-soft) 40%, transparent); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text); padding: 12px; }
.dropzone svg { color: var(--accent); }
.dropzone.drag, .dropzone:hover { background: var(--accent-soft); border-color: var(--accent); }
.dropzone-sm { min-height: 80px; width: 100%; }
.camera-btn { height: auto; min-height: 110px; flex: 0 1 170px; flex-direction: column; }
.thumbs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { position: relative; width: 132px; display: flex; flex-direction: column; gap: 4px; }
.thumb img, .thumb-doc { width: 132px; height: 150px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12px; }
.thumb-link { display: block; text-decoration: none; }
.thumb-name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; flex-direction: column; }
.thumb-name small { color: var(--muted); }
.thumb-del { position: absolute; top: 6px; right: 6px; background: var(--surface); border-color: var(--border); }

.type-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; max-width: 900px; }
.type-card { display: flex; flex-direction: column; gap: 8px; padding: 22px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; color: var(--text); }
.type-card b { font-size: 19px; }
.type-card span { color: var(--muted); }
.type-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.type-card .type-card-go { color: var(--accent-text); font-weight: 600; margin-top: 6px; }

/* ---------- картка заявки ---------- */

.card-head h1 { margin-top: 8px; }
.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stepper { list-style: none; margin: 0; padding: 14px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.step { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; font-size: 13px; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; border: 1px solid var(--border-strong); }
.step-done { color: var(--text); } .step-done .step-dot { background: var(--green); border-color: var(--green); color: #0e0f11; }
.step-now { color: var(--text); } .step-now .step-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step-warn { color: var(--red-fg); } .step-warn .step-dot { background: var(--red); border-color: var(--red); color: #fff; }
.step-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.step-text small { font-weight: 400; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.card-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.card-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.dl-grid { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 24px; }
.dl-grid .wide { grid-column: 1 / -1; }
.dl-grid dt { font-size: 12px; color: var(--muted); }
.dl-grid dd { margin: 3px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.doc { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--border); text-decoration: none; color: var(--text); border-radius: 6px; }
.doc:first-of-type { border-top: 0; }
.doc:hover { background: var(--surface-2); }
.doc-ext { width: 38px; height: 44px; border-radius: 6px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-family: "Cascadia Mono", Consolas, monospace; font-size: 10px; font-weight: 700; color: #141414; background: var(--gray); }
.doc-ext-docx { background: #8db8ff; } .doc-ext-pdf { background: #ff8f8f; } .doc-ext-p7s { background: var(--green); }
.doc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.doc-text b { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-text small { color: var(--muted); font-size: 11.5px; }
.doc-group { display: flex; flex-direction: column; }
.doc-group-title { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.signed-upload { margin-top: 4px; }
.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.comment { padding: 10px 12px; border-radius: 10px; background: var(--surface-sunk); border: 1px solid var(--border); }
.comment-fix { border-color: color-mix(in srgb, var(--red) 40%, transparent); background: var(--red-bg); }
.comment-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.comment p { white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.comment-form textarea { min-height: 60px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: flex; gap: 10px; font-size: 13px; }
.timeline small { display: block; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.tl-dot.tone-green { background: var(--green); } .tl-dot.tone-red { background: var(--red); } .tl-dot.tone-blue { background: var(--blue); }
.tl-dot.tone-orange { background: var(--orange); } .tl-dot.tone-gray { background: var(--gray); } .tl-dot.tone-muted { background: var(--border-strong); }
.views summary { cursor: pointer; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.views .timeline { margin-top: 10px; }

/* ---------- адмінка ---------- */

.tokens { display: flex; flex-wrap: wrap; gap: 6px; }
.token { height: 28px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-sunk); color: var(--muted); font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; cursor: pointer; }
.token:hover { color: var(--text); border-color: var(--accent); }
.preview-box { padding: 12px 14px; border-radius: 10px; background: var(--surface-sunk); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; font-size: 13px; overflow-wrap: anywhere; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; }
.add-row input { flex: 2 1 260px; }
.add-row select { flex: 0 1 160px; }
.add-row input.mono { flex: 1 1 200px; }
.temp-pass { font-size: 22px; letter-spacing: 0.04em; padding: 14px 16px; border-radius: 10px; background: var(--surface-sunk); border: 1px dashed var(--accent); color: var(--accent-text); text-align: center; user-select: all; }

/* ---------- вхід ---------- */

.auth {
  /* Екран входу завжди темний — як емблема. */
  --bg: #050506; --surface: rgba(18, 19, 22, 0.86); --surface-2: #202227; --border: #26282e; --border-strong: #363940;
  --text: #ecedef; --muted: #9ca2aa; --faint: #6e747c; color-scheme: dark; color: var(--text);
  position: relative; min-height: 100vh; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 32px 16px;
  background: radial-gradient(700px 420px at 50% 32%, rgba(255, 255, 255, 0.05), transparent 70%), #050506;
}
.auth-column { position: relative; z-index: 1; width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 26px 26px 22px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}
.auth-hero { position: relative; height: 200px; display: grid; place-items: center; }
/* Кардіограма проходить крізь емблему на всю ширину екрана. */
.auth-ecg { position: absolute; left: 50%; top: 50%; width: max(100vw, 1500px); height: 120px; transform: translate(-50%, -38%); pointer-events: none; }
.auth-ecg path { fill: none; vector-effect: non-scaling-stroke; }
.auth-ecg .ecg-base { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1.6; }
/* Без filter: світіння на рухомій лінії змушувало перемальовувати її кожен кадр — на слабких ПК сторінка входу гальмувала. */
.auth-ecg .ecg-pulse { stroke: rgba(255, 255, 255, 0.9); stroke-width: 2.4; stroke-linecap: round; stroke-dasharray: 60 940; animation: ecg-run 5.5s linear infinite; }
@keyframes ecg-run { from { stroke-dashoffset: 1000; } to { stroke-dashoffset: 0; } }
.auth-emblem { position: relative; width: 96px; height: 179px; display: grid; place-items: center; }
/* Чорна «тінь» під емблемою: кардіограма не просвічує крізь неї, а навколо — м’яке світіння, як на фото. */
.auth-emblem::before { content: ""; position: absolute; inset: -26px -40px; background: radial-gradient(ellipse at center, #050506 52%, transparent 72%); }
/* Світіння намальоване один раз, «дихає» лише прозорість — це робить відеокарта, без перемальовування. */
.auth-emblem img { position: relative; width: 96px; height: auto; filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.55)) drop-shadow(0 0 28px rgba(255, 255, 255, 0.18)); animation: emblem-breathe 5.5s ease-in-out infinite; will-change: opacity; }
@keyframes emblem-breathe { 0%, 100% { opacity: 0.86; } 50% { opacity: 1; } }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; margin: -6px 0 4px; }
.auth-brand .brand-name-lg { font-size: 32px; }
.auth-sub { margin: 0; color: var(--muted); font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.auth-note { text-align: center; }

/* Тло: сітки, хрестики, «двійковий» шум, молекули — ледь помітно. */
.auth-decor { position: absolute; inset: 0; pointer-events: none; color: rgba(255, 255, 255, 0.12); }
.auth-grid { position: absolute; width: 240px; height: 190px; background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px); background-size: 30px 30px; mask-image: radial-gradient(closest-side, #000, transparent); }
.auth-grid-l { left: 18%; top: 26%; }
.auth-grid-r { right: 14%; bottom: 20%; width: 210px; height: 70px; }
.auth-bits { position: absolute; font: 11px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.35em; white-space: pre; color: rgba(255, 255, 255, 0.13); }
.auth-bits-tl { left: 17%; top: 14%; }
.auth-bits-tr { right: 9%; top: 9%; }
.auth-bits-br { right: 11%; bottom: 10%; }
.auth-cross { position: absolute; width: 22px; height: 22px; fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 1.4; }
.auth-cross-1 { left: 32%; top: 12%; }
.auth-cross-2 { right: 25%; top: 24%; width: 30px; height: 30px; fill: rgba(255, 255, 255, 0.1); stroke: none; }
.auth-cross-3 { left: 21%; bottom: 30%; width: 14px; height: 14px; fill: rgba(255, 255, 255, 0.12); stroke: none; }
.auth-cross-4 { left: 16%; bottom: 20%; }
.auth-cross-5 { right: 37%; bottom: 12%; width: 28px; height: 28px; fill: rgba(255, 255, 255, 0.09); stroke: none; }
.auth-molecule { position: absolute; width: 120px; height: 90px; }
.auth-molecule line { stroke: rgba(255, 255, 255, 0.14); stroke-width: 1; }
.auth-molecule circle { fill: rgba(255, 255, 255, 0.18); }
.auth-molecule-1 { right: 28%; top: 13%; }
.auth-molecule-2 { left: 28%; bottom: 14%; transform: scale(0.8) rotate(160deg); }
@media (max-width: 720px) {
  .auth-bits-tl, .auth-grid-l, .auth-molecule-2, .auth-cross-4 { display: none; }
  .side-ecg { display: none; }
}
@media (prefers-reduced-motion: reduce) { .auth-ecg .ecg-pulse, .auth-emblem img, .spinner { animation: none; } }
.print-only { display: none; }

/* ---------- пошук (Ctrl+K) ---------- */
.backdrop.palette-backdrop { align-items: flex-start; padding-top: 12vh; }
.palette { width: min(620px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); color: var(--muted); }
.palette-input input { height: 54px; border: 0; background: transparent; box-shadow: none; padding: 0; font-size: 16px; }
.palette-input input:focus { box-shadow: none; }
.palette-results { max-height: min(60vh, 460px); overflow-y: auto; padding: 6px; }
.palette-hint { padding: 14px 10px; margin: 0; }
.palette-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.palette-item.active { background: var(--surface-2); }
.palette-item b { display: block; font-size: 14px; }
.palette-item small { display: block; color: var(--muted); font-size: 12px; }
.palette .empty { padding: 28px 16px; }

/* ---------- модальні вікна та сповіщення ---------- */

.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.modal-wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 14px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; flex-wrap: wrap; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toasts .toast { pointer-events: auto; }
/* Над липкими кнопками форми, щоб не закривати «Далі» / «Подати». */
body:has(.form-foot) .toasts { bottom: 104px; }
.toast { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); max-width: 380px; transition: opacity 0.3s, transform 0.3s; }
.toast-ok svg { color: var(--green); }
.toast-error { border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.toast-error svg { color: var(--red); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- вузькі екрани (телефон) ---------- */

@media (max-width: 1100px) {
  .quick { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); border-radius: 0; max-height: none; z-index: 40; box-shadow: var(--shadow); }
}

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 6px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding: 0 8px 0 0; }
  .brand-text small { display: none; }
  .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
  .brand-mark img { width: 17px; }
  .nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; gap: 4px; }
  .nav-item { white-space: nowrap; height: 36px; }
  .nav-item.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .nav-group, .backup-hint { display: none; }
  .search-btn { order: 2; margin: 0; flex: 0 0 auto; }
  .search-btn span, .search-btn kbd { display: none; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .me-text { display: none; }
  .main { padding: 16px 16px 32px; }
  .form-side { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .search { flex: 1 1 100%; }
  h1 { font-size: 22px; }
  :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select), .choice-btn { height: 48px; font-size: 16px; }
  .search input, .inline-field input { height: auto; }
  .form-foot .btn { flex: 1 1 auto; }
}

@media (max-width: 860px) {
  .form-foot .grow, .form-foot .foot-errors:empty { display: none; }
}

/* ---------- звіти ---------- */

:root, :root[data-theme="dark"] { --series-0: #e8650a; --series-1: #3f84f0; --good: #3fc17f; --bad: #ff8f8f; }
:root[data-theme="light"] { --series-0: #2f80ed; --series-1: #e2730c; --good: #157a46; --bad: #b3261e; }

.reports { display: flex; flex-direction: column; gap: 14px; transition: opacity 0.15s; }
.reports.refetching { opacity: 0.6; }
.saved { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); overflow: hidden; }
.chip-main { border: 0; background: transparent; padding: 4px 4px 4px 12px; cursor: pointer; font-size: 13px; }
.chip-x { border: 0; background: transparent; color: var(--muted); padding: 6px 8px; cursor: pointer; display: inline-flex; }
.chip-x:hover, .chip-main:hover { color: var(--text); }
.inline-field select { height: auto; padding: 0 4px; border: 0; background: transparent; box-shadow: none; max-width: 220px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { color: var(--muted); font-size: 12.5px; }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
.delta-good { color: var(--good); }
.delta-bad { color: var(--bad); }
.delta-neutral { color: var(--muted); }

.legend { display: flex; flex-wrap: wrap; gap: 14px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.legend-key { width: 12px; height: 12px; border-radius: 3px; }
.series-0 { background: var(--series-0); }
.series-1 { background: var(--series-1); }
.series-done, .bar-done { background: var(--green); }
.bar-pair { width: min(80%, 40px); height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bar-pair .bar { flex: 1; min-height: 0; border-radius: 3px 3px 0 0; }
.kpi-good .kpi-value { color: var(--green-fg); }
.kpi-warn { border-color: color-mix(in srgb, var(--orange) 45%, var(--border)); }
.kpi-warn .kpi-value { color: var(--orange-fg); }
.workers-table tbody tr { cursor: pointer; }
.workers-table tbody tr:hover { background: var(--surface-2); }

.chart { display: flex; gap: 8px; height: 230px; padding-bottom: 22px; }
.y-axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 11px; color: var(--faint); text-align: right; min-width: 22px; margin-bottom: -6px; transform: translateY(-6px); }
.plot { position: relative; flex: 1; min-width: 0; }
.gridlines { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.gridlines span { border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent); }
.gridlines span:last-child { border-top-color: var(--border-strong); }
.bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; cursor: default; border-radius: 4px; }
.bar-col:hover, .bar-col:focus-visible { background: color-mix(in srgb, var(--surface-2) 60%, transparent); outline: none; }
.bar-stack { width: min(70%, 36px); display: flex; flex-direction: column; gap: 2px; }
.seg-fill { display: block; min-height: 2px; }
.bar-stack .seg-fill:first-child { border-radius: 4px 4px 0 0; }
.x-label { position: absolute; bottom: -20px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.x-hidden { visibility: hidden; }
.tooltip { position: fixed; z-index: 70; display: none; pointer-events: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; box-shadow: var(--shadow); font-size: 12.5px; }
.tooltip b { font-size: 15px; }
.tip-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.tip-key { width: 10px; height: 2px; border-radius: 1px; }

.stages { display: flex; flex-direction: column; gap: 12px; }
.stage-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 4px; background: var(--series-0); }
.status-title { margin-top: 8px; }
.status-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; }
.status-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.status-list .share { width: 36px; text-align: right; }

.table-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table .num { text-align: right; }
.table .faint { color: var(--faint); }
.th-btn { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.table tr.row-static { cursor: default; }
.inline-bar { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; min-width: 120px; }
.inline-bar-fill { display: block; height: 6px; border-radius: 3px; background: var(--series-0); max-width: 80px; flex: none; }

@media print {
  :root, :root[data-theme] {
    --bg: #fff; --surface: #fff; --surface-2: #f2f2f2; --surface-sunk: #fff; --head: #f6f6f6; --border: #d6d6d6; --border-strong: #bbb;
    --text: #111; --muted: #555; --faint: #888; --series-0: #e8650a; --series-1: #2f6fe0; --good: #157a46; --bad: #b3261e;
  }
  :root, :root[data-theme] { color-scheme: light; }
  html, body { background: #fff !important; font-size: 10pt; }
  .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 20px; }
  .table-scroll { overflow: visible; }
  .table-compact td, .table-compact th { padding: 5px 6px; font-size: 9pt; }
  .inline-bar { min-width: 0; }
  .inline-bar-fill { display: none; }
  .app { display: block; min-height: 0; }
  .report-row { grid-template-columns: 1.3fr 1fr; }
  .chart { height: 200px; }
  .side, .no-print, .toasts, .tooltip { display: none !important; }
  .print-only { display: flex !important; }
  .print-brand { align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--series-0); margin-bottom: 6px; }
  .print-brand .print-logo { filter: invert(1); width: 24px; height: auto; }
  .main { padding: 0; }
  .kpi, .report-row .panel { break-inside: avoid; box-shadow: none; }
  .table-card { box-shadow: none; }
  .table tr { break-inside: avoid; }
  @page { size: A4 landscape; margin: 12mm; }
}
.reports .table-card { flex: none; }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-value { font-size: 24px; } }

/* ---------- звіт за день ---------- */
.daily-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.daily-nav { display: flex; align-items: center; gap: 4px; }
.daily-nav input { height: 34px; width: auto; }
.icon-btn.flip svg { transform: scaleX(-1); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.daily-body { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-start; }
.daily-figures { display: flex; gap: 24px; align-items: center; flex: 0 1 auto; }
.daily-total { display: flex; flex-direction: column; }
.daily-total .kpi-value { font-size: 40px; }
.daily-types { list-style: none; margin: 0; padding: 0 0 0 24px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; min-width: 170px; }
.daily-types li { display: flex; justify-content: space-between; gap: 16px; }
.daily-message { flex: 1 1 320px; display: flex; flex-direction: column; gap: 8px; }
.message-preview { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-sunk); border: 1px solid var(--border); font: 13.5px/1.55 "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; user-select: all; }
.daily-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.panel > .btn { align-self: flex-start; }

/* ---------- конструктор форми ---------- */
.field-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.field-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--border); }
.field-row:first-child { border-top: 0; }
.field-off .field-main { opacity: 0.55; }
.field-move { display: flex; flex-direction: column; }
.field-move .icon-btn { width: 28px; height: 22px; font-size: 13px; }
.field-main { flex: 1; min-width: 0; }
.field-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.field-row .sub { font-size: 12px; margin-top: 2px; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.check-row select { width: auto; min-width: 200px; }

/* ---------- єЧерга ---------- */
.equeue { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); }
.equeue-icon { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; flex: none; }
.equeue-booked { border-color: color-mix(in srgb, var(--green) 45%, transparent); background: var(--green-bg); }
.equeue-booked .equeue-icon { background: var(--green); color: #0e0f11; }
.equeue-todo { border-color: color-mix(in srgb, var(--orange) 45%, transparent); background: var(--orange-bg); }
.equeue-todo .equeue-icon { background: var(--orange); color: #fff; }
.equeue-wait .equeue-icon { background: var(--surface-2); color: var(--muted); }
.equeue-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.equeue-when { font-size: 20px; font-weight: 800; margin-top: 2px; }
.equeue-note { margin-top: 2px; }
.equeue-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.equeue-form input[type="datetime-local"] { width: auto; height: 36px; }
.equeue-form input:not([type]) { flex: 1 1 260px; height: 36px; }
.equeue-badge { font-size: 11.5px; margin-top: 3px; white-space: nowrap; }
.equeue-ok { color: var(--green-fg); }
.equeue-missing { color: var(--orange-fg); }
.sample-cell { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.problems { margin: 8px 0 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }

/* ---------- Google Форма ---------- */
.inline-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-row > .btn { margin-bottom: 1px; }
.steps-list { margin: 8px 0 4px; padding-left: 22px; display: grid; gap: 6px; font-size: 13.5px; line-height: 1.5; }
.gs-source { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 12px; }
.gs-source + .gs-source { margin-top: 12px; }
.gs-source.on { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.gs-source-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gs-source-head .grow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gs-script { width: 100%; font-size: 12px; line-height: 1.45; white-space: pre; }
.pre-line { white-space: pre-line; }
.gs-tab { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 10px; }
.gs-tab.on { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.gs-tab + .gs-tab { margin-top: 10px; }
.gs-tab-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.gs-status { gap: 10px; }
.pill.tone-sheet { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.pill-xs { font-size: 11px; padding: 1px 7px; margin-top: 3px; }
.inline-field > span { white-space: nowrap; }
.word-notice { font-size: 13px; }
.word-notice .btn { margin-top: 8px; }

/* ---------- Документ у браузері ---------- */
.doc-head { align-items: center; position: sticky; top: 0; z-index: 5; background: var(--bg); padding: 10px 0; margin-top: -10px; }
.page-head.doc-head > .doc-head-title { flex: 1 1 440px; display: flex; align-items: center; gap: 14px; min-width: min(100%, 460px); }
.doc-head-title > div { min-width: 0; }
.doc-head-title h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-head-title p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-head .head-actions { align-items: center; }
.doc-hint { margin: -4px 0 0; }
.doc-toolbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.doc-tool { display: inline-flex; align-items: center; gap: 4px; }
.doc-tool-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.doc-tool-value { min-width: 52px; text-align: center; font-size: 13px; }
.doc-tool-sel { padding-right: 6px; border-right: 1px solid var(--border); }
.doc-align .btn.active { border-color: var(--accent); color: var(--accent); }
.btn-icon { min-width: 30px; justify-content: center; padding-left: 6px; padding-right: 6px; }

.doc-stage { overflow-x: auto; padding: 8px 0 32px; display: flex; justify-content: center; }
/* Аркуш завжди «паперовий»: білий з чорним текстом, у світлій і темній темі. */
.doc-page {
  box-sizing: border-box; width: var(--page-w); min-height: var(--page-h);
  background: #fff; color: #000; color-scheme: light;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25), 0 12px 32px rgba(0, 0, 0, 0.35);
  font-family: "Times New Roman", "Liberation Serif", Tinos, serif;
  /* Межі сторінок — орієнтовно. */
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--page-h) - 1px), #c9c9c9 calc(var(--page-h) - 1px), #c9c9c9 var(--page-h));
}
.doc-page { position: relative; }
.doc-hf { position: absolute; opacity: 0.55; pointer-events: none; }
.doc-p { white-space: pre-wrap; overflow-wrap: break-word; margin: 0; border-radius: 2px; outline: 1px solid transparent; outline-offset: 1px; }
.doc-p.editable { cursor: pointer; }
.doc-p.editable:hover { outline-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.doc-p.selected { outline: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); cursor: text; }
.doc-p[contenteditable="true"]:focus { outline: 2px solid var(--accent); }
.doc-p img { vertical-align: bottom; }
.doc-p.page-break { border-top: 1px dashed #c9c9c9; }
.doc-table { border-collapse: collapse; table-layout: fixed; margin: 0; }
.doc-table.doc-float { float: left; margin-right: 9pt; }
.doc-cell { vertical-align: top; padding: 0 5.4pt; outline: 1px dashed rgba(0, 0, 0, 0.08); outline-offset: -1px; }
.doc-cell.bordered { border: 1px solid #000; outline: none; }
@media (max-width: 720px) {
  .doc-toolbar { gap: 6px 8px; padding: 6px 8px; }
  .doc-tool-label { display: none; }
}
/* Порожній абзац у Word займає висоту рядка — тут так само. */
.doc-p:empty::before { content: "\200b"; }
/* Друк документа: лише аркуш, без інтерфейсу, у розмірі сторінки документа. */
@media print {
  body.print-doc .main > :not(.doc-stage), body.print-doc .side { display: none !important; }
  body.print-doc .main { padding: 0 !important; }
  body.print-doc .doc-stage { display: block; padding: 0; overflow: visible; }
  body.print-doc .doc-page { page: docsheet; zoom: 1 !important; box-shadow: none; background-image: none; margin: 0; }
  body.print-doc .doc-p, body.print-doc .doc-p.selected { outline: none !important; background: none; }
  body.print-doc .doc-cell { outline: none; }
  body.print-doc .doc-hf { opacity: 1; }
}
/* Підписаний файл і кнопки біля нього — в один рядок. */
.doc-row { display: flex; align-items: center; gap: 6px; }
.doc-row > .doc { flex: 1; min-width: 0; }

/* Список заявок на телефоні: замість широкої таблиці — компактні рядки-картки. */
@media (max-width: 700px) {
  .req-table thead { display: none; }
  .req-table, .req-table tbody { display: block; }
  .req-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "num status" "person person" "time act"; gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .req-table tr[class*="type-color-"] { box-shadow: inset 3px 0 0 var(--type); }
  .req-table td { display: block; padding: 0; border: 0; box-shadow: none !important; }
  .req-table .col-check, .req-table .col-facility, .req-table .col-assignee { display: none; }
  .req-table .col-num { grid-area: num; }
  .req-table .col-status { grid-area: status; text-align: right; }
  .req-table .col-person { grid-area: person; white-space: normal; }
  .req-table .col-time { grid-area: time; align-self: center; }
  .req-table .col-act { grid-area: act; display: block !important; text-align: right; }
  .table-foot .kbd-hints { display: none; }
}

/* ---------- v0.14: наступний крок, меню «Ще», перегляд документа, перетягування ---------- */
.next-step { min-width: 0; }
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary.is-disabled { opacity: 0.55; pointer-events: none; }
.menu[open] > summary { border-color: var(--border-strong); background: var(--surface-2); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px;
  display: flex; flex-direction: column; padding: 6px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.menu-item {
  text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: none;
  color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.menu-danger { color: var(--red-fg); }
.menu-item:disabled { opacity: 0.55; cursor: default; }

.doc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.doc-actions:empty { display: none; }
.doc-actions .btn { height: 34px; padding: 0 10px; }
.doc-preview {
  display: block; position: relative; max-height: 300px; overflow: hidden; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-sunk); cursor: zoom-in;
}
.doc-preview .doc-page { box-shadow: none; pointer-events: none; }
.doc-preview::after {
  content: ''; position: absolute; inset: auto 0 0 0; height: 48px;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.95)); pointer-events: none;
}
.doc-preview-wait { min-height: 160px; }
.doc-preview:hover { border-color: var(--accent); }
.doc-preview-wait { display: flex; align-items: center; justify-content: center; height: 100%; }

.drop-active { outline: 3px dashed var(--accent); outline-offset: -6px; border-radius: 14px; }
.drop-active::before {
  content: 'Відпустіть, щоб додати підписаний файл'; position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  z-index: 60; padding: 10px 18px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700;
  box-shadow: var(--shadow);
}
.req-row-drop { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }

/* Форма по кроках на телефоні */
.form-steps[hidden] { display: none; }
.form-steps { margin-bottom: 12px; }
.form-steps-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.form-step { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.form-step-line { height: 4px; border-radius: 4px; background: var(--border); }
.form-step.done .form-step-line { background: var(--green); }
.form-step.now { color: var(--text); }
.form-step.now .form-step-line { background: var(--accent); }
.form-step.err { color: var(--red-fg); }
.form-step.err .form-step-line { background: var(--red); }
.form-section.step-hidden { display: none; }

/* Підказки при першому вході */
.hints {
  position: fixed; right: 20px; bottom: 20px; z-index: 50; width: min(360px, calc(100vw - 32px));
  padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  border-top: 3px solid var(--accent); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px;
}
.hints h3 { margin: 0; font-size: 16px; }
.hints p { margin: 0; color: var(--muted); line-height: 1.45; }
.hints-head { display: flex; align-items: center; justify-content: space-between; }
.hints-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.hints-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.hints-dots { display: flex; gap: 5px; margin-right: auto; }
.hints-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.hints-dot.on { background: var(--accent); }
@media (max-width: 700px) { .hints { right: 16px; top: 12px; bottom: auto; } }
[hidden] { display: none !important; }

/* ---------- v0.15: документ нагорі картки, перегляд на весь екран, «Підписання» ---------- */
.btn-accent { border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent-text); background: var(--accent-soft); }
.btn-accent:hover { border-color: var(--accent); }
.block { display: block; }
.doc-panel .doc-actions { margin-top: 2px; }

body.viewer-open { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: color-mix(in srgb, #000 82%, var(--bg)); }
.viewer-head { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border); }
.viewer-title { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; }
.viewer-title b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-title small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-nav { display: flex; align-items: center; gap: 6px; }
.viewer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.viewer-actions .btn { height: 36px; }
.viewer-stage { flex: 1; overflow: auto; padding: 24px 16px 48px; display: flex; justify-content: center; align-items: flex-start; }
.viewer-stage .doc-page { flex: none; }
.viewer-wait { display: flex; align-items: center; justify-content: center; min-height: 50vh; }
.viewer-error { color: #ddd; margin-top: 20vh; text-align: center; }
@media (max-width: 700px) {
  .viewer-head { padding: 10px 12px; }
  .viewer-actions { width: 100%; }
  .viewer-actions .btn { flex: 1 1 auto; }
  .viewer-close { position: absolute; top: 8px; right: 8px; }
  .viewer-stage { padding: 12px 6px 32px; }
}

.seg-btn { display: inline-flex; align-items: center; gap: 7px; }
.seg-count { min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.sign-panel { padding: 0; gap: 0; overflow: hidden; }
.sign-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.sign-bar-foot { border-bottom: 0; border-top: 1px solid var(--border); }
.sign-bar .check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.sign-table { width: 100%; border-collapse: collapse; }
.sign-table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); padding: 9px 12px; border-bottom: 1px solid var(--border); }
.sign-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sign-table tr:last-child td { border-bottom: 0; }
.sign-table .col-check { width: 36px; padding-left: 16px; }
.sign-table .col-x { width: 40px; text-align: right; }
.sign-table tr.is-picked { background: var(--accent-soft); }
.sign-table tr.is-done:not(.is-picked) td { opacity: 0.6; }
.sign-table td small { font-size: 12px; }
.sign-foot { padding: 10px 16px; margin: 0; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.empty-panel { align-items: center; text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-panel b { color: var(--text); font-size: 16px; }
.sign-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 26px 16px; border: 2px dashed color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); cursor: pointer; }
.sign-drop b { color: var(--text); }
.sign-drop:hover, .sign-drop:focus-visible { border-color: var(--accent); outline: none; }
.match-file a { word-break: break-all; }
.match-select { height: 34px; width: 100%; min-width: 200px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-sunk); color: var(--text); padding: 0 8px; font: inherit; font-size: 13px; }
.match-select.need { border-color: color-mix(in srgb, var(--red) 60%, transparent); }
.match-select.check { border-color: color-mix(in srgb, var(--orange) 70%, transparent); }
.match-table tr.m-done td { opacity: 0.7; }
@media (max-width: 760px) {
  .sign-table thead { display: none; }
  .sign-table, .sign-table tbody, .sign-table tr, .sign-table td { display: block; }
  .sign-table tr { position: relative; padding: 10px 14px 10px 44px; border-bottom: 1px solid var(--border); }
  .sign-table td { padding: 2px 0; border: 0; }
  .sign-table .col-check { position: absolute; left: 14px; top: 12px; width: auto; padding: 0; }
  .sign-table .col-x { position: absolute; right: 8px; top: 8px; }
}
@media (max-width: 700px) { .viewer-title { padding-right: 36px; } }

/* ---------- v0.16: вхід ключем доступу ---------- */
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-card > .btn-lg { width: 100%; justify-content: center; gap: 10px; }
.auth-more { border-top: 1px solid var(--border); padding-top: 12px; }
.auth-more > summary { cursor: pointer; color: var(--muted); font-size: 13.5px; list-style: none; }
.auth-more > summary::-webkit-details-marker { display: none; }
.auth-more > summary::before { content: '▸ '; }
.auth-more[open] > summary::before { content: '▾ '; }
.auth-more[open] > summary { margin-bottom: 14px; }
.auth-more .auth-form .btn { width: 100%; justify-content: center; }
.auth-wait { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.table-note { margin: 0; padding: 10px 16px; }
