/* VarioPlatform — gemeinsames Erscheinungsbild für beide Oberflächen.
   Ohne Rahmenwerk und ohne Bauschritt: die Dateien werden so ausgeliefert,
   wie sie hier stehen. */

:root {
  color-scheme: light dark;

  --ink:        #12181f;
  --ink-2:      #3d4854;
  --ink-3:      #6b7785;
  --line:       #dde3ea;
  --line-2:     #eef2f6;
  --bg:         #f6f8fa;
  --panel:      #ffffff;
  --panel-2:    #fbfcfd;

  --accent:     #0b5c8a;
  --accent-2:   #e8f1f7;
  --accent-ink: #ffffff;

  --ok:         #1a7f4b;
  --ok-bg:      #e8f5ee;
  --warn:       #9a6206;
  --warn-bg:    #fdf3e2;
  --bad:        #b3261e;
  --bad-bg:     #fbeae9;
  --idle:       #6b7785;
  --idle-bg:    #eef1f4;

  --radius:     8px;
  --radius-sm:  5px;
  --shadow:     0 1px 2px rgba(18,24,31,.06), 0 4px 14px rgba(18,24,31,.05);
  --mono:       "Cascadia Mono", Consolas, "SF Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:      #e8edf2;
    --ink-2:    #b3bdc8;
    --ink-3:    #8794a2;
    --line:     #2a333d;
    --line-2:   #222a33;
    --bg:       #12171d;
    --panel:    #191f26;
    --panel-2:  #1d242c;
    --accent:   #4aa3d8;
    --accent-2: #16303f;
    --accent-ink: #0b1116;
    --ok:       #4cc38a;  --ok-bg:   #14291f;
    --warn:     #e0a340;  --warn-bg: #2b2214;
    --bad:      #f07167;  --bad-bg:  #2e1a19;
    --idle:     #8794a2;  --idle-bg: #232a32;
    --shadow:   0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- Struktur --- */

.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.app.no-nav { grid-template-columns: 1fr; }

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 2px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}

.brand {
  display: flex; align-items: baseline; gap: 7px;
  padding: 4px 8px 14px;
}
.brand b { font-size: 15px; letter-spacing: -.2px; }
.brand span { font-size: 11px; color: var(--ink-3); }

.nav-group { margin-top: 12px; padding: 0 8px 4px; font-size: 11px;
  text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }

.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 9px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 13.5px; text-decoration: none;
}
.nav a:hover { background: var(--line-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.nav .count {
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 600;
  border-radius: 20px; padding: 1px 7px; min-width: 20px; text-align: center;
}
.nav a.active .count { background: var(--accent); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 5;
}
.topbar input[type=search] {
  flex: 1; max-width: 520px; padding: 7px 11px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--ink); font-size: 13.5px;
}
.topbar .who { margin-left: auto; font-size: 12.5px; color: var(--ink-3); text-align: right; }
.topbar .who b { display: block; color: var(--ink); font-weight: 600; }

.content { padding: 20px; max-width: 1400px; width: 100%; }

h1 { font-size: 19px; margin: 0 0 3px; letter-spacing: -.2px; }
h2 { font-size: 15px; margin: 26px 0 10px; }
h3 { font-size: 13.5px; margin: 18px 0 8px; color: var(--ink-2); }
.lede { color: var(--ink-3); margin: 0 0 18px; font-size: 13px; max-width: 78ch; }

/* --------------------------------------------------------------- Karten --- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow);
}
.card .k { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.card .v { font-size: 26px; font-weight: 650; letter-spacing: -.5px; margin-top: 2px; }
.card .s { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.card.bad .v { color: var(--bad); }
.card.warn .v { color: var(--warn); }
.card.ok  .v { color: var(--ok); }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.panel > header {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.panel > header h2, .panel > header h3 { margin: 0; font-size: 13.5px; }
.panel > header .spacer { flex: 1; }
.panel .body { padding: 15px; }
.panel + .panel { margin-top: 16px; }

/* -------------------------------------------------------------- Tabellen -- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-weight: 600; color: var(--ink-3);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .sub { color: var(--ink-3); font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }

.empty { padding: 28px 15px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* --------------------------------------------------------------- Status --- */

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  background: var(--idle-bg); color: var(--idle); white-space: nowrap;
}
.pill.ok   { background: var(--ok-bg);   color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad  { background: var(--bad-bg);  color: var(--bad); }
.pill.info { background: var(--accent-2); color: var(--accent); }
.pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex: none;
}
.pill.plain::before { display: none; }

.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tag {
  font-size: 11px; padding: 1px 7px; border-radius: 4px;
  background: var(--line-2); color: var(--ink-2); border: 1px solid var(--line);
}

/* ------------------------------------------------------------- Bedienung -- */

