/* ============================================================
   GoodBuddy Company — Dashboard styles
   Dark glass theme · no external assets · system fonts only
   ============================================================ */

:root {
  --bg: #0a0e1a;
  --bg-2: #0d1322;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(17, 23, 39, 0.72);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-strong: rgba(255, 255, 255, 0.13);

  --text: #e7ecf6;
  --text-dim: #9aa4ba;
  --text-faint: #5d6880;

  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-grad: linear-gradient(135deg, #6366f1, #22d3ee);

  --ok: #34d399;
  --warn: #fbbf24;
  --crit: #f87171;
  --info: #60a5fa;
  --violet: #a78bfa;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;

  --shadow: 0 12px 32px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.55);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 620px at 82% -12%, rgba(99, 102, 241, 0.18), transparent 60%),
    radial-gradient(900px 520px at -12% 12%, rgba(34, 211, 238, 0.10), transparent 55%),
    radial-gradient(700px 700px at 50% 120%, rgba(99, 102, 241, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint grid overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 78%);
}

/* ------------------------------------------------------------
   Top navigation
   ------------------------------------------------------------ */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  background: rgba(10, 14, 26, 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--panel-border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex: none;
}
.brand-mark { filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.5)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.tab.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--panel-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  transition: background 0.16s ease, color 0.16s ease;
}
.badge.has { background: var(--accent-grad); color: #06121a; }

.conn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 6px 11px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.conn-dot.online { background: var(--ok); box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
.conn-dot.offline { background: var(--crit); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.18); }
.conn-dot.connecting { background: var(--warn); animation: pulse 1.4s ease-in-out infinite; }

[hidden] { display: none !important; }

.offline-banner {
  position: sticky;
  top: 57px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 7px 16px;
  font-size: 12.5px;
  font-weight: 600;
  color: #fecaca;
  background: rgba(127, 29, 29, 0.75);
  border-bottom: 1px solid rgba(248, 113, 113, 0.25);
  backdrop-filter: blur(8px);
}
.offline-banner-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--crit);
  animation: pulse 1.4s ease-in-out infinite;
}

/* ------------------------------------------------------------
   Layout
   ------------------------------------------------------------ */
main { position: relative; z-index: 1; }
.view { max-width: 1240px; margin: 0 auto; padding: 26px 22px 90px; }
.view[hidden] { display: none !important; }

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.view-title { margin: 4px 0 4px; font-size: 26px; font-weight: 750; letter-spacing: -0.02em; }
.view-sub { margin: 0; font-size: 13.5px; color: var(--text-dim); }

.header-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.header-status { display: flex; align-items: center; }

.clock { text-align: right; line-height: 1.15; }
.clock-time {
  display: block;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.clock-date { display: block; font-size: 11.5px; color: var(--text-dim); }

/* ------------------------------------------------------------
   Panels & cards (glass)
   ------------------------------------------------------------ */
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-title {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--panel-border-strong); }
.stat-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent-grad);
  opacity: 0;
  transition: opacity 0.18s ease;
}
.stat-card:hover::after { opacity: 1; }
.stat-card.tone-crit::after { background: var(--crit); opacity: 1; }
.stat-card.tone-crit { border-color: rgba(248, 113, 113, 0.35); }

.stat-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  font-size: 20px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
}
.stat-body { min-width: 0; }
.stat-value {
  font-size: 25px;
  font-weight: 750;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-card.tone-crit .stat-value { color: var(--crit); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-dim); margin-top: 2px; }
.stat-sub { font-size: 11px; color: var(--text-faint); margin-top: 3px; }

.overview-cols {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 16px;
  align-items: start;
}

/* ------------------------------------------------------------
   Activity feed
   ------------------------------------------------------------ */
.mini-toggle {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.mini-toggle.on { color: #06121a; background: var(--accent-grad); border-color: transparent; }

.spark-wrap { padding: 2px 2px 10px; }
.sparkline { width: 100%; height: 52px; display: block; }
.spark-empty { fill: var(--text-faint); font-size: 5px; font-family: var(--mono); }

.feed {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 2px;
}
.feed::-webkit-scrollbar, .run-trace::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 8px; }
.feed::-webkit-scrollbar-thumb, .run-trace::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-left: 3px solid transparent;
  border-radius: 8px;
}
.feed-item.level-info { border-left-color: var(--info); }
.feed-item.level-warn { border-left-color: var(--warn); }
.feed-item.level-critical { border-left-color: var(--crit); }
.feed-item.is-new { animation: fadeIn 0.3s ease; }

