/* N2X Invoice Manager. Ported from the approved mockup "N2X Invoice Manager v2" (artifact VNmxRRgJCaEicyF1E2bPYd);
   tokens and components follow Ops Connect (ops-connect/stock-manager/css/style.css). */
/* Layout: ops-connect header + two columns — the document on the left, context (dossier/obra) and reconciliation in a sticky column on the right. */
:root {
    --bg: #f5f6f8; --surface: #ffffff; --surface-2: #eef1f4; --border: #e1e3e6;
    --text: #181a1c; --muted: #5b6169; --accent: #3a6ea5; --accent-ink: #ffffff; --accent-soft: #dde8f2;
    --danger: #b91c1c;
    --shadow: 0 1px 2px rgba(24,26,28,.04), 0 8px 24px -12px rgba(24,26,28,.16);
    --st-pending-fg: #6b6458; --st-pending-bg: #efece5;
    --st-hold-fg: #92650a;   --st-hold-bg: #f8ecd2;
    --st-done-fg: #15803d;   --st-done-bg: #dcf3e2;
    --st-cancel-fg: #b91c1c; --st-cancel-bg: #fbe2e0;
    --t-inv: #0e7c86;
    --ob1: #2f6fc0; --ob2: #c2570c; --ob3: #7a55b8; --ob4: #0f8a5f; --ob5: #a8326e; --ob6: #8a6d0b; --ob7: #0e7490; --ob8: #b4232f;
    --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #101214; --surface: #16181b; --surface-2: #1d2024; --border: #2e3236;
        --text: #e8eaec; --muted: #9aa0a6; --accent: #7fa8d6; --accent-ink: #16181b; --accent-soft: #242c35;
        --danger: #f5a19c;
        --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 28px -14px rgba(0,0,0,.55);
        --st-pending-fg: #b3aa9a; --st-pending-bg: #2a2721;
        --st-hold-fg: #f0c264;   --st-hold-bg: #332512;
        --st-done-fg: #7fe0a0;   --st-done-bg: #142e1e;
        --st-cancel-fg: #f5a19c; --st-cancel-bg: #3a1a17;
        --t-inv: #4dbdc6;
        --ob1: #6b9fe0; --ob2: #e8894a; --ob3: #a98be0; --ob4: #4cc994; --ob5: #e07aa9; --ob6: #d6b44a; --ob7: #4fc3dc; --ob8: #f07a82;
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #101214; --surface: #16181b; --surface-2: #1d2024; --border: #2e3236;
    --text: #e8eaec; --muted: #9aa0a6; --accent: #7fa8d6; --accent-ink: #16181b; --accent-soft: #242c35;
    --danger: #f5a19c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 28px -14px rgba(0,0,0,.55);
    --st-pending-fg: #b3aa9a; --st-pending-bg: #2a2721;
    --st-hold-fg: #f0c264;   --st-hold-bg: #332512;
    --st-done-fg: #7fe0a0;   --st-done-bg: #142e1e;
    --st-cancel-fg: #f5a19c; --st-cancel-bg: #3a1a17;
    --t-inv: #4dbdc6;
    --ob1: #6b9fe0; --ob2: #e8894a; --ob3: #a98be0; --ob4: #4cc994; --ob5: #e07aa9; --ob6: #d6b44a; --ob7: #4fc3dc; --ob8: #f07a82;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); padding-inline: 16px; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
svg.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--t-inv); outline-offset: 2px; }
.wrap { max-width: 112rem; margin: 0 auto; padding-block: 20px 64px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }

/* Header (ops-connect) */
header.top { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--t-inv); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 600; font-size: 14px; flex: none; }
.brand h1 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.brand p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
nav.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
nav.tabs button { border: 0; background: none; border-radius: 9px; padding: 7px 12px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
nav.tabs button:hover { color: var(--text); background: var(--surface-2); }
nav.tabs button[aria-current="page"] { color: var(--t-inv); background: color-mix(in srgb, var(--t-inv) 11%, var(--surface)); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; padding: 1px 10px; border-radius: 999px; background: color-mix(in srgb, var(--t-inv) 12%, var(--surface)); color: color-mix(in srgb, var(--t-inv) 75%, var(--text)); border: 1px solid color-mix(in srgb, var(--t-inv) 30%, var(--surface)); white-space: nowrap; }
.who { font-size: 12px; color: var(--muted); }
.icbtn { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 6px; display: inline-flex; cursor: pointer; color: var(--muted); }
.icbtn:hover { color: var(--text); border-color: var(--text); }
.banner { display: flex; align-items: center; gap: 10px; background: var(--st-hold-bg); color: var(--st-hold-fg); border-radius: 10px; padding: 7px 12px; font-size: 13px; font-weight: 500; }

/* Buttons */
.btn { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 7px 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); white-space: nowrap; }
.btn:hover { border-color: var(--t-inv); }
.btn.t { background: var(--t-inv); border-color: var(--t-inv); color: #fff; }
.btn.t:hover { filter: brightness(1.08); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.dng { background: var(--st-cancel-fg); border-color: var(--st-cancel-fg); color: var(--surface); }
.btn.dng:hover { filter: brightness(1.08); }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); color: var(--muted); white-space: nowrap; }
.btn.t kbd { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }

