/* ==========================================================================
   Tender Stamps — дизайн-система
   ========================================================================== */
:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef1f8;
  --text: #121a2c;
  --text-2: #3d4760;
  --muted: #6c7690;
  --line: #e4e8f1;
  --line-2: #d3d9e6;

  --primary: #2f5bea;
  --primary-2: #2148c9;
  --primary-soft: #e9efff;
  --primary-ink: #1b3aa6;

  --ok: #12825a;      --ok-soft: #e2f6ec;
  --warn: #a15c00;    --warn-soft: #fff3db;
  --danger: #c4302b;  --danger-soft: #fde9e7;
  --info: #0e7490;    --info-soft: #e0f4f8;
  --violet: #6d4ae0;  --violet-soft: #efeaff;

  --sidebar: #0d1530;
  --sidebar-2: #16214a;
  --sidebar-text: #aab6d6;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(17, 26, 51, .05);
  --shadow: 0 1px 2px rgba(17, 26, 51, .04), 0 4px 16px rgba(17, 26, 51, .06);
  --shadow-lg: 0 12px 40px rgba(17, 26, 51, .18);
  --ring: 0 0 0 3px rgba(47, 91, 234, .22);
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", Arial, sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #121a2e;
  --surface-2: #161f36;
  --surface-3: #1c2742;
  --text: #e8ecf6;
  --text-2: #c2cbe0;
  --muted: #8b96b3;
  --line: #222d48;
  --line-2: #2c395a;
  --primary: #5b80ff;
  --primary-2: #7594ff;
  --primary-soft: #1d2a55;
  --primary-ink: #b8c8ff;
  --ok: #3fcf95;     --ok-soft: #0f3326;
  --warn: #f2b14b;   --warn-soft: #3a2a0d;
  --danger: #ff6b63; --danger-soft: #3d1517;
  --info: #4cc4dd;   --info-soft: #0d2f38;
  --violet: #a48bff; --violet-soft: #251d47;
  --sidebar: #080c1a;
  --sidebar-2: #121a36;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); }
