@font-face { font-family: 'Schibsted'; src: url(sg.woff2) format('woff2'); font-weight: 400 900; font-display: swap; }
@font-face { font-family: 'JBM'; src: url(jbm.woff2) format('woff2'); font-weight: 100 800; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url(nr.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
    --paper: #f5f3ee;
    --card: #ffffff;
    --ink: #17212b;
    --ink-2: #3d4854;
    --muted: #6f7882;
    --line: #e3dfd6;
    --line-2: #eeebe4;
    --accent: #176b5f;
    --accent-2: #e0a63a;
    --accent-soft: #e3f0ec;
    --amber: #a86a0c;
    --amber-soft: #fbefd9;
    --red: #b3412c;
    --side: #1b2530;
    --side-2: #26313d;
    --r: 10px;
    --mono: 'JBM', ui-monospace, monospace;
    --sans: 'Schibsted', system-ui, sans-serif;
    --serif: 'Newsreader', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--paper); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-feature-settings: 'zero' 0; letter-spacing: -0.01em; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg path { vector-effect: non-scaling-stroke; }

.ribbon { position: fixed; right: 12px; bottom: 12px; z-index: 60; font-size: 11px; letter-spacing: .03em; color: var(--ink-2); background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; text-decoration: none; }
.ribbon:hover { color: var(--ink); border-color: var(--muted); }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #c9d1d9; padding: 18px 14px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; }
.mark { width: 32px; height: 32px; flex: none; }
.side .mark rect { fill: #f5f3ee; }
.side .mark path:first-of-type { stroke: var(--side); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { color: #fff; font-size: 16px; letter-spacing: -0.01em; }
.brand-text span { font-size: 11.5px; color: #8d99a6; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-h { margin: 14px 8px 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #7b8794; }
.nav-i { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 8px 10px; border-radius: 7px; color: #c9d1d9; cursor: pointer; text-align: left; font-size: 13.5px; }
.nav-i svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-i:hover { background: var(--side-2); color: #fff; }
.nav-i.is-on { background: #f5f3ee; color: var(--ink); font-weight: 600; }
.nav-i.is-dim { opacity: .45; cursor: default; }
.nav-i.is-dim:hover { background: none; color: #c9d1d9; }
.side-foot { margin-top: auto; padding: 12px 10px; border-top: 1px solid var(--side-2); }
.conn { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #dfe5ea; }
.conn.sub { color: #7b8794; padding-left: 16px; margin-top: 3px; font-family: var(--mono); font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: #4cc38a; box-shadow: 0 0 0 3px rgba(76,195,138,.18); }

.main { min-width: 0; padding: 20px 28px 48px; }
.view { display: none; }
.view.is-on { display: block; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; min-height: 40px; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); min-width: 0; }
.crumbs svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.crumbs h1 { margin: 0; font-size: 20px; letter-spacing: -0.015em; color: var(--ink); font-weight: 650; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.pill { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.pill.draft { background: #ecebe6; color: var(--ink-2); }
.pill.sending { background: var(--amber-soft); color: var(--amber); }
.pill.posted { background: var(--accent-soft); color: var(--accent); }
.pill.paid { background: var(--accent); color: #fff; }
.pill.open { background: var(--amber-soft); color: var(--amber); }

.btn { display: inline-flex; align-items: center; gap: 7px; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 600; font-size: 13.5px; transition: background .15s, border-color .15s, transform .1s; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn:hover { border-color: #c9c3b6; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #26323f; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: none; border-color: transparent; color: var(--accent); padding-left: 6px; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.wide { width: 100%; justify-content: center; padding: 11px; }

.seg { display: inline-flex; background: #ebe8e1; border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg button:disabled { color: #a9a59c; cursor: default; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; }
.panel-h h2, .sync-h h2 { margin: 0; font-size: 14.5px; font-weight: 650; }

/* invoice */
.inv-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.form-panel { padding: 20px 22px; }
.form-head { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line-2); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .note label, legend { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field input, .field select, textarea, .line input, .line select { border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; background: #fdfcfa; min-width: 0; width: 100%; }
.field input[readonly] { background: #f8f7f3; color: var(--ink-2); }
.cust-card { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 9px; padding: 12px; background: #fdfcfa; }
.cust-card strong { display: block; font-size: 14.5px; }
.cust-card span { display: block; font-size: 12.5px; color: var(--muted); }
.cust-card .nif { color: var(--accent); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.cust-card .nif b { font-weight: 500; color: var(--ink); }
.ok-tick { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); position: relative; flex: none; }
.ok-tick::after { content: ''; position: absolute; left: 4.5px; top: 2.5px; width: 3.5px; height: 6.5px; border: solid #fff; border-width: 0 1.6px 1.6px 0; transform: rotate(45deg); }
.avatar { width: 38px; height: 38px; border-radius: 8px; background: #efe3cc; color: #7a5310; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

.lines { margin-top: 14px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 64px 92px 172px 86px 30px; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.line-h { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding-top: 4px; }
.line .r, .line input.r { text-align: right; }
.line .sub { text-align: right; padding-top: 7px; font-family: var(--mono); font-size: 13px; }
.line .desc strong { display: block; font-weight: 600; font-size: 13.5px; }
.line .desc input { font-weight: 600; }
.line .desc span { font-size: 12px; color: var(--muted); }
.line .vat { display: flex; flex-direction: column; gap: 6px; }
.line .exempt { font-size: 12px; border-color: #e8c98d; background: #fffaf0; }
.line .exempt-l { font-size: 11px; color: var(--amber); font-weight: 600; }
.line .rm { border: 0; background: none; color: #a39e94; cursor: pointer; padding: 6px; border-radius: 6px; }
.line .rm:hover { background: #f3efe7; color: var(--red); }
.line .rm svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.line .lbl { display: none; }
.add { margin-top: 8px; }
.locked .line input, .locked .line select { background: transparent; border-color: transparent; pointer-events: none; padding-left: 0; padding-right: 0; appearance: none; }
.locked .line .rm, .locked .add { visibility: hidden; }
.locked textarea { background: transparent; border-color: transparent; resize: none; padding-left: 0; }

.form-foot { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; margin-top: 16px; align-items: start; }
.note { display: flex; flex-direction: column; gap: 5px; }
textarea { resize: vertical; }
.totals { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; font-size: 13px; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; text-align: right; font-family: var(--mono); }
.totals .grand { font-size: 17px; font-weight: 700; color: var(--ink); padding-top: 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.totals dd.grand { font-weight: 600; }

/* sync timeline */
.sync { padding: 16px 18px; position: sticky; top: 20px; }
.sync-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl li { position: relative; padding: 0 0 16px 30px; }
.tl li::before { content: ''; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--line-2); }
.tl li:last-child::before { display: none; }
.tl li.done::before { background: var(--accent); }
.tl .ic { position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); display: grid; place-items: center; }
.tl .done .ic { background: var(--accent); border-color: var(--accent); }
.tl .done .ic::after { content: ''; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.tl .run .ic { border-color: var(--accent-2); border-top-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tl .t { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.tl .idle .t { color: #a39e94; font-weight: 500; }
.tl time { font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.tl .d { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tl .k { display: inline-block; margin-top: 5px; font-family: var(--mono); font-size: 11.5px; background: #f4f2ec; border: 1px solid var(--line-2); padding: 2px 7px; border-radius: 5px; color: var(--ink); max-width: 100%; overflow-wrap: anywhere; }
.tl .k.code { color: var(--accent); }
.tl li.fresh { animation: rise .35s ease-out; }
@keyframes rise { from { opacity: .3; transform: translateY(4px); } }
.sync-foot { border-top: 1px solid var(--line-2); padding-top: 12px; margin-top: 2px; }
.sync-foot p { margin: 0; }
.sync-foot .btn { width: 100%; justify-content: center; margin-top: 10px; }

/* certified sheet */
.pdf-panel { padding: 14px; background: #e9e6df; border-color: #ddd8cd; }
.pdf-tools { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 0 4px 12px; }
.sheet-wrap { display: flex; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 720px; padding: 40px 44px 30px; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 10px 30px rgba(40,30,10,.12); font-size: 11.5px; color: #222; border-radius: 2px; }
.sh-top { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.sh-co { display: flex; gap: 12px; align-items: flex-start; }
.sh-co svg { width: 46px; height: 46px; flex: none; }
.sh-co h3 { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; color: #2c3a1d; }
.sh-co p { margin: 2px 0 0; color: #666; line-height: 1.4; }
.sh-doc { text-align: right; }
.sh-doc .ty { font-family: var(--serif); font-size: 24px; font-weight: 500; }
.sh-doc .no { font-family: var(--mono); font-size: 13px; margin-top: 2px; }
.sh-doc .orig { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #888; margin-top: 4px; }
.sh-meta { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; margin: 26px 0 18px; }
.sh-box h4 { margin: 0 0 4px; font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: #8a8a8a; font-weight: 600; }
.sh-box p { margin: 0; line-height: 1.5; }
.sh-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; }
.sh-kv dt { color: #888; }
.sh-kv dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 11px; }
.sh-table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.sh-table th { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: #888; font-weight: 600; text-align: left; border-bottom: 1.5px solid #2c3a1d; padding: 6px 4px; }
.sh-table td { padding: 7px 4px; border-bottom: 1px solid #eee; vertical-align: top; }
.sh-table .r { text-align: right; font-family: var(--mono); font-size: 11px; }
.sh-table .code { color: #888; font-family: var(--mono); font-size: 10px; display: block; }
.sh-low { display: grid; grid-template-columns: 1fr 230px; gap: 26px; margin-top: 18px; }
.sh-tax { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.sh-tax th { text-align: left; color: #888; font-weight: 600; font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 4px; border-bottom: 1px solid #ddd; }
.sh-tax td { padding: 3px 4px; font-family: var(--mono); font-size: 10.5px; }
.sh-tax td:not(:first-child), .sh-tax th:not(:first-child) { text-align: right; }
.sh-exempt { margin-top: 8px; font-size: 10.5px; color: #555; }
.sh-tot { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; }
.sh-tot dt { color: #777; }
.sh-tot dd { margin: 0; text-align: right; font-family: var(--mono); }
.sh-tot .g { font-size: 15px; font-weight: 700; color: #111; border-top: 1.5px solid #2c3a1d; padding-top: 6px; margin-top: 4px; }
.sh-pay { margin-top: 18px; display: flex; gap: 12px; align-items: center; border: 1px dashed #c9c3b6; border-radius: 6px; padding: 10px 12px; }
.sh-pay svg { width: 36px; height: 25px; flex: none; }
.sh-pay dl { display: grid; grid-template-columns: repeat(3, auto); gap: 0 20px; margin: 0; }
.sh-pay dt { font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: #888; }
.sh-pay dd { margin: 0; font-family: var(--mono); font-size: 12px; font-weight: 600; }
.sh-paid { margin-left: auto; border: 2px solid var(--accent); color: var(--accent); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 11px; padding: 3px 8px; transform: rotate(-4deg); border-radius: 4px; }
.sh-foot { display: grid; grid-template-columns: 104px 1fr; gap: 16px; align-items: end; margin-top: 26px; padding-top: 14px; border-top: 1px solid #e5e5e5; }
.sh-foot svg { width: 104px; height: 104px; display: block; }
.sh-legal { font-size: 10px; color: #666; line-height: 1.55; }
.sh-legal b { color: #111; font-family: var(--mono); font-weight: 600; font-size: 11px; }
.sh-legal .payload { font-family: var(--mono); font-size: 8.5px; color: #8a8a8a; overflow-wrap: anywhere; margin-top: 6px; }

/* payments */
.pay-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.inv-list { list-style: none; margin: 0; padding: 0 8px 8px; }
.inv-list button { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; text-align: left; border: 1px solid transparent; background: none; border-radius: 8px; padding: 10px; cursor: pointer; }
.inv-list button:hover { background: #f8f6f1; }
.inv-list button[aria-current="true"] { background: #f4f1ea; border-color: var(--line); }
.inv-list .n { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.inv-list .c { color: var(--muted); font-size: 12.5px; grid-column: 1; }
.inv-list .a { font-family: var(--mono); text-align: right; font-size: 13px; }
.inv-list .pill { justify-self: end; }
.pay-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pay-head { padding: 16px 18px; display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; }
.pay-head h2 { margin: 0; font-size: 17px; font-family: var(--mono); font-weight: 600; letter-spacing: -0.02em; }
.pay-head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.pay-head .amt { font-family: var(--mono); font-size: 22px; font-weight: 600; text-align: right; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.method { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.method-h { display: flex; gap: 12px; align-items: center; }
.method-h h3 { margin: 0; font-size: 14.5px; }
.method-h p { margin: 1px 0 0; }
.mlogo { width: 40px; height: 28px; flex: none; }
.method-body { display: flex; flex-direction: column; gap: 12px; min-height: 170px; }
.ref-card { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.ref-card div { display: flex; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid var(--line-2); gap: 10px; }
.ref-card div:last-child { border-bottom: 0; }
.ref-card dt { color: var(--muted); font-size: 12.5px; }
.ref-card dd { margin: 0; font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.ref-card dl { margin: 0; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.status .dot { background: var(--accent-2); }
.status.wait .dot { animation: pulse 1.2s ease-in-out infinite; }
.status.paid { color: var(--accent); }
.status.paid .dot { background: var(--accent); }
@keyframes pulse { 50% { opacity: .3; } }
.phone-row { display: grid; grid-template-columns: 76px 1fr; gap: 8px; }
.phone-row span { border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; background: #f8f7f3; font-family: var(--mono); font-size: 13px; text-align: center; }
.phone-row input { border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; font-family: var(--mono); background: #fdfcfa; min-width: 0; }
.mini-phone { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fbfaf7; display: flex; gap: 10px; align-items: center; }
.mini-phone .app { width: 30px; height: 30px; border-radius: 7px; background: #c8102e; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 10px; }
.mini-phone p { margin: 0; font-size: 12px; line-height: 1.35; }
.mini-phone b { font-family: var(--mono); }
.countdown { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: auto; }
.receipt { font-size: 12.5px; background: var(--accent-soft); color: #0f4f46; border-radius: 8px; padding: 9px 12px; }
.receipt b { font-family: var(--mono); }
.empty-note { color: var(--muted); font-size: 12.5px; margin: 0; }

/* saft */
.saft-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.saft-form { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.fmt { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.fmt legend { margin-bottom: 6px; }
.radio { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--ink); background: #faf9f6; box-shadow: inset 0 0 0 1px var(--ink); }
.radio input { accent-color: var(--ink); margin: 0; }
.radio span { display: flex; flex-direction: column; }
.radio em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.field-row.two { grid-template-columns: 1fr 1fr; }
.company-box { background: #f8f7f3; border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 12px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.company-box b { color: var(--ink); }
.saft-out { padding-bottom: 14px; min-width: 0; }
.checks { list-style: none; margin: 0; padding: 0 18px; }
.checks li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.checks li:last-child { border-bottom: 0; }
.checks .ci { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); margin-top: 1px; position: relative; }
.checks .ok .ci { background: var(--accent); border-color: var(--accent); }
.checks .ok .ci::after, .checks .warn .ci::after { content: ''; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checks .warn .ci { background: var(--accent-2); border-color: var(--accent-2); }
.checks .run .ci { border-color: var(--accent-2); border-top-color: transparent; animation: spin .8s linear infinite; }
.checks .ct { font-weight: 600; font-size: 13.5px; }
.checks .cd { font-size: 12px; color: var(--muted); }
.checks .cv { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.checks .idle .ct { color: #a39e94; font-weight: 500; }
.saft-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line-2); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); margin: 8px 0 14px; }
.saft-stats div { background: var(--card); padding: 12px 18px; }
.saft-stats dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.saft-stats dd { margin: 3px 0 0; font-family: var(--mono); font-size: 16px; font-weight: 600; }
.saft-stats dl { margin: 0; display: contents; }
.dl-row { display: flex; align-items: center; gap: 12px; padding: 0 18px; flex-wrap: wrap; }
.xml { margin: 14px 18px 0; background: #1b2530; color: #cfd8e0; border-radius: 9px; padding: 14px 16px; font-family: var(--mono); font-size: 11.5px; line-height: 1.55; overflow: auto; max-height: 260px; white-space: pre; }
.xml .tg { color: #8ec5ff; }
.xml .at { color: #e0a63a; }
.xml .tx { color: #f5f3ee; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 70; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* responsive */
@media (max-width: 1180px) {
    .inv-grid { grid-template-columns: minmax(0, 1fr); }
    .sync { position: static; }
    .pay-methods { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
    .pay-grid, .saft-grid { grid-template-columns: minmax(0, 1fr); }
    .form-head { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .side { position: sticky; top: 0; z-index: 40; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 10px; }
    .brand-text span, .nav-h, .side-foot, .nav-i.is-dim { display: none; }
    .brand { padding: 0; }
    .brand-text strong { font-size: 15px; }
    .mark { width: 28px; height: 28px; }
    .nav { flex-direction: row; margin-left: auto; gap: 2px; }
    .nav-i { padding: 7px 9px; font-size: 12.5px; gap: 6px; }
    .nav-i svg { width: 16px; height: 16px; }
    .main { padding: 14px 16px 64px; }
    .bar { gap: 10px; }
    .crumbs h1 { font-size: 17px; }
    .crumbs > span:first-child, .crumbs > svg { display: none; }
    .actions { width: 100%; justify-content: space-between; }
    .form-panel { padding: 14px; }
    .field-row { grid-template-columns: 1fr 1fr; }
    .line-h { display: none; }
    .line { grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 12px 0; }
    .line .desc { grid-column: 1 / 3; }
    .line .rm { grid-column: 3; grid-row: 1; justify-self: end; }
    .line .vat { grid-column: 1 / 4; }
    .line .sub { grid-column: 3; grid-row: 2; padding-top: 22px; }
    .line .lbl { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 3px; }
    .line .sub .lbl { text-align: right; }
    .form-foot { grid-template-columns: minmax(0, 1fr); }
    .sheet { padding: 22px 18px 18px; font-size: 10.5px; }
    .sh-top { flex-direction: column; gap: 12px; }
    .sh-doc { text-align: left; }
    .sh-meta, .sh-low { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .sh-table .hide-sm { display: none; }
    .sh-foot { grid-template-columns: 84px 1fr; }
    .sh-foot svg { width: 84px; height: 84px; }
    .sh-pay { flex-wrap: wrap; }
    .sh-pay dl { gap: 0 12px; }
    .pdf-panel { padding: 8px; }
    .saft-stats { grid-template-columns: 1fr 1fr; }
    .checks li { grid-template-columns: 22px 1fr; }
    .checks .cv { grid-column: 2; text-align: left; }
}
@media (max-width: 420px) {
    .brand-text { display: none; }
    .nav { margin-left: 0; flex: 1; justify-content: space-between; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
    .side, .bar, .sync, .ribbon, .pdf-tools { display: none !important; }
}
.sh-tot { align-content: start; }
.sh-foot { align-items: start; }
#confirmBtn.done:disabled { opacity: 1; background: var(--accent-soft); color: var(--accent); border-color: transparent; }