/* Page title */
.ptitle { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ti { --tc: var(--t-inv); display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 10px; width: 36px; height: 36px; color: var(--tc); background: color-mix(in srgb, var(--tc) 13%, var(--surface)); }
.ptitle h2 { font-size: 19px; letter-spacing: -.01em; }
.ptitle p { margin: 0; color: var(--muted); font-size: 13px; }
.ptitle .grow { flex: 1 1 16rem; min-width: 0; }

/* Two-column entry layout */
.lz { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 16px; align-items: start; }
.main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.side { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
@media (max-width: 1080px) { .lz { grid-template-columns: 1fr; } .side { position: static; order: -1; } }
.sec-h { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sec-h h3 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.cnt { font-size: 11px; font-weight: 700; background: var(--surface-2); border-radius: 999px; padding: 1px 8px; color: var(--text); }

/* Scanner */
.scan { display: flex; gap: 8px; }
.scan input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 18px; padding: 10px 12px; border: 2px solid var(--t-inv); border-radius: 11px; background: var(--surface); color: var(--text); }
.scan input::placeholder { color: var(--muted); font-size: 15px; }
.scan input:focus-visible { outline: 3px solid color-mix(in srgb, var(--t-inv) 35%, transparent); outline-offset: 1px; }
.sims { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--muted); }
.sims button { border: 1px dashed var(--border); background: none; border-radius: 999px; padding: 2px 10px; font-size: 12px; cursor: pointer; color: var(--text); }
.sims button:hover { border-color: var(--t-inv); }
.res { --c: var(--st-done-fg); margin-top: 10px; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 7%, var(--surface)); border-radius: 0 10px 10px 0; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.res.warn { --c: var(--st-hold-fg); } .res.err { --c: var(--st-cancel-fg); } .res.info { --c: var(--accent); }
.res b { color: var(--c); display: flex; gap: 8px; align-items: center; }
.res p { margin: 0; font-size: 13px; }
.res .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Document header */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 10px 12px; }
.f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.f.w2 { grid-column: span 2; }
@media (max-width: 560px) { .f.w2 { grid-column: auto; } }
.f label { font-size: 11.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.f label svg.ic { width: 12px; height: 12px; }
.inp { width: 100%; min-width: 0; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 6px 9px; color: var(--text); }
.inp:disabled { background: var(--surface-2); color: var(--text); border-color: transparent; opacity: 1; cursor: default; -webkit-text-fill-color: var(--text); }
select.inp:disabled { appearance: none; }
.inp.r { text-align: right; font-variant-numeric: tabular-nums; }
.locknote { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.locknote svg.ic { width: 15px; height: 15px; color: var(--t-inv); }
.at { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.at b { color: var(--text); font-weight: 600; }
.at .ok { color: var(--st-done-fg); font-weight: 600; }
.at .wn { color: var(--st-hold-fg); font-weight: 600; }
.rt { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.rt th { text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 4px 6px; }
.rt th:first-child, .rt td:first-child { text-align: left; }
.rt td { padding: 3px 6px; text-align: right; font-variant-numeric: tabular-nums; }
.rt td:first-child { font-weight: 600; white-space: nowrap; }
.rt td .inp { max-width: 9rem; margin-left: auto; display: block; }
.rt tr.tot td { border-top: 1px solid var(--border); padding-top: 7px; font-weight: 700; }
.newforn { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--st-hold-bg); color: var(--st-hold-fg); border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; font-size: 13px; font-weight: 500; }
.newforn input { flex: 1 1 14rem; min-width: 0; }
.ro { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 8px 12px; font-size: 13px; }

/* Lines grid */
.lwrap { overflow-x: auto; margin-inline: -4px; padding-inline: 4px; }
.lg { min-width: 52rem; display: flex; flex-direction: column; }
.lr { --oc: transparent; display: grid; grid-template-columns: 1.5rem 7.6rem minmax(14rem, 1fr) 4.8rem 5.2rem 6rem 4.2rem 5.6rem 2.6rem 7rem 1.8rem; gap: 5px; align-items: center; padding: 3px 4px 3px 6px; border-left: 3px solid var(--oc); border-radius: 0 8px 8px 0; }
.lr.h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; border-left-color: transparent; padding-bottom: 6px; }
.lr.h > :nth-child(n+5):nth-child(-n+8), .lr.h > :nth-child(10) { text-align: right; }
.lr { --rowbg: var(--surface); }
.lr:not(.h):focus-within { --rowbg: color-mix(in srgb, var(--t-inv) 6%, var(--surface)); background: var(--rowbg); }
/* Total and delete stay pinned to the right while the grid scrolls sideways. */
.lr > :nth-child(10), .lr > :nth-child(11) { position: sticky; background: var(--rowbg); z-index: 1; align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.lr > :nth-child(11) { right: 0; align-items: center; }
.lr > :nth-child(10) { right: calc(1.8rem + 5px); box-shadow: -8px 0 8px -8px color-mix(in srgb, var(--text) 25%, transparent); padding-left: 6px; }
.lr.h > :nth-child(10) { align-items: flex-end; }
.lr .n { font-size: 11px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.ci { width: 100%; min-width: 0; border: 1px solid var(--border); background: var(--surface); border-radius: 7px; padding: 5px 7px; color: var(--text); }
.ci.r { text-align: right; font-variant-numeric: tabular-nums; }
.ci.cod { font-family: var(--mono); font-size: 13px; }
.ci:disabled { background: transparent; border-color: transparent; -webkit-text-fill-color: var(--text); opacity: 1; }
.dcell { position: relative; min-width: 0; }
.dcell .ci { padding-right: 4.6rem; }
.tag { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-radius: 999px; padding: 0 6px; pointer-events: none; }
.tag.chg { color: var(--st-hold-fg); background: var(--st-hold-bg); }
.tag.new { color: var(--accent); background: var(--accent-soft); }
.tag.cat { color: var(--st-done-fg); background: var(--st-done-bg); }
.obtn { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; border: 1px solid var(--border); background: var(--surface); border-radius: 7px; padding: 5px 7px; cursor: pointer; text-align: left; }
.obtn { justify-content: center; padding: 3px; }
/* Obra bubble: colour + 2-letter code, so obras sharing a colour still tell apart. */
.obub { --oc2: var(--oc, var(--muted)); display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 999px; background: var(--oc2); color: #fff; font: 700 10.5px/1 var(--mono); font-style: normal; letter-spacing: .02em; }
.pal li .obub { width: 30px; height: 30px; font-size: 11.5px; }
.obtn:disabled { cursor: default; border-color: transparent; background: transparent; }
.odot { width: 9px; height: 9px; border-radius: 999px; background: var(--oc, var(--muted)); flex: none; }
.ltot { text-align: right; font-variant-numeric: tabular-nums; line-height: 1.25; }
.ltot b { font-weight: 600; display: block; }
.ltot small { color: var(--muted); font-size: 11px; }
.lx { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 17px; line-height: 1; padding: 3px; border-radius: 6px; }
.lx:hover { color: var(--st-cancel-fg); background: var(--surface-2); }
/* Active line: the row stays in place and a detail strip opens underneath it. */
.lr.on { --rowbg: color-mix(in srgb, var(--t-inv) 7%, var(--surface)); background: var(--rowbg); border-radius: 0 8px 0 0; }
.ldet { --oc: var(--t-inv); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 8px 18px; margin-bottom: 6px; padding: 4px 10px 10px calc(1.5rem + 11px); border-left: 3px solid var(--oc); border-radius: 0 0 8px 8px; background: color-mix(in srgb, var(--t-inv) 7%, var(--surface)); }
.ldet .ci { font-size: 14px; padding: 7px 9px; }
.ldet .f label.lbl { font-size: 11px; color: var(--muted); }
.dinfo { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; min-width: 0; }
.di { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.di small { color: var(--muted); }
.okc { color: var(--st-done-fg); font-weight: 600; }
.wnc { color: var(--st-hold-fg); font-weight: 600; }
.lfoot { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.keys { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.keys span { display: inline-flex; gap: 5px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 4px 10px; font-size: 12.5px; cursor: pointer; border-right: 1px solid var(--border); color: var(--text); font-weight: 600; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.seg button:disabled { cursor: default; }

/* Context panel */
.ctx { display: flex; flex-direction: column; gap: 12px; }
.ctx .row { display: flex; flex-direction: column; gap: 5px; }
.obig { --oc: var(--muted); display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid var(--border); border-left: 5px solid var(--oc); background: var(--surface); border-radius: 10px; padding: 8px 10px; cursor: pointer; text-align: left; }
.obig:hover { border-color: var(--oc); }
.obig .t { flex: 1; min-width: 0; }
.obig .t b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obig .t small { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent { display: flex; flex-wrap: wrap; gap: 5px; }
.recent button { --oc: var(--muted); display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 2px 9px; font-size: 12px; cursor: pointer; }
.recent button:hover { border-color: var(--oc); }
.dsub { font-size: 12px; color: var(--muted); }

/* Reconciliation */
.st { --c: var(--st-hold-fg); --b: var(--st-hold-bg); display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; padding: 2px 10px 2px 7px; border-radius: 999px; color: var(--c); background: var(--b); border: 1.5px solid transparent; white-space: nowrap; }
.st i { font-style: normal; display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 999px; font-size: 12px; line-height: 1; background: var(--c); color: var(--surface); }
.st.ok { --c: var(--st-done-fg); --b: var(--st-done-bg); }
.st.approx { --c: var(--st-done-fg); --b: var(--st-done-bg); border-color: var(--st-hold-fg); }
.st.approx i { background: var(--st-hold-fg); }
.st.big { font-size: 13.5px; padding: 4px 12px 4px 8px; }
.st.big i { width: 20px; height: 20px; font-size: 13px; }
.prog { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.prog .l1 { display: flex; justify-content: space-between; font-size: 12.5px; gap: 8px; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; background: var(--t-inv); transition: width .2s; }
.bar i.over { background: var(--st-cancel-fg); }
.falta { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.falta.zero { color: var(--st-done-fg); }
.falta.neg { color: var(--st-cancel-fg); }
.ct { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 12px; }
.ct th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; text-align: right; padding: 3px 4px; }
.ct th:first-child, .ct td:first-child { text-align: left; }
.ct td { padding: 4px; text-align: right; font-variant-numeric: tabular-nums; border-top: 1px solid var(--border); white-space: nowrap; }
.ct td.k { font-weight: 600; }
.ct td.sub { color: var(--muted); font-size: 11px; padding-top: 0; border-top: 0; }
.ct .d0 { color: var(--st-done-fg); font-weight: 700; }
.ct .d1 { color: var(--st-hold-fg); font-weight: 700; }
.ct .d2 { color: var(--st-cancel-fg); font-weight: 700; }
.ct tr.tot td { border-top: 2px solid var(--border); font-weight: 700; }
.issues { margin: 10px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--st-hold-fg); }
.issues li::before { content: "• "; }
.byobra { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.byobra div { --oc: var(--muted); display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.byobra div span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.byobra div b { font-variant-numeric: tabular-nums; font-weight: 600; }
.tolnote { font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.savebar { display: flex; gap: 8px; flex-wrap: wrap; }
.savebar .btn.t { flex: 1; }

/* Empty / placeholders */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ti { width: 54px; height: 54px; border-radius: 14px; }
.empty .ti svg.ic { width: 28px; height: 28px; }
.empty h3 { color: var(--text); font-size: 16px; }
.empty p { margin: 0; max-width: 32rem; }
.empty ul { text-align: left; margin: 4px 0 0; padding-left: 18px; max-width: 32rem; }

/* Documents list */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { --c: var(--t-inv); display: flex; flex-direction: column; gap: 1px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: 12px; padding: 9px 12px; box-shadow: var(--shadow); min-width: 0; }
.kpi b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.2; }
.kpi span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.kpi.w { --c: var(--st-hold-fg); } .kpi.g { --c: var(--st-done-fg); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.tools select, .tools input { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 6px 9px; }
.tools input { flex: 1 1 14rem; min-width: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.twrap { overflow-x: auto; }
.dt { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 52rem; }
.dt th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--border); }
.dt td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.dt tbody tr { cursor: pointer; }
.dt tbody tr:hover td { background: var(--surface-2); }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dt td.act { text-align: right; white-space: nowrap; }
.opills { display: flex; flex-wrap: wrap; gap: 4px; }
.opill { --oc: var(--muted); display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 0 8px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.dsp { font-size: 12px; font-weight: 600; white-space: nowrap; }
.dsp.closed { color: var(--muted); }
.lock-i { display: inline-flex; vertical-align: -3px; color: var(--muted); }
.lock-i svg.ic { width: 14px; height: 14px; }

/* Typeahead, palette, modal, toast */
#ta { position: fixed; z-index: 50; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; max-height: 18rem; overflow-y: auto; min-width: 22rem; max-width: calc(100vw - 32px); }
#ta div { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13px; }
#ta div[aria-selected="true"] { background: color-mix(in srgb, var(--t-inv) 12%, var(--surface)); }
#ta .c { font-family: var(--mono); font-size: 12px; color: var(--muted); }
#ta .p { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
#ta .hd { display: block; font-size: 11px; color: var(--muted); padding: 4px 8px 2px; cursor: default; }
.ovl { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--text) 35%, transparent); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.pal { width: min(30rem, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pal h4 { font-size: 13px; color: var(--muted); font-weight: 600; }
.pal input { border: 2px solid var(--t-inv); border-radius: 10px; padding: 8px 11px; font-size: 15px; background: var(--surface); }
.pal ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 20rem; overflow-y: auto; }
.pal li { --oc: var(--muted); display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 9px; cursor: pointer; }
.pal li[aria-selected="true"] { background: color-mix(in srgb, var(--oc) 13%, var(--surface)); }
.pal li .t { flex: 1; min-width: 0; }
.pal li .t b { display: block; font-size: 13.5px; }
.pal li .t small { color: var(--muted); font-size: 12px; }
.pal li em { font-style: normal; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pal .ft { font-size: 11.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }
.mdl { width: min(34rem, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.mdl h3 { font-size: 16px; }
.mdl p { margin: 0; color: var(--muted); }
.mdl .acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.chg { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chg li { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; display: flex; flex-direction: column; gap: 6px; }
.chg .ft { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.chg s { color: var(--muted); }
.chg b { color: var(--t-inv); font-weight: 600; }
.chg label { display: flex; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 600; cursor: pointer; }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 500; z-index: 70; max-width: calc(100% - 32px); text-align: center; }
@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }

/* --- Only in the app (not in the mockup) --- */
.login-wrap { display: flex; justify-content: center; margin-top: 12vh; }
.login-card { width: 100%; max-width: 23rem; padding: 26px 24px 22px; display: flex; flex-direction: column; gap: 6px; }
.login-card h1 { font-size: 19px; margin-top: 14px; }
.login-card > p { margin: 0 0 12px; color: var(--muted); }
.login-card label { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 6px; }
.login-card input { border: 1px solid var(--border); background: var(--surface); border-radius: 9px; padding: 9px 11px; }
.login-card .btn.t { padding: 10px 16px; font-size: 15px; margin-top: 14px; }
.error { color: var(--danger); font-size: .85rem; margin: .5rem 0 0; }
.loading { text-align: center; margin-top: 15vh; color: var(--muted); }
.icbtn.txt { padding: 5px 10px; font-size: 12.5px; font-weight: 600; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
#view { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
