/* ============================================================
   Faktura → ISDOC — UI
   "Ledger, precise": cool neutrals, cobalt accent, mono figures.
   Light theme (customer-demo priority).
   ============================================================ */

:root {
    /* neutrals (cool-biased) */
    --bg: #F5F7FA;
    --surface: #FFFFFF;
    --surface-2: #EFF3F8;
    --border: #E2E7EE;
    --border-strong: #D2DAE4;
    --ink: #16202B;
    --muted: #55636F;
    --faint: #8593A1;
    /* accent (spent sparingly) */
    --accent: #2F54EB;
    --accent-ink: #FFFFFF;
    --accent-soft: #E9EEFE;
    --accent-ring: rgba(47, 84, 235, .28);
    /* semantic */
    --good: #0E9F6E;  --good-soft: #E2F6EE;
    --warn: #B76E00;  --warn-soft: #FBF0DD;
    --crit: #D92D3C;  --crit-soft: #FCE7E9;
    /* elevation */
    --shadow-sm: 0 1px 2px rgba(16,32,48,.06), 0 1px 1px rgba(16,32,48,.04);
    --shadow-md: 0 6px 20px rgba(16,32,48,.08), 0 2px 6px rgba(16,32,48,.05);
    /* type */
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
    /* radius */
    --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px;
}

* { box-sizing: border-box; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font-family: var(--sans); font-size: 15px; line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    /* App shell: full-height flex column so the footer follows content on long pages
       and sits at the bottom of the viewport on short ones — without position:fixed. */
    min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1 0 auto; }
.footer { flex-shrink: 0; }
h1, h2, h3 { margin: 0; text-wrap: balance; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow {
    font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint);
}
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------- app shell ---------- */
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 16px;
    padding: 12px 26px; background: rgba(255,255,255,.86);
    backdrop-filter: saturate(140%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 650; letter-spacing: -.02em; }
.brand-glyph {
    width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
    background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm);
}
.brand-name small { color: var(--faint); font-weight: 500; }

/* Official logo — height-constrained, width auto so the aspect ratio is never
   distorted; object-fit:contain guarantees no cropping/stretching. Sharp because
   the source is SVG (or high-res PNG scaled down). */
.brand-logo {
    height: 36px; width: auto; max-width: 240px; display: block;
    object-fit: contain; image-rendering: auto;
}
/* Wordmark fallback is hidden by default (the PNG is present); it only appears if
   the asset fails to load — so the generic blue document icon never flashes. */
.brand-fallback { display: none; align-items: center; gap: 10px; }
.brand.no-logo .brand-fallback { display: flex; }
.brand.no-logo .brand-logo { display: none; }
.topbar-spacer { flex: 1; }
.topnav { display: flex; gap: 4px; }
.topnav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 500; }
.topnav a:hover { background: var(--surface-2); color: var(--ink); }
.topnav a.active { background: var(--accent-soft); color: var(--accent); }
.topnav a.nav-logout { color: var(--faint); }
.topnav a.nav-logout:hover { color: var(--crit); background: var(--crit-soft); }

.page { width: 100%; max-width: 920px; margin: 0 auto; padding: 30px 22px 72px; }
.page-wide { width: 100%; max-width: 1360px; margin: 0 auto; padding: 22px 26px 96px; }
.page-full { width: 100%; max-width: 1680px; margin: 0 auto; padding: 22px 30px 96px; }

.footer { border-top: 1px solid var(--border); padding: 18px 24px; margin-top: 24px; }
.footer-inner { max-width: 1680px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center;
    justify-content: center; gap: 6px 10px; color: var(--muted); font-size: 12.5px; }
.footer-inner a { color: var(--muted); text-decoration: none; }
.footer-inner a:hover { color: var(--accent); text-decoration: underline; }
.footer-brand { font-weight: 600; color: var(--ink); }
.footer-sep { color: var(--faint); }
.footer-copy { color: var(--faint); }