.feed-time { color: var(--text-faint); flex: none; font-variant-numeric: tabular-nums; padding-top: 1px; }
.feed-content { min-width: 0; }
.feed-msg { color: var(--text); word-break: break-word; white-space: pre-wrap; }
.feed-meta { margin-top: 2px; font-size: 11px; color: var(--text-faint); }

.type-badge {
  flex: none;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 5px;
  font-family: var(--mono);
  white-space: nowrap;
  margin-top: 1px;
  background: rgba(148, 163, 184, 0.13);
  color: #94a3b8;
}
.type-badge.tb-agent { background: rgba(34, 211, 238, 0.14); color: #67e8f9; }
.type-badge.tb-task { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.type-badge.tb-alert { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
.type-badge.tb-monitor { background: rgba(167, 139, 250, 0.16); color: #c4b5fd; }
.type-badge.tb-connector { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; }

/* ------------------------------------------------------------
   Health panel
   ------------------------------------------------------------ */
.health-checks { display: flex; flex-direction: column; gap: 8px; }
.health-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 11px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
}
.health-main { min-width: 0; flex: 1; }
.health-name { font-size: 13px; font-weight: 650; }
.health-detail { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; word-break: break-word; }
.health-latency {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------
   Chips, pills, badges
   ------------------------------------------------------------ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  color: #94a3b8;
  white-space: nowrap;
}
.chip.ok { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; }
.chip.warn { background: rgba(251, 191, 36, 0.16); color: #fcd34d; }
.chip.crit { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
.chip.info { background: rgba(96, 165, 250, 0.16); color: #93c5fd; }

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill.queued { background: rgba(96, 165, 250, 0.14); color: #93c5fd; border-color: rgba(96, 165, 250, 0.28); }
.pill.running { background: rgba(34, 211, 238, 0.14); color: #67e8f9; border-color: rgba(34, 211, 238, 0.28); }
.pill.done { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.28); }
.pill.failed { background: rgba(248, 113, 113, 0.14); color: #fca5a5; border-color: rgba(248, 113, 113, 0.28); }
.pill.cancelled { background: rgba(148, 163, 184, 0.12); color: #94a3b8; border-color: rgba(148, 163, 184, 0.22); }

/* ------------------------------------------------------------
   Agents
   ------------------------------------------------------------ */
.division { margin-bottom: 26px; }
.division-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 12px; flex-wrap: wrap; }
.division-dot { width: 10px; height: 10px; border-radius: 3px; align-self: center; flex: none; }
.division-name { margin: 0; font-size: 16px; font-weight: 700; }
.division-count { font-size: 11px; font-weight: 700; color: var(--text-faint); background: rgba(255,255,255,0.05); padding: 2px 8px; border-radius: 999px; }
.division-desc { width: 100%; margin: 2px 0 0; font-size: 12.5px; color: var(--text-dim); }

.agent-grid, .connector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 14px;
}

.agent-card {
  position: relative;
  padding: 15px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.agent-card:hover, .agent-card:focus-visible { transform: translateY(-2px); border-color: var(--panel-border-strong); outline: none; }
.agent-top { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.agent-avatar {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: 11px;
  font-size: 17px;
  font-weight: 800;
  color: #0b1020;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.agent-avatar.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 22px; }
.agent-id { min-width: 0; flex: 1; }
.agent-name { font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-role { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-model { margin-bottom: 9px; }
.model-chip { text-transform: none; letter-spacing: 0; font-family: var(--mono); font-size: 11px; }
.agent-task {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-2);
  padding: 7px 9px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  margin-bottom: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-meta { font-size: 11.5px; color: var(--text-faint); }

.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: #6b7280; }
.status-dot.idle { background: #64748b; }
.status-dot.running { background: var(--ok); }
.status-dot.error { background: var(--crit); }
.status-dot.paused { background: var(--warn); }
.status-dot.running.pulse { animation: pulse 1.7s ease-out infinite; }

/* ------------------------------------------------------------
   Runs
   ------------------------------------------------------------ */
.run-list { display: flex; flex-direction: column; gap: 8px; }
.run-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  color: inherit;
  font-family: inherit;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.run-row:hover { transform: translateY(-1px); border-color: var(--panel-border-strong); }
.run-main { flex: 1; min-width: 0; }
.run-title { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-meta { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.run-times { flex: none; text-align: right; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.run-times .dim { color: var(--text-faint); }

.run-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.run-detail-title { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; }
.run-detail-meta { width: 100%; font-size: 12px; color: var(--text-dim); }

.run-trace {
  position: relative;
  padding-left: 20px;
  font-family: var(--mono);
}
.run-trace::before {
  content: "";
  position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--accent), var(--accent-2), transparent);
  opacity: 0.35;
  border-radius: 2px;
}
.step {
  position: relative;
  padding: 11px 2px;
  border-bottom: 1px solid var(--panel-border);
}
.step:last-child { border-bottom: none; }
.step::before {
  content: "";
  position: absolute;
  left: -20px; top: 16px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--step-color, var(--text-faint));
  border: 2px solid var(--bg-2);
}
.step-thought { --step-color: var(--violet); }
.step-tool { --step-color: var(--accent-2); }
.step-observation { --step-color: var(--info); }
.step-final { --step-color: var(--ok); }
.step-error { --step-color: var(--crit); }
.step-system { --step-color: #64748b; }

.step-time { display: block; font-size: 10.5px; color: var(--text-faint); margin-bottom: 3px; font-variant-numeric: tabular-nums; }
.step-content { display: flex; flex-direction: column; gap: 6px; }
.step-icon { font-size: 13px; margin-right: 4px; }
.step-label {
  align-self: flex-start;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(34, 211, 238, 0.13);
  color: #67e8f9;
}
.step-text {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ------------------------------------------------------------
   Connectors
   ------------------------------------------------------------ */
.connector-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.connector-card:hover { transform: translateY(-2px); border-color: var(--panel-border-strong); }
.connector-card.disabled { opacity: 0.72; }
.connector-head { display: flex; align-items: center; gap: 11px; }
.connector-icon {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  flex: none;
  font-size: 21px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
}
.connector-id { flex: 1; min-width: 0; }
.connector-title { font-weight: 700; font-size: 14.5px; }
.connector-kind { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.connector-desc { font-size: 12.5px; color: var(--text-dim); line-height: 1.45; }
.connector-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.action-chip { text-transform: none; letter-spacing: 0; font-family: var(--mono); font-size: 10.5px; }
.test-info { font-size: 12px; font-family: var(--mono); }
.test-info.ok { color: var(--ok); }
.test-info.fail { color: var(--crit); }
.connector-actions-row { display: flex; gap: 8px; margin-top: 2px; }

.switch {
  position: relative;
  width: 46px; height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--panel-border);
  cursor: pointer;
  flex: none;
  padding: 0;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.switch .knob {
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease, background 0.2s ease;
}
.switch.on { background: var(--accent-grad); border-color: transparent; }
.switch.on .knob { background: #fff; transform: translateX(20px); }

.configure-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.configure-title { font-size: 16px; font-weight: 700; }

/* ------------------------------------------------------------
   Alerts
   ------------------------------------------------------------ */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-chip {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}
.filter-chip:hover { color: var(--text); }
.filter-chip.active { color: #06121a; background: var(--accent-grad); border-color: transparent; }

.alert-list { display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.alert-item.sev-info { border-left-color: var(--info); }
.alert-item.sev-warn { border-left-color: var(--warn); }
.alert-item.sev-critical { border-left-color: var(--crit); }
.alert-item.acked { opacity: 0.6; }

.alert-sev-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: 5px; }
.alert-item.sev-info .alert-sev-dot { background: var(--info); }
.alert-item.sev-warn .alert-sev-dot { background: var(--warn); }
.alert-item.sev-critical .alert-sev-dot { background: var(--crit); }

.alert-main { flex: 1; min-width: 0; }
.alert-title-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.alert-sev { font-size: 10px; font-weight: 800; letter-spacing: 0.08em; }
.sev-info { color: var(--info); }
.sev-warn { color: var(--warn); }
.sev-critical { color: var(--crit); }
.alert-title { font-weight: 700; font-size: 14px; }
.alert-msg { font-size: 13px; color: var(--text-dim); margin-top: 4px; line-height: 1.45; }
.alert-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 6px; }
.alert-action { flex: none; display: flex; align-items: center; }
.acked-chip { text-transform: none; }

/* ------------------------------------------------------------
   Buttons & forms
   ------------------------------------------------------------ */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--panel-border-strong);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.14s ease, background 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--panel-border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { color: #06121a; background: var(--accent-grad); border-color: transparent; font-weight: 700; }
.btn-primary:hover { background: var(--accent-grad); filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 9px; }
.btn-link {
  appearance: none;
  border: none;
  background: none;
  color: var(--accent-2);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 650;
  padding: 4px 0;
  cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }

.input, select.input {
  width: 100%;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--panel-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.input:focus, select.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.22);
}
textarea.input { resize: vertical; min-height: 70px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input.input::placeholder, textarea.input::placeholder { color: var(--text-faint); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 12px; font-weight: 650; color: var(--text-dim); }
.field-help { font-size: 11px; color: var(--text-faint); }
.checkbox { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.assign-form { margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }

.note { font-size: 12.5px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.note.warn { background: rgba(251, 191, 36, 0.12); color: #fcd34d; border-color: rgba(251, 191, 36, 0.28); }

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(4, 6, 12, 0.66);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fadeIn 0.18s ease;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: min(86vh, 860px);
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(20, 27, 45, 0.98), rgba(13, 19, 34, 0.98));
  border: 1px solid var(--panel-border-strong);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
  padding: 22px;
  animation: popIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.modal-body { padding-top: 4px; }

.agent-detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.agent-detail-id { min-width: 0; }
.agent-detail-name { font-size: 19px; font-weight: 750; }
.agent-detail-role { font-size: 13px; color: var(--text-dim); }
.agent-detail-meta { display: flex; align-items: center; gap: 8px; margin-top: 7px; font-size: 12.5px; color: var(--text-dim); flex-wrap: wrap; }
.agent-detail-meta .sep { color: var(--text-faint); }
.agent-detail-task { font-family: var(--mono); font-size: 12.5px; color: var(--accent-2); margin-bottom: 14px; }
.detail-section { margin-top: 18px; }
.detail-title { margin: 0 0 9px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); }
.prompt-box {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

/* ------------------------------------------------------------
   Toast
   ------------------------------------------------------------ */
.toast-root {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(360px, calc(100vw - 36px));
}
.toast {
  padding: 11px 15px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid var(--panel-border-strong);
  background: rgba(17, 23, 39, 0.96);
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: none; }
.toast.ok { border-left: 3px solid var(--ok); }
.toast.error { border-left: 3px solid var(--crit); }
.toast.warn { border-left: 3px solid var(--warn); }

/* ------------------------------------------------------------
   Empty / loading states
   ------------------------------------------------------------ */
.empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}
.empty.crit { color: var(--crit); }
.empty-panel { margin-top: 6px; }
.feed-empty { font-family: var(--mono); font-size: 12px; }
.noscript { position: fixed; inset: 0; display: grid; place-items: center; color: var(--text); background: var(--bg); font-family: var(--font); }

/* ------------------------------------------------------------
   Animations
   ------------------------------------------------------------ */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.conn-dot.connecting, .offline-banner-dot { animation: pulseWarn 1.4s ease-in-out infinite; }
@keyframes pulseWarn {
  0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0); }
  100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------
   Responsive
   ------------------------------------------------------------ */
@media (max-width: 900px) {
  .overview-cols { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topnav { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .brand-sub { display: none; }
  .conn { margin-left: auto; }
  .tabs { order: 3; width: 100%; margin-left: 0; }
  .tab { flex: 1; text-align: center; }
  .view { padding: 18px 14px 80px; }
  .view-title { font-size: 22px; }
  .clock { text-align: left; }
  .header-right { width: 100%; justify-content: space-between; }
  .run-row { flex-wrap: wrap; }
  .run-times { text-align: left; width: 100%; }
  .alert-item { flex-wrap: wrap; }
  .alert-action { width: 100%; }
}

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