/* ==========================================================
   Oberfläche — Aufbau und Aussehen

   Gestaltungsrichtung "Studio-Look", übernommen aus pt-studio:
   hell, durchgehender Hintergrund, Trennlinien und Weißraum
   statt Kacheln. Grund: ein Dashboard wächst. Verkachelte
   Layouts wirken unruhig, sobald viele Zahlen und Tabellen
   dazukommen — eine ruhige Fläche bleibt ruhig.

   Daher: Karten nur dort, wo etwas anklickbar ist (.tile).
   Alles andere trennt über .section mit Oberlinie.

   Farben kommen ausschließlich aus tokens.css. Hier stehen
   keine festen Farbwerte.
   ========================================================== */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  background: var(--pt-bg);
  color: var(--pt-text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--pt-cool-500);
  outline-offset: 2px;
}

/* ---------- App-Shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--pt-surface);
  border-right: 1px solid var(--pt-line);
  display: flex;
  flex-direction: column;
  padding: 22px 0 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  padding: 0 20px 22px;
  border-bottom: 1px solid var(--pt-line);
  margin-bottom: 18px;
}

.sidebar-brand img {
  display: block;
  width: 190px;   /* wird pro Mandant aus config.js überschrieben */
  max-width: 100%;
  height: auto;
}

.brand-name {
  margin-top: 12px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 12px;
  color: var(--pt-text-soft);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}

.nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pt-text-soft);
  padding: 16px 8px 6px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  border-radius: var(--pt-radius-sm);
  color: var(--pt-cool-700);
  font-size: 14px;
}

.nav a svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.nav a:hover { background: var(--pt-cool-50); color: var(--pt-text); }

.nav a.active {
  background: var(--pt-cool-100);
  color: var(--pt-text);
  font-weight: 600;
}

.nav a.active svg { color: var(--lb-red); }

.sidebar-foot {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid var(--pt-line);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--pt-text-soft);
}

.sidebar-foot img { width: 44px; height: auto; opacity: 0.65; }

/* ---------- Main ---------- */
.main {
  padding: 0 0 80px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 30px 40px 22px;
  max-width: var(--page-max);
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.topbar .meta {
  font-size: 13px;
  color: var(--pt-text-soft);
  white-space: nowrap;
}

/* ---------- Demo-Umschalter (Platzhalter für das Login) ---------- */
.demo-switch {
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-switch .ds-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pt-text-soft);
}

.demo-switch select {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--pt-cool-700);
  background: var(--pt-surface);
  border: 1px solid var(--pt-line);
  border-radius: var(--pt-radius-full);
  padding: 4px 10px;
}

/* ---------- Ein/Aus-Schalter ---------- */
.switch { display: inline-block; position: relative; width: 40px; height: 22px; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }

.switch span {
  position: absolute;
  inset: 0;
  background: var(--pt-cool-300);
  border-radius: var(--pt-radius-full);
  transition: background 0.15s ease;
  pointer-events: none;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(45,51,63,0.25);
  transition: transform 0.15s ease;
}

.switch input:checked + span { background: var(--st-ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--pt-cool-500); outline-offset: 2px; }

.view { display: none; padding: 0 40px; max-width: var(--page-max); }
.view.active { display: block; }

.lead {
  margin: 0 0 30px;
  font-size: 16px;
  color: var(--pt-cool-700);
  max-width: 64ch;
}

/* ---------- Section (Trennlinie statt Kachel) ---------- */
.section { padding: 26px 0; border-top: 1px solid var(--pt-line); }
.section:first-of-type { border-top: 0; padding-top: 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.section-head .hint { font-size: 13px; color: var(--pt-text-soft); }

/* ---------- Kennzahlen-Reihe ----------
   Die Zahlen stehen frei auf dem Grund, ohne Kästen. Sie sind
   durch ihre Größe schon deutlich genug; Rahmen würden nur
   Unruhe erzeugen. Passt sich per auto-fit an die Anzahl an —
   ein Kunde mit vier Kennzahlen bekommt kein Loch. */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 4px 28px;
}

.kpi { padding: 6px 0 10px; }

.kpi .k-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pt-text-soft);
}

.kpi .k-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.kpi .k-delta { font-size: 12px; color: var(--pt-text-soft); }
.kpi .k-delta.up { color: var(--st-ok); }
.kpi .k-delta.down { color: var(--st-crit); }

/* ---------- Tabellen-Liste ---------- */
.list { width: 100%; border-collapse: collapse; font-size: 14px; }

.list th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pt-text-soft);
  font-weight: 600;
  padding: 0 12px 8px 0;
  border-bottom: 1px solid var(--pt-line);
}

