:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #5b6475;
  --line: #e2e6ec;
  --accent: #1f5fbf;
  --accent-soft: #e8f0fc;
  --ok: #1d7a4b;
  --ok-soft: #e6f4ec;
  --wait: #8a5a00;
  --wait-soft: #fdf3dc;
  --stop: #b42318;
  --stop-soft: #fdecea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.top {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-weight: 650; min-width: 0; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), #5b8fe0); }
.badge {
  font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.badge.live { background: var(--stop-soft); color: var(--stop); }

.tabs {
  display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.tabs button {
  border: 0; background: none; padding: 8px 12px; border-radius: 8px; font: inherit;
  color: var(--muted); white-space: nowrap; cursor: pointer; min-height: 40px;
}
.tabs button[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

main { max-width: 980px; margin: 0 auto; padding: 16px; }
.foot { max-width: 980px; margin: 0 auto; padding: 8px 16px 32px; font-size: 0.8rem; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi .label { color: var(--muted); font-size: 0.85rem; }
.kpi .value { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.pos { color: var(--ok); }
.neg { color: var(--stop); }

.ampel { display: flex; gap: 14px; align-items: flex-start; }
.ampel .dot { flex: none; width: 18px; height: 18px; border-radius: 50%; margin-top: 4px; }
.ampel.ok { border-left: 6px solid var(--ok); }
.ampel.ok .dot { background: var(--ok); }
.ampel.wartet, .ampel.achtung { border-left: 6px solid var(--wait); background: var(--wait-soft); }
.ampel.wartet .dot, .ampel.achtung .dot { background: var(--wait); }
.ampel.gestoppt { border-left: 6px solid var(--stop); background: var(--stop-soft); }
.ampel.gestoppt .dot { background: var(--stop); }

.btn {
  font: inherit; font-weight: 600; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); padding: 10px 16px; min-height: 44px; cursor: pointer;
}
.btn:hover { border-color: #c5ccd6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--surface); border-color: var(--stop); color: var(--stop); }
.btn.danger.solid { background: var(--stop); color: #fff; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 8px; min-height: 40px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.between { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.chip {
  display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: #eef1f5; color: var(--muted);
}
.chip.gruen, .chip.erfuellt, .chip.ok, .chip.bereit_fuer_paper, .chip.filled { background: var(--ok-soft); color: var(--ok); }
.chip.rot, .chip.blocked, .chip.verworfen { background: var(--stop-soft); color: var(--stop); }
.chip.gelb, .chip.awaiting_approval, .chip.offen, .chip.wartet_auf_daten { background: var(--wait-soft); color: var(--wait); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; border-top: 0; }
td.num, th.num { text-align: right; }
.scroll { overflow-x: auto; }

meter { display: block; width: 100%; height: 10px; margin-top: 6px; }

details { margin-top: 8px; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details p { margin-top: 8px; }

.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; font-size: 0.85rem; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 6px; }
.legend .lg-acct { background: #1f5fbf; }
.legend .lg-bench { background: #9aa3b2; }

.flash { padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.flash.err { background: var(--stop-soft); color: var(--stop); }
.error { color: var(--stop); min-height: 1.5em; margin-top: 8px; }
.empty { color: var(--muted); padding: 8px 0; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #c9d0da; border-radius: 10px;
  background: #fff; min-height: 44px;
}
.login-card .btn { width: 100%; margin-top: 16px; }

dialog { border: 0; border-radius: var(--radius); padding: 20px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(16, 24, 40, 0.4); }

@media (max-width: 560px) {
  .kpi .value { font-size: 1.15rem; }
  .hide-sm { display: none; }
  main { padding: 12px; }
}
