/* Recognica Workflows. Same palette as the design tools and the old landing page. */

:root {
    --bg: #eef0f3;
    --panel: #ffffff;
    --line: #d9dde3;
    --line-strong: #c3c9d1;
    --text: #1d232b;
    --muted: #6a7480;
    --accent: #1f5fbf;
    --accent-hover: #194f9f;
    --accent-soft: #e6eefb;
    --ok: #1d7a3e;
    --ok-soft: #e3f4e8;
    --bad: #b3261e;
    --bad-soft: #fbe7e5;
    --warn-soft: #fdf3dc;
    --extract: #1f5fbf;
    --extract-soft: #e6eefb;
    --classify: #7a4fc4;
    --classify-soft: #efe8fb;
    --input-bg: #ffffff;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #15181c;
        --panel: #1e2227;
        --line: #2e343b;
        --line-strong: #3b424a;
        --text: #e6e9ed;
        --muted: #9aa3ad;
        --accent: #5b93e6;
        --accent-hover: #74a5ec;
        --accent-soft: #1d2b40;
        --ok: #5cc985;
        --ok-soft: #173223;
        --bad: #f08a80;
        --bad-soft: #3a1d1b;
        --warn-soft: #3a2f15;
        --extract: #5b93e6;
        --extract-soft: #1d2b40;
        --classify: #a98be6;
        --classify-soft: #2a2140;
        --input-bg: #15181c;
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
}
a { color: var(--accent); }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 10px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 0; }
code { font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: 13px; }
.muted { color: var(--muted); font-weight: normal; }
.nowrap { white-space: nowrap; }
.hint { color: var(--muted); font-size: 14px; }
.lede { color: var(--muted); max-width: 680px; }

/* ---- controls ---- */
button, .btn, input, select { font: inherit; color: inherit; }
button {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid var(--line-strong); background: var(--panel); border-radius: 6px;
    padding: 7px 14px; cursor: pointer;
}
button:hover:not(:disabled) { background: var(--bg); }
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.small { padding: 3px 10px; font-size: 14px; }
button.wide { width: 100%; padding: 10px; }
button.link { border: none; background: none; padding: 0; color: var(--accent); }
button.link:hover { background: none; text-decoration: underline; }
@media (prefers-color-scheme: dark) { button.primary, button.danger { color: #111418; } }

input:not([type=checkbox]), select {
    border: 1px solid var(--line-strong); border-radius: 6px; padding: 8px 10px; background: var(--input-bg);
    min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 1px;
}

.notice { background: var(--ok-soft); color: var(--ok); padding: 8px 12px; border-radius: 6px; }
.form-error { background: var(--bad-soft); color: var(--bad); padding: 8px 12px; border-radius: 6px; }

/* ---- page frame ---- */
/* One width for every page and the top bar, so the logo, menu and headings never move between tabs. */
.wrap { max-width: 1500px; margin: 0 auto; padding: 0 16px; }
header.top { border-bottom: 1px solid var(--line); background: var(--panel); }
header.top .wrap { display: flex; align-items: center; gap: 18px; min-height: 56px; flex-wrap: wrap; }
.home-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.mark { width: 26px; height: 26px; flex: none; }
.brand { font-weight: 700; font-size: 16px; }
.main-nav { display: flex; gap: 4px; }
.main-nav a { text-decoration: none; color: var(--muted); padding: 6px 10px; border-radius: 6px; }
.main-nav a:hover { color: var(--text); background: var(--bg); }
.main-nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 14px; }
.who-name { font-weight: 600; }
.who form { margin: 0; }

.page { padding: 28px 16px 48px; }
/* A short form: same page width and left edge as every other page, only its content kept narrow. */
.page.narrow > * { max-width: 560px; }

/* ---- start page ---- */
.top-notice { margin: 20px 0 0; }
.intro { padding: 28px 0 24px; }   /* the start page's heading sits where every page's does */
.intro p { margin: 0; color: var(--muted); max-width: 680px; }
.block { margin: 0 0 32px; }
.block-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.empty-panel { background: var(--panel); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 18px 20px; }
.empty-panel p { margin: 0; }
.empty-panel p + p { margin-top: 4px; }

.apps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
    padding: 20px; display: flex; flex-direction: column; gap: 12px;
    border-top: 4px solid var(--app);
}
.card.extract { --app: var(--extract); --app-soft: var(--extract-soft); }
.card.classify { --app: var(--classify); --app-soft: var(--classify-soft); }
.card-head { display: flex; align-items: center; gap: 12px; }
.icon { width: 44px; height: 44px; border-radius: 10px; flex: none; background: var(--app-soft); color: var(--app); display: grid; place-items: center; }
.icon svg { width: 24px; height: 24px; }
.card h3 { font-size: 18px; margin: 0; line-height: 1.25; }
.port { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.card .lede { margin: 0; color: var(--text); }
.card ul { margin: 0; padding-left: 18px; color: var(--muted); }
.card li { margin: 3px 0; }
.card li strong { color: var(--text); font-weight: 600; }
.card-foot { margin-top: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.open {
    display: inline-flex; align-items: center; gap: 8px; background: var(--app); color: #fff;
    text-decoration: none; font-weight: 600; padding: 9px 16px; border-radius: 6px;
}
.open:hover { filter: brightness(1.08); }
@media (prefers-color-scheme: dark) { .open { color: #111418; } }
.engine { color: var(--muted); font-size: 14px; margin: 14px 0 0; display: flex; align-items: center; gap: 8px; }

.status {
    display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted);
    padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line);
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.status.ok { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.status.ok::before { background: var(--ok); }
.status.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.status.bad::before { background: var(--bad); }

/* ---- sign-in pages ---- */
.account { max-width: 420px; margin: 0 auto; padding: 56px 16px 32px; }
.account-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 18px; }
.account-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 26px 24px; }
.account-card h1 { font-size: 22px; }
.account-card code { display: block; margin-top: 4px; padding: 6px 8px; background: var(--bg); border-radius: 6px; overflow-wrap: anywhere; }
.account-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; margin: 16px 0 6px; }
.stack label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 14px; }
.stack label .muted { font-weight: normal; }
.stack input { font-weight: normal; }

