.viz-root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --page-plane:     #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11,11,11,0.10);
  --success-text:   #006300;
  --series-1: #2a78d6; /* Cash */
  --series-2: #eb6834; /* Transfer */
  --series-3: #1baf7a; /* Stripe */
  --series-4: #eda100; /* Sumup */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page-plane);
  color: var(--text-primary);
}
.app { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }

header.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
header.top .brand { display: flex; align-items: center; gap: 10px; }
header.top .logo {
  width: 34px; height: 34px; border-radius: 8px; background: var(--series-1); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
header.top h1 { font-size: 18px; margin: 0; }
header.top p.sub { margin: 0; font-size: 12.5px; color: var(--text-secondary); }

.flash { border-radius: 10px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 16px; }
.flash.good { background: #eaf7ea; border: 1px solid #b9e3b9; color: #0a5c0a; }
.flash.warning { background: #fff7e8; border: 1px solid #f0d9a6; color: #6b4e04; }
.flash.critical { background: #fdeceb; border: 1px solid #f2b6b1; color: #7a1f1a; }

.banner { background: #fff7e8; border: 1px solid #f0d9a6; color: #6b4e04; border-radius: 10px; padding: 10px 14px; font-size: 12.5px; margin-bottom: 20px; }

nav.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gridline); margin-bottom: 22px; flex-wrap: wrap; }
nav.tabs a.tab-btn, nav.tabs span.tab-btn {
  text-decoration: none; font-size: 13.5px; color: var(--text-secondary);
  padding: 10px 14px; border-bottom: 2px solid transparent; font-weight: 600; display: inline-block;
}
nav.tabs a.tab-btn.active { color: var(--text-primary); border-bottom-color: var(--series-1); }
nav.tabs a.tab-btn:hover { color: var(--text-primary); }
.soon-tag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  background: var(--gridline); color: var(--text-muted); border-radius: 4px; padding: 1px 5px; margin-left: 4px;
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px,1fr)); gap: 12px; margin-bottom: 22px; }
.stat-tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat-tile .label { font-size: 11.5px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.stat-tile .value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-tile .delta { font-size: 12px; margin-top: 2px; color: var(--text-secondary); }
.stat-tile .delta.good { color: var(--success-text); }

.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 22px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.card h2 { font-size: 13.5px; margin: 0 0 4px; }
.card p.hint { font-size: 11.5px; color: var(--text-muted); margin: 0 0 14px; }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 64px; align-items: center; gap: 10px; }
.bar-row .cat { font-size: 12.5px; color: var(--text-primary); font-weight: 600; }
.bar-track { position: relative; height: 10px; background: var(--gridline); border-radius: 5px; }
.bar-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 5px; }
.bar-row .val { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-secondary); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: 11.5px; color: var(--text-secondary); }
.legend .swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .02em;
  color: var(--text-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--gridline); white-space: nowrap;
}
tbody td { padding: 9px 10px; border-bottom: 1px solid var(--gridline); vertical-align: top; }
tbody tr:hover { background: rgba(11,11,11,0.02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.reg { display: inline-block; font-weight: 700; letter-spacing: .03em; background: #ffd83d; border: 1px solid #cbaa00; border-radius: 4px; padding: 2px 8px; font-size: 12px; }

.type-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; margin: 1px 3px 1px 0; }
.type-badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.type-badge.legal { background: rgba(42,120,214,0.10); color: #1c5cab; }
.type-badge.legal .dot { background: var(--series-1); }
.type-badge.show { background: rgba(74,58,167,0.10); color: #4a3aa7; }
.type-badge.show .dot { background: #4a3aa7; }
.type-badge.chars { background: rgba(27,175,122,0.10); color: #0f7a53; }
.type-badge.chars .dot { background: var(--series-3); }
.type-badge.printed { background: rgba(237,161,0,0.14); color: #8a6300; }
.type-badge.printed .dot { background: var(--series-4); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.good { background: rgba(12,163,12,0.10); color: #0a6b0a; }
.badge.good .dot { background: var(--status-good); }
.badge.warning { background: rgba(250,178,25,0.16); color: #7a5300; }
.badge.warning .dot { background: #b17a00; }
.badge.critical { background: rgba(208,59,59,0.10); color: var(--status-critical); }
.badge.critical .dot { background: var(--status-critical); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.toolbar .title { font-size: 15px; font-weight: 700; }
.btn { appearance: none; border: none; border-radius: 8px; padding: 8px 14px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; }
.btn.primary { background: var(--series-1); color: #fff; }
.btn.primary:hover { background: #2467bd; }
.btn.ghost { background: none; border: 1px solid var(--border); color: var(--text-primary); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.meter-track { position: relative; width: 120px; height: 8px; background: var(--gridline); border-radius: 4px; }
.meter-fill { position: absolute; left:0; top:0; height:100%; border-radius: 4px; }

.recipe-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--gridline); font-size: 12.5px; flex-wrap: wrap; }
.recipe-row:last-child { border-bottom: none; }
.recipe-name { font-weight: 700; min-width: 110px; }
.recipe-parts { color: var(--text-secondary); }
.recipe-part { font-weight: 600; color: var(--text-primary); }

form.stack .field { margin-bottom: 14px; }
form.stack label { display: block; font-size: 11.5px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }
form.stack input, form.stack select, form.stack textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--border); font: inherit; font-size: 13px; background: #fff;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.login-wrap { max-width: 360px; margin: 80px auto; }
.login-wrap .card { padding: 24px; }
.error-text { color: var(--status-critical); font-size: 12.5px; margin-bottom: 12px; }
.empty { text-align: center; color: var(--text-muted); font-size: 12.5px; padding: 30px 10px; }

.doc-cell { min-width: 170px; }
.doc-cell select, .doc-cell input[type="text"] {
  width: 100%; padding: 5px 7px; border-radius: 6px; border: 1px solid var(--border);
  font: inherit; font-size: 11.5px; background: #fff; margin-bottom: 4px; display: block;
}
.doc-save-btn { padding: 4px 10px; font-size: 10.5px; }
