/* OmniCCS – Design: Echtzeit-Monitoring, datendicht, Dark first. Status nie nur über Farbe: immer Icon + Text. */

@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url('/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url('/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 600; font-display: swap; src: url('/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 700; font-display: swap; src: url('/fonts/ibm-plex-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 100 800; font-display: swap; src: url('/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2'); }

/* ---------- Tokens ---------- */
:root {
  --font: 'IBM Plex Sans', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --t-fast: 120ms; --t: 180ms; --ease: cubic-bezier(.2, .7, .2, 1);
  --header-h: 60px;

  /* Dunkel (Standard) */
  --bg: #0b0f17;
  --bg-grad: radial-gradient(1200px 500px at 10% -10%, #15203a 0%, transparent 60%), radial-gradient(900px 400px at 100% 0%, #1a1530 0%, transparent 55%);
  --surface: #121826;
  --surface-2: #182032;
  --surface-3: #202a40;
  --line: #243049;
  --line-strong: #34425f;
  --text: #e6ebf5;
  --muted: #a3aec3;
  --faint: #7d8aa3;
  --brand: #f0a73a;
  --on-brand: #1a1204;
  --primary: #e6ebf5;
  --on-primary: #0b0f17;
  --ring: #8ab4ff;

  --working: #60a5fa; --working-bg: rgb(96 165 250 / 12%);
  --waiting: #fbbf24; --waiting-bg: rgb(251 191 36 / 12%);
  --question: #a78bfa; --question-bg: rgb(167 139 250 / 13%);
  --done: #34d399; --done-bg: rgb(52 211 153 / 12%);
  --error: #f87171; --error-bg: rgb(248 113 113 / 12%);
  --offline: #94a3b8; --offline-bg: rgb(148 163 184 / 12%);

  --shadow: 0 1px 0 rgb(255 255 255 / 3%) inset, 0 8px 24px rgb(0 0 0 / 28%);
  --shadow-pop: 0 24px 64px rgb(0 0 0 / 50%);
  color-scheme: dark;
}

/* Hell: System hell (ohne Wahl) oder ausdrücklich gewählt */
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f4f6fa;
    --bg-grad: radial-gradient(1200px 500px at 10% -10%, #e5ecfb 0%, transparent 60%), radial-gradient(900px 400px at 100% 0%, #efe9fb 0%, transparent 55%);
    --surface: #ffffff;
    --surface-2: #f2f5fa;
    --surface-3: #e8edf5;
    --line: #dfe5ef;
    --line-strong: #c9d2e1;
    --text: #0f172a;
    --muted: #475569;
    --faint: #5f6b7f;
    --primary: #0f172a;
    --on-primary: #ffffff;
    --ring: #2563eb;
    --working: #1d4ed8; --working-bg: #e7efff;
    --waiting: #a35200; --waiting-bg: #fff3dc;
    --question: #6d28d9; --question-bg: #f1eafe;
    --done: #047857; --done-bg: #e3f6ee;
    --error: #b91c1c; --error-bg: #fde8e8;
    --offline: #5f6b7f; --offline-bg: #eef1f6;
    --shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 6px 18px rgb(15 23 42 / 6%);
    --shadow-pop: 0 24px 64px rgb(15 23 42 / 22%);
    color-scheme: light;
  }
}
:root[data-theme='light'] {
  --bg: #f4f6fa;
  --bg-grad: radial-gradient(1200px 500px at 10% -10%, #e5ecfb 0%, transparent 60%), radial-gradient(900px 400px at 100% 0%, #efe9fb 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f2f5fa;
  --surface-3: #e8edf5;
  --line: #dfe5ef;
  --line-strong: #c9d2e1;
  --text: #0f172a;
  --muted: #475569;
  --faint: #5f6b7f;
  --primary: #0f172a;
  --on-primary: #ffffff;
  --ring: #2563eb;
  --working: #1d4ed8; --working-bg: #e7efff;
  --waiting: #a35200; --waiting-bg: #fff3dc;
  --question: #6d28d9; --question-bg: #f1eafe;
  --done: #047857; --done-bg: #e3f6ee;
  --error: #b91c1c; --error-bg: #fde8e8;
  --offline: #5f6b7f; --offline-bg: #eef1f6;
  --shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 6px 18px rgb(15 23 42 / 6%);
  --shadow-pop: 0 24px 64px rgb(15 23 42 / 22%);
  color-scheme: light;
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: var(--s4) 0 var(--s2); }
p { margin: 0; }
a { color: inherit; text-underline-offset: 2px; }
code, pre, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--surface-3); border-radius: 4px; padding: 1px 5px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: color-mix(in srgb, var(--ring) 35%, transparent); }