/* ---- admin: users ---- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin: 18px 0; }
.panel h2 { font-size: 16px; margin-bottom: 10px; }
.row-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; flex: 1 1 160px; }
.row-form label select, .row-form label input { font-weight: normal; }
.reveal {
    display: flex; gap: 16px; align-items: flex-start; justify-content: space-between;
    background: var(--warn-soft); border-radius: 10px; padding: 14px 16px; margin: 16px 0;
}
.reveal p { margin: 4px 0 0; font-size: 14px; }
code.big { display: block; font-size: 20px; letter-spacing: 0.04em; margin-top: 4px; }

table.list { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: 13px; color: var(--muted); font-weight: 600; background: var(--bg); }
table.list tr:last-child td { border-bottom: none; }
table.list tr.inactive td { color: var(--muted); }
table.list tr.editing td { background: var(--accent-soft); }
table.list td input:not([type=checkbox]), table.list td select { padding: 5px 8px; width: 100%; }
td.actions { white-space: nowrap; text-align: right; }
td.actions button + button, td.actions .confirm { margin-left: 6px; }
.confirm button { margin-left: 4px; }
label.check { display: inline-flex; align-items: center; gap: 6px; }
label.check.top { align-items: flex-start; }
label.check.top input { margin-top: 3px; }

/* ---- admin: file sharing ---- */
.mono { font-family: Consolas, "Cascadia Mono", Menlo, monospace; font-size: 14px; }
.sharing-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 0; font-size: 14px; }
.button-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.stack-label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; max-width: 420px; margin-bottom: 12px; }
.stack-label input { font-weight: normal; }
table.list.compact td, table.list.compact th { padding: 7px 10px; }
.c { text-align: center; }
.small-path { color: var(--muted); font-size: 12px; }
.help ul { margin: 0; padding-left: 18px; }
.help li { margin: 4px 0; }
p.empty-panel { margin: 0; color: var(--muted); }

