/* OSP-Server-Monitor · css/ansichten/uebersicht.css — Startseite (v1.0.0 Stufe B, AP-07, Entscheid F4).
   Höhenbudget Rahmen 2.6: Kachelreihe ≤ 64 px (unter 560 px Fensterhöhe einzeilig-kompakt ≤ 32 px), Warnungen über die volle
   Höhe mit eigenem Scroll (mindestens 280 px breit), Token-Verlauf füllt den Rest, Sessions (höchstens fünf Zeilen) fallen im
   niedrigen Fenster weg. Kein Seitenscroll: die Ansicht ist so hoch wie der Inhaltsbereich des Rumpfs (Kopf 44 px, Polster 8 px). */

#tab-overview { --ub-polster: 16px; }
@media (max-height: 560px) { #tab-overview { --ub-polster: 8px; } }

.ub {
  height: calc(100dvh - 44px - var(--ub-polster)); min-height: 0;
  display: grid; gap: 8px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "kacheln kacheln" "token warn" "sessions warn";
}
.ub .panel { min-height: 0; min-width: 0; }
.ub-hd { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-height: 36px; padding: 4px 12px; border-bottom: 1px solid var(--border); flex: none; }
.ub-hd h3 { font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--text); font-weight: 600; }
.ub-n { margin-left: auto; font: 600 12px var(--mono); color: var(--text-2); }