.i { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.i.sm { width: 15px; height: 15px; }
.i.lg { width: 22px; height: 22px; }
.spin { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 8px 12px; border-radius: var(--r-sm); }
.skip:focus { left: 8px; }

/* ---------- Buttons ---------- */
.btn {
  --h: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--h); padding: 0 14px;
  font: 500 14px/1 var(--font); color: var(--text); text-decoration: none; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r);
  cursor: pointer; user-select: none;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), opacity var(--t-fast);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.primary:hover { opacity: .9; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.small { --h: 32px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn.small .i { width: 16px; height: 16px; }
.btn.icon { padding: 0; width: var(--h); }
.btn.block { width: 100%; --h: 44px; }
.btn[aria-pressed='true'] { color: var(--done); }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Kopf ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  min-height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(20px, env(safe-area-inset-right)) 0 max(20px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { flex: none; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand h1 { font-size: 16px; font-weight: 700; line-height: 1.2; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); line-height: 1.3; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--offline); }
.live.on { color: var(--done); }
.live.on .live-dot { background: var(--done); box-shadow: 0 0 0 0 var(--done); animation: beacon 2.4s ease-out infinite; }
@keyframes beacon { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--done) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
.actions { display: flex; align-items: center; gap: 2px; }

main { padding: var(--s5) max(20px, env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); max-width: 1560px; margin: 0 auto; }

/* ---------- Kennzahlen (zugleich Filter) ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s5); }
.stat {
  --c: var(--muted);
  display: flex; align-items: center; gap: var(--s3); text-align: left;
  padding: 14px 16px; min-height: 72px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  color: var(--text); font: inherit; cursor: pointer;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), transform var(--t-fast) var(--ease);
}
.stat:hover { border-color: var(--line-strong); }
.stat:active { transform: scale(.985); }
.stat[aria-pressed='true'] { border-color: var(--c); background: color-mix(in srgb, var(--c) 7%, var(--surface)); }
.stat .ico { width: 38px; height: 38px; border-radius: var(--r); display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); flex: none; }
.stat .num { font: 600 24px/1.1 var(--font); font-variant-numeric: tabular-nums; }
.stat .num small { font-size: 15px; color: var(--faint); font-weight: 500; }
.stat .cap { font-size: 12.5px; color: var(--muted); }
.stat.attn { --c: var(--waiting); }
.stat.attn.hot { border-color: color-mix(in srgb, var(--waiting) 55%, var(--line)); }
.stat.attn.hot .num { color: var(--waiting); }
.stat.work { --c: var(--working); }
.stat.all { --c: var(--done); }
.stat.hostsc { --c: var(--offline); }
.stat.hostsc.warn { --c: var(--error); }

/* ---------- Abschnitte ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s5); align-items: start; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); min-height: 32px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; }
.count { font: 600 12px/1 var(--font); background: var(--waiting-bg); color: var(--waiting); padding: 4px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.lane { margin-bottom: var(--s6); }

/* ---------- Status-Chip ---------- */
:where(.chip) { --c: var(--offline); --cb: var(--offline-bg); }
.chip {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font: 600 12px/1 var(--font); color: var(--c); background: var(--cb);
  border-radius: 999px; padding: 5px 9px 5px 7px; white-space: nowrap;
}
.chip .i { width: 14px; height: 14px; }
.chip.plain { background: transparent; border: 1px solid var(--line-strong); color: var(--muted); padding: 4px 8px; }
a.chip { text-decoration: none; }
a.chip:hover { filter: brightness(1.12); }

.c-working { --c: var(--working); --cb: var(--working-bg); }
.c-waiting, .c-permission, .c-attention { --c: var(--waiting); --cb: var(--waiting-bg); }
.c-question { --c: var(--question); --cb: var(--question-bg); }
.c-done, .c-turn_done, .c-task_done, .c-rc_restored, .c-host_online { --c: var(--done); --cb: var(--done-bg); }
.c-error, .c-rc_lost, .c-session_gone { --c: var(--error); --cb: var(--error-bg); }
.c-idle, .c-ended, .c-offline, .c-host_offline, .c-session_start, .c-session_end, .c-compact { --c: var(--offline); --cb: var(--offline-bg); }

/* ---------- Braucht dich ---------- */
.attention-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: var(--s3); }
:where(.acard) { --c: var(--waiting); --cb: var(--waiting-bg); }
.acard {
  position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 12px;
  padding: 14px 16px 14px 14px;
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--c) 32%, var(--line)); border-radius: var(--r-lg);
  box-shadow: var(--shadow); scroll-margin-top: calc(var(--header-h) + 24px);
  animation: enter var(--t) var(--ease);
}
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }
.acard.flash::after { content: ''; position: absolute; inset: -1px; border-radius: inherit; border: 2px solid var(--c); animation: flash 1.4s var(--ease) 1 forwards; pointer-events: none; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.acard .badge-ico { grid-row: 1 / span 2; width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; color: var(--c); background: var(--cb); }
.acard .head { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.acard .kind { font-weight: 600; color: var(--c); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard .age { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }
.acard .who { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--muted); }
.acard .who b { color: var(--text); font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acard .who .sep { color: var(--faint); }
.acard .content { grid-column: 1 / -1; margin-top: 8px; }
.acard .body { white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.acard .body.code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; -webkit-line-clamp: 4; }
.acard .path { grid-column: 1 / -1; font-family: var(--mono); font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; margin-top: 2px; }
.acard .foot { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.acard .foot .push { margin-left: auto; }

.calm {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--muted);
}
.calm .i { color: var(--done); }

/* ---------- Hosts ---------- */
.host { margin-bottom: var(--s6); }
.host-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: var(--s3); }
.host-head h2 { display: flex; align-items: center; gap: 8px; font-size: 15.5px; }
.host-head h2 .i { color: var(--muted); }
.host-head .meta { color: var(--faint); font-size: 12.5px; }
.host-head .end { margin-left: auto; }
.host.offline .sessions { opacity: .6; }
.sessions { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s3); }
.empty { display: flex; align-items: center; gap: 10px; color: var(--faint); padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--r-lg); }