/* ---------- banners ---------- */
.banner { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.banner-warn { background: var(--warn-soft); color: var(--warn); }
.banner-error { background: var(--crit-soft); color: var(--crit); }

/* ---------- cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-pad-tight { padding: 8px 12px 14px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 15px; }
.card-eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-eyebrow .eyebrow { flex: 1; }
.card.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
    padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
    border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
    transition: transform .04s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--faint); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: #2647c9; border-color: transparent; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-camera { font-weight: 600; }

/* ---------- chips ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.good, .chip-confirmed { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.warn, .chip-edited { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.crit { background: var(--crit-soft); color: var(--crit); border-color: transparent; }
.chip-extracted { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ============================================================
   UPLOAD PAGE
   ============================================================ */
.upload-hero { text-align: center; max-width: 620px; margin: 8px auto 24px; }
.upload-hero h1 { font-size: 30px; letter-spacing: -.03em; }
.upload-hero p { color: var(--muted); margin-top: 10px; font-size: 16px; }

.upload-form { display: flex; flex-direction: column; align-items: stretch; }
.dropzone {
    position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
    cursor: pointer; padding: 46px 26px; border-radius: var(--r-xl);
    border: 1.5px dashed var(--border-strong); background: var(--surface);
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.dropzone:hover, .dropzone.drag {
    border-color: var(--accent); background: var(--accent-soft);
    box-shadow: 0 0 0 4px var(--accent-ring);
}
.dropzone.has-file { border-style: solid; border-color: var(--good); background: var(--good-soft); }
.dz-icon {
    width: 60px; height: 60px; margin-bottom: 15px; border-radius: 18px; display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent); box-shadow: var(--shadow-sm);
}
.dropzone.has-file .dz-icon { background: #fff; color: var(--good); }
.dz-title { font-size: 19px; font-weight: 650; letter-spacing: -.02em; }
.dz-sub { color: var(--muted); margin-top: 4px; }
.formats { display: flex; gap: 8px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.fmt {
    font-family: var(--mono); font-size: 11.5px; letter-spacing: .03em; color: var(--faint);
    border: 1px solid var(--border); border-radius: 7px; padding: 3px 9px; background: var(--surface-2);
}
.upload-actions { display: flex; gap: 10px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.upload-hint { text-align: center; margin-top: 12px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 38px 4px 12px; }
.section-head h2 { font-size: 17px; letter-spacing: -.02em; }

/* recent invoices */
.rlist { display: flex; flex-direction: column; }
.rrow {
    display: grid; grid-template-columns: 34px 1fr auto 20px; align-items: center; gap: 16px;
    padding: 13px 18px; border-bottom: 1px solid var(--border); color: var(--ink);
    transition: background .12s ease;
}
.rrow:last-child { border-bottom: 0; }
.rrow:hover { background: var(--surface-2); }
.rfile {
    width: 34px; height: 40px; border-radius: 7px; background: var(--surface-2);
    border: 1px solid var(--border); display: grid; place-items: center; color: var(--faint);
}
.rmeta { min-width: 0; }
.rmeta strong { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rmeta .sub { color: var(--faint); font-size: 12.5px; font-family: var(--mono); }
.rgo { color: var(--faint); display: flex; }
.rrow:hover .rgo { color: var(--accent); }

/* ============================================================
   REVIEW PAGE — split screen
   ============================================================ */
.review-top {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px;
}
.review-top .back { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.review-top .back:hover { color: var(--ink); }
.review-top .filemeta { color: var(--faint); font-size: 13px; margin-left: 2px; }
.review-top .status-pill { margin-left: auto; }

.status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13px;
}
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill.good { background: var(--good-soft); color: var(--good); }
.status-pill.warn { background: var(--warn-soft); color: var(--warn); }
.status-pill.crit { background: var(--crit-soft); color: var(--crit); }

/* Wider canvas on the review screen so widescreen monitors get real estate. */
.review-page { max-width: 1780px; }

/* Preview | draggable divider | data. The preview share is a CSS variable the
   divider drag updates; the data panel takes the remaining space. */
.split {
    display: grid;
    grid-template-columns: var(--split-preview, 38%) 12px minmax(0, 1fr);
    gap: 0; align-items: start;
}
.split > .preview { margin-right: 10px; }
.split > .fields { margin-left: 10px; }

/* Draggable divider */
.split-divider {
    position: sticky; top: 78px; align-self: stretch; min-height: 260px; height: 100%;
    display: flex; align-items: center; justify-content: center;
    cursor: col-resize; touch-action: none;
}
.split-divider .sd-grip {
    width: 4px; height: 56px; border-radius: 3px; background: var(--border-strong);
    transition: background .12s ease;
}
.split-divider:hover .sd-grip, .split-divider:focus-visible .sd-grip { background: var(--accent); }
.split-divider:focus-visible { outline: none; }
body.col-resizing { cursor: col-resize; user-select: none; }
body.col-resizing iframe { pointer-events: none; }  /* keep drag smooth over the PDF */

/* left: document panel (placeholder until preview endpoint exists) */
.preview {
    position: sticky; top: 78px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg);
    padding: 16px; box-shadow: var(--shadow-sm);
}
.preview-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding: 0 4px; }
.preview-open { font-size: 12px; font-weight: 600; color: var(--accent); }
.preview-frame {
    width: 100%; aspect-ratio: 1 / 1.3; border: 1px solid var(--border);
    border-radius: 10px; background: #fff; box-shadow: var(--shadow-md); display: block;
}
.preview-img {
    width: 100%; height: auto; border: 1px solid var(--border);
    border-radius: 10px; background: #fff; box-shadow: var(--shadow-md); display: block;
}
.preview-placeholder {
    background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 10px;
    aspect-ratio: 1 / 1.3; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 24px; gap: 6px;
}
.pp-icon {
    width: 66px; height: 66px; border-radius: 16px; display: grid; place-items: center;
    background: var(--surface-2); color: var(--faint); margin-bottom: 6px;
}
.pp-name { font-weight: 600; word-break: break-all; max-width: 90%; }
.pp-type { color: var(--faint); font-size: 12px; }
.pp-note { color: var(--faint); font-size: 12.5px; margin-top: 8px; }

/* right: fields */
.fields { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.grid { display: grid; gap: 12px 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.card .grid { margin-top: 0; }
.card-pad > .grid + .field, .card-pad > .field + .grid { margin-top: 12px; }
.fields .card-pad .field + .grid,
.fields .card-pad .grid + .field { margin-top: 12px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.field input {
    width: 100%; padding: 9px 11px; border-radius: 9px; background: var(--surface);
    border: 1px solid var(--border-strong); color: var(--ink);
    font-family: var(--sans); font-size: 14px; font-weight: 400; letter-spacing: normal; text-transform: none;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.field input.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
/* vertical rhythm between stacked fields inside a card */
.card-pad > .field + .field { margin-top: 12px; }

/* line items / VAT tables */
.table-wrap { overflow-x: auto; }
.items { width: 100%; border-collapse: collapse; font-size: 13px; }
.items th {
    text-align: left; font-size: 10px; letter-spacing: .05em; text-transform: uppercase;
    color: var(--faint); font-weight: 600; padding: 6px 8px;
}
.items td { padding: 3px 6px; }
.items td input {
    width: 100%; padding: 8px 9px; border: 1px solid transparent; border-radius: 7px;
    background: transparent; color: var(--ink); font-family: var(--sans); font-size: 13px;
}
.items td.num input { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.items td input:hover { background: var(--surface-2); }
.items td input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.items .col-desc { width: auto; }
.items td input.unit { max-width: 80px; }

/* Line-items table: fixed numeric columns, description takes all remaining width.
   table-layout:fixed + a colgroup keeps numbers tidy and gives Popis the space. */
.items-lines { table-layout: fixed; }
.items-lines col.c-code  { width: 76px; }
.items-lines col.c-desc  { width: auto; }      /* remainder — the widest column */
.items-lines col.c-qty   { width: 74px; }
.items-lines col.c-unit  { width: 58px; }
.items-lines col.c-price { width: 98px; }
.items-lines col.c-vat   { width: 66px; }
.items-lines col.c-total { width: 124px; }
.items-lines td, .items-lines th { overflow: hidden; }
.items-lines td input { text-overflow: ellipsis; }

/* invoice category assignment — "Kategorie faktury" card (classification only) */
.cat-status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.cat-status.cat-confirmed { background: #e9f7ef; color: #1e7a45; }
.cat-status.cat-suggested { background: var(--accent-soft); color: var(--accent); }
.cat-status.cat-none { background: var(--surface-2); color: var(--muted); }
.incl-cell { white-space: nowrap; }
.incl-value { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.acct-grid select, .acct-grid input {
    width: 100%; padding: 9px 11px; border-radius: 9px; background: var(--surface);
    border: 1px solid var(--border-strong); color: var(--ink);
    font-family: var(--sans); font-size: 14px;
}
.acct-grid input[readonly] { background: var(--surface-2); color: var(--muted); }
.acct-grid .field.save-rule-field { justify-content: flex-start; }
.save-rule-box { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400;
    text-transform: none; letter-spacing: normal; color: var(--ink); padding: 9px 0; }
.save-rule-box input { width: 16px; height: 16px; accent-color: var(--accent); }
.auto-badge { display: inline-block; font-size: 12px; font-weight: 700; color: var(--good); }

/* settings hub + categories + rules */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-tile { display: block; text-decoration: none; color: inherit; transition: box-shadow .12s; }
.settings-tile:hover { box-shadow: var(--shadow-md, 0 4px 14px rgba(0,0,0,.08)); }
.settings-tile h2 { font-size: 17px; margin-bottom: 6px; }
.settings-count { display: inline-block; margin-top: 10px; font-weight: 700; color: var(--accent); }
.rules-table input, .rules-table select {
    width: 100%; padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: 7px;
    background: var(--surface); font-size: 13px; font-family: var(--sans);
}
.rules-table .mono { font-family: var(--mono); }
.rules-table tr.rule-off { opacity: .5; }

/* categories: empty state + add/edit modal form */
.cat-empty { text-align: center; display: flex; flex-direction: column; align-items: center;
    gap: 16px; padding: 52px 24px; color: var(--muted); }
.cat-empty p { font-size: 15px; }
.modal-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.modal-form .field input, .modal-form .field select {
    width: 100%; padding: 9px 11px; border-radius: 9px; background: var(--surface);
    border: 1px solid var(--border-strong); color: var(--ink); font-size: 14px;
}
/* user modal — show only the fields relevant to the current mode */
#userForm .uf-email, #userForm .uf-password, #userForm .uf-role { display: none; }
#userForm.mode-add .uf-email, #userForm.mode-add .uf-password, #userForm.mode-add .uf-role,
#userForm.mode-edit .uf-email, #userForm.mode-edit .uf-role,
#userForm.mode-password .uf-password { display: flex; }
@media (max-width: 700px) { .settings-grid { grid-template-columns: 1fr; } }

/* validation summary */
.validation { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vitem { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; padding: 10px 12px; border-radius: 10px; }
.vitem.crit { background: var(--crit-soft); }
.vitem.warn { background: var(--warn-soft); }
.vsev { font-weight: 700; flex: none; }
.vitem.crit .vsev { color: var(--crit); }
.vitem.warn .vsev { color: var(--warn); }
.vtxt { color: var(--ink); }
.vfield { color: var(--muted); font-size: 12.5px; }
.ok-note { color: var(--good); }

/* sticky action bar */
.actionbar {
    position: sticky; bottom: 0; margin-top: 6px;
    display: flex; align-items: center; gap: 12px; justify-content: flex-end;
    padding: 14px 16px; background: rgba(255,255,255,.9);
    backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
}
.actionbar .ab-status { margin-right: auto; color: var(--muted); font-size: 13px; }
.actionbar .ab-confirmed { color: var(--good); font-weight: 600; }
.actionbar .act-approve { margin-right: auto; color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, var(--border)); }
.actionbar .act-approve:hover { background: var(--good-soft); border-color: var(--good); }

/* ============================================================
   HISTORY WORKSPACE
   ============================================================ */
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--muted); font-weight: 600; font-size: 14px; margin-bottom: 10px;
}
.back-link:hover { color: var(--ink); }

.filters { margin-bottom: 16px; }
.filter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; }
.filter-actions { display: flex; gap: 10px; margin-top: 14px; }

.toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap; margin-bottom: 12px;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 12px; }
.selall { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.selcount { font-size: 14px; color: var(--muted); }
.selcount strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.history-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.history-table th {
    text-align: left; font-size: 10px; letter-spacing: .05em; text-transform: uppercase;
    color: var(--faint); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.history-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.history-table tr:last-child td { border-bottom: 0; }
.history-table tbody tr:hover { background: var(--surface-2); }
.history-table .num { text-align: right; }
.history-table .col-check { width: 34px; text-align: center; }
.history-table .rsub { color: var(--faint); font-size: 12px; margin-top: 2px; }
.history-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.empty-cell { text-align: center; color: var(--muted); padding: 28px !important; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.pager-info { color: var(--muted); font-size: 13px; }
.pager-links { display: flex; gap: 8px; }

/* confirm dialog */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
    background: rgba(16, 32, 48, .42); padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-md); padding: 24px; max-width: 420px; width: 100%;
}
.modal h3 { font-size: 17px; margin-bottom: 10px; }
.modal-body { color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
    .filter-grid { grid-template-columns: 1fr 1fr; }
    /* Single column on narrow screens — the divider drag is desktop-only. */
    .split { grid-template-columns: 1fr; }
    .split > .preview, .split > .fields { margin: 0; }
    .split-divider { display: none; }
    .preview { position: static; }
    .preview-placeholder { aspect-ratio: auto; min-height: 220px; }
    /* Let the wide items table scroll horizontally instead of squashing. */
    .items-lines { min-width: 640px; }
}
@media (max-width: 620px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .upload-hero h1 { font-size: 24px; }
    .dropzone { padding: 36px 18px; }
    .topnav { display: none; }
    .review-top .status-pill { margin-left: 0; }
    .actionbar { flex-wrap: wrap; }
    .actionbar .ab-status { width: 100%; margin-bottom: 4px; }
}

/* ============================================================
   AUTH / LOGIN
   ============================================================ */
.login-wrap { min-height: calc(100vh - 160px); display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; padding: 30px 28px; }
.login-head { text-align: center; margin-bottom: 20px; }
.login-logo {
    height: 52px; width: auto; max-width: 260px; display: block; margin: 0 auto 16px;
    object-fit: contain;
}
.login-fallback { display: none; }
.login-head.no-logo .login-fallback { display: block; }
.login-head .brand-glyph { width: 44px; height: 44px; border-radius: 12px; margin: 0 auto 14px; }
/* processing/loading screen logo (optional branding touch) */
.proc-logo { height: 30px; width: auto; max-width: 200px; object-fit: contain; display: none; }
.proc-logo.shown { display: block; }
.login-head h1 { font-size: 22px; }
.login-head p { margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.login-form .field input { margin-top: 6px; }
.login-btn { width: 100%; justify-content: center; margin-top: 4px; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
}
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-value.kpi-crit { color: var(--crit); }
.kpi-value.kpi-good { color: var(--good); }
.kpi-split { display: flex; gap: 12px; font-size: 12px; color: var(--muted); }
.kpi-split strong { color: var(--ink); font-variant-numeric: tabular-nums; }
/* per-currency amounts stack (currencies are never summed together) */
.money-line { display: block; }
.kpi-money { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.kpi-money .money-line:not(:first-child) { font-size: 16px; color: var(--muted); }
.sup-totals .money-line:not(:first-child) { font-size: 12px; color: var(--muted); }

/* Document-type selector (upload + batch) — same visual language as fields/cards:
   1px borders, --r-md radius, --accent-ring focus, subtle hover, accent selected state. */
.doctype-select { border: 0; padding: 0; margin: 0 0 16px; }
.doctype-select legend { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--faint); padding: 0; margin-bottom: 8px; }
.doctype-select .req { color: var(--crit); }
.doctype-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.doctype-opt { position: relative; cursor: pointer; }
.doctype-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.doctype-opt .dt-card {
    display: flex; flex-direction: column; gap: 3px;
    border: 1px solid var(--border); border-radius: var(--r-md);
    padding: 12px 14px; background: var(--surface);
    transition: border-color .12s, background .12s, box-shadow .12s;
}
.doctype-opt .dt-card strong { font-size: 14px; color: var(--ink); }
.doctype-opt .dt-card small { color: var(--muted); font-size: 12px; }
.doctype-opt:hover .dt-card { border-color: var(--border-strong); }
.doctype-opt input:checked + .dt-card {
    border-color: var(--accent); background: var(--accent-soft);
    box-shadow: 0 0 0 1px var(--accent);
}
.doctype-opt input:focus-visible + .dt-card { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.tabs-doctype { border-bottom: 0; margin-bottom: 10px; }
@media (max-width: 560px) { .doctype-options { grid-template-columns: 1fr; } }

/* ---- Kontrola údajů (verification workspace) ---- */
.nav-badge {
    display: inline-block; min-width: 17px; padding: 0 5px; margin-left: 5px;
    font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
    color: #fff; background: var(--crit); border-radius: 9px;
}
.sev { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.sev-critical { background: #fdecec; color: #b3261e; }
.sev-warning { background: #fff5e6; color: #9a6400; }
.sev-info { background: var(--surface-2); color: var(--muted); }
.state { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.state-open { background: #eef2ff; color: #3730a3; }
.state-approved { background: #e9f7ef; color: #1e7a45; }
.state-rejected { background: #fdecec; color: #b3261e; }
.state-deferred { background: var(--surface-2); color: var(--muted); }
/* Filters — a distinct card, visually separate from the results table below. */
.kf-grid { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.kf { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.kf select { min-width: 160px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }

/* Results table — semantic table with explicit columns (colgroup), stable layout,
   sticky header inside a self-contained scroll box, safe wrapping in value cells. */
.kontrola-card { padding: 0; overflow: hidden; }
.kontrola-scroll { overflow: auto; max-height: calc(100vh - 300px); }
.ktable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; table-layout: fixed; }
.ktable col.k-sev { width: 108px; }
.ktable col.k-state { width: 92px; }
.ktable col.k-supplier { width: 15%; }
.ktable col.k-doc { width: 112px; }
.ktable col.k-type { width: 15%; }
.ktable col.k-prev { width: 13%; }
.ktable col.k-new { width: 13%; }
.ktable col.k-diff { width: 88px; }
.ktable col.k-date { width: 104px; }
.ktable col.k-actions { width: 170px; }
.ktable thead th {
    position: sticky; top: 0; z-index: 2; text-align: left; vertical-align: bottom;
    background: var(--surface-2); color: var(--muted);
    font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
    padding: 11px 12px; border-bottom: 1px solid var(--border);
    /* wrap long headers (e.g. "Datum zjištění") instead of clipping in a fixed col */
    white-space: normal; overflow-wrap: break-word;
}
.ktable td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.ktable tbody tr:last-child td { border-bottom: 0; }
.ktable tbody tr:hover { background: var(--surface-2); }
.ktable td.mono { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.ktable td.k-wrap { overflow-wrap: anywhere; word-break: break-word; }
.ktable td.k-break { overflow-wrap: anywhere; word-break: break-all; }
.k-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.k-empty { text-align: center; color: var(--muted); padding: 44px 16px !important; font-size: 14px; }

/* Generic simple table (audit log on the incident detail). */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
    color: var(--muted); padding: 9px 10px; border-bottom: 1px solid var(--border);
}
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }

/* Mobile — incident cards instead of squeezing the desktop table. */
@media (max-width: 860px) {
    .kontrola-scroll { max-height: none; overflow: visible; }
    .ktable { table-layout: auto; }
    .ktable colgroup, .ktable thead { display: none; }
    .ktable, .ktable tbody, .ktable tr, .ktable td { display: block; width: auto; }
    .ktable tbody tr {
        border: 1px solid var(--border); border-radius: var(--r-lg);
        padding: 12px 14px; margin: 12px; background: var(--surface);
    }
    .ktable td { border: 0; padding: 5px 0; }
    .ktable td[data-label] { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
    .ktable td[data-label]::before {
        content: attr(data-label); color: var(--faint); font-size: 11px; font-weight: 700;
        text-transform: uppercase; letter-spacing: .03em; flex: none;
    }
    .ktable td.k-wrap, .ktable td.k-break { text-align: right; }
    .k-actions { justify-content: flex-end; }
    .k-empty-row { margin: 12px; }
    .ktable td.k-empty { display: block; text-align: center; }
    .ktable td.k-empty::before { content: ""; }
}
.kd-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.kd-grid { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 12px 0; }
.kd-grid dt { color: var(--muted); font-size: 13px; font-weight: 600; }
.kd-grid dd { margin: 0; }
.kd-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.kd-actions form { margin: 0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* dashboard review widget */
.review-widget { display: block; margin-bottom: 18px; text-decoration: none; color: inherit; transition: box-shadow .12s; }
.review-widget:hover { box-shadow: var(--shadow-md, 0 4px 14px rgba(0,0,0,.08)); }
.review-widget-alert { border-color: var(--crit); }
.rw-head { display: flex; align-items: center; justify-content: space-between; }
.rw-title { font-weight: 700; }
.rw-count { font-size: 22px; font-weight: 800; color: var(--crit); font-variant-numeric: tabular-nums; }
.review-widget:not(.review-widget-alert) .rw-count { color: var(--good); }
.rw-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; gap: 16px; flex-wrap: wrap; }
.rw-list li { font-size: 13px; color: var(--muted); }
.rw-num { font-weight: 700; color: var(--ink); }
.rw-cta { display: inline-block; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--accent); }

.dash-main { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.dash-secondary { display: grid; grid-template-columns: 1fr 1.3fr; gap: 16px; }

.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.chart-head h2 { font-size: 16px; }
.chart-controls { display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; gap: 3px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.seg a { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.year-select { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); font-size: 13px; color: var(--ink); }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 220px; padding-top: 10px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.chart-bar-wrap { width: 100%; height: 190px; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; max-width: 34px; margin: 0 auto; background: var(--accent); border-radius: 5px 5px 0 0; min-height: 2px; transition: height .2s ease; }
.chart-col:hover .chart-bar { background: #2647c9; }
.chart-xlabel { font-size: 10.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.summary-period { font-weight: 600; color: var(--accent); margin: 4px 0 12px; }
.summary-list { display: flex; flex-direction: column; gap: 0; margin: 0; }
.summary-list > div { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.summary-list > div:last-child { border-bottom: 0; }
.summary-list dt { color: var(--muted); font-size: 13.5px; }
.summary-list dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th { text-align: left; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 6px 8px; }
.mini-table td { padding: 9px 8px; border-top: 1px solid var(--border); }
.mini-table tbody tr:first-child td { border-top: 0; }
.mini-table .num { text-align: right; }
.mini-table .rank { color: var(--faint); font-variant-numeric: tabular-nums; width: 22px; }
.supplier-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* validation dots */
.vdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.vdot.ok { background: var(--good); } .vdot.warning { background: var(--warn); }
.vdot.error { background: var(--crit); } .vdot.exported { background: var(--accent); }

/* ============================================================
   HISTORY WORKSPACE (wide)
   ============================================================ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 9px 9px 0 0; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count { font-size: 11px; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.tab.active .tab-count { background: var(--accent-soft); color: var(--accent); }

.filter-form { margin-bottom: 14px; }
.search-row { display: flex; gap: 10px; }
.search-input { flex: 1; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 10px; font-size: 15px; color: var(--ink); background: var(--surface); }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.filter-panel { margin-top: 14px; }
.filter-panel > summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--accent); list-style: none; padding: 6px 0; }
.filter-panel > summary::-webkit-details-marker { display: none; }
.filter-panel > summary::before { content: "▸ "; }
.filter-panel[open] > summary::before { content: "▾ "; }
.filter-panel .filter-grid { grid-template-columns: repeat(4, 1fr); margin-top: 12px; }
.filter-panel select { padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 14px; margin-top: 5px; }

.bulk-toolbar {
    position: sticky; top: 64px; z-index: 15;
    display: flex; align-items: center; gap: 12px;
    background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--r-md);
    padding: 12px 16px; margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.bulk-toolbar[hidden] { display: none; }
.bulk-toolbar .selcount { margin-right: auto; font-size: 14px; color: var(--ink); }
.bulk-toolbar .selcount strong { font-variant-numeric: tabular-nums; }

.history-table .strong { font-weight: 600; }
.history-table .col-actions { width: 1%; white-space: nowrap; }
.row-actions { display: flex; gap: 4px; }
.row-actions .act { font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 7px; color: var(--muted); border: 1px solid var(--border); background: var(--surface); }
.row-actions .act:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.vpill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.vpill.ok { background: var(--good-soft); color: var(--good); }
.vpill.warning { background: var(--warn-soft); color: var(--warn); }
.vpill.error { background: var(--crit-soft); color: var(--crit); }

.pager-left { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.page-size { font-size: 13px; color: var(--muted); }
.page-size a { padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.page-size a.active { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .dash-main, .dash-secondary { grid-template-columns: 1fr; }
    .filter-panel .filter-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .filter-panel .filter-grid { grid-template-columns: 1fr; }
    .topnav a { padding: 6px 8px; font-size: 13px; }
}

/* ============================================================
   HISTORY — column-header filters
   ============================================================ */
.filter-summary {
    display: flex; align-items: center; gap: 14px; margin-bottom: 12px;
    font-size: 13px; color: var(--muted);
}
.filter-summary .fs-count { font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; }
.filter-summary .clear-all { font-weight: 600; }

.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }

.cols-filter thead th { position: relative; }
.th-filterable .th-toggle {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    background: transparent; border: 0; padding: 0; font: inherit;
    font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); font-weight: 600;
}
.th-filterable .th-toggle:hover { color: var(--ink); }
.th-filterable .funnel { opacity: .5; }
.th-filterable.th-active .th-toggle { color: var(--accent); }
.th-filterable.th-active .funnel { opacity: 1; fill: var(--accent-soft); }
.th-filterable.th-active::after {
    content: ""; position: absolute; top: 8px; right: 8px; width: 6px; height: 6px;
    border-radius: 50%; background: var(--accent);
}
.th-toggle.open { color: var(--accent); }

.popover {
    position: absolute; top: 100%; left: 0; z-index: 30; margin-top: 6px;
    min-width: 220px; background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--r-md); box-shadow: var(--shadow-md); padding: 12px;
    display: flex; flex-direction: column; gap: 10px; text-transform: none; letter-spacing: normal;
}
.popover-wide { min-width: 268px; }
.popover[hidden] { display: none; }
.pf { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: none; }
.pf input { padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; font-weight: 400; color: var(--ink); background: var(--surface); }
.pf input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.pf-radios { display: flex; flex-direction: column; gap: 7px; }
.pf-radios label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer; text-transform: none; }
.pf-presets { display: flex; gap: 6px; }
.pf-monthyear { display: flex; gap: 6px; align-items: center; }
.pf-monthyear select { flex: 1; min-width: 0; padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; background: var(--surface); color: var(--ink); }
.pf-range { display: flex; gap: 8px; }
.pf-range label { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: none; }
.pf-range input { padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; color: var(--ink); background: var(--surface); }
.pf-actions { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }

@media (max-width: 900px) {
    /* On small screens, prefer the expanded panel; hide per-column toggles. */
    .th-filterable .th-toggle .funnel { display: none; }
    .popover { position: fixed; left: 12px; right: 12px; min-width: 0; }
}

/* ============================================================
   UPLOAD PAGE — enterprise refinement (states + processing)
   ============================================================ */
.upload-hero { text-align: left; max-width: none; margin: 4px 0 16px; }
.upload-hero h1 { font-size: 22px; letter-spacing: -.02em; }
.upload-hero p { color: var(--muted); margin-top: 6px; font-size: 14.5px; }

.upload-card { padding: 22px; margin-bottom: 30px; }

/* state visibility */
.uploader .up-selected, .uploader .up-processing { display: none; }
.uploader.has-file .up-empty { display: none; }
.uploader.has-file .up-selected { display: block; }
.uploader.processing .up-empty, .uploader.processing .up-selected { display: none; }
.uploader.processing .up-processing { display: flex; }

/* state 1 — empty */
.up-empty { display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.dropzone { gap: 10px; }
.dz-icon { width: 52px; height: 52px; margin-bottom: 6px; border-radius: 15px; }
.dz-title { font-size: 15px; font-weight: 600; color: var(--muted); }
.dz-choose { margin-top: 6px; }
.camera-link {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
    color: var(--muted); font-size: 13.5px; font-weight: 600; padding: 6px;
}
.camera-link:hover { color: var(--accent); }

/* state 2 — selected */
.file-card {
    display: flex; align-items: center; gap: 14px;
    border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--surface-2); padding: 14px 16px;
}
.fc-icon {
    width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none;
    background: var(--surface); border: 1px solid var(--border); color: var(--accent);
}
.fc-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fc-meta strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-ready { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--good); font-weight: 600; }
.up-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* state 3 — processing */
.up-processing { flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 26px 10px 12px; }
.spinner {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--accent-soft); border-top-color: var(--accent);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.proc-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.proc-steps .step {
    display: flex; align-items: center; gap: 9px; justify-content: center;
    font-size: 14px; color: var(--faint); transition: color .2s ease;
}
.proc-steps .step::before {
    content: ""; width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid var(--border-strong); flex: none;
}
.proc-steps .step.active { color: var(--ink); font-weight: 600; }
.proc-steps .step.active::before { border-color: var(--accent); }
.proc-steps .step.done { color: var(--good); font-weight: 500; }
.proc-steps .step.done::before {
    border-color: var(--good); background: var(--good);
    content: "✓"; color: #fff; font-size: 10px; display: grid; place-items: center; line-height: 1;
}
.proc-hint { color: var(--faint); font-size: 12.5px; }

/* ============================================================
   DUPLICATE INTERSTITIALS
   ============================================================ */
.dup-card { max-width: 560px; margin: 24px auto; padding: 30px 30px 26px; text-align: center; }
.dup-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin: 0 auto 16px; }
.dup-icon.warn { background: var(--warn-soft); color: var(--warn); }
.dup-card h1 { font-size: 21px; letter-spacing: -.02em; }
.dup-card > p { margin-top: 8px; }
.dup-existing {
    text-align: left; background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 6px 16px; margin: 22px 0;
}
.de-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.de-row:last-child { border-bottom: 0; }
.de-k { color: var(--muted); font-size: 13.5px; }
.de-v { font-weight: 600; font-variant-numeric: tabular-nums; }
.dup-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.dup-confirm { display: inline; }

/* login brand wordmark */
.login-brand { font-weight: 700; letter-spacing: -.01em; margin: 6px 0 2px; }

/* ============================================================
   PHASE 2 — delete, currency, suppliers
   ============================================================ */
.banner-good { background: var(--good-soft); color: var(--good); }

.btn-danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 35%, var(--border-strong)); background: var(--surface); }
.btn-danger:hover { background: var(--crit-soft); border-color: var(--crit); color: var(--crit); }

.row-del { display: inline; margin: 0; }
.act-danger { color: var(--crit) !important; border-color: color-mix(in srgb, var(--crit) 30%, var(--border)) !important; }
.act-danger:hover { background: var(--crit-soft) !important; border-color: var(--crit) !important; }

.cur-chip { background: var(--surface-2); color: var(--ink); font-weight: 600; }

/* ============================================================
   PHASE 3 — history workflow (sync, approve, sticky, filters)
   ============================================================ */
.section-head .head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* Export dropdown — groups Excel / POHODA XML / ISDOC under one clear control,
   visually distinct from the (unrelated) accounting-system sync button. */
.export-menu { position: relative; }
.btn-export { display: inline-flex; align-items: center; gap: 7px; }
.btn-export .caret { font-size: 0.8em; line-height: 1; }
.export-dropdown {
    position: absolute; top: calc(100% + 6px); right: 0; z-index: 40;
    min-width: 240px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,.14));
}
.export-dropdown .export-hint {
    margin: 4px 8px 8px; font-size: 12px; color: var(--muted);
    border-bottom: 1px solid var(--border); padding-bottom: 8px;
}
.export-dropdown form { margin: 0; }
.export-dropdown form button {
    display: block; width: 100%; text-align: left;
    padding: 9px 10px; border: 0; border-radius: 7px;
    background: transparent; color: var(--text); font: inherit; cursor: pointer;
}
.export-dropdown form button:hover { background: var(--surface-2, var(--accent-soft)); }
.export-dropdown .small { font-size: 12px; }

/* stronger filter workspace */
.filter-form { border-left: 3px solid var(--accent); }

/* Table header. NOT position:sticky — the header sits inside .table-wrap, whose
   overflow-x:auto makes it a scroll container; a sticky top offset then vacated a
   gap and clipped the first body row (Chromium sticky-in-scroll-container paint
   bug). A plain header renders reliably; horizontal scroll on the wrapper stays. */
.history-table thead th {
    background: var(--surface); box-shadow: inset 0 -1px 0 var(--border);
}

.act-approve { color: var(--good) !important; border-color: color-mix(in srgb, var(--good) 30%, var(--border)) !important; }
.act-approve:hover { background: var(--good-soft) !important; border-color: var(--good) !important; }
.chip-approved { background: var(--good-soft); color: var(--good); border-color: transparent; }

/* ============================================================
   PHASE 4 — batch / folder upload
   ============================================================ */
.batch-pickers { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.batch-summary { display: flex; gap: 18px; flex-wrap: wrap; margin: 18px 0 4px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-md); font-size: 14px; }
.bs-item strong { font-variant-numeric: tabular-nums; }
.batch-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; }
.batch-item { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 11px 8px; border-top: 1px solid var(--border); }
.batch-item:first-child { border-top: 0; }
.bi-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bi-msg { color: var(--muted); font-size: 13px; }
.bi-state { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.batch-item[data-state="zpracovava"] .bi-state { background: var(--accent-soft); color: var(--accent); }
.batch-item[data-state="hotovo"] .bi-state { background: var(--good-soft); color: var(--good); }
.batch-item[data-state="vyzaduje_kontrolu"] .bi-state { background: var(--warn-soft); color: var(--warn); }
.batch-item[data-state="duplicita"] .bi-state { background: var(--warn-soft); color: var(--warn); }
.batch-item[data-state="chyba"] .bi-state { background: var(--crit-soft); color: var(--crit); }

/* ============================================================
   PHASE 6 — MOBILE (intentional interaction pass)
   ============================================================ */
.nav-toggle {
    display: none; width: 44px; height: 44px; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--ink); cursor: pointer;
}

@media (max-width: 820px) {
    /* --- mobile navigation drawer --- */
    .nav-toggle { display: inline-flex; }
    /* keep the logo crisp but smaller on phones (still aspect-correct) */
    .brand-logo { height: 30px; max-width: 170px; }
    .login-logo { height: 44px; }
    .topnav {
        display: none; position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; gap: 2px; padding: 8px;
        background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md);
    }
    body.nav-open .topnav { display: flex; }
    .topnav a { padding: 13px 14px; font-size: 15px; border-radius: 10px; }
    .topbar { position: sticky; }

    /* larger touch targets */
    .btn, .btn-lg { min-height: 44px; }
    .field input, .search-input, select, input[type="date"], input[type="number"], input[type="text"], input[type="email"], input[type="password"] { min-height: 44px; }
    .tab { min-height: 44px; }

    /* page paddings tighten */
    .page, .page-wide, .page-full { padding-left: 14px; padding-right: 14px; }

    /* dashboard portrait */
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .chart { height: 180px; }
    .chart-bar-wrap { height: 150px; }
    .dash-main, .dash-secondary { grid-template-columns: 1fr; }

    /* camera-first upload */
    .up-empty { gap: 14px; }
    .camera-link {
        border: 1px solid var(--border-strong); border-radius: 12px; padding: 14px; min-height: 48px;
        font-size: 15px; color: var(--ink);
    }

    /* batch progress readable */
    .batch-item { grid-template-columns: 1fr auto; }
    .batch-item .bi-msg { grid-column: 1 / -1; }

    /* modals fill small screens comfortably */
    .modal { max-width: 100%; }
    .modal-actions .btn { min-height: 44px; }
}

/* history table -> cards (no horizontal scrolling on phones) */
@media (max-width: 760px) {
    .cols-filter thead { display: none; }
    .history-table, .history-table tbody, .history-table tr, .history-table td { display: block; }
    .history-table tr {
        border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
        margin-bottom: 12px; padding: 8px 14px 12px;
    }
    .history-table td { border: 0; padding: 7px 0; }
    .history-table td[data-label] { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
    .history-table td[data-label]::before {
        content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; flex: none;
    }
    .history-table td.col-check { position: absolute; right: 18px; }
    .history-table tr { position: relative; }
    .history-table .rsub { display: none; }
    .history-table td.col-actions { padding-top: 10px; border-top: 1px solid var(--border); margin-top: 6px; }
    .history-table .row-actions { flex-wrap: wrap; gap: 6px; }
    .history-table .row-actions .act { min-height: 40px; display: inline-flex; align-items: center; }
    .empty-cell { text-align: left; }

    /* suppliers table: allow graceful scroll on very small screens */
    .table-wrap { -webkit-overflow-scrolling: touch; }

    .section-head { flex-wrap: wrap; gap: 10px; }
    .section-head .head-actions { width: 100%; }
    .section-head .head-actions .btn { flex: 1; }
    .section-head .head-actions .export-menu { flex: 1; }
    .section-head .head-actions .export-menu .btn-export { width: 100%; justify-content: center; }
    .export-dropdown { right: auto; left: 0; width: 100%; }
    .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .bulk-toolbar { flex-wrap: wrap; }
    .bulk-toolbar .btn { flex: 1; }
}

/* Phase 7 — document type */
.doctype-chip { background: var(--accent-soft); color: var(--accent); border-color: transparent; margin-left: 6px; font-size: 11px; }

/* ============================================================
   .NET Razor UI additions (Phase 5) — extends the ported design
   system. Normalizes a few product interactions to one system.
   ============================================================ */

/* logout is a form button in the nav (CSRF-safe) — styled like the nav link */
.nav-logout-form { display: inline-flex; margin: 0; }
.topnav .nav-logout {
    background: none; border: 0; font: inherit; cursor: pointer;
    padding: 7px 12px; border-radius: 8px; color: var(--faint); font-size: 14px; font-weight: 500;
}
.topnav .nav-logout:hover { color: var(--crit); background: var(--crit-soft); }

/* mobile nav drawer (body.nav-open) */
@media (max-width: 620px) {
    .topnav { display: none; }
    body.nav-open .topnav {
        display: flex; flex-direction: column; align-items: stretch; gap: 2px;
        position: absolute; top: 100%; left: 0; right: 0;
        background: var(--surface); border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md); padding: 8px 12px 12px;
    }
    body.nav-open .topnav a, body.nav-open .nav-logout-form { width: 100%; }
    body.nav-open .topnav .nav-logout { width: 100%; text-align: left; }
    .nav-toggle { display: inline-flex; }
}
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; color: var(--ink); padding: 6px; }

/* processing steps (upload) */
.up-processing { flex-direction: column; align-items: center; gap: 12px; padding: 30px 20px; text-align: center; }
.proc-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.proc-step { color: var(--faint); font-size: 14px; transition: color .2s; }
.proc-step.on, .proc-step:first-child { color: var(--ink); font-weight: 600; }
.proc-hint { color: var(--faint); font-size: 13px; }
.spinner {
    width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--accent-soft);
    border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* processing screen on the detail page */
.processing-screen { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 24px; text-align: center; }
.processing-screen h2 { font-size: 20px; }

/* batch rows */
.batch-pickers { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.batch-summary { display: flex; gap: 18px; flex-wrap: wrap; margin: 14px 0; font-size: 14px; color: var(--muted); }
.batch-summary strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.batch-list { display: flex; flex-direction: column; }
.batch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 10px 4px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.batch-row:last-child { border-bottom: 0; }
.bf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf-state { color: var(--muted); font-weight: 600; flex: none; }

/* sync stub modal */
.sync-busy { display: block; } .sync-done-only { display: none; }
#syncModal.sync-done .sync-busy { display: none; }
#syncModal.sync-done .sync-done-only { display: block; }

/* export dropdown */
.dropdown-wrap { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: 100%; margin-top: 6px; z-index: 30; min-width: 240px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
    box-shadow: var(--shadow-md); padding: 8px; display: flex; flex-direction: column; gap: 4px;
}
.dropdown-menu[hidden] { display: none; }
.dropdown-menu form { margin: 0; }
.dropdown-menu button, .dropdown-menu .di {
    display: block; width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
    padding: 9px 10px; border-radius: 8px; font: inherit; color: var(--ink); font-size: 14px;
}
.dropdown-menu button:hover, .dropdown-menu .di:hover { background: var(--surface-2); }
.dropdown-hint { color: var(--faint); font-size: 12px; padding: 4px 10px 6px; }

.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.btn-danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 30%, var(--border)); }
.btn-danger:hover { background: var(--crit-soft); border-color: var(--crit); }

/* empty / loading / error states */
.state-block { text-align: center; color: var(--muted); padding: 44px 24px; }
.state-block h2 { font-size: 17px; color: var(--ink); margin-bottom: 6px; }

/* ---------- HISTORY: mobile card representation ---------- */
@media (max-width: 820px) {
    .history-table thead { display: none; }
    .history-table, .history-table tbody, .history-table tr, .history-table td { display: block; width: auto; }
    .history-table tr {
        border: 1px solid var(--border); border-radius: var(--r-lg);
        padding: 12px 14px; margin-bottom: 12px; background: var(--surface);
    }
    .history-table td { border: 0; padding: 5px 0; }
    .history-table td.col-check { position: absolute; }
    .history-table td[data-label] { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
    .history-table td[data-label]::before {
        content: attr(data-label); color: var(--faint); font-size: 11px; font-weight: 700;
        text-transform: uppercase; letter-spacing: .03em; flex: none;
    }
    .history-table td.num { text-align: right; }
    .row-actions { flex-wrap: wrap; justify-content: flex-end; }
    .history-table td.empty-cell { text-align: center; }
    .history-table td.empty-cell::before { content: ""; }
}

/* touch targets ≥ 44px on phones */
@media (max-width: 620px) {
    .btn, .tab, .row-actions .act, .btn-sm { min-height: 40px; }
    .row-actions .act { padding: 9px 12px; }
}

/* ---------- workspace lists (Kategorie, Pravidla, Dodavatelé, Profil) ---------- */
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.strong { font-weight: 600; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.row-disabled { opacity: .55; }

.data-table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .strong { font-weight: 600; }

/* text areas match the field inputs */
.field textarea {
    font: inherit; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px;
    background: var(--surface); color: var(--ink); resize: vertical; min-height: 68px;
    text-transform: none; letter-spacing: normal; font-weight: 400;
}
.field textarea.mono { font-family: var(--mono); }
.field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---------- data-table: mobile card representation ---------- */
@media (max-width: 820px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: auto; }
    .data-table tr {
        border: 1px solid var(--border); border-radius: var(--r-lg);
        padding: 12px 14px; margin-bottom: 12px; background: var(--surface);
    }
    .data-table td { border: 0; padding: 5px 0; }
    .data-table td[data-label] { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
    .data-table td[data-label]::before {
        content: attr(data-label); color: var(--faint); font-size: 11px; font-weight: 700;
        text-transform: uppercase; letter-spacing: .03em; flex: none;
    }
    .data-table .col-actions { text-align: left; white-space: normal; }
    .data-table .num { text-align: right; }
}

/* ---------- review state banner (top of invoice detail) ---------- */
.page-narrow { width: 100%; max-width: 820px; margin: 0 auto; padding: 22px 30px 96px; }
.review-state { display: flex; align-items: flex-start; gap: 14px; border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: 16px 18px; margin-bottom: 18px; background: var(--surface); }
.review-state .rs-icon { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid;
    place-items: center; font-weight: 800; font-size: 18px; }
.review-state .rs-head { font-size: 16px; font-weight: 700; color: var(--ink); }
.review-state .rs-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.review-state.rs-green { border-color: color-mix(in srgb, var(--good) 40%, var(--border)); background: var(--good-soft); }
.review-state.rs-green .rs-icon { background: var(--good); color: #fff; }
.review-state.rs-amber { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: var(--warn-soft); }
.review-state.rs-amber .rs-icon { background: var(--warn); color: #fff; }
.review-state.rs-red { border-color: color-mix(in srgb, var(--crit) 40%, var(--border)); background: var(--crit-soft); }
.review-state.rs-red .rs-icon { background: var(--crit); color: #fff; }
.rs-list { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rs-list li { font-size: 13px; color: var(--ink); display: flex; gap: 8px; align-items: baseline; }
.rs-list li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; margin-top: 6px; }
.rs-list.rs-list-red li::before { background: var(--crit); }
.rs-list.rs-list-amber li::before { background: var(--warn); }
.rs-list li a { color: inherit; }

/* ---------- field-level red/amber state (missing / verify) ---------- */
.field.field-error > input, .field.field-error > select, .field.field-error > textarea { border-color: var(--crit); background: var(--crit-soft); }
.field.field-warn > input, .field.field-warn > select, .field.field-warn > textarea { border-color: var(--warn); }
.field-note { font-size: 11px; font-weight: 600; letter-spacing: normal; text-transform: none; margin-top: 3px; }
.field-note.error { color: var(--crit); }
.field-note.warn { color: var(--warn); }
.card.card-error { border-color: color-mix(in srgb, var(--crit) 45%, var(--border)); }
.card.card-warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }

/* ---------- legal documents (privacy / terms) ---------- */
.legal-doc { padding-top: 20px; }
.legal-doc .back-link { margin-bottom: 14px; }
.legal-eyebrow { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--accent); background: var(--accent-soft);
    padding: 4px 10px; border-radius: 999px; margin-bottom: 12px; }
.legal-title { font-size: 26px; line-height: 1.2; margin: 0 0 8px; }
.legal-intro { font-size: 15px; color: var(--muted); line-height: 1.6; margin: 0 0 6px; }
.legal-date { font-size: 13px; color: var(--faint); margin: 0 0 20px; }
.legal-lead { font-size: 14.5px; line-height: 1.7; color: var(--ink); margin: 18px 0 8px; }
.legal-toc { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2);
    padding: 16px 18px; margin: 8px 0 8px; }
.legal-toc-head { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.legal-toc ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.legal-toc a { color: var(--accent); text-decoration: none; font-size: 14px; }
.legal-toc a:hover { text-decoration: underline; }
.legal-section { scroll-margin-top: 84px; padding: 18px 0; border-top: 1px solid var(--border); }
.legal-section h2 { font-size: 17px; color: var(--ink); margin: 0 0 10px; }
.legal-section h3 { font-size: 14px; color: var(--ink); margin: 14px 0 4px; }
.legal-section p { font-size: 14.5px; line-height: 1.7; color: var(--ink); margin: 0 0 8px; }
.legal-section ul { margin: 6px 0 10px 18px; display: flex; flex-direction: column; gap: 5px; }
.legal-section li { font-size: 14.5px; line-height: 1.6; color: var(--ink); }
.legal-section a { color: var(--accent); }
.legal-placeholder { color: var(--muted); font-style: italic; }
.login-legal { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 18px;
    font-size: 12.5px; }
.login-legal a { color: var(--muted); text-decoration: none; }
.login-legal a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- advance invoice (progressive disclosure) ---------- */
.advance-block { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.advance-legend { display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.advance-choice { display: flex; gap: 18px; align-items: center; }
.radio-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); cursor: pointer; }
.radio-inline input { width: 16px; height: 16px; }
.advance-relates { margin-top: 12px; }
.advance-relates[hidden] { display: none; }

/* ---------- preview viewer actions ---------- */
.preview-actions { display: inline-flex; gap: 14px; align-items: center; }

/* processing state pill (history) */
.vpill.processing { background: var(--accent-soft); color: var(--accent); }

/* ---------- multi-photo capture (mobile) ---------- */
.photo-capture { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 14px; }
.photo-capture-head { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.photo-capture-note { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.photo-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.photo-thumb { position: relative; width: 84px; height: 108px; border: 1px solid var(--border);
    border-radius: var(--r-sm); overflow: hidden; background: var(--surface-2); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb .pt-num { position: absolute; top: 3px; left: 3px; background: rgba(22,32,43,.75); color: #fff;
    font-size: 11px; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; }
.photo-thumb .pt-del { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border: 0;
    border-radius: 50%; background: rgba(217,45,60,.92); color: #fff; font-size: 13px; line-height: 20px; cursor: pointer; padding: 0; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.photo-count { font-size: 13px; color: var(--muted); }

/* verification "Je to chyba?" prompt */
.kd-question { font-weight: 700; font-size: 15px; color: var(--ink); margin: 4px 0 10px; }

/* ---------- upload page simplification ---------- */
.upload-hero { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.upload-hero-text { flex: 1; min-width: 0; }
/* one primary camera action, secondary to the dropzone on desktop */
.camera-primary { width: 100%; justify-content: center; gap: 8px; }
.bulk-panel .bulk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bulk-panel .bulk-head strong { font-size: 15px; }
/* mobile: camera prominent, order Typ dokladu -> Vyfotit doklad -> Vybrat soubor */
@media (max-width: 620px) {
    .camera-primary { order: -2; padding: 14px 16px; font-size: 16px; min-height: 48px; }
    .photo-capture { order: -1; }
}

/* ---- Platform admin console -------------------------------------------------- */
.nav-admin { font-weight: 600; }
.admin-badge {
    display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent); margin-bottom: 8px;
}
.admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.admin-head h1 { margin-top: 2px; }
.admin-head .muted { margin-top: 4px; }
.admin-stats { display: flex; gap: 22px; color: var(--muted); font-size: 13px; }
.admin-stats span { display: flex; flex-direction: column; }
.admin-stats strong { font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Shared styled form control (matches .field input) so admin inputs/selects never look default. */
.input {
    width: 100%; padding: 9px 12px; border-radius: 9px; background: var(--surface);
    border: 1px solid var(--border-strong); color: var(--ink);
    font-family: var(--sans); font-size: 14px; line-height: 1.3; min-height: 40px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.input:disabled { background: var(--surface-2); color: var(--faint); cursor: not-allowed; }
select.input {
    appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a93a6' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
    background-repeat: no-repeat; background-position: right 10px center;
}

.admin-filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.admin-filter .input { width: auto; min-width: 230px; flex: 1 1 230px; }
.admin-filter select.input { min-width: 170px; flex: 0 0 auto; }

/* Admin tables reuse the history-table visual language. */
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
    text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
    color: var(--faint); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.admin-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.admin-table td.col-actions { text-align: right; }
.admin-usage-cell { display: flex; flex-direction: column; line-height: 1.25; }
.admin-usage-cell .u-main { font-variant-numeric: tabular-nums; }
.admin-usage-cell .u-pct { color: var(--muted); font-size: 12px; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.admin-grid .admin-audit, .admin-grid .admin-activity { grid-column: 1 / -1; }
.admin-grid section h2 { font-size: 15px; margin-bottom: 12px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.kv code { font-size: 12px; color: var(--muted); }

.feature-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.feature-row .muted { margin-top: 2px; }

.usage-block { margin-bottom: 8px; }
.usage-figure { display: flex; align-items: baseline; gap: 8px; }
.usage-count { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.usage-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 10px 0 6px; }
.usage-bar span { display: block; height: 100%; background: var(--accent); }
.usage-bar.is-full span { background: var(--crit); }

.limit-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.limit-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.limit-form .input { width: 150px; }
.limit-form .check { flex-direction: row; align-items: center; gap: 7px; font-size: 14px; color: var(--ink); font-weight: 500; }

.chip-muted { background: var(--surface-2); color: var(--muted); }

/* Activity feed */
.activity-filter { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.activity-filter label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.activity-filter .input { width: auto; min-width: 150px; }
.act-outcome { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em; }
.act-ok { background: var(--good-soft); color: var(--good); }
.act-failed { background: var(--crit-soft); color: var(--crit); }
.act-warning { background: var(--warn-soft); color: var(--warn); }
.act-corr { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.act-ref { color: var(--muted); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--muted); }
.pager .btn-sm { text-decoration: none; }