button, .btn {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); cursor: pointer;
}
button:hover, .btn:hover { background: var(--line-2); }
button.primary, .btn.primary {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
button.danger:hover { background: var(--bad); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.small { padding: 3px 9px; font-size: 12px; }

input, select, textarea {
  font: inherit; font-size: 13px; padding: 6px 9px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--ink); width: 100%;
}
label { display: block; font-size: 12px; color: var(--ink-3); margin-bottom: 3px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 140px; }
.row > .fixed { flex: none; min-width: 0; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }

/* --------------------------------------------------------------- Dialog --- */

dialog {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0; background: var(--panel); color: var(--ink);
  max-width: 560px; width: calc(100% - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.28);
}
dialog::backdrop { background: rgba(10,14,18,.45); }
dialog header { padding: 13px 17px; border-bottom: 1px solid var(--line); font-weight: 600; }
dialog .body { padding: 17px; }
dialog footer { padding: 12px 17px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end; background: var(--panel-2); }

.note {
  border-left: 3px solid var(--accent); background: var(--accent-2);
  padding: 9px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px; color: var(--ink-2); margin: 12px 0;
}
.note.warn { border-color: var(--warn); background: var(--warn-bg); }
.note.bad  { border-color: var(--bad);  background: var(--bad-bg); }

/* Beiwerk zu einer Zeile: warum dieser Schritt zählt, was zuletzt gemessen
   wurde. Klein genug, dass es die Zeile nicht sprengt, gross genug, dass es
   jemand liest, der stockt. */
.hinweis { font-size: 11.5px; color: var(--ink-3, var(--ink-2)); margin-top: 3px;
  line-height: 1.45; max-width: 62ch; }

/* Aufzählung ohne Punkte, für Listen in Dialogen. */
ul.plain { list-style: none; margin: 8px 0; padding: 0; }
ul.plain li { padding: 4px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: none; }

/* Zeile in einem Dialog: Bündelteile, Auswahllisten. */
.zeile {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--line);
}
.zeile:last-child { border-bottom: none; }

/* Kleine Tabelle in einem Aufklappbereich: MSI-Eigenschaften. */
table.mini { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
table.mini td { padding: 3px 8px 3px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.mini td:first-child { white-space: nowrap; width: 1%; }

/* ------------------------------------------------------ Umgebungsband ---
   Testdaten dürfen nicht aussehen wie Produktivdaten. Ein Band über allem
   ist unhöflich genug, dass man es nicht übersieht, und schmal genug, dass
   es nicht stört. */
.band {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 20px; font-size: 12px; font-weight: 600;
  background: var(--warn-bg); border-bottom: 1px solid #f0dcb8; color: var(--warn);
}
.band svg { flex: none; }
.band.bad { background: var(--bad-bg); border-bottom-color: var(--bad); color: var(--bad); }

/* ------------------------------------------------------ Mandantenwähler ---
   Bei einer Plattform, deren zentrale Regel die Mandantengrenze ist, gehört
   sichtbar hin, wessen Daten man gerade sieht. */
.mandant {
  display: flex; align-items: center; gap: 7px;
  margin-left: auto; padding: 4px 10px 4px 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-2); font-size: 12.5px; color: var(--ink-3);
  cursor: pointer;
}
.mandant:hover { border-color: var(--line-strong, var(--ink-3)); }
.mandant select {
  border: none; background: none; font: inherit; color: inherit;
  padding: 0; cursor: pointer;
}

/* --------------------------------------------------------------- Zu tun ---
   Zahlen mit Dringlichkeit: gross, farbig, mit dem Satz dazu, warum sie
   zählen. Vorher standen sie gleichrangig neben dem Bestand — eine 0 sah aus
   wie eine 164. */
.zutun {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
}
@media (max-width: 1100px) { .zutun { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px)  { .zutun { grid-template-columns: 1fr; } }

.zutun .karte {
  background: var(--panel); border: 1px solid var(--line);
  border-top: 3px solid var(--line);
  border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 3px;
}
.zutun .karte.bad  { border-top-color: var(--bad); }
.zutun .karte.warn { border-top-color: var(--warn); }
.zutun .karte .k {
  font-size: 11.5px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em;
}
.zutun .karte .v {
  font-size: 34px; font-weight: 650; letter-spacing: -.8px; line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.zutun .karte.bad .v  { color: var(--bad); }
.zutun .karte.warn .v { color: var(--warn); }
.zutun .karte .s { font-size: 12px; color: var(--ink-2); }
.zutun .karte .s.leise { color: var(--ink-3); }

/* -------------------------------------------------------------- Bestand ---
   Dieselben Zahlen, aber ohne Kachelrahmen. Weniger Rahmen heisst mehr
   Hierarchie: das hier wartet auf niemanden. */
.bestand {
  display: flex; flex-wrap: wrap; gap: 0;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); overflow: hidden;
}
.bestand > div {
  flex: 1; min-width: 150px; padding: 11px 15px;
  border-right: 1px solid var(--line-2);
  display: flex; flex-direction: column; gap: 1px;
}
.bestand > div:last-child { border-right: none; }
.bestand .k {
  font-size: 11.5px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .04em;
}
.bestand .v {
  font-size: 20px; font-weight: 650; letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
}

/* Die linke Kante trägt die Schwere, nicht nur die Plakette. */
td.schwer-bad  { border-left: 3px solid var(--bad); }
td.schwer-warn { border-left: 3px solid var(--warn); }

.abschnitt { display: flex; flex-direction: column; gap: 10px; }
.abschnitt > h2 { font-size: 16px; margin: 0; font-weight: 650; }
.abschnitt .kopf { display: flex; align-items: baseline; gap: 10px; }
.abschnitt .kopf .sub { font-size: 12.5px; }

details > summary {
  cursor: pointer; font-size: 12.5px; color: var(--ink-2); padding: 4px 0;
}

.secret {
  font-family: var(--mono); font-size: 15px; letter-spacing: .5px;
  background: var(--line-2); padding: 11px 13px; border-radius: var(--radius-sm);
  word-break: break-all; user-select: all;
}

.kv { display: grid; grid-template-columns: minmax(120px, 30%) 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.split { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; }
  .nav { display: flex; gap: 4px; }
  .nav-group { display: none; }
}

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button {
  border: none; background: none; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 8px 13px; color: var(--ink-3);
}
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 9px 17px;
  border-radius: 20px; font-size: 13px; box-shadow: var(--shadow); z-index: 50;
}
.toast.bad { background: var(--bad); color: #fff; }

.login {
  max-width: 380px; margin: 12vh auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow);
}
.login h1 { margin-bottom: 4px; }

.bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar.ok > span  { background: var(--ok); }
.bar.bad > span { background: var(--bad); }