.scard {
  --c: var(--offline);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 7px; min-width: 0;
  padding: 13px 14px 11px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  scroll-margin-top: calc(var(--header-h) + 24px);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.scard:hover { border-color: var(--line-strong); }
.scard.ph-working { --c: var(--working); }
.scard.ph-waiting { --c: var(--waiting); border-color: color-mix(in srgb, var(--waiting) 40%, var(--line)); }
.scard.ph-question { --c: var(--question); border-color: color-mix(in srgb, var(--question) 40%, var(--line)); }
.scard.ph-done { --c: var(--done); }
.scard.ph-error { --c: var(--error); border-color: color-mix(in srgb, var(--error) 35%, var(--line)); }
.scard.ph-ended, .scard.ph-offline { background: transparent; }
.scard.ph-ended > * { opacity: .7; }
.scard.target { outline: 2px solid var(--ring); outline-offset: 2px; }
/* Arbeitet: ruhige Laufleiste oben */
.scard.ph-working::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--working), transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  animation: scan 2.2s var(--ease) infinite;
}
@keyframes scan { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.srow { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sname { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.srow .chip:first-of-type { margin-left: auto; }
.spath { display: flex; align-items: center; gap: 6px; color: var(--faint); min-width: 0; }
.spath .i { width: 14px; height: 14px; }
.spath span { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
.snote { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.snote b { color: var(--text); font-weight: 500; }
.sfoot { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin-top: 2px; min-height: 32px; }
.sfoot .meta-item { display: inline-flex; align-items: center; gap: 4px; }
.sfoot .meta-item .i { width: 13px; height: 13px; }
.sfoot .tools { margin-left: auto; display: flex; gap: 2px; }

/* ---------- Verlauf ---------- */
.feed { position: sticky; top: calc(var(--header-h) + 20px); max-height: calc(100vh - var(--header-h) - 40px); display: flex; flex-direction: column; }
.timeline {
  list-style: none; margin: 0; padding: 6px 0; overflow: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
:where(.timeline li) { --c: var(--offline); --cb: var(--offline-bg); }
.timeline li { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 1px 10px; padding: 9px 14px; cursor: pointer; transition: background var(--t-fast); }
.timeline li:hover { background: var(--surface-2); }
.timeline li::before { content: ''; position: absolute; left: 28px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.timeline li:first-child::before { top: 20px; }
.timeline li:last-child::before { bottom: calc(100% - 20px); }
.timeline .dot { position: relative; grid-row: 1 / span 3; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: var(--c); background: var(--surface); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 40%, var(--line)); }
.timeline .dot .i { width: 14px; height: 14px; }
.timeline .ft { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline time { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.timeline .fw { color: var(--muted); font-size: 12.5px; grid-column: 2 / 4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline .fb { color: var(--faint); font-size: 12.5px; grid-column: 2 / 4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.timeline .none { display: block; color: var(--faint); cursor: default; padding: 16px; }
.timeline .none::before { display: none; }

/* ---------- Tabs (nur schmal) ---------- */
.tabs { display: none; }

/* ---------- Schalter ---------- */
.switch { display: inline-flex; flex-direction: row; align-items: center; font-weight: 400; gap: 10px; cursor: pointer; color: var(--text); font-size: 14px; min-height: 36px; user-select: none; }
.switch.small { font-size: 13px; color: var(--muted); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-strong); flex: none; transition: background var(--t) var(--ease), border-color var(--t); }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform var(--t) var(--ease), background var(--t); }
.switch input:checked + .track { background: var(--done); border-color: var(--done); }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- Dialoge ---------- */
.dlg {
  padding: 0; border: 1px solid var(--line-strong); border-radius: 18px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
  width: min(580px, calc(100vw - 24px)); max-height: min(88vh, 900px);
}
.dlg.wide { width: min(760px, calc(100vw - 24px)); }
.dlg[open] { animation: pop var(--t) var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.dlg::backdrop { background: rgb(5 8 14 / 62%); backdrop-filter: blur(3px); }
.dlg form { display: flex; flex-direction: column; max-height: inherit; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 17px; }
.dlg-body { padding: 18px 22px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 18px; border-top: 1px solid var(--line); }
fieldset { border: 0; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
legend { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 0; margin-bottom: 12px; }
legend .i { width: 15px; height: 15px; }
fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 18px; }
.hint { color: var(--muted); font-size: 13px; }
.cmd { margin: 0; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; white-space: pre-wrap; word-break: break-all; user-select: all; font-size: 12.5px; line-height: 1.6; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
input[type='number'], input[type='url'], input[type='password'], input[type='text'] {
  font: 400 15px var(--font); color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: 0 12px; min-height: 42px; width: 100%;
  transition: border-color var(--t-fast);
}
input:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--line-strong)); }
input:focus-visible { outline: 2px solid var(--ring); outline-offset: 0; border-color: transparent; }
input::placeholder { color: var(--faint); }
.field-suffix { display: flex; align-items: center; gap: 10px; }
.field-suffix input { width: 96px; flex: none; }
.field-suffix span { font-weight: 400; color: var(--faint); font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.span2 { grid-column: 1 / -1; }
.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2px 16px; }
.kinds .switch { font-size: 13.5px; gap: 9px; }
.kinds .switch .i { width: 15px; height: 15px; color: var(--c); }
.devices { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.devices li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13.5px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: var(--r); min-height: 44px; }
.devices li > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.devices .none { color: var(--faint); border-style: dashed; padding: 10px 12px; }
.facts { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.facts li { display: grid; grid-template-columns: 18px 1fr; gap: 10px; color: var(--muted); font-size: 13.5px; }
.facts .i { color: var(--faint); margin-top: 2px; }
.err { display: flex; align-items: center; gap: 8px; color: var(--error); font-size: 13.5px; }

/* ---------- Anmeldung ---------- */
.login { display: grid; place-items: center; min-height: calc(100vh - 200px); }
.login-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.login-card img { margin-bottom: 6px; }
.login-card h2 { font-size: 20px; }
.login-card .hint { margin-bottom: 10px; }
.login-card .btn { margin-top: 6px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast {
  --c: var(--muted);
  display: flex; align-items: flex-start; gap: 10px; pointer-events: auto;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); border-left: 3px solid var(--c);
  border-radius: var(--r); padding: 10px 14px; font-size: 13.5px; max-width: min(400px, calc(100vw - 32px)); box-shadow: var(--shadow-pop);
  animation: enter var(--t) var(--ease);
}
.toast .i { color: var(--c); margin-top: 1px; }

/* ---------- Responsiv ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .tabs {
    display: flex; gap: 4px; padding: 4px; margin-bottom: var(--s4);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    position: sticky; top: calc(var(--header-h) + env(safe-area-inset-top) + 8px); z-index: 10;
  }
  .tab { flex: 1; min-height: 40px; border: 0; border-radius: var(--r); background: transparent; color: var(--muted); font: 600 14px var(--font); cursor: pointer; }
  .tab[aria-selected='true'] { background: var(--surface-3); color: var(--text); }
  .panel[data-hidden='true'] { display: none; }
  .feed { position: static; max-height: none; }
}
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: var(--s4); }
  .stat { min-height: 64px; padding: 12px; }
  .stat .ico { width: 34px; height: 34px; }
  .stat .num { font-size: 21px; }
  .actions .lbl { display: none; }
  .actions .btn { width: 44px; min-height: 44px; padding: 0; }
  .attention-grid, .sessions { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
  .btn { --h: 44px; }
  .btn.small { --h: 40px; }
  .sfoot { min-height: 40px; }
  .dlg { width: 100vw; max-width: 100vw; max-height: 92vh; border-radius: 18px 18px 0 0; margin: auto 0 0; inset: auto 0 0 0; border-bottom: 0; }
  .dlg.wide { width: 100vw; }
  .dlg-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .dlg-foot .btn { flex: 1; }
}
@media (max-width: 380px) {
  main { padding-left: 12px; padding-right: 12px; }
  .top { padding-left: 12px; padding-right: 8px; }
  .stat .cap { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }
  .scard.ph-working::before { background: var(--working); }
}
@media (forced-colors: active) {
  .chip, .stat, .acard, .scard { border: 1px solid CanvasText; }
}
