@import url('tokens.css');
/* Oochtenka components — built only from tokens.css. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--sans); font-size: var(--fs-m); line-height: var(--lh); color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; font-feature-settings: "ss01"; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); font-size: var(--fs-s); letter-spacing: 0; }
.muted { color: var(--ink-3); }

/* ── App frame ─────────────────────────────────────────── */
.app { display: grid; grid-template-columns: var(--rail-w) 1fr; height: 100vh; }
.main { overflow-y: auto; }
.rail { padding: 20px 12px; display: flex; flex-direction: column; gap: 20px; border-right: 1px solid var(--rule); background: var(--paper); }
.rail.ink { background: var(--rail); border-right: 0; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; font-weight: 600; font-size: var(--fs-l); letter-spacing: -0.02em; }
.brand .mark { width: 22px; height: 22px; border-radius: 6px; background: var(--ink); position: relative; }
.brand .mark::after { content: ""; position: absolute; left: 6px; right: 6px; top: 7px; height: 2px; background: #fff; box-shadow: 0 5px 0 #fff; }
.rail.ink .brand { color: #fff; } .rail.ink .brand .mark { background: #fff; } .rail.ink .brand .mark::after { background: var(--rail); box-shadow: 0 5px 0 var(--rail); }
.firm { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: var(--r-m); border: 1px solid var(--rule-strong); background: var(--sheet); font-weight: 500; font-size: var(--fs-m); }
.firm small { display: block; font-weight: 400; color: var(--ink-3); font-size: var(--fs-xs); }
.rail.ink .firm { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: #fff; }
.rail.ink .firm small { color: var(--rail-ink-2); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav h6 { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-4); text-transform: none; letter-spacing: 0.02em; padding: 12px 12px 8px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: var(--r-s); color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: var(--fs-m); }
.nav a:hover { background: rgba(14,23,38,0.04); }
.nav a.on { background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 1px var(--rule), 0 1px 2px rgba(14,23,38,0.04); }
.nav a .count { font-size: var(--fs-s); font-weight: 600; color: #fff; background: var(--stamp); border-radius: 10px; padding: 0 8px; line-height: 18px; }
.nav a .k { font-size: var(--fs-s); color: var(--ink-4); font-weight: 500; }
.rail.ink .nav h6 { color: var(--rail-ink-2); }
.rail.ink .nav a { color: var(--rail-ink); }
.rail.ink .nav a:hover { background: rgba(255,255,255,0.05); }
.rail.ink .nav a.on { background: rgba(255,255,255,0.09); color: #fff; box-shadow: none; }
.rail.ink .nav a .k { color: var(--rail-ink-2); }
.rail .foot { margin-top: auto; display: flex; align-items: center; gap: 12px; padding: 8px 12px; font-size: var(--fs-m); color: var(--ink-2); }
.rail .foot .av { width: 26px; height: 26px; border-radius: 50%; background: var(--inset); display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 600; color: var(--ink); }
.rail.ink .foot { color: var(--rail-ink); } .rail.ink .foot .av { background: rgba(255,255,255,0.12); color: #fff; }

.main { display: flex; flex-direction: column; min-width: 0; }
.period { display: flex; align-items: baseline; gap: 24px; padding: 20px 28px 16px; border-bottom: 1px solid var(--rule); }
.period h1 { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.025em; }
.period .fact { font-size: var(--fs-m); color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.period .fact b { color: var(--ink); font-weight: 500; }
.period .spacer { flex: 1; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot.b { background: var(--balanced); } .dot.p { background: var(--pending); } .dot.m { background: var(--missing); } .dot.st { background: var(--stamp); }
.btn { font: inherit; font-size: var(--fs-m); font-weight: 500; height: 32px; padding: 0 12px; border-radius: var(--r-s); border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.btn.primary { background: var(--stamp); border-color: var(--stamp); color: #fff; box-shadow: 0 1px 2px rgba(44,70,200,0.3), inset 0 1px 0 rgba(255,255,255,0.12); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
kbd { font-family: var(--mono); font-size: var(--fs-xs); padding: 0 4px; border-radius: var(--r-xs); line-height: 17px; border: 1px solid var(--rule-strong); color: var(--ink-3); background: var(--sheet); }
.btn.primary kbd { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.25); color: #fff; }

/* ── Inbox ─────────────────────────────────────────────── */
.inbox { flex: 1; display: grid; grid-template-columns: var(--queue-w) 1fr; min-height: 0; }
.queue { border-right: 1px solid var(--rule); overflow: hidden; padding: 8px 0; }
.queue h3 { display: flex; justify-content: space-between; font-size: var(--fs-s); font-weight: 500; color: var(--ink-3); padding: 16px 20px 8px; }
.item { display: grid; grid-template-columns: 10px 1fr auto; gap: 4px 12px; align-items: center; padding: 12px 20px 12px 20px; border-left: 2px solid transparent; }
.item .t { font-weight: 500; font-size: var(--fs-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .a { font-weight: 500; text-align: right; }
.item .s { grid-column: 2; font-size: var(--fs-s); color: var(--ink-3); }
.item .tag { grid-column: 3; justify-self: end; }
.item.sel { background: var(--sheet); border-left-color: var(--stamp); box-shadow: inset 0 1px 0 var(--rule), inset 0 -1px 0 var(--rule); }
.tag { font-size: var(--fs-xs); font-weight: 500; padding: 1px 8px; border-radius: var(--r-xs); color: var(--ink-2); background: var(--inset); white-space: nowrap; }
.tag.s { color: var(--stamp); background: var(--stamp-wash); }
.tag.b { color: var(--balanced); background: var(--balanced-wash); }
.tag.p { color: var(--pending); background: var(--pending-wash); }
.tag.m { color: var(--missing); background: var(--missing-wash); }

.detail { overflow: hidden; display: flex; flex-direction: column; background: var(--sheet); }
.detail .body { padding: 24px 32px; display: grid; grid-template-columns: 1fr var(--doc-w); gap: 28px; flex: 1; }
.who { font-size: var(--fs-s); color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.amount { font-size: var(--fs-hero); font-weight: 600; letter-spacing: -0.035em; margin: 8px 0 2px; }
.amount small { font-size: var(--fs-l); font-weight: 500; color: var(--ink-3); letter-spacing: -0.01em; margin-left: 8px; }
.conv { font-size: var(--fs-m); color: var(--ink-3); }
.facts { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 4px 36px; margin: 24px 0 28px; }
.facts dt { font-size: var(--fs-xs); color: var(--ink-3); }
.facts dd { font-size: var(--fs-m); font-weight: 500; }
.sect { font-size: var(--fs-s); font-weight: 500; color: var(--ink-3); margin-bottom: 8px; display: flex; justify-content: space-between; }

/* signature: the balanced entry and where it lands in the tax forms */
.entry { border: 1px solid var(--rule); border-radius: var(--r-m); overflow: hidden; }
.entry table { width: 100%; border-collapse: collapse; }
.entry th { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); text-align: left; padding: 8px 16px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.entry th.r, .entry td.r { text-align: right; }
.entry td { padding: 8px 16px; border-bottom: 1px solid var(--rule); font-size: var(--fs-m); }
.entry td .acc { font-family: var(--mono); font-size: var(--fs-s); color: var(--ink); margin-right: 12px; }
.entry td .nm { color: var(--ink-2); }
.entry tr.sum td { border-bottom: 0; background: var(--paper); font-weight: 600; font-size: var(--fs-m); }
.entry .ok { color: var(--balanced); font-weight: 500; font-size: var(--fs-s); display: inline-flex; align-items: center; gap: 8px; }
.lands { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; font-size: var(--fs-s); color: var(--ink-3); }
.lands .tag { font-family: var(--mono); font-size: var(--fs-xs); }

.pair { margin-top: 28px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 12px 16px; border-radius: var(--r-m); background: var(--paper); }
.pair .ic { width: 28px; height: 28px; border-radius: 7px; background: var(--sheet); box-shadow: var(--ring); display: grid; place-items: center; font-size: var(--fs-m); }
.pair .l1 { font-weight: 500; font-size: var(--fs-m); }
.pair .l2 { font-size: var(--fs-s); color: var(--ink-3); }

.doc { border-radius: var(--r-m); box-shadow: var(--float); background: #fff; padding: 16px 16px 16px; font-size: 8.5px; color: #333; line-height: 1.5; height: 318px; position: relative; }
.doc .lg { font-weight: 700; font-size: var(--fs-xs); color: #111; letter-spacing: -0.01em; }
.doc .h { display: flex; justify-content: space-between; margin-bottom: 12px; }
.doc .ln { height: 5px; background: #E9ECF1; border-radius: 2px; margin: 4px 0; }
.doc .tb { margin-top: 16px; border-top: 1px solid #E5E7EB; padding-top: 8px; display: flex; justify-content: space-between; }
.doc .tot { font-weight: 700; color: #111; display: flex; justify-content: space-between; border-top: 1px solid #111; margin-top: 8px; padding-top: 4px; font-size: 9.5px; }
.seal { margin-top: 12px; font-size: var(--fs-xs); color: var(--ink-3); display: flex; justify-content: space-between; }
.seal .mono { font-size: var(--fs-xs); }
.src { margin-top: 16px; font-size: var(--fs-s); color: var(--ink-3); line-height: 1.7; }
.src b { color: var(--ink-2); font-weight: 500; }

.actions { display: flex; align-items: center; gap: 8px; padding: 16px 32px; border-top: 1px solid var(--rule); background: var(--sheet); }
.actions .note { margin-left: auto; font-size: var(--fs-s); color: var(--ink-3); }

/* ── DPH month-end ─────────────────────────────────────── */
.steps { display: flex; gap: 0; padding: 0 28px; border-bottom: 1px solid var(--rule); background: var(--sheet); }
.steps div { padding: 12px 16px 12px 0; margin-right: 20px; font-size: var(--fs-m); color: var(--ink-3); display: flex; gap: 8px; align-items: center; border-bottom: 2px solid transparent; }
.steps div.done { color: var(--ink-2); }
.steps div.now { color: var(--ink); font-weight: 500; border-bottom-color: var(--stamp); }
.steps .n { width: 18px; height: 18px; border-radius: 50%; font-size: var(--fs-xs); display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--rule-strong); }
.steps .done .n { background: var(--balanced); color: #fff; box-shadow: none; }
.steps .now .n { background: var(--stamp); color: #fff; box-shadow: none; }
.vat { padding: 24px 28px; display: grid; grid-template-columns: 1fr 340px; gap: 24px; overflow: hidden; }
.panel { background: var(--sheet); border-radius: var(--r-l); box-shadow: var(--ring); }
.panel > header { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 20px 12px; }
.panel > header h2 { font-size: var(--fs-l); font-weight: 600; letter-spacing: -0.015em; }
.panel > header .x { font-size: var(--fs-s); color: var(--ink-3); display: flex; gap: 8px; align-items: center; }
.rows { width: 100%; border-collapse: collapse; }
.rows th { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); text-align: right; padding: 8px 20px; border-bottom: 1px solid var(--rule); }
.rows th:first-child, .rows td:first-child { text-align: left; }
.rows td { padding: 8px 20px; border-bottom: 1px solid var(--rule); text-align: right; font-size: var(--fs-m); }
.rows td .rn { font-family: var(--mono); font-size: var(--fs-s); color: var(--ink-3); display: inline-block; width: 34px; }
.rows tr.total td { font-weight: 600; border-bottom: 0; font-size: var(--fs-m); padding-top: 12px; padding-bottom: 16px; }
.rows tr.dim td { color: var(--ink-4); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 24px; }
.kh { list-style: none; }
.kh li { display: grid; grid-template-columns: 44px 1fr auto; padding: 8px 20px; border-top: 1px solid var(--rule); font-size: var(--fs-m); align-items: baseline; }
.kh li .sec { font-family: var(--mono); font-size: var(--fs-s); color: var(--ink-3); }
.kh li .c { font-size: var(--fs-s); color: var(--ink-3); }
.check { display: flex; gap: 12px; align-items: center; padding: 8px 20px; border-top: 1px solid var(--rule); font-size: var(--fs-m); }
.check .r { margin-left: auto; font-size: var(--fs-s); color: var(--ink-3); }
.pay { padding: 20px; }
.pay .big { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.035em; }
.pay .lbl { font-size: var(--fs-s); color: var(--ink-3); }
.pay dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 16px 0; font-size: var(--fs-m); }
.pay dt { color: var(--ink-3); } .pay dd { font-family: var(--mono); font-size: var(--fs-s); text-align: right; }
.qr { width: 132px; height: 132px; padding: 12px; border-radius: var(--r-m); box-shadow: var(--ring); background: #fff; }
.qr svg { width: 100%; height: 100%; display: block; }
.trivi { margin-top: 24px; display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: var(--r-m); background: var(--balanced-wash); color: var(--balanced); font-size: var(--fs-m); font-weight: 500; }

.close-grid { display: grid; grid-template-columns: minmax(300px, 0.8fr) minmax(400px, 1fr) minmax(260px, 0.72fr); gap: var(--sp-4); align-items: start; }
.close-grid > section, .close-side > section { overflow: hidden; }
.close-side { display: flex; flex-direction: column; gap: var(--sp-4); }
.checklist li { min-height: 42px; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--rule); }
.checklist li .n { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--rule-strong); border-radius: 50%; color: var(--ink-3); font-family: var(--mono); font-size: var(--fs-xs); flex: none; }
.checklist li.now { background: var(--stamp-wash); }
.checklist li.now .n { color: var(--stamp); border-color: var(--stamp); }
.checklist li .c { margin-left: auto; color: var(--ink-3); font-size: var(--fs-s); text-align: right; }
.close-note { padding: var(--sp-4); color: var(--ink-3); font-size: var(--fs-s); }
.close-xml { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.xml-preview { max-height: 60vh; overflow: auto; padding: var(--sp-4); color: var(--ink-2); background: var(--inset); font-family: var(--mono); font-size: var(--fs-xs); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── Phone ─────────────────────────────────────────────── */
.phone { width: 390px; height: 844px; background: var(--paper); display: flex; flex-direction: column; overflow: hidden; position: relative; }
.ptop { padding: 56px 20px 12px; display: flex; justify-content: space-between; align-items: center; }
.ptop .firm { padding: 4px 12px; font-size: var(--fs-m); }
.ptitle { padding: 8px 20px 2px; font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.035em; }
.psub { padding: 0 20px 16px; font-size: var(--fs-m); color: var(--ink-3); }
.pcard { margin: 0 12px 12px; background: var(--sheet); border-radius: var(--r-xl); box-shadow: var(--ring); overflow: hidden; }
.prow { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; border-top: 1px solid var(--rule); }
.prow:first-child { border-top: 0; }
.prow .t { font-weight: 500; font-size: var(--fs-l); }
.prow .a { font-weight: 500; font-size: var(--fs-l); text-align: right; }
.prow .s { font-size: var(--fs-m); color: var(--ink-3); }
.pgroup { padding: 16px 24px 8px; font-size: var(--fs-s); color: var(--ink-3); font-weight: 500; display: flex; justify-content: space-between; }
.tabs { margin-top: auto; display: grid; grid-template-columns: repeat(4, 1fr); padding: 8px 8px 32px; border-top: 1px solid var(--rule); background: rgba(255,255,255,0.92); }
.tabs div { text-align: center; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 500; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tabs div i { width: 22px; height: 22px; border-radius: 6px; box-shadow: inset 0 0 0 1.5px var(--ink-4); display: block; }
.tabs div.on { color: var(--stamp); }
.pdetail .pamount { padding: 4px 20px 0; font-size: 40px; font-weight: 600; letter-spacing: -0.04em; }
.pdetail .pconv { padding: 0 20px 16px; font-size: var(--fs-m); color: var(--ink-3); }
.pbar { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px 36px; display: grid; grid-template-columns: 1fr 2fr; gap: 12px; background: linear-gradient(to top, var(--paper) 70%, rgba(246,247,249,0)); }
.pbar .btn { height: 50px; justify-content: center; font-size: var(--fs-l); border-radius: 12px; }
.pentry .prow .t { font-family: var(--mono); font-size: var(--fs-m); font-weight: 500; }
.pentry .prow .s { font-family: var(--sans); }

/* ── Shared patterns added for the remaining screens ───── */
.page { padding: var(--sp-6) 28px; overflow: hidden; display: flex; flex-direction: column; gap: var(--sp-6); }
.filters { display: flex; gap: var(--sp-2); align-items: center; }
.filters .scope { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 var(--sp-3); border-radius: var(--r-s); background: var(--sheet); box-shadow: var(--ring); font-size: var(--fs-m); font-weight: 500; }
.filters .scope span { color: var(--ink-3); font-weight: 400; }
.filters .search { margin-left: auto; width: 260px; height: 32px; border-radius: var(--r-s); background: var(--inset); display: flex; align-items: center; padding: 0 var(--sp-3); color: var(--ink-4); font-size: var(--fs-m); }
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-s); background: var(--inset); }
.seg span { padding: 4px var(--sp-3); border-radius: var(--r-xs); font-size: var(--fs-m); color: var(--ink-3); font-weight: 500; }
.seg span.on { background: var(--sheet); color: var(--ink); box-shadow: var(--ring), 0 1px 2px rgba(14,23,38,0.06); }
.table { width: 100%; border-collapse: collapse; }
.table th { font-size: var(--fs-s); font-weight: 500; color: var(--ink-3); text-align: left; padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table td { height: var(--row-h); padding: 0 var(--sp-4); border-bottom: 1px solid var(--rule); font-size: var(--fs-m); white-space: nowrap; }
.table th.r, .table td.r { text-align: right; }
.table tr.sel td { background: var(--stamp-wash); }
.table tr.sel td:first-child { box-shadow: inset 2px 0 0 var(--stamp); }
.table td .sub { color: var(--ink-3); margin-left: var(--sp-2); }
.table tr.group td { height: 32px; background: var(--paper); font-size: var(--fs-s); color: var(--ink-3); font-weight: 500; }
.split { display: grid; grid-template-columns: 1fr 360px; gap: var(--sp-6); min-height: 0; }
.ledger-strip { display: flex; gap: 40px; align-items: baseline; }
.ledger-strip .v { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: var(--track-tight); }
.ledger-strip .l { font-size: var(--fs-s); color: var(--ink-3); }
.ledger-strip .d { font-size: var(--fs-s); }
.toggle { width: 32px; height: 18px; border-radius: 9px; background: var(--stamp); position: relative; display: inline-block; vertical-align: middle; }
.toggle::after { content: ""; position: absolute; right: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; }
.toggle.off { background: var(--ink-4); } .toggle.off::after { right: auto; left: 2px; }
.banner { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-radius: var(--r-m); background: var(--sheet); box-shadow: var(--ring); font-size: var(--fs-m); }
.banner .r { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; color: var(--ink-3); font-size: var(--fs-s); }
.checklist { list-style: none; }
.checklist li { display: grid; grid-template-columns: 24px 1fr auto; gap: var(--sp-3); align-items: center; padding: 10px var(--sp-5); border-top: 1px solid var(--rule); font-size: var(--fs-m); }
.checklist li .n { width: 20px; height: 20px; border-radius: 50%; font-size: var(--fs-xs); display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--rule-strong); color: var(--ink-3); }
.checklist li.done .n { background: var(--balanced); color: #fff; box-shadow: none; }
.checklist li.now { background: var(--stamp-wash); }
.checklist li.now .n { background: var(--stamp); color: #fff; box-shadow: none; }
.checklist li .c { font-size: var(--fs-s); color: var(--ink-3); }
.bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--sp-3); align-items: end; height: 160px; padding: 0 var(--sp-5); }
.bars .m { display: flex; gap: 3px; align-items: end; height: 100%; }
.bars .m i { flex: 1; border-radius: 2px 2px 0 0; background: var(--ink); }
.bars .m i.c { background: var(--rule-strong); }
.bars .m i.f { background: var(--stamp-wash); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--sp-3); padding: var(--sp-2) var(--sp-5) var(--sp-4); font-size: var(--fs-xs); color: var(--ink-3); text-align: center; }
.tabsh { display: flex; gap: var(--sp-6); border-bottom: 1px solid var(--rule); padding: 0 28px; background: var(--sheet); }
.tabsh span, .tabsh a { text-decoration: none; padding: var(--sp-3) 0 10px; font-size: var(--fs-m); color: var(--ink-3); font-weight: 500; border-bottom: 2px solid transparent; }
.tabsh span.on, .tabsh a.on { color: var(--ink); border-bottom-color: var(--stamp); }
.field { display: flex; align-items: center; height: 32px; padding: 0 var(--sp-3); border-radius: var(--r-s); background: var(--inset); font-family: var(--mono); font-size: var(--fs-s); color: var(--ink-2); }
.role { font-size: var(--fs-s); font-weight: 500; padding: 2px var(--sp-2); border-radius: var(--r-xs); background: var(--inset); color: var(--ink-2); }
.role.own { background: var(--stamp-wash); color: var(--stamp); }
.rail .foot { white-space: nowrap; }
.entry td { white-space: nowrap; }
.table td.clip { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

/* ── Shell: forms, popovers, phone ─────────────────────── */
a { color: var(--stamp); }
:focus-visible { outline: 2px solid var(--stamp); outline-offset: 2px; }
.btn { text-decoration: none; transition: transform var(--t-fast) var(--ease); }
.btn:active { transform: scale(0.97); }
.btn:disabled { color: var(--ink-4); cursor: default; }
.btn.wide { width: 100%; justify-content: center; margin-top: var(--sp-3); }
.linkbtn { font: inherit; font-size: var(--fs-s); color: var(--missing); background: none; border: 0; padding: 0; cursor: pointer; }
.rail.ink .foot .linkbtn { color: var(--rail-ink-2); }
form.inline { display: inline; }
.rail .push { margin-top: auto; }
.rail .foot { margin-top: 0; align-items: center; }
.rail .foot form { margin-left: auto; }
.rail .role-line { font-size: var(--fs-xs); color: var(--rail-ink-2); }
.rail .who-am-i { min-width: 0; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.av { border-radius: 50%; background: var(--inset); display: grid; place-items: center; font-weight: 600; color: var(--ink); text-decoration: none; }
.topbar .av { width: var(--sp-8); height: var(--sp-8); font-size: var(--fs-s); }
.firm-switch { position: relative; }
.firm-switch summary { list-style: none; cursor: pointer; }
.firm-switch summary::-webkit-details-marker { display: none; }
.firm-switch .menu { position: absolute; z-index: 2; left: 0; right: 0; top: 100%; margin-top: var(--sp-1); padding: var(--sp-1); display: flex; flex-direction: column; background: var(--sheet); border-radius: var(--r-m); box-shadow: var(--float); min-width: var(--rail-w); }
.menu-item { font: inherit; font-weight: 500; color: var(--ink); text-align: left; padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--r-s); background: none; cursor: pointer; }
.menu-item:hover, .menu-item.on { background: var(--inset); }
.menu-item small { display: block; font-weight: 400; color: var(--ink-3); font-size: var(--fs-xs); }
.topbar, .tabbar { display: none; }
.period .fact { white-space: nowrap; }
.page .note, .panel .note { padding: var(--sp-3) var(--sp-5) var(--sp-4); color: var(--ink-3); font-size: var(--fs-s); }
.page > .banner { margin-bottom: calc(-1 * var(--sp-2)); }
.panel .pad { padding: 0 var(--sp-5) var(--sp-4); }
.panel .pad .l { font-size: var(--fs-s); margin-bottom: var(--sp-2); }
.panel .banner { margin: 0 var(--sp-5) var(--sp-3); box-shadow: none; background: var(--balanced-wash); }
.panel .field.token { margin: 0 var(--sp-5) var(--sp-4); user-select: all; overflow-x: auto; }
.scroll { overflow-x: auto; }
.table td form.inline { margin-left: var(--sp-3); }
.add { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: end; padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--rule); }
.add label { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-s); color: var(--ink-3); }
.input { font: inherit; font-size: var(--fs-m); height: var(--sp-8); min-width: var(--doc-w); padding: 0 var(--sp-3); border: 0; border-radius: var(--r-s); background: var(--inset); color: var(--ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-6); padding: 0 var(--sp-5) var(--sp-5); font-size: var(--fs-m); }
.kv dt { color: var(--ink-3); }
.kv dd { font-weight: 500; }
.kh li form.inline { display: inline; }
.bare { display: grid; place-items: center; height: 100%; }
.sign { width: min(100%, var(--queue-w)); padding: var(--sp-6); background: var(--sheet); border-radius: var(--r-l); box-shadow: var(--ring); }
.sign .brand { padding: 0 0 var(--sp-5); }
.sign-title { font-size: var(--fs-xl); font-weight: 600; letter-spacing: var(--track-title); }
.sign .note { color: var(--ink-3); padding: var(--sp-2) 0 var(--sp-2); }
.tabbar .ic { width: var(--sp-6); height: var(--sp-6); background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.ic-inbox { --icon: url(icons/inbox.svg); } .ic-bank { --icon: url(icons/bank.svg); } .ic-vat { --icon: url(icons/vat.svg); } .ic-more { --icon: url(icons/more.svg); }

@media (max-width: 1023px) {
  .app { display: block; height: auto; min-height: 100vh; }
  .rail { display: none; }
  .main { overflow: visible; }
  .topbar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5) var(--sp-3); }
  .topbar .firm-switch .firm { padding: var(--sp-1) var(--sp-3); gap: var(--sp-2); }
  .topbar .firm small { display: none; }
  .topbar .firm-switch .menu { right: auto; }
}
@media (max-width: 767px) {
  .main { padding-bottom: calc(var(--tap) + var(--sp-8) + var(--sp-4)); }
  .period { flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); padding: var(--sp-2) var(--sp-5) var(--sp-4); border-bottom: 0; }
  .period h1 { flex: 1 0 100%; font-size: var(--fs-2xl); letter-spacing: var(--track-tight); }
  .period .spacer { display: none; }
  .tabsh { padding: 0 var(--sp-5); overflow-x: auto; gap: var(--sp-5); }
  .tabsh a, .tabsh span { white-space: nowrap; }
  .page { padding: var(--sp-4) var(--sp-3); gap: var(--sp-4); }
  .duo, .split { grid-template-columns: 1fr; }
  .add { align-items: stretch; flex-direction: column; }
  .input, .add .btn { width: 100%; min-height: var(--tap); }
  .prow { min-height: var(--tap); align-items: center; }
  .pcard .prow { text-decoration: none; color: var(--ink); }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; padding: var(--sp-2) var(--sp-2) var(--sp-5); border-top: 1px solid var(--rule); background: var(--sheet); }
  .tabbar a { min-height: var(--tap); display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); text-decoration: none; }
  .tabbar a.on { color: var(--stamp); }
  .bare { padding: var(--sp-4); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ── Screens: Ke schválení, Banka, Doklady, DPH a KH ──── */
.on-phone { display: none; }
a.item, a.plain { color: inherit; text-decoration: none; }
a.item:hover { background: var(--inset); }
.queue { overflow-y: auto; }
.detail { overflow-y: auto; }
.detail .actions { position: sticky; bottom: 0; flex-wrap: wrap; }
.actions form.inline { display: inline-flex; }
.actions .note .linkbtn { color: var(--stamp); font-size: var(--fs-s); }
.actions .note .linkbtn kbd { margin-left: var(--sp-1); }
.actions .skip, .detail .back { display: none; }
.page.flash { flex: none; padding-bottom: 0; overflow: visible; }
.sect .ok { color: var(--balanced); font-weight: 500; }
.sect .bad { color: var(--missing); font-weight: 500; }
.detail .note { color: var(--ink-3); font-size: var(--fs-m); margin-top: var(--sp-3); }
.upload { display: flex; gap: var(--sp-3); align-items: center; margin-top: var(--sp-4); flex-wrap: wrap; }
.upload .input { min-width: 0; flex: 1; height: auto; min-height: var(--sp-8); padding: var(--sp-1) var(--sp-3); }
label.btn { position: relative; cursor: pointer; }
.pick { position: absolute; width: var(--sp-1); height: var(--sp-1); opacity: 0; overflow: hidden; }
.doc img { width: 100%; height: 100%; object-fit: contain; }
.doc .b { font-weight: 600; }
.doc .to { margin-top: var(--sp-3); }
.doc .to b { color: var(--ink); }
.doc .w8 { width: 80%; margin-top: var(--sp-4); }
.doc .w6 { width: 65%; }
.doc .tb.plain { border: 0; padding-top: calc(var(--sp-1) / 2); }
.seal a { font-size: var(--fs-xs); }

.filters { flex-wrap: wrap; }
.panel .filters { padding: var(--sp-3) var(--sp-4); }
.filters .scope .pickbox { font: inherit; font-weight: 500; color: var(--ink); border: 0; background: none; cursor: pointer; }
.filters input.search { border: 0; font: inherit; font-size: var(--fs-m); color: var(--ink); }
.filters input.search::placeholder { color: var(--ink-4); }
.seg a { text-decoration: none; padding: var(--sp-1) var(--sp-3); border-radius: var(--r-xs); font-size: var(--fs-m); color: var(--ink-3); font-weight: 500; }
.seg a.on { background: var(--sheet); color: var(--ink); box-shadow: var(--ring); }
.clip-panel { overflow: hidden; }
.table .clip { color: var(--ink-3); }
.ledger-strip .push { margin-left: auto; }
.ledger-strip .d.ok { color: var(--balanced); }
.ledger-strip .d.bad { color: var(--missing); }
.ledger-strip .d b { color: var(--ink); font-weight: 500; }
.split { align-items: start; }
.side { padding: var(--sp-5); }
.side .side-amount { font-size: var(--fs-2xl); letter-spacing: var(--track-tight); }
.side .sect { margin-top: var(--sp-6); }
.side .pair { margin-top: var(--sp-2); }
.side .pick-doc { cursor: pointer; background: var(--paper); }
.side .pick-doc:has(input:checked) { background: var(--sheet); box-shadow: var(--ring); }
.side .entry { margin-top: var(--sp-4); }
.row-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-5); flex-wrap: wrap; }
.side .note, .vat .note { padding: var(--sp-3) 0 0; color: var(--ink-3); font-size: var(--fs-s); }
.pay .note { padding: var(--sp-3) 0 0; }
.qrrow { display: flex; gap: var(--sp-4); align-items: end; }
.qr { color: var(--ink); flex: none; }
.qrnote { font-size: var(--fs-s); color: var(--ink-3); line-height: 1.5; }
.vat aside .trivi { margin-top: var(--sp-4); }
.vat aside .row-actions { padding: 0; }
.panel > header .x .btn { height: var(--sp-6); font-size: var(--fs-s); }
.steps { overflow-x: auto; }
.steps div { white-space: nowrap; }

@media (max-width: 1023px) {
  .vat { grid-template-columns: 1fr; }
  .inbox { display: block; }
  .queue { border-right: 0; }
  .inbox.picked .queue, .inbox:not(.picked) .detail { display: none; }
  .detail { background: var(--paper); }
  .detail .back { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-2) var(--sp-5); font-size: var(--fs-l); color: var(--ink-3); }
  .detail .back a { color: var(--stamp); font-weight: 500; text-decoration: none; }
  .detail .body { display: block; padding: 0 var(--sp-5) var(--sp-6); }
  .detail .body aside { margin-top: var(--sp-5); }
  .facts { grid-template-columns: repeat(2, auto); gap: var(--sp-3) var(--sp-6); }
}
@media (max-width: 767px) {
  .on-desk { display: none; }
  .on-phone { display: inline; }
  .queue { padding: 0; }
  .queue h3 { padding: var(--sp-4) var(--sp-6) var(--sp-2); }
  .grp { margin: 0 var(--sp-3) var(--sp-3); background: var(--sheet); border-radius: var(--r-xl); box-shadow: var(--ring); overflow: hidden; }
  .grp .item { padding: var(--sp-3) var(--sp-4); border-left: 0; border-top: 1px solid var(--rule); min-height: var(--tap); }
  .grp .item:first-child { border-top: 0; }
  .grp .item.sel { background: none; box-shadow: none; }
  .item .t, .item .a { font-size: var(--fs-l); }
  .item .s { font-size: var(--fs-m); }
  .detail .amount { font-size: calc(var(--fs-hero) * 1.18); letter-spacing: var(--track-tight); }
  .detail .doc { display: none; }
  .detail .actions { position: fixed; left: 0; right: 0; bottom: 0; flex-wrap: nowrap; padding: var(--sp-3) var(--sp-4) var(--sp-8); background: var(--paper); }
  .actions .note, .actions:has(.primary) [data-next] { display: none; }
  .actions .btn { height: calc(var(--tap) + var(--sp-1) / 2); justify-content: center; font-size: var(--fs-l); border-radius: var(--r-xl); width: 100%; }
  .actions > form.inline { flex: 2; order: 2; }
  .actions > [data-edit], .actions > [data-next], .actions > button, .actions > a.btn { flex: 1; order: 1; }
  .app:has(.inbox.picked) .tabbar { display: none; }
  .app:has(.inbox.picked) .main { padding-bottom: calc(var(--tap) * 3); }
  .ledger-strip { flex-wrap: wrap; gap: var(--sp-3) var(--sp-6); }
  .ledger-strip .push { margin-left: 0; }
  .filters .search { margin-left: 0; width: 100%; }
  .page { overflow: visible; }
  .vat { padding: var(--sp-4) var(--sp-3); }
  .steps { padding: 0 var(--sp-5); }
  .upload .btn, .upload .input { width: 100%; }
}
.actions .note { text-align: right; }
@media (max-width: 767px) {
  .period .on-desk { display: none; }
  .app:has(.inbox.picked) .period, .app:has(.inbox.picked) .topbar { display: none; }
  .entry td, .entry th { padding: var(--sp-2) var(--sp-3); }
  .entry td .acc { margin-right: var(--sp-2); }
  .entry td .nm { white-space: normal; }
}
.vat > div, .vat > aside { min-width: 0; }
@media (max-width: 767px) {
  .close-grid { grid-template-columns: 1fr; }
  .panel > header { flex-wrap: wrap; gap: var(--sp-2); }
  .rows th, .rows td, .kh li, .check { padding-left: var(--sp-4); padding-right: var(--sp-4); }
  .rows td .rn { width: var(--sp-6); }
}

.editrows { width: 100%; border-collapse: collapse; margin-bottom: var(--sp-4); }
.editrows th { font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); text-align: left; padding: var(--sp-1) var(--sp-2); }
.editrows td { padding: var(--sp-1) var(--sp-2); }
.editrows .input { min-width: 0; width: 100%; }
.editrows .input.num { text-align: right; font-variant-numeric: tabular-nums; }
.detail .banner { margin: var(--sp-3) 0; }
.pick-list { max-height: calc(var(--queue-w) * 1.5); overflow-y: auto; }
.pick-doc + .preview { display: none; }
.pick-doc:has(input:checked) + .preview { display: block; }
.pick-doc input:disabled + div { color: var(--ink-3); }
.side .filters { padding: var(--sp-2) 0; }
.side .filters .search { width: 100%; margin-left: 0; }
.kh li.khm b { font-weight: 600; }
.doc.file { padding: 0; overflow: hidden; height: calc(var(--doc-w) * 1.414); font-size: var(--fs-s); }
.doc.file object, .doc.file img { width: 100%; height: 100%; border: 0; display: block; }
.doc.file .note { padding: var(--sp-4); }

/* Vydané faktury: the auto-invoice toggle is a button, its date field sits beside it. */
.toggle-btn { background: none; border: 0; padding: 0; cursor: pointer; border-radius: var(--sp-3); }
.banner .r form { display: flex; gap: var(--sp-2); align-items: center; }
.banner .r .input { min-width: 0; height: var(--sp-6); }
.row-actions form { display: contents; }
/* Přehledy: bar heights come from classes (the CSP allows no inline style), the three-panel row, late amounts. */
.duo.three { grid-template-columns: 1.2fr 1fr 1fr; margin-top: 0; }
.dot.ink { background: var(--ink); } .dot.rule { background: var(--rule-strong); }
.kh li .c.late { color: var(--missing); }
.panel > header .x a { color: inherit; }
.bars .m i.h0 { height: 0%; }
.bars .m i.h1 { height: 5%; }
.bars .m i.h2 { height: 10%; }
.bars .m i.h3 { height: 15%; }
.bars .m i.h4 { height: 20%; }
.bars .m i.h5 { height: 25%; }
.bars .m i.h6 { height: 30%; }
.bars .m i.h7 { height: 35%; }
.bars .m i.h8 { height: 40%; }
.bars .m i.h9 { height: 45%; }
.bars .m i.h10 { height: 50%; }
.bars .m i.h11 { height: 55%; }
.bars .m i.h12 { height: 60%; }
.bars .m i.h13 { height: 65%; }
.bars .m i.h14 { height: 70%; }
.bars .m i.h15 { height: 75%; }
.bars .m i.h16 { height: 80%; }
.bars .m i.h17 { height: 85%; }
.bars .m i.h18 { height: 90%; }
.bars .m i.h19 { height: 95%; }
.bars .m i.h20 { height: 100%; }
@media (max-width: 767px) {
  .duo.three { grid-template-columns: 1fr; }
  .bars, .months { gap: var(--sp-1); padding-left: var(--sp-3); padding-right: var(--sp-3); }
  .invoice-banner { align-items: flex-start; flex-wrap: wrap; }
  .invoice-banner-copy { flex: 1 1 calc(100% - var(--sp-6)); min-width: 0; }
  .invoice-banner .r { width: 100%; margin-left: var(--sp-6); justify-content: space-between; }
  .invoice-banner .r form { flex: 1; justify-content: flex-end; }
  .invoice-banner .r .input { width: auto; min-width: 0; }
  .split > * { min-width: 0; }
  .clip-panel .scroll { max-width: 100%; }
}
.page > .queue { border-right: 0; padding: 0; overflow: visible; }

/* ── Nastavení → Faktura: editor with live PDF preview ── */
.lk { display: grid; grid-template-columns: 5fr 6fr; gap: var(--sp-6); align-items: start; }
.lk-row { display: grid; grid-template-columns: calc(var(--doc-w) * 3 / 5) 1fr; gap: var(--sp-3) var(--sp-4); align-items: center; padding: var(--sp-3) var(--sp-5); font-size: var(--fs-m); }
.lk-row .input { width: 100%; }
.lk-logo { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.lk-box { display: grid; place-items: center; width: calc(var(--doc-w) * 3 / 4); height: calc(var(--sp-8) * 2); padding: var(--sp-2) var(--sp-4); border-radius: var(--r-m); border: 1px dashed var(--rule-strong); }
.lk-img { max-width: 100%; max-height: var(--sp-8); }
.lk-logo .linkbtn, .lk-logo label.linkbtn { color: var(--stamp); }
.lk-hint { padding-top: 0; }
.lk-color { display: flex; gap: var(--sp-3); align-items: center; }
.lk-color .input { min-width: 0; width: calc(var(--doc-w) / 2); }
.swatch { width: var(--sp-8); height: var(--sp-8); padding: 0; border: 0; border-radius: var(--r-s); background: none; cursor: pointer; }
.lk-actions { display: flex; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5) var(--sp-5); }
.lk-cap { font-size: var(--fs-s); padding-bottom: var(--sp-2); }
.lk-frame { display: block; width: 100%; aspect-ratio: 210 / 297; border: 0; border-radius: var(--r-m); background: var(--sheet); box-shadow: var(--float); }
@media (max-width: 767px) {
  .lk { grid-template-columns: 1fr; gap: var(--sp-4); }
  .lk-row { grid-template-columns: 1fr; }
  .lk-box { width: 100%; flex: 1 0 100%; }
  .lk-actions { flex-direction: column-reverse; }
  .lk-actions .btn { justify-content: center; min-height: var(--tap); }
}