/* ── Kachelreihe ── */
.ub-kachelreihe { grid-area: kacheln; position: relative; display: flex; align-items: stretch; gap: 8px; min-width: 0; }
.ub-kacheln { flex: 1 1 auto; min-width: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
.ub-k {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 1px; min-width: 0; height: 58px;
  padding: 6px 12px 8px; text-align: left; text-decoration: none; color: var(--text); font: inherit; cursor: pointer;
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.ub-k:hover { border-color: var(--border-2); }
.ub-kz { display: none; }
.ub-k--kurz .ub-lg { display: none; }
.ub-k--kurz .ub-kz { display: inline; }
.ub-k-l { font-size: 12px; line-height: 15px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ub-k-v { font: 600 18px/22px var(--mono); letter-spacing: -.3px; white-space: nowrap; }
.ub-k-bar { position: absolute; left: 12px; right: 12px; bottom: 5px; height: 3px; border-radius: 2px; background: var(--border); overflow: hidden; }
.ub-k-bar b { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--ok); }
.ub-k--ohne-balken .ub-k-bar { display: none; }
.ub-k[data-stufe="warn"] .ub-k-v { color: #f0b429; }
.ub-k[data-stufe="warn"] .ub-k-bar b { background: var(--warn); }
.ub-k[data-stufe="crit"] .ub-k-v { color: #ff8078; }
.ub-k[data-stufe="crit"] .ub-k-bar b { background: var(--crit); }
.ub-k[data-stufe="na"] .ub-k-v { color: var(--text-2); }
.ub-k-leer { color: var(--text-2); font-size: 12px; padding: 8px 4px; align-self: center; }

.ub-tools { position: relative; flex: none; display: flex; align-items: center; gap: 8px; }
.ub-stand { font-size: 12px; color: var(--text-2); white-space: nowrap; }
.ub-zahnrad { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text-2); }
.ub-zahnrad:hover, .ub-zahnrad[aria-expanded="true"] { color: var(--text); border-color: var(--border-2); background: var(--panel-2); }
.ub-menue { position: absolute; z-index: 40; top: calc(100% + 4px); right: 0; width: 240px; padding: 8px 10px; background: var(--bg-2); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0, 0, 0, .55); }
.ub-menue-hd { margin: 0 0 4px; font-size: 12px; color: var(--text-2); }
.ub-menue-z { display: flex; align-items: center; gap: 8px; min-height: 28px; font-size: 13px; cursor: pointer; }
.ub-menue-z input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.ub-menue-hinweis { margin: 6px 0 0; font-size: 12px; color: var(--text-2); }

/* ── Token-Verlauf ── */
.ub-token { grid-area: token; display: flex; flex-direction: column; }
.ub-chips { display: inline-flex; gap: 4px; }
.ub-chip { min-width: 40px; min-height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--border-2); background: var(--panel); color: var(--text-2); font-size: 12px; font-weight: 600; }
.ub-chip:hover { color: var(--text); }
.ub-chip[aria-pressed="true"] { background: #0070B0; border-color: #0070B0; color: #fff; }
.ub-summe { margin-left: auto; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ub-chartbox { flex: 1 1 0; min-height: 80px; padding: 6px 8px 0; overflow: hidden; }
.ub-chartbox svg { display: block; }
.ub-gitter { stroke: var(--border); stroke-width: 1; }
.ub-achse { fill: var(--text-2); font: 12px var(--font); }
.ub-saeule { fill: var(--orange); }
.ub-saeule:hover { fill: #f27c47; }
.ub-geist { fill: url(#ubSchraffur); stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
.ub-schraffur { stroke: var(--text-3); stroke-width: 1.4; }
.ub-legende { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 16px; padding: 2px 12px 6px; font-size: 12px; color: var(--text-2); flex: none; min-height: 22px; }
.ub-legende-l { display: inline-flex; flex-wrap: wrap; gap: 2px 16px; min-width: 0; }
.ub-leg { display: inline-flex; align-items: center; gap: 6px; }
.ub-leg-bar { width: 10px; height: 10px; border-radius: 2px; background: var(--orange); }
.ub-leg-leer { width: 10px; height: 10px; border-radius: 2px; border: 1px dashed var(--text-3); background: repeating-linear-gradient(45deg, var(--text-3) 0 1px, transparent 1px 4px); }

/* ── Sessions: höchstens fünf Zeilen ── */
.ub-sessions { grid-area: sessions; display: flex; flex-direction: column; }
.ub-sessions .ovses { padding: 2px 8px 4px; display: flex; flex-direction: column; }
.ub-sessions .ovses__row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 28px; align-items: center; gap: 8px; min-height: 28px; padding: 1px 0; border-bottom: 1px solid var(--border); }
.ub-sessions .ovses__row:last-child { border-bottom: 0; }
.ub-sessions .ovses__proj { display: grid; place-items: center; width: 24px; height: 20px; border-radius: 5px; font: 700 12px var(--mono); }
.ub-sessions .ovses__t { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.ub-sessions .ovses__m { font: 12px var(--mono); color: var(--text-2); white-space: nowrap; }
.ub-sessions .ovses__go { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 7px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text-2); }
.ub-sessions .ovses__go:hover { color: var(--text); border-color: var(--border-2); }
.ub-sessions .ovses__go.is-off { opacity: .55; cursor: default; }
.ub-sessions .ovses__go svg { width: 13px; height: 13px; }
.ub-sessions .empty, .ub-sessions .loading { padding: 10px 12px; }
.ub .empty { font-size: 13px; line-height: 1.45; color: var(--text-2); }                                      /* Leertexte: mindestens 12 px, lesbarer Kontrast */
.ub-chartbox .empty { padding: 14px 16px; max-width: 70ch; }

/* ── Warnungen: volle Höhe, eigener Scroll, mindestens 280 px breit ── */
.ub-warn { grid-area: warn; display: flex; flex-direction: column; min-width: 280px; }
.ub-warnliste { flex: 1 1 0; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; padding: 8px 4px 8px 8px; display: flex; flex-direction: column; gap: 6px; }
.ub-warnliste:focus-visible { outline-offset: -2px; }
.ub-w { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; align-items: baseline; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font: inherit; }
.ub-w:hover { border-color: var(--border-2); background: var(--panel); }
.ub-w-st { grid-row: 1; font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: 10px; border: 1px solid var(--border); white-space: nowrap; }
.ub-w-t { grid-column: 2; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.ub-w-s { grid-column: 2; font-size: 12px; color: var(--text-2); overflow-wrap: anywhere; }
.ub-w--crit { border-color: rgba(248, 81, 73, .4); } .ub-w--crit .ub-w-st { color: #ff8078; border-color: rgba(248, 81, 73, .45); background: rgba(248, 81, 73, .1); }
.ub-w--warn { border-color: rgba(210, 153, 34, .35); } .ub-w--warn .ub-w-st { color: #f0b429; border-color: rgba(210, 153, 34, .4); background: rgba(210, 153, 34, .1); }
.ub-w--info .ub-w-st { color: #79b8ff; border-color: rgba(56, 139, 253, .4); background: rgba(56, 139, 253, .1); }
.ub-leer { display: flex; flex-direction: column; gap: 4px; padding: 14px 12px; color: var(--text-2); font-size: 13px; }
.ub-leer-t { color: var(--text); font-weight: 600; }

/* ── Dichtemodus (Fenster unter 560 px Höhe, z. B. 150 % Skalierung): Kachelreihe ≤ 32 px, Sessions weg ── */
@media (max-height: 560px) {
  .ub { gap: 6px; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "kacheln kacheln" "token warn"; }
  .ub-sessions { display: none; }
  .ub-k { height: 32px; padding: 2px 8px; gap: 0; justify-content: center; }
  .ub-k-l { font-size: 12px; line-height: 14px; }
  .ub-k-v { font-size: 13px; line-height: 15px; }
  .ub-k-bar { display: none; }
  .ub-kacheln { gap: 4px; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); }
  .ub-zahnrad { height: 32px; }
  .ub-hd { min-height: 30px; padding: 2px 10px; }
  .ub-chip { min-height: 24px; }
  .ub-stand { display: none; }
}

/* ── Schmal (unter 1000 px): eine Spalte, Warnungen unter dem Verlauf ── */
@media (max-width: 999px) {
  .ub { height: auto; min-height: calc(100dvh - 44px - var(--ub-polster)); align-content: start; grid-template-columns: minmax(0, 1fr); grid-template-rows: none;
    grid-template-areas: "kacheln" "token" "warn" "sessions"; }
  .ub-token { min-height: 280px; }
  .ub-chartbox { min-height: 180px; }
  .ub-warn { min-width: 0; height: 300px; }
  .ub-kacheln { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
}

/* Die Detaildialoge (Platte, CPU/Speicher, Laufzeit, Tokens) behalten ihre Tabellen aus app.css */
@media (prefers-reduced-motion: reduce) { .ub * { transition: none !important; animation: none !important; } }
