:root { --bg: #0f1115; --panel: #171a21; --line: #272c37; --muted: #8b93a3; --accent: #5b8cff; --pos: #3ecf8e; --neg: #ff6b6b; --warn: #f5a524; }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: #e8ecf1; font-family: system-ui, sans-serif; }
#app { max-width: 1040px; margin: 0 auto; padding: 24px 16px 64px; display: flex; flex-direction: column; gap: 16px; }
h1 { margin: 0; font-size: 1.7rem; }
h2 { margin: 0 0 12px; font-size: 1.1rem; }
.sub { margin: 16px 0 8px; font-size: .95rem; }
.muted { color: var(--muted); margin: 4px 0 0; }
.small { font-size: .85rem; margin-bottom: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.top { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; }
.toolbar, .filters, .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.panel { padding: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.stat strong { font-size: 1.4rem; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
form label { display: block; margin: 10px 0 4px; font-size: .85rem; color: var(--muted); }
form .fx-input { width: 100%; }
#cat-form .fx-input { width: auto; flex: 1 1 160px; }
.seg { display: flex; gap: 8px; }
.seg label { margin: 0; flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: #e8ecf1; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); }
.seg input:focus-visible + span { outline: 2px solid #fff; }
.err { color: var(--neg); font-size: .8rem; min-height: 1em; }
.row { margin-top: 12px; }
.bar-row, .budget { margin-bottom: 12px; }
.bar-label { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; margin-bottom: 4px; flex-wrap: wrap; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.fill.warn { background: var(--warn) !important; }
.fill.over { background: var(--neg) !important; }
span.warn { color: var(--warn); }
span.over { color: var(--neg); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.chart { display: block; width: 100%; margin: 0 auto 12px; }
.budgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 20px; }
.budget .fx-input { width: 100%; margin-top: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.1rem; line-height: 1; padding: 0 6px; border-radius: 50%; }
.chip button:hover, .chip button:focus-visible { color: var(--neg); }
.list-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 8px; }
.list-head h2 { margin: 0; }
.table-wrap { overflow-x: auto; }
.fx-table { width: 100%; }
.r { text-align: right; }
.actions { white-space: nowrap; }
.small-btn { padding: 4px 10px; font-size: .8rem; }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; margin: 0; }
button:disabled { opacity: .4; cursor: not-allowed; }
.print-only { display: none; }
[hidden] { display: none !important; }
@media (max-width: 600px) { .filters .fx-input { flex: 1 1 140px; } }

@media print {
  html, body { background: #fff !important; color: #000 !important; }
  #app { max-width: none; padding: 0; gap: 12px; }
  .no-print, .toolbar, .top .muted { display: none !important; }
  .print-only { display: block; font-size: 1.2rem; }
  .fx-card, .panel, .stat { background: #fff !important; color: #000 !important; border: 1px solid #ccc !important; box-shadow: none !important; break-inside: avoid; }
  .muted, .bar-label, .fx-table th { color: #444 !important; }
  .pos { color: #0a7a46 !important; }
  .neg { color: #c0392b !important; }
  .bar { background: #ddd !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fill, .dot, .fx-badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .fx-table td, .fx-table th { border-color: #ddd !important; color: #000; }
  .chart { filter: invert(1) hue-rotate(180deg); }
}
