:root {
  --bg: #0b1220; --panel: #111a2c; --panel2: #16213a; --line: #22304d;
  --text: #e6ebf5; --muted: #8a97b2; --accent: #00b965; --accent-d: #009452;
  --red: #ff6b6b; --amber: #f5b942; --blue: #5aa9ff;
  --radius: 10px; font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; display: flex; min-height: 100vh; background: var(--bg); color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
a { color: var(--accent); }
.sidebar { width: 220px; background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; gap: 6px; padding: 6px 8px 20px; }
.brand .logo { width: 170px; height: auto; display: block; }
.brand small { color: var(--muted); font-size: 11px; }
nav a { display: block; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; margin-bottom: 2px; }
nav a:hover { background: var(--panel2); }
nav a.active { background: rgba(0,185,101,.14); color: var(--accent); }
.who { margin-top: auto; color: var(--muted); font-size: 12px; padding: 8px; word-break: break-all; }
main { flex: 1; padding: 24px 28px; max-width: 1400px; overflow-x: auto; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 16px; margin: 24px 0 10px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; margin: 14px 0; }
.spacer { flex: 1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea { background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 10px; font: inherit; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(0,185,101,.5); border-color: var(--accent); }
textarea { min-height: 70px; resize: vertical; }
button, .btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; font: inherit; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #04140b; font-weight: 600; }
button.primary:hover { background: var(--accent-d); }
button.danger { color: var(--red); }
button.small { padding: 4px 9px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin: 16px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card .k { color: var(--muted); font-size: 12px; } .card .v { font-size: 22px; font-weight: 600; margin-top: 6px; }
.card.warn { border-color: var(--amber); } .card.warn .v { color: var(--amber); }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--panel2); font-weight: 600; font-size: 12px; color: var(--muted); white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: var(--panel2); }
td input, td select { padding: 4px 6px; width: 100%; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.pill.green { color: var(--accent); border-color: rgba(0,185,101,.4); }
.pill.red { color: var(--red); border-color: rgba(255,107,107,.4); }
.pill.amber { color: var(--amber); border-color: rgba(245,185,66,.4); }
.pill.blue { color: var(--blue); border-color: rgba(90,169,255,.4); }
.in { color: var(--accent); } .out { color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.full { grid-column: 1 / -1; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal.hidden { display: none; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(760px, 100%); }
.modal-card h2 { margin-top: 0; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel2); border: 1px solid var(--accent); padding: 10px 16px; border-radius: 10px; z-index: 60; }
.toast.err { border-color: var(--red); }
.toast.hidden { display: none; }
.note { background: var(--panel2); border-left: 3px solid var(--amber); padding: 10px 12px; border-radius: 6px; color: var(--text); margin: 12px 0; }
.receipts li { margin: 4px 0; }
@media (max-width: 800px) { body { flex-direction: column; } .sidebar { width: 100%; height: auto; position: static; } .grid2, .grid3 { grid-template-columns: 1fr; } }
td:first-child { white-space: nowrap; }
