:root { --brand: #1f4e79; --brand-soft: #e8f0f9; --ink: #1d2733; --muted: #6b7684; --line: #e2e6ec; --bg: #f5f7fa;
  --ok: #18794e; --warn: #a35b00; --bad: #c0392b; font-family: Inter, "Segoe UI", system-ui, sans-serif; color: var(--ink); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; padding-bottom: 32px; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 32px); }
.side { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand { padding: 18px 18px 14px; font-size: 18px; color: var(--brand); }
.brand span { display: block; font-size: 11px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.side nav { display: flex; flex-direction: column; padding: 0 8px; flex: 1; }
.side nav a { padding: 7px 10px; border-radius: 6px; color: var(--ink); }
.side nav a:hover { background: var(--bg); text-decoration: none; }
.side nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-h { font-size: 11px; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; letter-spacing: .05em; }
.me { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.me span { color: var(--muted); font-size: 12px; }
main { padding: 22px 28px; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 14px; font-weight: 600; } h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 14px; margin: 0 0 8px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.head h1 { margin: 0; } .head .sub { color: var(--muted); font-size: 13px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: block; color: inherit; }
.tile:hover { text-decoration: none; border-color: var(--brand); }
.tile b { display: block; font-size: 22px; margin-top: 4px; } .tile span { color: var(--muted); font-size: 12px; }
.tile.bad b { color: var(--bad); } .tile.warn b { color: var(--warn); } .tile.ok b { color: var(--ok); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f8fafc; }
td.n, th.n { text-align: right; white-space: nowrap; } .nw { white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef1f5; color: var(--muted); white-space: nowrap; }
.tag.ok { background: #e6f5ec; color: var(--ok); } .tag.warn { background: #fff3e0; color: var(--warn); } .tag.bad { background: #fde8e6; color: var(--bad); }
.btn, button { display: inline-block; background: var(--brand); color: #fff; border: 0; border-radius: 6px; padding: 7px 14px; font: inherit; cursor: pointer; }
.btn:hover, button:hover { opacity: .92; text-decoration: none; }
.btn.sec, button.sec { background: #fff; color: var(--brand); border: 1px solid var(--line); }
.btn.danger, button.danger { background: #fff; color: var(--bad); border: 1px solid #f2c4bf; }
.btn.small, button.small { padding: 3px 10px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #cfd6df; border-radius: 6px; width: 100%; background: #fff; }
input[type=checkbox], input[type=radio] { width: auto; }
label { font-weight: 500; font-size: 13px; }
.f { margin-bottom: 12px; } .f .help { font-size: 12px; color: var(--muted); } .f .err, .errorlist { color: var(--bad); font-size: 12px; margin: 2px 0; padding: 0; list-style: none; }
.fgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 16px; } .fgrid .wide { grid-column: span 2; }
.f ul { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-wrap: wrap; gap: 4px 16px; } .f ul label { font-weight: 400; }
.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; } .filters input, .filters select { width: auto; }
.msg { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--brand-soft); color: var(--brand); }
.msg.error { background: #fde8e6; color: var(--bad); } .msg.success { background: #e6f5ec; color: var(--ok); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 14px; border-bottom: 2px solid transparent; color: var(--muted); } .tabs a.on { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.centre { max-width: 420px; margin: 8vh auto 0; padding: 0 16px; }
.centre .card { padding: 28px; } .centre h1 { color: var(--brand); }
.qr svg { width: 100%; max-width: 280px; height: auto; }
.foot { position: fixed; left: 0; right: 0; bottom: 0; height: 30px; display: flex; align-items: center; justify-content: center;
  background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; z-index: 10; }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
details summary { cursor: pointer; color: var(--brand); }
.alert { color: var(--bad); font-size: 12px; }
/* invoice print */
.invoice { background: #fff; max-width: 820px; margin: 0 auto; padding: 28px; border: 1px solid var(--line); }
.invoice table td, .invoice table th { border: 1px solid #cfd6df; }
.invoice .top { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
@media print { .side, .foot, .no-print, .msg { display: none !important; } .shell { display: block; } main { padding: 0; }
  body { background: #fff; padding: 0; } .invoice { border: 0; padding: 0; } }
table.lines td { padding: 4px; } table.lines input, table.lines select { padding: 5px 6px; font-size: 13px; }
table.tot td, table.tot th { border: 0; padding: 4px 8px; }
.inv-head td { border: 0 !important; padding: 0 !important; vertical-align: top; }
.brand img { width: 100%; max-width: 170px; display: block; }
.inv-logo { max-height: 64px; max-width: 300px; display: block; }
.card.pending { border-left: 4px solid #2e7d32; }
.card.pending.has { border-left-color: #c62828; background: #fff8f7; }
table.lines input[name$="-qty"] { min-width: 64px; }
table.lines input[name$="-rate"] { min-width: 100px; }
table.lines input[name$="-sac"] { min-width: 76px; }