h1 { font-size: 24px; line-height: 1.25; margin: 0; letter-spacing: -.02em; font-weight: 750; }
h2 { font-size: 16px; margin: 0 0 14px; letter-spacing: -.01em; font-weight: 700; }
h3 { font-size: 11.5px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
code { background: var(--surface-3); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .nowrap { white-space: nowrap; }
.err { color: var(--danger); } .warn { color: var(--warn); white-space: pre-line; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.hidden { display: none !important; }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i-sm { width: 15px; height: 15px; } .i-lg { width: 22px; height: 22px; } .i-xl { width: 34px; height: 34px; }

/* ------------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 252px; flex: none; background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40; }
.brand { display: flex; gap: 11px; align-items: center; padding: 20px 18px 18px; color: #fff; }
.brand:hover { color: #fff; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, #4d7bff, #7c4dff); box-shadow: 0 6px 18px rgba(77, 123, 255, .45); color: #fff; }
.brand-logo .i { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { font-size: 15.5px; letter-spacing: -.01em; }
.brand-text small { font-size: 11px; color: #8796c2; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; flex: 1; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #6676a6; padding: 14px 10px 6px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 11px; color: var(--sidebar-text); padding: 9px 11px; border-radius: 10px; font-weight: 550; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(91, 128, 255, .18); color: #fff; box-shadow: inset 3px 0 0 #6f8fff; }
.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #36c2a1, #2f5bea); color: #fff; font-weight: 700; flex: none; }
.me-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.me-text b { color: #fff; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { font-size: 11px; color: #8796c2; }
.me-actions { display: flex; gap: 2px; }
.me-actions form { margin: 0; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mobilebar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(5,10,25,.45); z-index: 30; }
  .mobilebar { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .brand-mini { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--primary); }
}

.container { width: 100%; max-width: 1360px; margin: 0 auto; padding: 26px 32px 64px; }
@media (max-width: 700px) { .container { padding: 18px 14px 48px; } }

/* ------------------------------------------------------------------ page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.page-head .sub span { display: inline-flex; align-items: center; gap: 6px; }
.crumbs { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 8px; font-weight: 550; }
.crumbs:hover { color: var(--primary); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px 22px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card.narrow { max-width: 480px; margin: 40px auto; }
.center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1080px) { .grid-main, .grid-2 { grid-template-columns: 1fr; } }
.sep { height: 1px; background: var(--line); margin: 16px 0; }

/* ------------------------------------------------------------------ stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 14px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow-sm); text-align: left; font: inherit; color: inherit; transition: transform .12s, box-shadow .12s, border-color .12s; }
button.stat { cursor: pointer; }
button.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.stat.active { border-color: var(--primary); box-shadow: var(--ring); }
.stat-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.stat-val { font-size: 22px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 12px; color: var(--muted); font-weight: 550; }
.tone-ok .stat-ico { background: var(--ok-soft); color: var(--ok); }
.tone-warn .stat-ico { background: var(--warn-soft); color: var(--warn); }
.tone-danger .stat-ico { background: var(--danger-soft); color: var(--danger); }
.tone-info .stat-ico { background: var(--info-soft); color: var(--info); }
.tone-violet .stat-ico { background: var(--violet-soft); color: var(--violet); }

/* ------------------------------------------------------------------ progress */
.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; transition: width .4s ease; }
.progress .p-ok { background: linear-gradient(90deg, #19a974, #12825a); }
.progress .p-skip { background: #8aa0d8; }
.progress .p-review { background: #f0a92e; }
.progress .p-error { background: var(--danger); }
.progress .p-queue { background: repeating-linear-gradient(45deg, var(--primary) 0 8px, #5b80ff 8px 16px); background-size: 22px 22px; animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 22px 0; } }
.progress-row { display: flex; align-items: center; gap: 12px; }
.progress-row .progress { flex: 1; }
.progress-pct { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ------------------------------------------------------------------ forms */
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); margin-bottom: 12px; font-weight: 600; }
label.check { flex-direction: row; align-items: center; gap: 9px; color: var(--text); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover { border-color: #b8c2d9; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); padding: 0; }
input[type=file] { padding: 7px; background: var(--surface-2); }
.row-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row-form label { margin-bottom: 0; }
.row-form .grow { flex: 1; min-width: 220px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 6px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-actions form { margin: 0; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon .i { position: absolute; left: 11px; color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 36px; width: 100%; }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 650; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none; }
.btn:hover { background: var(--surface-2); border-color: #b8c2d9; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(47, 91, 234, .28); }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-ink); }
.btn-soft:hover { background: var(--primary-soft); filter: brightness(.97); color: var(--primary-ink); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: #a82722; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-small .i { width: 15px; height: 15px; }
.btn-block { width: 100%; }
.btn.disabled, .btn:disabled { opacity: .45; pointer-events: none; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.on-dark { color: #8796c2; }
.icon-btn.on-dark:hover { background: rgba(255,255,255,.08); color: #fff; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

/* ------------------------------------------------------------------ pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; line-height: 1.4; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.pill-done { background: var(--ok-soft); color: var(--ok); }
.pill-skip { background: var(--surface-3); color: var(--muted); }
.pill-pending { background: var(--primary-soft); color: var(--primary); }
.pill-processing { background: var(--primary-soft); color: var(--primary); }
.pill-processing::before { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .2; transform: scale(.6); } }
.pill-review { background: var(--warn-soft); color: var(--warn); }
.pill-error { background: var(--danger-soft); color: var(--danger); }
.pill-muted { background: var(--surface-3); color: var(--muted); }
.pill-muted::before, .pill-plain::before { display: none; }
.pill-plain { background: var(--surface-3); color: var(--text-2); }
.badge-check { display: inline-flex; align-items: center; gap: 3px; color: var(--ok); font-size: 11.5px; font-weight: 650; }
.badge-check.bad { color: var(--warn); }
.badge-check .i { width: 14px; height: 14px; stroke-width: 2.4; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: .01em; }
.table tr.selected td { background: var(--primary-soft) !important; }
.table .w-check { width: 40px; padding-right: 0; }
.row-error td { background: color-mix(in srgb, var(--danger-soft) 55%, transparent); }
.audit .details { min-width: 280px; max-width: 460px; word-break: break-word; color: var(--text-2); }
.audit td:nth-child(5) { min-width: 260px; max-width: 380px; overflow-wrap: anywhere; }
.audit td:nth-child(6) { min-width: 150px; }
.audit td { vertical-align: top; }
.filters input[type=date] { padding: 8px 10px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 14px; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .i { width: 44px; height: 44px; color: var(--line-2); stroke-width: 1.4; margin-bottom: 8px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* docs table */
.file-cell { display: flex; align-items: center; gap: 11px; min-width: 260px; }
.ftype { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.ftype-docx { background: #e7efff; color: #2b5fd9; }
.ftype-pdf { background: #fde9e7; color: #d0392f; }
.ftype-other { background: var(--surface-3); color: var(--muted); }
[data-theme="dark"] .ftype-docx { background: #1b2a55; color: #8fb0ff; }
[data-theme="dark"] .ftype-pdf { background: #3d1a1a; color: #ff8a80; }
.file-name { font-weight: 600; color: var(--text); word-break: break-word; line-height: 1.35; }
.file-name:hover { color: var(--primary); }
.file-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 1px; }
.row-msg { font-size: 12px; margin-top: 4px; max-width: 520px; white-space: pre-line; }
.row-msg.err { color: var(--danger); } .row-msg.warn { color: var(--warn); }
.row-tools { text-align: right; white-space: nowrap; }
.row-tools .icon-btn { width: 30px; height: 30px; }
.group-row td { background: var(--surface-2) !important; font-weight: 700; color: var(--text-2); padding-top: 9px; padding-bottom: 9px; cursor: pointer; user-select: none; }
.group-row .i { color: var(--warn); }
.group-row .chev { transition: transform .15s; color: var(--muted); }
.group-row.collapsed .chev { transform: rotate(-90deg); }
.group-count { font-weight: 600; color: var(--muted); margin-left: 6px; font-size: 12px; }
.indent .file-cell { padding-left: 22px; }

/* toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .input-icon { flex: 1; min-width: 200px; max-width: 360px; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg a { border: 0; background: transparent; font: inherit; font-size: 12.5px; font-weight: 650; color: var(--text-2); padding: 5px 11px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover, .seg a:hover { color: var(--text); }
.seg button.active, .seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg .cnt { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.toolbar .spacer { flex: 1; }

/* bulk bar */
.bulkbar { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 200%); visibility: hidden; background: #121a33; color: #fff; border-radius: 14px; padding: 10px 12px 10px 18px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow-lg); z-index: 50; transition: transform .2s ease; }
.bulkbar.show { transform: translate(-50%, 0); visibility: visible; }
.lead { color: var(--muted); margin: 6px 0 0; }
.bulkbar .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); color: #fff; }
.bulkbar .btn:hover { background: rgba(255,255,255,.16); }
.bulkbar .btn-danger { color: #ff9b94; }
.bulkbar b { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ batch cards */
.batch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.batch-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s, border-color .12s; color: inherit; position: relative; }
.batch-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); color: inherit; }
.batch-card .bc-top { display: flex; gap: 12px; align-items: flex-start; }
.batch-card .bc-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary-soft), var(--violet-soft)); color: var(--primary); flex: none; }
.batch-card .bc-title { font-weight: 700; font-size: 15px; line-height: 1.3; color: var(--text); word-break: break-word; }
.batch-card .bc-sub { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 3px; }
.batch-card .bc-sub span { display: inline-flex; gap: 4px; align-items: center; }
.batch-card .bc-pills { display: flex; gap: 6px; flex-wrap: wrap; min-height: 24px; }
.batch-card .bc-foot { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; }
.new-batch { border: 2px dashed var(--line-2); background: transparent; box-shadow: none; justify-content: center; }

/* ------------------------------------------------------------------ dropzone */
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 26px 18px; text-align: center; background: var(--surface-2); transition: .15s; }
.dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dz-icon { width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.dz-icon .i { width: 28px; height: 28px; }
.dz-title { font-weight: 700; font-size: 15px; }
.dz-buttons { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.dz-buttons label { margin: 0; color: var(--text); font-weight: 650; }
.drop-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(23, 47, 140, .72); display: none; place-items: center; color: #fff; text-align: center; backdrop-filter: blur(3px); }
.drop-overlay.show { display: grid; }
.drop-overlay .box { border: 3px dashed rgba(255,255,255,.7); border-radius: 22px; padding: 50px 70px; }
.drop-overlay .i { width: 64px; height: 64px; }
.drop-overlay b { display: block; font-size: 22px; margin-top: 10px; }
.upload-progress { margin-top: 14px; }
.upload-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.upload-errors { color: var(--danger); padding-left: 18px; margin: 8px 0 0; max-height: 160px; overflow: auto; }
.upload-progress .progress > span { background: var(--primary); }

/* ------------------------------------------------------------------ toasts / modal */
.toasts { position: fixed; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: min(440px, calc(100vw - 36px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--primary); border-radius: 12px; padding: 12px 10px 12px 14px; box-shadow: var(--shadow-lg); animation: toast-in .25s ease; white-space: pre-line; font-size: 13.5px; }
.toast > .i { color: var(--primary); margin-top: 1px; }
.toast-info { border-left-color: var(--ok); } .toast-info > .i { color: var(--ok); }
.toast-error { border-left-color: var(--danger); } .toast-error > .i { color: var(--danger); }
.toast-warn { border-left-color: var(--warn); } .toast-warn > .i { color: var(--warn); }
.toast-secret { border-left-color: var(--violet); } .toast-secret > .i { color: var(--violet); }
.toast-secret .toast-body { user-select: all; }
.toast-body { flex: 1; }
.toast-x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; }
.toast-x:hover { background: var(--surface-3); }
.toast.out { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }
.modal { border: 0; border-radius: 18px; padding: 26px; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); background: var(--surface); color: var(--text); }
.modal::backdrop { background: rgba(8, 14, 35, .5); backdrop-filter: blur(2px); }
.modal[open] { animation: toast-in .2s ease; }
.modal-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--warn-soft); color: var(--warn); margin-bottom: 12px; }
.modal-title { font-size: 17px; text-transform: none; letter-spacing: -.01em; color: var(--text); margin: 0 0 6px; }
.modal-text { color: var(--text-2); margin: 0 0 20px; white-space: pre-line; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal form { margin: 0; }

/* flash (inline, у панелях) */
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; border: 1px solid; white-space: pre-line; display: flex; gap: 9px; align-items: flex-start; }
.flash-info { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.flash-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.flash-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }

/* ------------------------------------------------------------------ auth */
.auth-page { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, #3b62f0 0%, transparent 60%), radial-gradient(900px 600px at 110% 110%, #7a4dff 0%, transparent 55%), #0b1230; }
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { background: var(--surface); width: 100%; max-width: 410px; padding: 34px 32px; border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.auth-card.wide { max-width: 520px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 14px; }
.auth-logo .brand-logo { width: 58px; height: 58px; border-radius: 17px; }
.auth-logo .brand-logo .i { width: 32px; height: 32px; }
.auth-card h1 { text-align: center; font-size: 22px; }
.auth-card > .muted { text-align: center; margin-top: 6px; margin-bottom: 22px; }
.auth-foot { text-align: center; margin-top: 16px; }
.steps { padding-left: 0; list-style: none; counter-reset: s; margin: 18px 0; }
.steps li { counter-increment: s; position: relative; padding-left: 36px; margin-bottom: 10px; min-height: 24px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 24px; height: 24px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.qr-wrap { display: flex; justify-content: center; margin: 12px 0 16px; }
.qr-wrap canvas { border: 1px solid var(--line); border-radius: 14px; padding: 6px; background: #fff; }
.manual { margin-bottom: 16px; font-size: 13px; background: var(--surface-2); padding: 10px 14px; border-radius: 10px; }
.manual summary { cursor: pointer; font-weight: 600; }
.secret { font-size: 15px; letter-spacing: .05em; user-select: all; }
.code-form input[name=code] { font-size: 26px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; padding: 12px; }
.err-code { font-size: 64px; font-weight: 800; background: linear-gradient(135deg, var(--primary), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ------------------------------------------------------------------ viewer */
.viewer-main { padding: 0; }
/* Переглядач займає рівно висоту вікна: прокручуються лише сторінки PDF, мініатюри
   та бічна панель, а не вся сторінка (інакше меню зліва «від'їжджало» і знизу лишався фон). */
.viewer-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; grid-template-rows: minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.viewer-layout > * { min-height: 0; }
body:has(.viewer-layout) { overflow: hidden; }
.viewer-body > * { min-height: 0; }
.viewer-pane { display: flex; flex-direction: column; min-width: 0; background: #3b4252; }
[data-theme="dark"] .viewer-pane { background: #070b16; }
.viewer-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 9px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.viewer-toolbar .group { display: flex; align-items: center; gap: 4px; }
.viewer-toolbar .divider { width: 1px; height: 22px; background: var(--line); }
.docnav-title { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 4px; }
.pagenav input { width: 54px; padding: 4px 6px; text-align: center; }
.zoom-val { min-width: 48px; text-align: center; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.viewer-body { flex: 1; display: flex; min-height: 0; }
.thumbs { width: 132px; flex: none; overflow: auto; padding: 12px 10px; background: rgba(0,0,0,.18); display: flex; flex-direction: column; gap: 10px; }
.thumbs.hidden-rail { display: none; }
.thumb { border: 2px solid transparent; border-radius: 6px; cursor: pointer; background: #fff; position: relative; padding: 0; display: block; }
.thumb canvas { display: block; width: 100%; border-radius: 4px; }
.thumb.active { border-color: #7ea0ff; box-shadow: 0 0 0 3px rgba(126,160,255,.35); }
.thumb .tn { position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); font-size: 10.5px; background: rgba(13,21,48,.75); color: #fff; padding: 0 6px; border-radius: 6px; }
.thumb .tstamp { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; }
.thumb .tstamp .i { width: 12px; height: 12px; stroke-width: 2.6; }
.viewer-canvas { flex: 1; overflow: auto; padding: 22px; position: relative; scroll-behavior: smooth; }
.viewer-canvas.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; overflow: hidden; padding: 14px; }
.viewer-canvas.compare .col { overflow: auto; min-width: 0; }
.col-title { color: #fff; font-weight: 700; text-align: center; margin-bottom: 8px; position: sticky; top: 0; background: rgba(30,36,50,.9); padding: 6px; z-index: 1; border-radius: 8px; font-size: 12.5px; letter-spacing: .03em; }
.page { margin: 0 auto 18px; width: max-content; position: relative; box-shadow: 0 6px 24px rgba(0,0,0,.35); background: #fff; border-radius: 2px; }
.page canvas { display: block; }
.page-label { position: absolute; right: 8px; bottom: 6px; font-size: 11px; color: #555; background: rgba(255,255,255,.85); padding: 0 6px; border-radius: 5px; }
.viewer-empty { color: #e6e9f2; text-align: center; padding: 90px 20px; font-size: 15px; }
.viewer-empty a { color: #bcd2ff; }
.spinner { width: 36px; height: 36px; border: 4px solid rgba(255,255,255,.25); border-top-color: #fff; border-radius: 50%; margin: 0 auto 14px; animation: spin 1s linear infinite; }
.spinner.dark { border-color: var(--line); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }
.side { background: var(--surface); border-left: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; }
.side-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.side-head .crumbs { margin-bottom: 10px; }
.path-title { font-size: 15.5px; word-break: break-word; margin: 0 0 4px; display: flex; gap: 10px; align-items: flex-start; }
.path-folder { font-size: 12px; color: var(--muted); word-break: break-word; }
.side-sec { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.side-sec:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kv > div { background: var(--surface-2); border-radius: 10px; padding: 9px 12px; }
.kv .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.kv .v { font-weight: 700; margin-top: 2px; word-break: break-word; }
.kv .full { grid-column: 1 / -1; }
.check-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--ok-soft); color: var(--ok); }
.check-card.bad { background: var(--warn-soft); color: var(--warn); }
.check-card.none { background: var(--surface-3); color: var(--muted); }
.check-card b { display: block; }
.check-card .small { color: var(--text-2); }
.side-sec input[name=number] { width: 100%; margin-bottom: 6px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.number-hint { margin-bottom: 8px; }
.number-hint.ok { color: var(--ok); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 1100px) { body:has(.viewer-layout) { overflow: auto; } .viewer-layout { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; overflow: visible; } .viewer-canvas { min-height: 75vh; } .thumbs { display: none; } }

.asset-preview { background: repeating-conic-gradient(var(--surface-3) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; border-radius: 12px; padding: 16px; display: flex; justify-content: center; margin-bottom: 12px; border: 1px solid var(--line); }
.asset-preview img { max-height: 210px; }
.kbd { display: inline-block; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font-size: 11px; font-family: ui-monospace, monospace; color: var(--text-2); background: var(--surface); }
.hint-list { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; font-size: 12.5px; color: var(--text-2); align-items: center; }
