/* Höhenflug Swarm design system. Source: design-system/hoehenflug-swarm/MASTER.md (ui-ux-pro-max: "Real-Time Monitoring",
   dense dashboard). Blue = data/primary, amber = highlight only, green/amber/red = status. Fira Sans for text, Fira Code for numbers.
   Components only use the semantic tokens below, never raw colors. */
:root {
  --bg: #f6f8fb; --surface: #ffffff; --surface-2: #f1f4f9; --muted: #e9eef6; --border: #dbe3ef; --border-strong: #c3cfe0;
  --text: #0f1b3d; --text-2: #475569; --text-3: #5f6e85;
  --primary: #1e40af; --primary-hover: #1a3794; --on-primary: #ffffff; --primary-soft: #e6edfb; --ring: rgba(30, 64, 175, .28);
  --secondary: #3b82f6; --accent: #b45309; --accent-soft: #fdf1df;
  --success: #15803d; --success-soft: #e3f5e9; --warning: #b45309; --warning-soft: #fdf1df; --danger: #dc2626; --danger-soft: #fde8e8;
  --info: #1e40af; --info-soft: #e6edfb; --bot: #6d28d9; --bot-soft: #efe7fd;
  --shadow: 0 1px 2px rgba(15, 27, 61, .06), 0 1px 1px rgba(15, 27, 61, .03);
  --shadow-lg: 0 12px 32px rgba(15, 27, 61, .16);
  --font: "Fira Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Fira Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --t: 160ms cubic-bezier(.2, .7, .3, 1);
  --nav-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1120; --surface: #101a2e; --surface-2: #15213a; --muted: #1c2a46; --border: #22314f; --border-strong: #31446b;
    --text: #e6ecf7; --text-2: #a3b1c9; --text-3: #8695b0;
    --primary: #6ea0ff; --primary-hover: #8cb4ff; --on-primary: #0a1120; --primary-soft: #172a52; --ring: rgba(110, 160, 255, .35);
    --secondary: #60a5fa; --accent: #f5a524; --accent-soft: #33260f;
    --success: #3ecf8e; --success-soft: #10301f; --warning: #f5a524; --warning-soft: #33260f; --danger: #f87171; --danger-soft: #3a1618;
    --info: #6ea0ff; --info-soft: #172a52; --bot: #b79cff; --bot-soft: #261d45;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1120; --surface: #101a2e; --surface-2: #15213a; --muted: #1c2a46; --border: #22314f; --border-strong: #31446b;
  --text: #e6ecf7; --text-2: #a3b1c9; --text-3: #8695b0;
  --primary: #6ea0ff; --primary-hover: #8cb4ff; --on-primary: #0a1120; --primary-soft: #172a52; --ring: rgba(110, 160, 255, .35);
  --secondary: #60a5fa; --accent: #f5a524; --accent-soft: #33260f;
  --success: #3ecf8e; --success-soft: #10301f; --warning: #f5a524; --warning-soft: #33260f; --danger: #f87171; --danger-soft: #3a1618;
  --info: #6ea0ff; --info-soft: #172a52; --bot: #b79cff; --bot-soft: #261d45;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35); --shadow-lg: 0 16px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--primary); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.t2 { color: var(--text-2); } .t3 { color: var(--text-3); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.lg { width: 20px; height: 20px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s3);
  border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: 14px; cursor: pointer; transition: background var(--t), border-color var(--t), color var(--t); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.success { color: var(--success); } .btn.danger { color: var(--danger); } .btn.info { color: var(--info); }
.btn.sm { min-height: 30px; padding: 0 var(--s2); font-size: 13px; }
.btn.icon { width: 36px; padding: 0; }
.btn.block { width: 100%; }
.btn.busy { pointer-events: none; opacity: .7; }
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.field .help { font-weight: 400; color: var(--text-3); font-size: 12.5px; }
.input, select.input { width: 100%; min-height: 38px; padding: 0 var(--s3); border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 14px; transition: border-color var(--t), box-shadow var(--t); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
input[type=range] { accent-color: var(--primary); width: 100%; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 8px; background: var(--muted); }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; transition: background var(--t), color var(--t); }
.seg button[aria-current="page"], .seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- status ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 2px 8px 2px 7px; border-radius: 99px; background: var(--muted); color: var(--text-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.awake { background: var(--success-soft); color: var(--success); }
.status.awake::before { animation: blink 2s ease-in-out infinite; }
.status.paused { background: var(--info-soft); color: var(--info); }
.status.error { background: var(--danger-soft); color: var(--danger); }
@keyframes blink { 50% { opacity: .35; } }
.tag { font: 600 11px var(--mono); padding: 1px 6px; border-radius: 4px; background: var(--primary-soft); color: var(--primary); letter-spacing: .3px; white-space: nowrap; }
.badge { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 99px; white-space: nowrap; }
.badge.bot { background: var(--bot-soft); color: var(--bot); }
.badge.auto { background: var(--success-soft); color: var(--success); }
.badge.man { background: var(--info-soft); color: var(--info); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--text-3); }
.empty { padding: var(--s6) var(--s4); text-align: center; color: var(--text-2); display: grid; gap: var(--s3); justify-items: center; }

/* ---------- toast ---------- */
.toasts { position: fixed; right: var(--s4); bottom: var(--s4); z-index: 60; display: grid; gap: var(--s2); width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: var(--s2); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 14px; animation: rise 180ms ease-out; }
.toast .ic { color: var(--success); margin-top: 2px; } .toast.err .ic { color: var(--danger); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
