/*
 * Kaiport. Drei Ansichten mit je eigenen Tokens (body[data-sicht]):
 *   leitwarte  grau, Farbe nur fuer Abweichungen, Serifenschrift (Few, Tufte)
 *   start      ruhiger Nebel, grosse Symbole, Zustand am Rand (Calm Technology, Krug)
 *   karte      dunkle Flaeche, Farbe = Zustand (Shneiderman)
 * Kopf, Blatt und Palette nutzen nur die Tokens und passen sich so an.
 * Systemschriften: keine Fremddateien (CSP font-src 'self').
 */

:root {
  color-scheme: light dark;
  --bg: light-dark(#f3f4f6, #0c0f13);
  --flaeche: light-dark(#ffffff, #141920);
  --flaeche-2: light-dark(#eef0f3, #1a2028);
  --flaeche-3: light-dark(#e3e6eb, #222a34);
  --linie: light-dark(#e1e4e9, #232b35);
  --text: light-dark(#121619, #e8ecf1);
  --text-2: light-dark(#56606b, #9aa5b1);
  --text-3: light-dark(#8c949e, #66717d);
  --ok: light-dark(#1b9a59, #39cc7c);
  --warn: light-dark(#c4860a, #f0b440);
  --down: light-dark(#d43b3b, #ff5f5f);
  --deploy: light-dark(#2d6ce0, #5d9cff);
  --akzent: light-dark(#0e6f7b, #4fd1c5);
  --leer: light-dark(#e6e9ed, #1e252e);
  --g-basis: var(--linie);
  --g-alt: var(--text-2);
  --g-b1: var(--flaeche-2);
  --g-b2: var(--flaeche-3);
  --g-b3: var(--linie);
  --g-ist: var(--text);
  --g-spark: var(--text-2);
  --g-letzter: var(--text);
  --radius: 14px;
  --radius-klein: 9px;
  --schatten: light-dark(0 1px 2px rgb(16 24 32 / 6%), 0 0 0 transparent);
  --schatten-hoch: light-dark(0 12px 40px rgb(16 24 32 / 18%), 0 16px 48px rgb(0 0 0 / 55%));
  --schrift: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --schmal: 'Avenir Next Condensed', 'Roboto Condensed', 'Arial Narrow', 'Helvetica Neue', system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --rand: max(16px, env(safe-area-inset-left));
  --rand-r: max(16px, env(safe-area-inset-right));
}

/* ---- Tokens je Ansicht -------------------------------------------------- */

body[data-sicht="leitwarte"] {
  --bg: light-dark(#ffffff, #16181b);
  --flaeche: light-dark(#f7f8f9, #1e2125);
  --flaeche-2: light-dark(#eff1f3, #25292e);
  --flaeche-3: light-dark(#e4e7ea, #2e3338);
  --linie: light-dark(#e7e9ec, #2b3035);
  --text: light-dark(#2b2e33, #dfe3e8);
  --text-2: light-dark(#6c727a, #9aa1aa);
  --text-3: light-dark(#9aa0a8, #6f7781);
  /* Normalzustand ist grau - Farbe gibt es nur fuer Abweichungen (Few) */
  --ok: light-dark(#8b9098, #7d848d);
  --warn: light-dark(#c2620a, #ef8f3a);
  --down: light-dark(#b3261e, #f0645a);
  --deploy: light-dark(#5b6f8a, #8ea2c0);
  --akzent: var(--text);
  --leer: light-dark(#eceef0, #26292d);
  --g-basis: light-dark(#c9cdd2, #464c54);
  --g-alt: light-dark(#6c727a, #9aa1aa);
  --g-b1: light-dark(#e4e6e9, #24282c);
  --g-b2: light-dark(#d2d5da, #2e3338);
  --g-b3: light-dark(#bfc3c9, #3a4046);
  --g-ist: var(--text);
  --g-spark: light-dark(#6c727a, #9aa1aa);
  --g-letzter: var(--text);
  --radius: 6px;
  --radius-klein: 4px;
  --schatten: none;
  --schrift: 'Iowan Old Style', Charter, 'Source Serif 4', 'Source Serif Pro', 'Noto Serif', Georgia, serif;
}

body[data-sicht="start"] {
  --bg: light-dark(#e5ebef, #131a20);
  --flaeche: light-dark(#ffffff, #1c252d);
  --flaeche-2: light-dark(#edf1f4, #24303a);
  --flaeche-3: light-dark(#dfe6eb, #2c3a45);
  --linie: light-dark(#d6dee4, #2a3640);
  --text: light-dark(#1d2a35, #e3eaf0);
  --text-2: light-dark(#5d6b77, #9aabb8);
  --text-3: light-dark(#8794a0, #6c7d8b);
  --ok: light-dark(#4f9a86, #5fb39d);
  --warn: light-dark(#cc8516, #e3a238);
  --down: light-dark(#c8443a, #ef6458);
  --deploy: light-dark(#3f78cf, #6d9ef0);
  --akzent: var(--text);
  --leer: light-dark(#d9e1e7, #26323c);
  --radius: 18px;
  --radius-klein: 12px;
  --schrift: 'Atkinson Hyperlegible', 'Avenir Next', Avenir, 'Segoe UI', Roboto, 'Helvetica Neue', system-ui, sans-serif;
}

body[data-sicht="karte"] {
  color-scheme: dark;
  --bg: #162131;
  --flaeche: #1e2b3d;
  --flaeche-2: #26364c;
  --flaeche-3: #2f425c;
  --linie: #2c3b50;
  --text: #e4ebf3;
  --text-2: #93a3b8;
  --text-3: #6f8199;
  --ok: #4fb39a;
  --warn: #d99a2b;
  --down: #d4473d;
  --deploy: #5d9cff;
  --akzent: #e4ebf3;
  --leer: #24324a;
  --g-basis: #56708f;
  --g-alt: #93a3b8;
  --g-letzter: #e4ebf3;
  --radius: 8px;
  --radius-klein: 6px;
  --schatten: none;
}

/* ---- Grundlagen ---------------------------------------------------------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html.gesperrt { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--schrift);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); font-size: 0.86em; }
.leise { color: var(--text-2); }
.ganz-leise { color: var(--text-3); }
.st-ok { --farbe: var(--ok); }
.st-warn { --farbe: var(--warn); }
.st-down { --farbe: var(--down); }
.st-deploy { --farbe: var(--deploy); }
.st-info, .st-aus, .st-job { --farbe: var(--text-3); }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* ---- Kopf ---------------------------------------------------------------- */

.kopf {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) var(--rand-r) 10px var(--rand);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--linie);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
/* Startbildschirm: die Unterkante des Kopfs ist der ruhige Rand (Weiser/Brown) */
body[data-sicht="start"] .kopf { border-bottom: 0; box-shadow: inset 0 -4px 0 var(--zustand-rand, var(--ok)); transition: box-shadow 0.8s ease; }
body[data-sicht="start"][data-zustand="warn"] { --zustand-rand: var(--warn); }
body[data-sicht="start"][data-zustand="down"] { --zustand-rand: var(--down); }
body[data-sicht="start"][data-zustand="deploy"] { --zustand-rand: var(--deploy); }
.marke { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; text-decoration: none; flex-shrink: 0; }
.logo { width: 26px; height: 26px; border-radius: 7px; display: block; }
.sichten { display: inline-flex; border: 1px solid var(--linie); border-radius: 10px; overflow: hidden; background: var(--flaeche); flex-shrink: 0; }
.sichten button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; height: 36px; padding: 0 11px; font-size: 13.5px; color: var(--text-2); }
.sichten button + button { border-left: 1px solid var(--linie); }
.sichten button svg { width: 16px; height: 16px; }
.sichten button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.springen {
  flex: 1; max-width: 420px; margin-left: auto;
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 12px;
  border: 1px solid var(--linie); border-radius: 10px;
  background: var(--flaeche); color: var(--text-3); text-align: left;
}
.springen svg { flex-shrink: 0; }
.springen span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
kbd {
  font: 600 11px/1 var(--mono); color: var(--text-3);
  padding: 4px 6px; border: 1px solid var(--linie); border-bottom-width: 2px; border-radius: 6px; background: var(--flaeche-2);
}
.takt {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  height: 38px; padding: 0 10px 0 8px; border-radius: 10px; border: 1px solid transparent;
  background: none; color: var(--text-2); font-size: 13px;
}
.takt:hover { border-color: var(--linie); background: var(--flaeche); }
.takt-ring { width: 18px; height: 18px; transform: rotate(-90deg); }
.takt-ring circle { fill: none; stroke-width: 2.4; }
.takt-ring .bahn { stroke: var(--linie); }
.takt-ring .lauf { stroke: var(--text-2); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.takt.holt .takt-ring { animation: drehen 0.9s linear infinite; }
@keyframes drehen { to { transform: rotate(270deg); } }
@media (max-width: 860px) { .sichten button span { display: none; } .sichten button { padding: 0 10px; } }
@media (max-width: 560px) {
  .kopf { gap: 8px; }
  .marke { margin-right: auto; font-size: 16px; }
  .marke .logo { width: 24px; height: 24px; }
  .springen { flex: 0 0 auto; width: 38px; padding: 0; justify-content: center; margin-left: 0; }
  .springen span, .springen kbd, .takt .takt-text { display: none; }
  .takt { padding: 0 8px; }
}

/* ---- Seite --------------------------------------------------------------- */

.seite { max-width: 1560px; margin: 0 auto; padding: 0 var(--rand-r) calc(32px + env(safe-area-inset-bottom)) var(--rand); }
.banner { display: flex; gap: 10px; align-items: center; margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-klein); background: color-mix(in srgb, var(--warn) 18%, var(--bg)); font-size: 14px; }
.banner.rot { background: color-mix(in srgb, var(--down) 18%, var(--bg)); }
.laedt { padding: 60px 0; text-align: center; color: var(--text-3); }
.leer-hinweis { color: var(--text-3); font-size: 13.5px; padding: 4px 0; }

/* ---- Kleine Grafiken (Klassen aus gemeinsam.js) --------------------------- */

svg.graf { display: block; overflow: visible; }
.g-basis { stroke: var(--g-basis); stroke-width: 1; }
.g-luecke { stroke: var(--bg); stroke-width: 2; }
.g-alt { fill: var(--g-alt); }
.g-jetzt { fill: var(--down); }
.g-deploy { fill: var(--g-letzter); }
.g-spark { fill: none; stroke: var(--g-spark); stroke-width: 1; }
.g-letzter { fill: var(--g-letzter); }
.g-b1 { fill: var(--g-b1); }
.g-b2 { fill: var(--g-b2); }
.g-b3 { fill: var(--g-b3); }
.g-ist { fill: var(--g-ist); }
.g-ist.down { fill: var(--down); }
.g-ist.warn { fill: var(--warn); }

/* ===========================================================================
   Leitwarte
   =========================================================================== */

.sicht-leitwarte { padding: 16px 6px 0; font-size: 13px; line-height: 1.35; }
.sicht-leitwarte a { text-decoration: none; }
.sicht-leitwarte a:hover { text-decoration: underline; text-decoration-color: var(--text-3); }
.l-kopf { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 26px; padding-bottom: 10px; border-bottom: 1px solid var(--text); }
.l-zeit { color: var(--text-2); margin-right: auto; }
.l-kz { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.l-kz b { color: var(--text); font-weight: 600; }
.l-kz.st-deploy b { color: var(--deploy); }
.l-anm { color: var(--text-2); font-size: 11.5px; margin: 12px 0 0; }
.l-text-knopf { all: unset; cursor: pointer; color: var(--text); text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 2px; margin-left: 6px; }
.l-text-knopf:focus-visible { outline: 2px solid var(--akzent); }
.l-tab { width: 100%; border-collapse: collapse; margin-top: 4px; }
.l-tab th { font-weight: 400; color: var(--text-2); text-align: left; padding: 9px 10px 5px 0; font-size: 12px; vertical-align: bottom; line-height: 1.2; }
.l-tab td { padding: 4px 10px 4px 0; vertical-align: middle; border-top: 1px solid var(--leer); white-space: nowrap; }
.l-tab tbody tr { cursor: pointer; }
.l-tab tbody tr:hover td { background: var(--flaeche); }
.l-tab tbody tr:first-child td { border-top: 0; }
.l-tab .r { text-align: right; }
.l-tab .name { font-weight: 600; }
.l-tab .hinweis { white-space: normal; min-width: 150px; }
.l-tab .leise { color: var(--text-3); }
.l-tab tr.st-warn .name, .l-tab tr.st-warn .hinweis { color: var(--warn); }
.l-tab tr.st-down .name, .l-tab tr.st-down .hinweis, .l-tab tr.st-down .ms { color: var(--down); }
.l-tab tr.st-deploy .hinweis { color: var(--deploy); }
.l-tab .c-mehr { width: 1%; padding-right: 0; }
.l-tab .c-mehr button { border: 0; background: none; color: var(--text-3); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.l-tab .c-mehr button:hover { color: var(--text); background: var(--flaeche-2); }
.l-unten { display: grid; grid-template-columns: 1.1fr 1.15fr 1.2fr 0.8fr; gap: 26px; margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--text); }
.l-unten h2 { font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.l-unten table { border-collapse: collapse; width: 100%; }
.l-unten td { padding: 2px 8px 2px 0; white-space: nowrap; }
.l-unten td.r { text-align: right; }
.l-unten tr[data-act] { cursor: pointer; }
.l-unten tr[data-act]:hover td { background: var(--flaeche); }
.l-unten .st-warn td { color: var(--warn); }
.l-unten .st-down td { color: var(--down); }
.l-log td:first-child { color: var(--text-2); width: 1%; }
.l-log td:last-child { white-space: normal; }
.l-log .l-text-knopf { margin: 4px 0 0; font-size: 12px; color: var(--text-2); }
@media (max-width: 1180px) { .l-unten { grid-template-columns: 1fr 1fr; } .l-tab .c-30, .l-tab .c-cpu { display: none; } }
@media (max-width: 860px) {
  .sicht-leitwarte { padding: 12px 0 0; font-size: 13.5px; }
  .l-tab thead { display: none; }
  .l-tab, .l-tab tbody, .l-tab tr, .l-tab td { display: block; }
  .l-tab tr { display: grid; grid-template-columns: 1fr auto auto auto; gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--leer); align-items: center; }
  .l-tab tbody tr:first-child { border-top: 0; }
  .l-tab td { border: 0; padding: 0; }
  .l-tab tbody tr:hover td { background: none; }
  .l-tab .c-24, .l-tab .c-30, .l-tab .c-ram, .l-tab .c-mib, .l-tab .c-cpu, .l-tab .c-dep { display: none; }
  .l-tab .name { grid-column: 1; }
  .l-tab .c-spk { grid-column: 2; }
  .l-tab .ms { grid-column: 3; }
  .l-tab .c-mehr { grid-column: 4; grid-row: 1; display: block; }
  .l-tab .c-ticks { grid-column: 1 / -1; grid-row: 2; }
  .l-tab .hinweis { grid-column: 1 / -1; }
  .l-tab .hinweis:empty, .l-tab .hinweis:has(> .leise:empty) { display: none; }
  .l-unten { grid-template-columns: 1fr; gap: 18px; }
}

/* ===========================================================================
   Startbildschirm
   =========================================================================== */

.sicht-start { min-height: calc(100vh - 70px); min-height: calc(100svh - 70px); display: flex; }
.s-inhalt { flex: 1; width: 100%; max-width: 780px; margin: 0 auto; padding: 48px 12px 8px; display: flex; flex-direction: column; font-size: 17px; line-height: 1.5; }
.s-gruss { margin: 0 0 28px; color: var(--text-2); text-align: center; }
.s-karte { background: var(--flaeche); border-radius: 20px; padding: 20px 22px; margin: 0 auto 34px; max-width: 560px; width: 100%; border-left: 6px solid var(--warn); box-shadow: var(--schatten); }
.s-karte.stoer { border-left-color: var(--down); }
.s-karte h2 { margin: 0 0 4px; font-size: 21px; line-height: 1.25; }
.s-karte p { margin: 0 0 14px; color: var(--text-2); }
.s-aktionen { display: flex; flex-wrap: wrap; gap: 10px; }
.s-knopf { border: 0; border-radius: 12px; padding: 10px 16px; font-weight: 700; font-size: 16px; background: var(--text); color: var(--bg); }
.s-knopf.zweit { background: var(--flaeche-2); color: var(--text); }
.s-auch { margin: 12px 0 0 !important; font-size: 15px; color: var(--text-2); text-align: inherit; }
.s-inhalt > .s-auch { text-align: center; margin: -16px 0 24px !important; }
.s-raster { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 30px 16px; }
.s-app { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; border-radius: 18px; padding: 6px 2px; width: 100%; -webkit-touch-callout: none; }
.s-app:focus-visible { outline: 3px solid var(--text); outline-offset: 2px; }
.s-symbol { width: 76px; height: 76px; position: relative; transition: transform 0.12s ease; }
.s-app:hover .s-symbol { transform: translateY(-2px); }
.s-app:active .s-symbol { transform: scale(0.96); }
.s-bild, .s-mono { width: 100%; height: 100%; border-radius: 20px; display: grid; place-items: center; object-fit: cover; background: var(--flaeche); }
.s-mono { background: hsl(var(--ton) 48% 46%); color: #fff; font-weight: 700; font-size: 32px; }
.s-name { font-size: 15.5px; line-height: 1.2; max-width: 120px; overflow-wrap: anywhere; }
.s-abzeichen { position: absolute; top: -5px; right: -5px; width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--bg); }
.s-abzeichen.warn { background: var(--warn); }
.s-abzeichen.deploy { background: var(--deploy); animation: blinken 1.4s ease-in-out infinite; }
.s-abzeichen.down { background: var(--down); width: 26px; height: 26px; top: -8px; right: -8px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; line-height: 1; }
@keyframes blinken { 50% { opacity: 0.35; } }
.s-fuss { margin-top: auto; padding-top: 48px; text-align: center; color: var(--text-2); font-size: 15px; }
.s-link { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: var(--text); margin-left: 4px; }
.s-link:focus-visible { outline: 2px solid var(--text); }
.s-mehr { margin: 16px auto 0; max-width: 540px; text-align: left; background: var(--flaeche); border-radius: 16px; padding: 12px 18px; color: var(--text); font-size: 15.5px; }
.s-mehr p { margin: 7px 0; }
@media (max-width: 640px) {
  .s-inhalt { padding: 32px 4px 4px; }
  .s-gruss { margin-bottom: 22px; }
  .s-raster { grid-template-columns: repeat(3, 1fr); gap: 24px 6px; }
  .s-symbol { width: 64px; height: 64px; }
  .s-bild, .s-mono { border-radius: 17px; }
  .s-mono { font-size: 27px; }
  .s-name { font-size: 14.5px; }
  .s-karte { padding: 16px; margin-bottom: 28px; }
  .s-karte h2 { font-size: 19px; }
}

/* ===========================================================================
   Karte
   =========================================================================== */

.sicht-karte { padding-top: 12px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.k-steuer { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; color: var(--text-2); font-size: 13px; }
.k-steuer label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.k-steuer input[type=range] { width: 140px; accent-color: #8fb4dc; }
.k-steuer output { color: var(--text); min-width: 4.8em; display: inline-block; }
.k-pfad { display: flex; gap: 6px; align-items: center; margin-right: auto; color: var(--text-2); font-family: var(--schmal); font-size: 15px; }
.k-pfad b { color: var(--text); }
.k-pfad button { all: unset; cursor: pointer; color: var(--text); text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 3px; }
.k-such { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 7px; padding: 6px 10px; width: 180px; }
.k-haupt { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; height: calc(100vh - 150px); height: calc(100svh - 150px); min-height: 460px; }
.k-flaeche { position: relative; border-radius: 6px; overflow: hidden; background: #111a27; }
.k-feld { position: absolute; border: 1px solid var(--bg); overflow: hidden; cursor: pointer; transition: opacity 0.25s ease, filter 0.25s ease; color: #f1f5fa; }
.k-feld.k-kopf { border: 0; background: transparent !important; pointer-events: none; z-index: 2; }
.k-feld.gedimmt { opacity: 0.22; filter: saturate(0.3); }
.k-feld.gewaehlt { outline: 2px solid #f1f5fa; outline-offset: -2px; z-index: 3; }
.k-lbl { position: absolute; left: 6px; top: 2px; right: 6px; font: 600 13px/1.4 var(--schmal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.k-lbl small { font-weight: 400; opacity: 0.75; margin-left: 4px; }
.k-lbl.klein { font-weight: 400; font-size: 11.5px; top: 4px; opacity: 0.85; }
.k-pod.gross .k-lbl { top: 6px; font-size: 13.5px; }
.k-info { position: absolute; left: 10px; top: 32px; right: 10px; display: grid; gap: 6px; font-size: 13px; pointer-events: none; }
.k-balken { display: block; height: 6px; border-radius: 3px; background: rgb(255 255 255 / 14%); max-width: 220px; overflow: hidden; }
.k-balken i { display: block; height: 100%; background: currentColor; opacity: 0.85; }
.f-ok { background: #2e4a63; }
.k-pod.f-ok { background: #33526e; }
.f-sys { background: #3a4250; }
.k-pod.f-sys { background: #424b5a; }
.f-warn { background: #d99a2b; color: #1d1406; }
.f-down { background: #c9443b; }
.f-deploy { background: #3b6fb8; }
.k-detail { background: var(--flaeche); border-radius: 6px; padding: 14px 16px; overflow: auto; }
.k-detail h2 { margin: 0; font: 650 20px/1.2 var(--schmal); }
.k-detail h2.k-podname { font-size: 16px; overflow-wrap: anywhere; }
.k-zst { margin: 3px 0 12px; color: var(--text-2); }
.k-zst.warn { color: var(--warn); }
.k-zst.down { color: var(--down); }
.k-zst.deploy { color: var(--deploy); }
.k-detail dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; }
.k-detail dt { color: var(--text-2); }
.k-detail dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.k-knoepfe { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.k-knopf { border: 1px solid var(--linie); background: var(--flaeche-2); border-radius: 7px; padding: 6px 11px; text-decoration: none; font-size: 13.5px; }
.k-knopf.haupt { background: var(--text); color: var(--bg); border-color: transparent; font-weight: 600; }
.k-detail h3 { font-size: 12.5px; color: var(--text-2); font-weight: 500; margin: 12px 0 6px; }
.k-detail ul { list-style: none; margin: 0; padding: 0; }
.k-detail li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-top: 1px solid var(--linie); font-size: 12.5px; }
.k-detail li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--schmal); }
.k-detail li span:last-child { white-space: nowrap; }
.k-klein { font-size: 12.5px; color: var(--text-2); }
.k-link { all: unset; cursor: pointer; color: var(--text); text-decoration: underline; text-decoration-color: var(--text-3); text-underline-offset: 2px; margin-right: 8px; }
.k-legende { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 12.5px; align-items: center; margin: 0; }
.k-legende i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; }
@media (max-width: 760px) {
  .k-haupt { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .k-flaeche { height: 58svh; min-height: 360px; }
  .k-such { width: 100%; order: 5; }
  .k-pfad { width: 100%; }
  .k-steuer input[type=range] { width: 110px; }
}

/* ===========================================================================
   Blatt (Details einer App) - fuer alle Ansichten
   =========================================================================== */

.symbol { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; object-fit: cover; display: grid; place-items: center; overflow: hidden; background: var(--flaeche-2); }
.monogramm { color: #fff; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; background: hsl(var(--ton) 48% 46%); font-family: system-ui, sans-serif; }
.symbol.gross { width: 52px; height: 52px; border-radius: 13px; font-size: 23px; }
.symbol.klein { width: 22px; height: 22px; border-radius: 6px; font-size: 11px; }
.zustand { display: flex; align-items: center; gap: 8px; font-size: 13.5px; min-width: 0; }
.zustand .punkt { width: 8px; height: 8px; border-radius: 50%; background: var(--farbe); flex-shrink: 0; }
.st-deploy .punkt { animation: blinken 1.2s ease-in-out infinite; }
.zustand .was { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--farbe); font-weight: 550; }
.st-ok .zustand .was { color: var(--text-2); font-weight: 450; }

.huelle {
  position: fixed; inset: 0 0 auto 0; z-index: 40;
  /* svh statt fixed bottom:0 - in der installierten App auf Android reicht
     bottom:0 unter die Navigationsleiste (siehe Kaiteikarten). */
  height: 100vh; height: 100svh;
  display: flex; align-items: flex-end; justify-content: center;
}
.schleier { position: absolute; inset: 0; background: rgb(6 10 14 / 45%); animation: einblenden 0.18s ease; }
.blatt {
  position: relative; width: 100%; max-height: 92%;
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: 18px 18px 0 0; box-shadow: var(--schatten-hoch);
  animation: hochfahren 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.blatt:focus { outline: none; }
@media (min-width: 900px) {
  .huelle { justify-content: flex-end; align-items: stretch; }
  .blatt { width: 600px; max-height: none; height: 100%; border-radius: 0; animation-name: reinschieben; border-left: 1px solid var(--linie); }
}
@keyframes einblenden { from { opacity: 0; } }
@keyframes hochfahren { from { transform: translateY(40px); opacity: 0; } }
@keyframes reinschieben { from { transform: translateX(40px); opacity: 0; } }
.blatt-koerper { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.griff { width: 38px; height: 5px; border-radius: 3px; background: var(--flaeche-3); margin: 8px auto -2px; flex-shrink: 0; }
@media (min-width: 900px) { .griff { display: none; } }
.blatt-kopf { display: flex; gap: 14px; align-items: center; padding: 14px 18px 12px; flex-shrink: 0; }
.blatt-kopf h2 { margin: 0; font-size: 20px; letter-spacing: -0.015em; line-height: 1.2; }
.blatt-kopf .zustand { margin-top: 3px; }
.blatt-titel { flex: 1; min-width: 0; }
.zu { width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--flaeche-2); color: var(--text-2); display: grid; place-items: center; flex-shrink: 0; }
.blatt-tabs { display: flex; gap: 6px; padding: 0 18px 10px; flex-shrink: 0; flex-wrap: wrap; }
.knopf {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-klein); border: 1px solid var(--linie); background: var(--flaeche); text-decoration: none; font-size: 14px; font-weight: 550;
}
.knopf:hover { background: var(--flaeche-2); }
.knopf.haupt { background: var(--text); color: var(--bg); border-color: transparent; }
.knopf.an { background: var(--flaeche-3); border-color: transparent; }
.knopf svg { width: 15px; height: 15px; }
.blatt-inhalt { overflow: auto; padding: 4px 18px 22px; display: grid; gap: 12px; overscroll-behavior: contain; flex: 1; min-height: 0; align-content: start; }
.block { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 13px 14px; min-width: 0; }
.block h3 { margin: 0 0 8px; font-size: 13px; font-weight: 650; color: var(--text-2); display: flex; gap: 8px; align-items: baseline; }
.block h3 small { font-weight: 450; color: var(--text-3); margin-left: auto; font-size: 12px; text-align: right; }
.hinweise { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.hinweise li { display: flex; gap: 8px; align-items: baseline; font-size: 14px; }
.hinweise li::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--farbe); flex-shrink: 0; transform: translateY(-1px); }
.kennzahlen { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.kennzahlen div { min-width: 0; }
.kennzahlen b { display: block; font-size: 18px; font-weight: 650; letter-spacing: -0.015em; white-space: nowrap; }
.kennzahlen span { font-size: 12px; color: var(--text-3); }
@media (max-width: 420px) { .kennzahlen { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 12px; } }
.leiste { display: flex; gap: 2px; height: 44px; margin-top: 10px; }
.leiste i { flex: 1 1 0; min-width: 0; border-radius: 2px; background: var(--leer); position: relative; }
.leiste i.g { background: var(--ok); opacity: 0.85; }
.leiste i.f { background: var(--warn); }
.leiste i.r { background: var(--down); }
.leiste i.d::after { content: ''; position: absolute; left: 50%; top: -8px; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: var(--deploy); }
.leiste-skala { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.adresse { margin-top: 10px; font-size: 13px; overflow-wrap: anywhere; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabelle th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 0 8px 6px 0; }
.tabelle td { padding: 7px 8px 7px 0; border-top: 1px solid var(--linie); vertical-align: top; }
.tabelle td:last-child, .tabelle th:last-child { padding-right: 0; text-align: right; }
.tabelle .name { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.balken { height: 4px; border-radius: 2px; background: var(--leer); margin-top: 4px; overflow: hidden; min-width: 50px; }
.balken i { display: block; height: 100%; background: var(--text-2); }
.balken i.voll { background: var(--warn); }
.deploys { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.deploys span { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: color-mix(in srgb, var(--deploy) 22%, var(--flaeche)); }
.deploys span.alt { background: var(--flaeche-2); color: var(--text-2); }
.befehle { display: grid; gap: 6px; }
.befehl {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: var(--radius-klein); background: var(--flaeche-2);
  font: 12px/1.35 var(--mono); color: var(--text);
}
.befehl span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.befehl small { font: 11.5px system-ui, sans-serif; color: var(--text-3); white-space: nowrap; }
.befehl:hover { background: var(--flaeche-3); }
.befehl.kopiert small { color: var(--ok); }
.zeilen { display: grid; gap: 2px; }
.zeile { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--linie); }
.zeile:first-child { border-top: 0; padding-top: 2px; }
.zeile .haupt { min-width: 0; display: flex; align-items: center; gap: 8px; font-weight: 550; }
.zeile .haupt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile .neben { font-size: 12.5px; color: var(--text-2); text-align: right; white-space: nowrap; }
.zeile .unter { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.zeile .unter .st-warn { color: var(--warn); }
.laeufe { display: inline-flex; gap: 3px; }
.laeufe i { width: 7px; height: 7px; border-radius: 2px; background: var(--ok); }
.laeufe i.x { background: var(--down); }
.laeufe i.l { background: var(--deploy); animation: blinken 1.2s infinite; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; background: var(--flaeche-2); font-size: 12.5px; color: var(--text-2); border: 0; }
.st-down { color: inherit; }
span.st-down { color: var(--down); }
.lb-tag { font-size: 12px; font-weight: 650; color: var(--text-3); margin: 12px 0 4px; }
.lb-tag:first-child { margin-top: 0; }
.lb { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 2px 10px; padding: 5px 0; align-items: start; font-size: 13.5px; }
.lb-icon { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: color-mix(in srgb, var(--farbe) 16%, transparent); color: var(--farbe); }
.lb-icon svg { width: 13px; height: 13px; }
.lb-text { min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
.lb-zeit { font-size: 12px; color: var(--text-3); white-space: nowrap; padding-top: 1px; }

/* Logs */
.logs-leiste { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 0 18px 10px; flex-shrink: 0; }
.logs-leiste select, .logs-leiste input[type=search] { height: 34px; border-radius: 9px; border: 1px solid var(--linie); background: var(--flaeche); padding: 0 10px; font-size: 13px; min-width: 0; }
.logs-leiste input[type=search] { flex: 1; min-width: 140px; }
.logs-leiste select { max-width: 100%; }
.schalter { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); user-select: none; }
.logs { flex: 1; min-height: 0; overflow: auto; margin: 0 18px 18px; padding: 10px 0; background: #0b0f13; color: #d5dde5; border-radius: 10px; font: 12px/1.55 var(--mono); overscroll-behavior: contain; }
@media (max-width: 899px) { .logs { min-height: 50svh; } }
.logs div { padding: 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.logs div:hover { background: rgb(255 255 255 / 4%); }
.logs time { color: #6b7783; margin-right: 8px; user-select: none; }
.logs .fehler { color: #ff8b8b; }
.logs .warnung { color: #f5c76a; }
.logs mark { background: #4fd1c5; color: #061214; border-radius: 2px; }
.logs .leer { color: #6b7783; padding: 20px 12px; }

/* ---- Palette ------------------------------------------------------------- */

.palette-huelle { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; align-items: flex-start; padding: calc(10vh + env(safe-area-inset-top)) 12px 12px; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.palette { position: relative; width: 100%; max-width: 620px; max-height: 70vh; display: flex; flex-direction: column; overflow: hidden; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 16px; box-shadow: var(--schatten-hoch); animation: hochfahren 0.16s ease; }
@media (max-width: 560px) { .palette-huelle { padding-top: calc(10px + env(safe-area-inset-top)); } .palette { max-height: 60svh; } }
.palette-eingabe { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--linie); }
.palette-eingabe input { flex: 1; height: 52px; border: 0; background: none; outline: none; font-size: 16px; }
.treffer { overflow: auto; padding: 6px; margin: 0; list-style: none; }
.treffer li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.treffer li.an { background: var(--flaeche-2); }
.treffer .t-text { flex: 1; min-width: 0; }
.treffer .t-text b { display: block; font-weight: 550; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.treffer .t-text span { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.treffer .t-art { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.treffer .t-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--flaeche-2); color: var(--text-2); flex-shrink: 0; overflow: hidden; }
.treffer .t-icon .symbol { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; }
.treffer .t-icon > svg { width: 16px; height: 16px; }
.palette-fuss { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--linie); font-size: 12px; color: var(--text-3); }
@media (hover: none) { .palette-fuss { display: none; } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 60; transform: translateX(-50%); padding: 9px 16px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 14px; box-shadow: var(--schatten-hoch); animation: hochfahren 0.18s ease; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---- Anmeldung ------------------------------------------------------------ */

.login-seite { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; padding: 24px 16px; }
.login-karte { width: 100%; max-width: 360px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: 18px; padding: 26px 24px 22px; box-shadow: var(--schatten); }
.login-karte .marke { margin-bottom: 18px; }
.login-karte .logo { width: 32px; height: 32px; border-radius: 9px; }
.login-karte p { margin: 0 0 16px; color: var(--text-2); font-size: 14px; }
.login-karte label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.login-karte input { width: 100%; height: 44px; border-radius: 10px; border: 1px solid var(--linie); background: var(--bg); padding: 0 12px; font-size: 16px; }
.login-karte button { width: 100%; height: 44px; margin-top: 12px; border: 0; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; font-size: 15px; }
.login-karte button:disabled { opacity: 0.6; }
.login-fehler { color: var(--down); font-size: 13.5px; margin: 10px 0 0 !important; }
.login-ziel { font-size: 13px; color: var(--text-3); margin: 14px 0 0 !important; text-align: center; overflow-wrap: anywhere; }
