:root {
  color-scheme: light;
  --page: #f9f9f9;
  --surface: #ffffff;
  --text: #191919;
  --text-2: #666666;
  --grid: #e7e7e7;
  --border: #e2e2e2;
  --s-data: #257de0;
  --s-image: #f47230;
  --s-container: #00b894;
  --s-files: #f2a600;
  --neutral: #9c9c9c;
  --good: #0aac23;
  --warning: #fbb315;
  --critical: #dc3c3d;
  --line: #257de0;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0b0b0b;
    --surface: #191919;
    --text: #efefef;
    --text-2: #9c9c9c;
    --grid: #303030;
    --border: #2a2a2a;
    --s-data: #338ced;
    --s-image: #e76624;
    --s-container: #00a888;
    --s-files: #d28e05;
    --neutral: #6b6b6b;
    --line: #338ced;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
[hidden] { display: none !important; }
h1, h2 { margin: 0; }
h1 { font-size: 1.25rem; }
h2 { font-size: .95rem; font-weight: 600; }
button, select, input {
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .4rem .75rem;
}
button { cursor: pointer; }
button.primary { background: var(--line); border-color: var(--line); color: #fff; }
button.quiet { border-color: transparent; background: transparent; color: var(--text-2); }
button:disabled { opacity: .5; cursor: default; }

.login { max-width: 320px; margin: 15vh auto; text-align: center; padding: 1rem; }
.login-icon { width: 64px; height: 64px; }
.login form { display: grid; gap: .6rem; margin-top: 1rem; }
.err { color: var(--critical); min-height: 1.2em; margin: 0; }

#app { max-width: 1100px; margin: 0 auto; padding: 1rem; display: grid; gap: 1rem; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand-icon { width: 36px; height: 36px; }
.actions { display: flex; gap: .4rem; }
.sub { color: var(--text-2); margin: 0; font-size: .85rem; }
.warn { margin: 0; padding: .6rem .9rem; border-radius: 8px; border: 1px solid var(--critical); }

.cards { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 1rem; }
@media (max-width: 800px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 1rem 1.1rem; display: grid; gap: .45rem; align-content: start; min-width: 0; }
.hero { margin: 0; font-size: 2rem; font-weight: 650; line-height: 1.1; }
.hero .unit { font-size: 1rem; font-weight: 500; color: var(--text-2); }

.meter { height: 12px; border-radius: 6px; background: var(--grid); overflow: hidden; }
.meter .fill { height: 100%; width: 0; border-radius: 6px; background: var(--good); transition: width .4s; }
.meter.warning .fill { background: var(--warning); }
.meter.critical .fill { background: var(--critical); }
.status { margin: 0; font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.status .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.legend { list-style: none; display: flex; gap: .9rem; margin: 0; padding: 0; color: var(--text-2); font-size: .82rem; flex-wrap: wrap; }
.legend li { display: flex; align-items: center; gap: .35rem; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.s-data { background: var(--s-data); }
.s-image { background: var(--s-image); }
.s-container { background: var(--s-container); }
.s-files { background: var(--s-files); }
.s-neutral { background: var(--neutral); }

table.apps { width: 100%; border-collapse: collapse; font-size: .9rem; }
.apps th { text-align: left; font-weight: 500; color: var(--text-2); font-size: .8rem; padding: .3rem .4rem; border-bottom: 1px solid var(--grid); }
.apps td { padding: .45rem .4rem; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.apps tr:last-child td { border-bottom: 0; }
.apps .num { text-align: right; white-space: nowrap; }
.apps td.num { color: var(--text-2); }
.apps td.total { color: var(--text); font-weight: 600; }
.apps .barcol { width: 38%; }
#apps tr { cursor: pointer; }
#apps tr:hover td, #apps tr.sel td { background: color-mix(in srgb, var(--line) 8%, transparent); }
.name { font-weight: 600; }
.tag { font-size: .72rem; color: var(--text-2); border: 1px solid var(--border); border-radius: 999px; padding: 0 .4rem; margin-left: .3rem; font-weight: 400; }
.vols { display: block; font-size: .75rem; color: var(--text-2); font-weight: 400; }
.hint { margin-top: .2rem; }

/* gestapelter Balken: 2px Lücke zwischen Segmenten, runde Enden */
.bar { display: flex; gap: 2px; height: 12px; }
.bar span { height: 100%; min-width: 0; }
.bar span:first-child { border-radius: 4px 0 0 4px; }
.bar span:last-child { border-radius: 0 4px 4px 0; }
.bar span:only-child { border-radius: 4px; }

@media (max-width: 700px) {
  .apps .opt { display: none; }
  .apps .barcol { width: 45%; }
}

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: .35rem .65rem; color: var(--text-2); }
.seg button.on { background: var(--line); color: #fff; }

.chart { position: relative; min-height: 240px; }
.chart svg { display: block; width: 100%; height: 260px; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--text-2); font-size: 11px; }
.chart .capline { stroke: var(--critical); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .caplabel { fill: var(--text-2); font-size: 11px; }
.chart .series { fill: none; stroke: var(--line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--line); opacity: .08; }
.chart .cross { stroke: var(--text-2); stroke-width: 1; }
.chart .dot { fill: var(--line); stroke: var(--surface); stroke-width: 2; }
.chart .empty { color: var(--text-2); padding: 3rem 0; text-align: center; margin: 0; }

.tip {
  position: fixed; z-index: 10; pointer-events: none;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 4px 16px rgb(0 0 0 / .15);
  padding: .45rem .6rem; font-size: .82rem; line-height: 1.35;
}
.tip b { font-weight: 600; }
.tip .row { display: flex; align-items: center; gap: .4rem; }
.tip .row span:last-child { margin-left: auto; padding-left: .8rem; }
