:root { --fg:#1d2430; --muted:#6b7686; --line:#dde2ea; --bg:#f6f7f9; --card:#fff; --accent:#1f5fbf; --danger:#b42318; --ok:#067647; }
* { box-sizing: border-box; }
body { margin:0; font:14px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; color:var(--fg); background:var(--bg); }
a { color:var(--accent); text-decoration:none; } a:hover { text-decoration:underline; }
header { display:flex; align-items:center; gap:1.2rem; padding:.5rem 1rem; background:#16213a; color:#fff; flex-wrap:wrap; }
header a, header .link { color:#dbe6ff; }
header .brand a { color:#fff; font-weight:700; }
header nav { display:flex; gap:.9rem; flex:1; flex-wrap:wrap; }
header .me { font-size:.9em; }
main { padding:1rem 1.5rem 3rem; max-width:1300px; }
h1 { font-size:1.4rem; margin:.3rem 0 1rem; } h2 { font-size:1.1rem; margin:1.6rem 0 .6rem; }
.flash { padding:.6rem .9rem; border-radius:6px; background:#e7f6ec; border:1px solid #b7e2c4; margin-bottom:.8rem; }
.flash.err { background:#fdecea; border-color:#f5c2bd; color:var(--danger); }
ul.flash { padding-left:2rem; }
.card { background:var(--card); border:1px solid var(--line); border-radius:8px; padding:1rem; margin-bottom:1rem; }
.narrow { max-width:420px; }
label { display:flex; flex-direction:column; gap:.2rem; font-weight:600; font-size:.88em; color:#334; }
label.check, label.inline { flex-direction:row; align-items:center; gap:.4rem; font-weight:normal; }
input, select, textarea { font:inherit; padding:.38rem .5rem; border:1px solid #c7cfdb; border-radius:5px; background:#fff; min-width:0; }
input:focus, select:focus, textarea:focus { outline:2px solid #9bbcf0; border-color:var(--accent); }
.grid2 { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:.8rem 1.2rem; }
.grid4 { display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:.8rem 1rem; margin-bottom:1rem; }
.full { grid-column:1/-1; } .span2 { grid-column:span 2; }
.btn { display:inline-block; padding:.4rem .85rem; border:1px solid #c7cfdb; border-radius:6px; background:#fff; color:var(--fg); cursor:pointer; font:inherit; }
.btn:hover { background:#eef2f8; text-decoration:none; }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.btn.danger { color:var(--danger); border-color:#f0b8b2; }
button.link { background:none; border:0; color:var(--accent); cursor:pointer; font:inherit; padding:0; }
form.inline { display:inline-flex; gap:.4rem; align-items:center; flex-wrap:wrap; }
.toolbar { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; margin-bottom:1rem; }
table { border-collapse:collapse; width:100%; }
table.list, table.report, table.kv { background:#fff; border:1px solid var(--line); }
table.list th, table.list td, table.report th, table.report td { padding:.4rem .6rem; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
table.list thead th, table.report thead th { background:#eef1f6; font-size:.85em; text-transform:uppercase; letter-spacing:.02em; color:#445; }
table.kv { width:auto; min-width:380px; margin-bottom:1rem; } table.kv td { padding:.35rem .7rem; border-bottom:1px solid var(--line); } table.kv td:first-child { color:var(--muted); }
.num, th.num { text-align:right !important; font-variant-numeric:tabular-nums; white-space:nowrap; }
tr.inactive td { color:#99a; } tr.st-void td { color:#99a; text-decoration:line-through; } tr.st-overdue td:last-child { color:var(--danger); font-weight:600; }
tr.section td { font-weight:700; background:#f7f9fc; } tr.sub td { font-weight:600; border-top:1px solid #aab; }
tr.total td, tfoot td { font-weight:700; border-top:2px solid #556; }
table.lines td { padding:.25rem; } table.lines input, table.lines select { width:100%; }
table.lines th { text-align:left; font-size:.85em; color:#556; padding:.25rem; }
input.qty { max-width:5rem; } input.amt { max-width:8.5rem; text-align:right; }
.split { display:flex; gap:2rem; justify-content:space-between; align-items:flex-start; } .split > label { flex:1; }
table.totals { width:auto; min-width:280px; } table.totals td { padding:.3rem .6rem; }
.tiles { display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:1rem; margin-bottom:1rem; }
.tile { background:#fff; border:1px solid var(--line); border-radius:8px; padding:1rem; display:flex; flex-direction:column; gap:.3rem; color:var(--fg); }
.tile b { font-size:1.4rem; } .tile span { color:var(--muted); }
a.tile:hover { border-color:var(--accent); text-decoration:none; } a.tile b { font-size:1.05rem; }
.muted { color:var(--muted); } .ok { color:var(--ok); } .err { color:var(--danger); }
pre.log { background:#fff; border:1px solid var(--line); padding:.8rem; max-height:400px; overflow:auto; }
code { font-size:.9em; }
.doc { background:#fff; border:1px solid var(--line); padding:2rem; max-width:850px; }
.doc-head { display:flex; justify-content:space-between; gap:2rem; margin-bottom:1.5rem; }
.doc-title h2 { margin:0 0 .5rem; font-size:1.6rem; letter-spacing:.08em; color:#16213a; } .doc-title td { padding:.1rem .5rem; }
.doc-to { margin-bottom:1.5rem; }
.doc-lines th { border-bottom:2px solid #16213a; text-align:left; padding:.4rem; } .doc-lines td { border-bottom:1px solid var(--line); padding:.4rem; }
.doc-lines { margin-bottom:1rem; }
.doc-foot { margin-top:2rem; padding-top:1rem; border-top:1px solid var(--line); color:#445; font-size:.92em; }
@media print {
  header, .toolbar, .noprint, .flash, main:has(.doc) > h1 { display:none !important; }
  body { background:#fff; } main { padding:0; } .doc { border:0; padding:0; }
  table.report { font-size:11px; }
}