/* ---- workflows ---- */
.head-links { margin-left: auto; font-size: 14px; }
.wf-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.wf-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.wf-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.wf-head > div:first-child { flex: 1 1 200px; }
.wf-card h3 { font-size: 17px; margin: 0; line-height: 1.25; }
.wf-card h3 a { text-decoration: none; }
.wf-card h3 a:hover { text-decoration: underline; }
.wf-counts { display: grid; grid-template-columns: repeat(3, auto); gap: 8px; margin: 0; }
.wf-counts div { background: var(--bg); border-radius: 8px; padding: 6px 8px; }
.wf-counts dt { font-size: 12px; color: var(--muted); white-space: nowrap; }
.wf-counts dd { margin: 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.state { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; background: var(--bg); color: var(--muted); }
.state.running { background: var(--ok-soft); color: var(--ok); }
.state.paused { background: var(--warn-soft); color: var(--text); }
.crumbs { font-size: 14px; color: var(--muted); margin: 0 0 6px; }
.crumbs a { color: var(--muted); }
.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.title-row h1 { margin-bottom: 2px; }
.sub-title { margin: 0 0 8px; }
.title-actions { display: flex; align-items: center; gap: 10px; }
.btn-link { align-self: center; }
h3.sub, h2.sub { font-size: 15px; margin: 16px 0 8px; }
ul.checks { list-style: none; margin: 0; padding: 0; }
ul.checks li { padding: 4px 0 4px 26px; position: relative; }
ul.checks li::before { position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
ul.checks li.ok::before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
ul.checks li.bad::before { content: "✕"; background: var(--bad-soft); color: var(--bad); }
ul.checks li.warn::before { content: "!"; background: var(--warn-soft); color: var(--text); }
ul.changes { margin: 0 0 12px; padding-left: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.form-grid label input, .form-grid label select { font-weight: normal; }
.form-grid .hint { font-weight: normal; font-size: 13px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.inline { display: flex; align-items: center; gap: 8px; font-weight: normal; }
input.num { width: 90px; }
table.types td.fields { max-width: 460px; }
/* Per field: name, Always verify box, threshold. */
.field-cfg-list { display: grid; gap: 3px; }
.field-cfg { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; }
.field-cfg .chip { justify-self: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.field-cfg .thr { font-size: 13px; color: var(--muted); white-space: nowrap; }
.field-cfg .thr input.num { width: 4.2em; padding: 2px 4px; color: var(--muted); }
.field-cfg .thr.own, .field-cfg .thr.own input.num { color: var(--text); font-weight: 600; }
.chip { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 9px; font-size: 13px; margin: 2px 4px 2px 0; }
.bad-text { color: var(--bad); font-size: 14px; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.save-bar {
    z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: var(--panel); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 14px; margin: 18px 0;
}
.save-bar span { margin-right: auto; color: var(--muted); font-size: 14px; }
.save-bar.dirty { position: sticky; bottom: 12px; border-color: var(--accent); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); }
.save-bar.dirty span { color: var(--text); font-weight: 600; }
.small-cell { font-size: 12px; }
td.mono.small-cell { white-space: nowrap; }
.danger-zone { border-color: var(--bad-soft); }
.price-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.price-grid label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.price-grid label input { font-weight: normal; }

.wf-activity { font-size: 13px; color: var(--muted); }
.activity-line { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; flex-wrap: wrap; }

#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
    background: var(--bad-soft); color: var(--bad); padding: 10px 16px;
}

@media (max-width: 760px) {
    h1 { font-size: 22px; }
    .apps, .form-grid, .price-grid { grid-template-columns: minmax(0, 1fr); }
    .who { margin-left: 0; width: 100%; padding-bottom: 8px; }
    table.list { display: block; overflow-x: auto; }
}

/* ---- Verification --------------------------------------------------------------------------- */

.ok-chip { background: var(--ok-soft); color: var(--ok); }
.warn-chip { background: var(--warn-soft); color: var(--text); }
table.queue tr.mine td { background: var(--accent-soft); }
table.queue td.actions { white-space: nowrap; text-align: right; }
table.queue td.actions button + button { margin-left: 6px; }

.batch-title { font-size: 22px; }
.verify-grid {
    display: grid; grid-template-columns: 220px minmax(0, 1fr) 360px; gap: 14px; align-items: start;
}
.verify-grid > .panel { margin: 0; }
.verify-grid h2 { font-size: 15px; margin: 0 0 8px; }

.doc-list { padding: 12px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.doc-list ul { list-style: none; margin: 0; padding: 0; }
.doc-item {
    display: grid; grid-template-columns: 16px 1fr; column-gap: 6px; width: 100%; text-align: left;
    border: 1px solid transparent; background: none; padding: 6px 8px; border-radius: 6px; margin-bottom: 2px;
}
.doc-item.current { border-color: var(--accent); background: var(--accent-soft); }
.doc-mark { color: #b7791f; grid-row: span 2; font-size: 12px; line-height: 20px; }
.doc-item.confirmed .doc-mark { color: var(--ok); }
.doc-name { font-size: 14px; overflow-wrap: anywhere; }
.doc-type { font-size: 12px; color: var(--muted); }

.page-pane { padding: 10px; }
.page-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.page-tabs button { margin-right: 4px; min-width: 32px; }
.page-tabs button.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.zoom { display: inline-flex; align-items: center; gap: 6px; }
.small-link { font-size: 14px; margin-left: 8px; }
.page-scroll { overflow: auto; max-height: calc(100vh - 120px); border: 1px solid var(--line); border-radius: 6px; background: #8a8f96; }
.page-view { position: relative; margin: 0 auto; background: #fff; }
.page-view img, .page-view svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.page-view .box { fill: rgba(31, 95, 191, 0.08); stroke: rgba(31, 95, 191, 0.55); stroke-width: 1; }
.page-view .box.review { fill: rgba(214, 140, 0, 0.12); stroke: rgba(214, 140, 0, 0.8); }
.page-view .box.selected { fill: rgba(31, 95, 191, 0.18); stroke: #1f5fbf; stroke-width: 2.5; }
.page-view .box.drawn { stroke-dasharray: 5 3; }
/* Draw a box to read the active field: crosshair over the page, a dashed box while dragging. */
.page-view.can-draw, .page-view.can-draw img, .page-view.can-draw svg { cursor: crosshair; user-select: none; }
.page-view .draw-box { position: absolute; border: 2px dashed #1f5fbf; background: rgba(31, 95, 191, 0.12); pointer-events: none; z-index: 2; }
.page-view.reading { cursor: progress; }
.field .drawn-note { font-size: 0.85em; color: var(--muted, #667); margin-top: 2px; overflow-wrap: anywhere; }
.field .drawn-note.bad { color: var(--bad, #b3261e); }

.field-pane { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.doc-head { overflow-wrap: anywhere; }
.fields { display: grid; gap: 10px; margin-top: 12px; }
.field { border-left: 3px solid transparent; padding-left: 8px; }
.field.review { border-left-color: #d68c00; }
.field.selected { border-left-color: var(--accent); }
.field label { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 3px; }
.field-name { font-weight: 600; overflow-wrap: anywhere; }
.field-flags { white-space: nowrap; font-size: 13px; }
.field input {
    width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--input-bg);
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.field.review input { background: var(--warn-soft); }
.was { font-size: 13px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.was button.link { margin-left: 8px; font-size: 13px; }
.show-all { margin-top: 12px; }
.confirm-row { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

@media (max-width: 1100px) {
    .verify-grid { grid-template-columns: minmax(0, 1fr); }
    .doc-list, .field-pane { position: static; max-height: none; }
    .page-scroll { max-height: 70vh; }
}

/* ---- Unknown queue -------------------------------------------------------------------------- */

a.button-link {
    display: inline-block; padding: 3px 12px; border-radius: 6px; background: var(--accent); color: #fff;
    font-size: 14px; font-weight: 600; text-decoration: none;
}
a.button-link:hover { background: var(--accent-hover); }
.unknown-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 14px; align-items: start; }
.unknown-grid > .panel { margin: 0; }
.unknown-grid h2 { font-size: 16px; margin: 0 0 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.type-choices { border: none; padding: 0; margin: 12px 0 6px; display: grid; gap: 6px; }
.type-choice {
    display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; cursor: pointer;
    border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
.type-choice.picked { border-color: var(--accent); background: var(--accent-soft); }
.type-name { font-weight: 600; }
.type-score { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.score-bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.score-bar span { display: block; height: 100%; background: var(--accent); }
.train-choice { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: 14px; }
.train-choice input { margin-top: 3px; }
.reject-box { margin-top: 14px; padding: 12px; border-radius: 8px; background: var(--bad-soft); display: grid; gap: 8px; }
.reject-box label { font-size: 14px; font-weight: 600; }
.reject-box input { padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--input-bg); }
.reject-box button { justify-self: start; }
.queue-left { margin-top: 16px; }
@media (max-width: 1000px) { .unknown-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---- Reports -------------------------------------------------------------------------------- */

.filter-bar { display: grid; gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; }
.filter-row label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.filter-row input, .filter-row select {
    padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--input-bg); color: var(--text); min-width: 150px;
}
.quick { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 4px; }
.tabs .tab { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 14px; color: var(--muted); }
.tabs .tab.current { border-bottom-color: var(--accent); color: var(--text); font-weight: 600; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile-label { font-size: 13px; color: var(--muted); }
.tile-value { font-size: 28px; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tile-lines { display: grid; gap: 3px; margin-top: 6px; font-size: 14px; }
table.list th.r, table.list td.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list tr.total td { font-weight: 700; background: var(--bg); border-top: 2px solid var(--line-strong); }
.table-scroll { overflow-x: auto; }
table.usage { font-size: 14px; }
.downloads { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.definitions summary { cursor: pointer; color: var(--accent); font-size: 14px; }
.definitions ul { font-size: 14px; margin: 8px 0 0; padding-left: 20px; }
.definitions li { margin-bottom: 4px; }
.wrap-any { overflow-wrap: anywhere; }

/* Restart page */
.link-button { background: none; border: 0; padding: 0 2px; color: inherit; cursor: pointer; font: inherit; }
.step-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.step-choice { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line, #d0d7de); border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.step-choice.current { border-color: var(--accent); background: var(--accent-soft); }
.step-choice input { margin-top: 3px; }
.restart-page .options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.restart-page .options label.check { align-items: flex-start; }
.restart-page .options label.check input { margin-top: 3px; }
.locked-list { border-left: 3px solid var(--warn, #b7791f); padding: 4px 12px; margin: 10px 0; }
.locked-list ul { margin: 6px 0; padding-left: 18px; }
.locked-list li { margin: 4px 0; }
.run-form { margin-top: 16px; }
fieldset.billable { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
fieldset.billable legend { font-weight: 600; margin-bottom: 4px; }
tr.muted td { color: var(--muted, #6a737d); }
.form-grid fieldset.billable label.check { flex-direction: row; align-items: center; font-weight: normal; }

/* Server page */
.usage-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 4px 0; min-width: 80px; }
.usage-bar .fill { height: 100%; border-radius: 3px; }
.usage-bar .fill.green { background: #2f9e44; }
.usage-bar .fill.yellow { background: #e0a100; }
.usage-bar .fill.red { background: #d9363e; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.dot.green { background: #2f9e44; } .dot.yellow { background: #e0a100; } .dot.red { background: #d9363e; } .dot.grey { background: #b7bec7; }
.server-table tr.level-red td { background: #fdecec; }
.server-table tr.level-yellow td { background: var(--warn-soft); }
.server-table .why { color: var(--muted); }
.server-table .mem-cell { min-width: 170px; }
.server-table td { vertical-align: middle; }
svg.spark { width: 160px; height: 32px; display: block; background: #f6f8fa; border-radius: 4px; }
svg.spark polyline { fill: none; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
svg.spark polyline.first { stroke: var(--accent); }
svg.spark polyline.second { stroke: #9aa4b1; stroke-width: 1; }
svg.spark line.lvl { stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
svg.spark line.lvl.yellow { stroke: #e0a100; } svg.spark line.lvl.red { stroke: #d9363e; }
.tile svg.spark { width: 100%; margin-top: 6px; }
.warn-box { background: var(--warn-soft); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.warn-text { color: #9a6a00; }
.ok-text { color: var(--ok); }
.version-cell { cursor: help; }
.limit-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.limit-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.limit-form input { width: 120px; }
.limit-notes { margin: 8px 0 0; padding-left: 18px; }
.server-page button.small.current { background: var(--accent-soft); border-color: var(--accent); }

/* workflow editor: Folders */
table.folders code { white-space: nowrap; user-select: all; }
@media (max-width: 720px) { table.folders code { white-space: normal; overflow-wrap: anywhere; } }
table.folders td { vertical-align: top; }
.backup-line { display: flex; gap: 6px; align-items: baseline; margin: 6px 0 0; }
.wf-run { font-size: 13px; margin-top: 8px; }
/* Menu badges: how many documents wait on Verify and Unknown, blinking slowly. */
.nav-badge { display: inline-block; min-width: 18px; margin-left: 6px; padding: 1px 6px; border-radius: 9px; background: #d9363e; color: #fff;
             font-size: 12px; font-weight: 700; line-height: 16px; text-align: center; font-variant-numeric: tabular-nums;
             animation: nav-badge-blink 2.4s ease-in-out infinite; }
@keyframes nav-badge-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .nav-badge { animation: none; } }

/* start page: one full-width card per workflow, with a grid of its batches */
.wf-counts dd { font-size: 18px; }
table.wf-batches { width: 100%; border-collapse: collapse; font-size: 14px; }
table.wf-batches th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.wf-batches td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.wf-batches tr:last-child td { border-bottom: 0; }
table.wf-batches td.num { font-variant-numeric: tabular-nums; }
table.wf-batches th.c, table.wf-batches td.c { text-align: center; }
.table-scroll { overflow-x: auto; }
.bstate { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--bg); color: var(--muted); }
.bstate.processing { background: var(--accent-soft); color: var(--accent); }
.bstate.waiting { background: var(--warn-soft); color: var(--text); }
.bstate.done { background: var(--ok-soft); color: var(--ok); }
.bstate.error, .bstate.warn { background: var(--bad-soft); color: var(--bad); }
.progress-cell { min-width: 200px; }
.progress-cell .bar { display: inline-block; width: 70px; height: 6px; border-radius: 3px; background: var(--bg); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.progress-cell .bar span { display: block; height: 100%; background: var(--ok); }
.progress-cell .muted { font-size: 12px; }
.wf-none { margin: 0; }
.block-head button.refresh { margin-left: 4px; }
.small-note { font-size: 12px; }
.spin { display: inline-block; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
.wf-card { min-width: 0; }
.wf-head .wf-counts { display: flex; flex-wrap: wrap; }
.progress-cell .muted { white-space: nowrap; }
.progress-cell { white-space: nowrap; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search-note { margin: -8px 0 14px; font-size: 14px; }
table.wf-batches .matched { font-size: 12px; }
/* start page: workflow picker and batch search, on their own row under the Workflows heading */
.wf-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 20px; }
.wf-toolbar select, .wf-toolbar input { box-sizing: border-box; height: 30px; padding: 3px 10px; font-size: 14px; line-height: 1.2; }
.wf-toolbar select { max-width: 320px; }
.wf-toolbar input { width: 260px; max-width: 100%; }
@media (max-width: 560px) { .wf-toolbar label, .wf-toolbar select, .wf-toolbar input { width: 100%; max-width: none; } }

/* Restart link on a batch row (start page cards and Verify queue): looks like a small button. */
a.restart-link, a.open-link {
    display: inline-flex; align-items: center; padding: 3px 10px; font-size: 14px; border-radius: 6px;
    border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); text-decoration: none; white-space: nowrap;
}
a.restart-link:hover, a.open-link:hover { background: var(--bg); border-color: var(--accent); color: var(--accent); }
td.actions button + a.restart-link, td.actions a.open-link + a.restart-link { margin-left: 6px; }
/* "8 days left" before a finished batch's files are deleted, next to its Restart. */
td.actions .keep-left { margin-right: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; cursor: help; }
/* Restart's "Are you sure?" step. */
.confirm-restart { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--bad); border-radius: 8px; background: var(--bad-soft); }
.confirm-restart p { margin: 0 0 8px; }
table.wf-batches td.actions { text-align: right; white-space: nowrap; }

/* Keep the batch grid inside the card so the Restart column shows: the progress text sits under the
   bar and may wrap, and a long phase ("Being verified by …") wraps too. */
table.wf-batches .progress-cell { white-space: normal; min-width: 130px; }
table.wf-batches .progress-cell .bar { display: block; width: 100%; max-width: 150px; margin: 0 0 4px; }
table.wf-batches .progress-cell .muted { display: block; white-space: normal; line-height: 1.3; }
table.wf-batches td.phase { white-space: normal; min-width: 110px; }
table.wf-batches td.finished { min-width: 80px; }

/* ---- quick batch restart (Restart button on a batch) ---------------------------------------- */
.quick-restart h2 { margin-top: 0; }
.quick-steps { display: grid; gap: 8px; margin: 10px 0 14px; max-width: 640px; }
.quick-summary { margin: 0 0 8px; line-height: 1.5; max-width: 760px; }
.quick-go { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 14px 0 10px; }
.quick-go .quick-reason { flex: 1; min-width: 220px; max-width: 420px; }
.quick-actions { display: flex; align-items: center; gap: 14px; max-width: 760px; }
.quick-actions .spacer { flex: 1; }


/* ---- unpublished changes (start page card and workflow editor) ------------------------------- */
.wf-unpublished { margin: 8px 0 4px; padding: 7px 10px; border-left: 3px solid var(--warn, #b7791f); background: rgba(183, 121, 31, .12); border-radius: 4px; font-size: 14px; }
.wf-unpublished a { margin-left: 6px; white-space: nowrap; }
.unpublished-banner { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--warn, #b7791f); border-left-width: 4px; background: rgba(183, 121, 31, .12); border-radius: 6px; }
.unpublished-banner p { margin: 0 0 6px; }
.unpublished-banner ul { margin: 0 0 10px; padding-left: 20px; }

.edit-page table.list td.actions { text-align: right; white-space: nowrap; }

/* ---- cancel verification ---------------------------------------------------------------------- */
button.danger-outline { border-color: var(--bad); color: var(--bad); background: transparent; }
button.danger-outline:hover:not(:disabled) { background: var(--bad-soft); }
.cancel-ask { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--bad); border-left-width: 4px; border-radius: 6px; background: var(--bad-soft); }
.cancel-ask p { margin: 0 0 10px; }
.cancel-ask button { margin-right: 8px; }

/* ---- product, version and copyright (Components/LegalFooter.razor) -------------------------- */
.legal { color: var(--muted); font-size: 12px; text-align: right; padding: 18px 16px 14px; }
.legal.inline { padding: 0; margin-left: auto; white-space: nowrap; }
/* Short pages: the line sits at the bottom of the window, not right under the content. */
body { display: flex; flex-direction: column; min-height: 100vh; }
body > * { flex-shrink: 0; }
body > .legal { margin-top: auto; }
.foot-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 14px 0 18px; }
.foot-row .engine { margin: 0; }
body:has(.home-page) > .legal { display: none; }   /* the start page shows it in its last row */

/* Verify: what decided the document's type */
.classified-by { margin: -4px 0 8px; color: #1e6a36; }

/* ---- export and import of packages (same block in the three apps) ------------------------------ */
.pkg-modal-backdrop { position: fixed; inset: 0; background: rgba(20, 26, 34, .45); z-index: 50; }
.pkg-modal { position: fixed; z-index: 51; top: 8vh; left: 50%; transform: translateX(-50%); width: min(600px, calc(100vw - 32px));
    max-height: 84vh; overflow: auto; background: #fff; border-radius: 8px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); padding: 16px 18px; text-align: left; }
.pkg-modal h2 { font-size: 16px; margin: 0 0 6px; }
.pkg-modal .hint { color: #6a7480; margin: 0 0 10px; line-height: 1.45; }
.pkg-opt { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid #eef0f3; align-items: flex-start; cursor: pointer; }
.pkg-opt:last-of-type { border-bottom: 0; }
.pkg-opt .sz { margin-left: auto; color: #6a7480; white-space: nowrap; padding-left: 10px; }
.pkg-opt small { display: block; color: #6a7480; }
.pkg-opt.sub { padding-left: 26px; }
.pkg-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; align-items: center; }
.pkg .pkg-buttons { justify-content: flex-start; }
a.pkg-button { display: inline-block; border: 1px solid #c3c9d1; background: #f7f8fa; border-radius: 5px; padding: 5px 12px; text-decoration: none; color: inherit; }
a.pkg-button.primary { background: #1f5fbf; border-color: #1f5fbf; color: #fff; }
a.pkg-button.disabled { opacity: .45; pointer-events: none; }
.pkg-steps { display: flex; gap: 6px; margin: 4px 0 14px; font-size: 12px; flex-wrap: wrap; }
.pkg-steps span { padding: 3px 10px; border-radius: 12px; background: #e3e6ea; color: #6a7480; }
.pkg-steps span.on { background: #1f5fbf; color: #fff; }
.pkg-steps span.done { background: #e5f4ea; color: #1d7a3a; }
.pkg-drop { display: block; border: 2px dashed #c3c9d1; border-radius: 8px; padding: 26px; text-align: center; color: #6a7480; background: #fafbfc; cursor: pointer; }
.pkg-drop input { display: block; margin: 10px auto 0; }
.pkg-summary { line-height: 1.5; }
.pkg-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 4px; }
.pkg-choice label { border: 1px solid #c3c9d1; border-radius: 6px; padding: 10px 12px; cursor: pointer; line-height: 1.45; background: #fff; display: block; }
.pkg-choice label.on { border-color: #1f5fbf; background: #e6eefb; }
.pkg-choice label.off { opacity: .55; }
.pkg-choice .title { display: block; font-weight: 600; margin-bottom: 2px; }
.pkg-choice .row { display: block; margin: 8px 0 2px; }
.pkg-choice small { display: block; color: #6a7480; }
.pkg-choice small.error { color: #b3261e; }
.pkg-diff { border-collapse: collapse; width: 100%; background: #fff; margin: 6px 0 10px; }
.pkg-diff th, .pkg-diff td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #d9dde3; vertical-align: top; }
.pkg-diff th { font-size: 12px; color: #6a7480; font-weight: 600; }
.pkg-diff td:first-child { width: 90px; }
.pkg-diff tr.add td { background: #f4fbf6; } .pkg-diff tr.remove td { background: #fdf4f3; } .pkg-diff tr.change td { background: #f5f8fe; }
.pkg-pill { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; background: #eef0f3; color: #6a7480; }
.pkg-pill.add { background: #e5f4ea; color: #1d7a3a; } .pkg-pill.remove { background: #fbe9e7; color: #b3261e; }
.pkg-pill.change { background: #eaf0fb; color: #1f5fbf; } .pkg-pill.warn { background: #fff4d9; color: #8a5a00; }
.pkg-warn, .pkg-ok, .pkg-err { border-radius: 6px; padding: 9px 12px; margin: 10px 0; line-height: 1.45; }
.pkg-warn { background: #fff4d9; border: 1px solid #ecd28f; }
.pkg-ok { background: #e5f4ea; border: 1px solid #b7dfc3; }
.pkg-err { background: #fbe9e7; border: 1px solid #efc1bb; }
.pkg-warn .row { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.pkg-deps select, .pkg-deps input { max-width: 100%; }
@media (max-width: 760px) { .pkg-choice { grid-template-columns: 1fr; } .pkg-opt { flex-wrap: wrap; } }

/* Upload PDFs page */
.upload-pick { display: block; max-width: 420px; margin: 4px 0 16px; }
.upload-pick select { display: block; width: 100%; margin-top: 4px; }
/* The file input covers the whole square, so a drop anywhere on it lands in the input. */
.upload-drop { position: relative; max-width: 520px; min-height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.upload-drop strong { font-size: 1.1em; color: var(--text, inherit); }
.upload-drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.upload-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.upload-drop.busy, .upload-drop.busy input[type=file] { cursor: progress; }
.upload-results { border-collapse: collapse; margin-top: 16px; }
.upload-waiting { margin-top: 20px; max-width: 620px; }
.upload-waiting h2 { font-size: 1.05em; margin: 0 0 4px; }
.upload-waiting .upload-results { margin: 6px 0 12px; width: 100%; }
.upload-problems { color: #b42318; margin: 12px 0 0; padding-left: 20px; }
.upload-results th, .upload-results td { text-align: left; padding: 4px 12px 4px 0; border-bottom: 1px solid #e3e6ea; }
.upload-results tr.bad td { color: #b42318; }

/* ---- Download page ---- */
a.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid var(--line-strong); background: var(--panel); border-radius: 6px;
    padding: 7px 14px; text-decoration: none;
}
a.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
a.btn.primary:hover { background: var(--accent-hover); }
@media (prefers-color-scheme: dark) { a.btn.primary { color: #111418; } }
.download-list { margin: 8px 0 14px; }
.download-list th.c, .download-list td.c { width: 32px; text-align: center; }
.download-list tr.chosen td { background: var(--accent-soft); }
.download-page .status-new { color: var(--accent); font-weight: 600; }
.confirm-box { border: 1px solid var(--bad); border-radius: 8px; padding: 12px 16px; margin-top: 12px; max-width: 620px; }
.confirm-box p { margin: 0 0 10px; }

/* Verify: what the export gets after the field's Clean up and Format */
.export-as { font-size: 13px; color: var(--accent); margin-top: 3px; overflow-wrap: anywhere; }
.export-as.bad { color: var(--bad); }

/* ---- Work button ----------------------------------------------------------------------------- */
.work-panel { text-align: center; }
.work-button { font-size: 1.15em; padding: 10px 28px; }
a.button-link.primary-link { padding: 6px 16px; font-weight: 600; }
.main-nav .work-link { font-weight: 600; }

/* History: finished batches, and the read-only view of one. */
.history-page .show-more { margin-top: 8px; }
.history-view .view-field { cursor: pointer; }
.history-view .view-field input[readonly] { background: var(--bg); cursor: pointer; }

/* License banner under the menu (section 18). */
.license-banner { padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.license-banner a { margin-left: 8px; font-weight: 600; }
.license-banner.warn { background: var(--accent-soft); }
.license-banner.grace { background: #fff4d6; color: #6b4a00; }
.license-banner.stopped { background: #fde2e1; color: #8a1c17; }
@media (prefers-color-scheme: dark) {
    .license-banner.grace { background: #3a2f10; color: #f3d48a; }
    .license-banner.stopped { background: #3d1715; color: #f3a6a1; }
}
.license-page .install-id { font-size: 20px; letter-spacing: 1px; }
.license-page dl.terms { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.license-page dl.terms dt { color: var(--muted); }
.license-page dl.terms dd { margin: 0; }
.history-page td.actions .restart-button { margin-left: 6px; }
.history-page tr.ask-row td { border-top: none; padding-top: 0; }

/* One batch per person: "You're already working on batch X" with Continue and Release. */
.holds-another { margin: 16px 0; padding: 14px 16px; border: 1px solid var(--accent); border-left-width: 4px; border-radius: 8px; background: var(--accent-soft); }
.holds-another p { margin: 0 0 10px; }
.holds-another .whole-batch-note { margin: 10px 0 0; }
.whole-batch-note { margin: 4px 0 12px; font-size: 0.9em; }