.list td {
  padding: 12px 12px 12px 0;
  border-bottom: 1px solid var(--pt-cool-200);
  vertical-align: top;
}

.list tr:hover td { background: var(--pt-cool-50); }
.list .num { text-align: right; font-variant-numeric: tabular-nums; }
.list .t-main { font-weight: 600; }
.list .t-sub { font-size: 12.5px; color: var(--pt-text-soft); }

/* ---------- Status-Pill ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--pt-radius-full);
  background: var(--pt-cool-100);
  color: var(--pt-cool-700);
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--st-idle);
}

.pill.ok::before { background: var(--st-ok); }
.pill.warn::before { background: var(--st-warn); }
.pill.crit::before { background: var(--st-crit); }

/* ---------- Kanal-Zeilen ---------- */
.channels { display: flex; flex-direction: column; }

.channel {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--pt-cool-200);
}

.channel .c-name { font-weight: 600; }
.channel .c-sub { font-size: 12.5px; color: var(--pt-text-soft); }
.channel .c-num { font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Kachel-Links (nur für Tool-Einstiege) ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.tile {
  display: block;
  background: var(--pt-surface);
  border: 1px solid var(--pt-line);
  border-radius: var(--pt-radius-md);
  padding: 18px;
  box-shadow: var(--pt-shadow-card);
  transition: border-color 0.15s ease;
}

.tile:hover { border-color: var(--pt-line-strong); }
.tile h3 { margin: 0 0 4px; font-size: 15px; }
.tile p { margin: 0; font-size: 13px; color: var(--pt-text-soft); }

/* ---------- Doku-Blöcke (Verwaltungs-Ansicht) ----------
   Fließtext statt Tabelle: die Eckdaten je Kanal sind Sätze,
   keine Werte. Bewusst ohne Kachelrahmen — im Studio-Look
   trennt Weißraum, nicht der Kasten. */
.docs { display: flex; flex-direction: column; gap: 22px; }

.doc h3 {
  margin: 0 0 6px;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Ampel neben der Überschrift: die Pille steht hier ohne Text
   und wirkt nur als Punkt. */
.doc h3 .pill { padding: 0; background: none; }

.doc p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--pt-text-soft);
  max-width: 78ch;
}

.doc ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--pt-text-soft);
  max-width: 78ch;
}

.doc li { margin-bottom: 4px; }

/* Nummerierte Abfolge, etwa die Bau-Reihenfolge. */
.steps {
  margin: 0;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--pt-text-soft);
  max-width: 78ch;
}

.steps li { margin-bottom: 8px; }
.steps li::marker { color: var(--pt-text); font-weight: 600; }

/* Sicherheitshinweis. Rot, aber ohne Fläche — er soll auffallen,
   ohne den ruhigen Grundton der Oberfläche zu brechen. */
.note-warn {
  margin: 22px 0 0;
  padding-left: 14px;
  border-left: 3px solid var(--lb-red);
  font-size: 13px;
  line-height: 1.6;
  color: var(--pt-text-soft);
  max-width: 78ch;
}

/* ---------- Platzhalter-Marker ---------- */
.demo-note {
  display: inline-block;
  margin-bottom: 22px;
  font-size: 12px;
  font-weight: 600;
  color: var(--lb-red);
  background: #fdecec;
  border-radius: var(--pt-radius-full);
  padding: 4px 12px;
}

.demo-note.admin {
  color: var(--pt-cool-700);
  background: var(--pt-cool-200);
}

.placeholder code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--pt-cool-200);
  border-radius: 4px;
  padding: 1px 5px;
}

.placeholder {
  border: 1px dashed var(--pt-line-strong);
  border-radius: var(--pt-radius-md);
  padding: 32px;
  text-align: center;
  color: var(--pt-text-soft);
  font-size: 14px;
  background: var(--pt-cool-50);
}

/* ---------- Balken-Platzhalter ----------
   Bewusst reines CSS statt einer Diagramm-Bibliothek: solange
   keine echten Daten fließen, wäre eine Bibliothek nur Ballast.
   Die Balkenhöhen stehen als style-Angabe im HTML. Beim Umbau
   ersetzt eine richtige Diagramm-Lösung diesen Block. */
.bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 132px;
  padding-top: 8px;
  border-bottom: 1px solid var(--pt-line);
}

.bars .bar {
  flex: 1;
  background: var(--pt-cool-300);
  border-radius: 4px 4px 0 0;
  position: relative;
}

.bars .bar:last-child { background: var(--lb-red); }

.bars-x {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--pt-text-soft);
  padding-top: 6px;
}

.bars-x span { flex: 1; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .topbar, .view { padding-left: 20px; padding-right: 20px; }
}
