:root {
  --radius: 14px;
  --radius-lg: 18px;
  --sidebar-w: 260px;
  --mono: 'JetBrains Mono', 'Consolas', monospace;
}

/* Dark theme — FLOW cool slate + teal */
:root,
[data-theme="dark"] {
  --bg-base: #0F1215;
  --bg-elevated: #151A1F;
  --bg-surface: #1A2128;
  --bg-surface-2: #222A33;
  --bg-hover: #2A333D;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #F3F4F6;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;
  --accent: #0F9B8E;
  --accent-2: #0D8579;
  --accent-glow: rgba(15, 155, 142, 0.35);
  --accent-soft: rgba(15, 155, 142, 0.16);
  --accent-border: rgba(15, 155, 142, 0.28);
  --accent-text: #5EEAD4;
  --accent-text-strong: #2DD4BF;
  --success: #34D399;
  --danger: #F87171;
  --warning: #FBBF24;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'DM Sans', system-ui, -apple-system, sans-serif;
  --sidebar-bg: rgba(21, 26, 31, 0.92);
  --topbar-bg: rgba(21, 26, 31, 0.78);
  --body-overlay: radial-gradient(ellipse 80% 50% at 20% -10%, rgba(15, 155, 142, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(15, 155, 142, 0.06), transparent);
  --chart-grid: rgba(255, 255, 255, 0.04);
  --chart-grid-strong: rgba(255, 255, 255, 0.06);
  --chart-tick: #6B7280;
  --chart-tooltip-bg: #1A2128;
  --chart-tooltip-border: rgba(255, 255, 255, 0.1);
  --chart-tooltip-title: #F3F4F6;
  --chart-tooltip-body: #9CA3AF;
  --flow-line-proj: rgba(15, 155, 142, 0.45);
  --flow-line-chat: rgba(45, 212, 191, 0.4);
  --flow-line-image: rgba(251, 146, 60, 0.4);
}

/* Light theme — matches FLOW mobile app */
[data-theme="light"] {
  --bg-base: #F8F9FB;
  --bg-elevated: #FFFFFF;
  --bg-surface: #FFFFFF;
  --bg-surface-2: #F3F4F6;
  --bg-hover: #EEF0F3;
  --border: #E8ECF0;
  --border-strong: #D8DEE6;
  --text: #1A1D21;
  --text-muted: #6B7280;
  --text-dim: #9CA3AF;
  --accent: #0F9B8E;
  --accent-2: #0D8579;
  --accent-glow: rgba(15, 155, 142, 0.2);
  --accent-soft: #E6F7F5;
  --accent-border: rgba(15, 155, 142, 0.28);
  --accent-text: #0D8579;
  --accent-text-strong: #0B6B61;
  --success: #059669;
  --danger: #DC2626;
  --warning: #D97706;
  --shadow: 0 1px 3px rgba(26, 29, 33, 0.06), 0 4px 16px rgba(26, 29, 33, 0.04);
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'DM Sans', system-ui, -apple-system, sans-serif;
  --sidebar-bg: rgba(248, 249, 251, 0.94);
  --topbar-bg: rgba(255, 255, 255, 0.9);
  --body-overlay: none;
  --chart-grid: rgba(26, 29, 33, 0.06);
  --chart-grid-strong: rgba(26, 29, 33, 0.08);
  --chart-tick: #9CA3AF;
  --chart-tooltip-bg: #FFFFFF;
  --chart-tooltip-border: #E8ECF0;
  --chart-tooltip-title: #1A1D21;
  --chart-tooltip-body: #6B7280;
  --flow-line-proj: rgba(15, 155, 142, 0.4);
  --flow-line-chat: rgba(13, 133, 121, 0.32);
  --flow-line-image: rgba(217, 119, 6, 0.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--body-overlay);
  background-size: auto;
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] body::before {
  display: none;
}

a { color: inherit; text-decoration: none; }

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon svg { width: 22px; height: 22px; color: #fff; }
.brand-icon img { width: 100%; height: 100%; object-fit: contain; }

.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand-text p {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 1px;
}

.sidebar-nav { padding: 16px 12px; flex: 1; overflow-y: auto; }

.nav-section {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 10px;
  margin: 20px 0 8px;
}

.nav-section:first-child { margin-top: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s ease;
  margin-bottom: 2px;
  position: relative;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: linear-gradient(135deg, var(--accent-soft), rgba(59, 158, 255, 0.06));
  color: var(--accent-text);
  border: 1px solid var(--accent-border);
}

.nav-item.active svg { opacity: 1; color: var(--accent-text-strong); }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sidebar-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
}

.sidebar-account-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-account-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-account-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-account-text strong { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account-text span { font-size: 11px; color: var(--text-dim); }
.sidebar-logout { flex-shrink: 0; }

/* Theme toggle */
.theme-toggle {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.theme-toggle-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 8px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.theme-toggle-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  color: var(--text-muted);
  background: var(--bg-hover);
}

.theme-toggle-btn.active {
  background: var(--bg-elevated);
  color: var(--accent-text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .theme-toggle-btn.active {
  background: var(--bg-hover);
  color: var(--accent-text-strong);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.2);
  border-radius: 10px;
  font-size: 12px;
  color: var(--success);
}

.status-dot {
  width: 7px;
  height: 7px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

/* ── Main ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

.topbar {
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.menu-toggle svg { width: 20px; height: 20px; }

.topbar h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-family: var(--font-display);
}

.topbar-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.topbar-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

.content {
  padding: 28px 32px 40px;
  flex: 1;
}

/* ── Stats ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  opacity: 0.8;
}

.stat-card.purple::before { background: linear-gradient(90deg, #0F9B8E, #2DD4BF); }
.stat-card.blue::before   { background: linear-gradient(90deg, #3b9eff, #60a5fa); }
.stat-card.green::before  { background: linear-gradient(90deg, #34d399, #6ee7b7); }
.stat-card.orange::before { background: linear-gradient(90deg, #fb923c, #fbbf24); }

.stat-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-card.purple .stat-icon { background: rgba(15, 155, 142, 0.15); color: #2DD4BF; }
.stat-card.blue .stat-icon   { background: rgba(59, 158, 255, 0.15); color: #60a5fa; }
.stat-card.green .stat-icon  { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.stat-card.orange .stat-icon { background: rgba(251, 146, 60, 0.15); color: #fb923c; }

.stat-card .label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card .value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.stat-card.purple .value { color: #5EEAD4; }
.stat-card.blue .value   { color: #93c5fd; }
.stat-card.green .value  { color: #6ee7b7; }
.stat-card.orange .value { color: #fdba74; }

.stat-card .sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 6px;
}

/* ── Quick actions ── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 0.2s ease;
  cursor: pointer;
}

.quick-action:hover {
  border-color: rgba(15, 155, 142, 0.35);
  background: var(--bg-surface-2);
  transform: translateY(-1px);
}

.quick-action-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-action-icon svg { width: 20px; height: 20px; }

.quick-action-icon.purple { background: rgba(15, 155, 142, 0.15); color: #2DD4BF; }
.quick-action-icon.blue   { background: rgba(59, 158, 255, 0.15); color: #60a5fa; }
.quick-action-icon.green  { background: rgba(52, 211, 153, 0.15); color: #34d399; }

.quick-action-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.quick-action-text span {
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Grid layouts ── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

/* ── Cards & Tables ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card-body { padding: 20px 22px; }

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 12px 18px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background 0.12s; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ── Provider bar chart ── */
.usage-bar-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.usage-bar-row:last-child { border-bottom: none; }

.usage-bar-label {
  width: 100px;
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}

.usage-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.6s ease;
}

.usage-bar-stats {
  width: 90px;
  text-align: right;
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green  { background: rgba(52, 211, 153, 0.12); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.25); }
.badge-red    { background: rgba(248, 113, 113, 0.12); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.25); }
.badge-purple { background: rgba(45, 212, 191, 0.12); color: #2DD4BF; border: 1px solid rgba(45, 212, 191, 0.25); }
.badge-blue   { background: rgba(96, 165, 250, 0.12); color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.25); }
.badge-gray   { background: rgba(148, 163, 184, 0.1); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.2); }
.badge-orange { background: rgba(251, 146, 60, 0.12); color: #fb923c; border: 1px solid rgba(251, 146, 60, 0.25); }
.badge-yellow { background: rgba(251, 191, 36, 0.12); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.25); }

.provider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.btn-danger:hover { background: rgba(248, 113, 113, 0.18); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-success {
  background: rgba(52, 211, 153, 0.1);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.btn-success:hover { background: rgba(52, 211, 153, 0.18); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-sm svg { width: 14px; height: 14px; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-control {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  border-color: rgba(15, 155, 142, 0.5);
  box-shadow: 0 0 0 3px rgba(15, 155, 142, 0.12);
}

.form-control::placeholder { color: var(--text-dim); }
select.form-control { cursor: pointer; }

.form-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 5px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Checkbox pills */
.checkbox-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.checkbox-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 10px;
  transition: all 0.15s;
}

.checkbox-pill:has(input:checked) {
  border-color: rgba(15, 155, 142, 0.4);
  background: rgba(15, 155, 142, 0.1);
  color: #5EEAD4;
}

.checkbox-pill input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

/* Filter pills */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-pill {
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-surface);
  transition: all 0.15s;
}

.filter-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.filter-pill.active {
  background: linear-gradient(135deg, rgba(15, 155, 142, 0.2), rgba(59, 158, 255, 0.12));
  border-color: rgba(15, 155, 142, 0.35);
  color: #5EEAD4;
}

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.show { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp 0.25s ease;
}

.modal h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 22px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ── Alerts ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 20px;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-success {
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}

.alert-danger {
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}

/* ── Empty state ── */
.empty-state {
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--text-dim);
}

.empty-icon svg { width: 26px; height: 26px; }

.empty-state h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 13px;
  color: var(--text-dim);
  max-width: 280px;
  margin: 0 auto 16px;
}

/* ── Code block ── */
.code-block {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #5EEAD4;
  word-break: break-all;
  line-height: 1.6;
}

.code-block.pre { white-space: pre; overflow-x: auto; }

/* Key reveal card */
.key-reveal {
  border-color: rgba(52, 211, 153, 0.35) !important;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.05), transparent);
}

.key-reveal .card-header {
  background: rgba(52, 211, 153, 0.06);
  border-bottom-color: rgba(52, 211, 153, 0.2);
}

.key-reveal h3 { color: #34d399; }

/* API endpoint card (legacy) */
.api-endpoint-card {
  background: linear-gradient(135deg, rgba(15, 155, 142, 0.08), rgba(59, 158, 255, 0.05));
  border: 1px solid rgba(15, 155, 142, 0.2);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 28px;
}

.api-endpoint-card h4 {
  font-size: 13px;
  font-weight: 600;
  color: #2DD4BF;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* API docs block */
.api-docs {
  padding: 24px;
}

.api-docs-compact {
  padding: 20px;
}

.api-docs-compact .api-flow-mini {
  padding: 12px;
  margin-bottom: 16px;
}

.api-docs-compact .code-syntax {
  font-size: 11.5px;
  padding: 12px 14px;
}

.api-docs-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.api-docs-header h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.api-docs-header p {
  font-size: 13px;
  color: var(--text-dim);
}

.api-docs-header code {
  font-family: var(--mono);
  color: #5EEAD4;
  font-size: 12px;
}

.endpoint-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  flex-wrap: wrap;
}

.method-tag {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.endpoint-url {
  font-family: var(--mono);
  font-size: 12px;
  color: #93c5fd;
  word-break: break-all;
}

.api-flow-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.flow-mini-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.flow-mini-step.highlight {
  border-color: rgba(15, 155, 142, 0.4);
  background: rgba(15, 155, 142, 0.1);
  color: #5EEAD4;
}

.flow-mini-arrow {
  color: var(--text-dim);
  font-size: 18px;
}

.flow-mini-icon {
  font-size: 9px;
  font-weight: 800;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(15, 155, 142, 0.2);
  color: #2DD4BF;
  letter-spacing: 0.04em;
}

.code-tabs { margin-bottom: 16px; }

.code-tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 6px 6px 0;
}

.code-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.15s;
}

.code-tab.active {
  background: var(--bg-base);
  color: #5EEAD4;
}

.code-tab:hover:not(.active) { color: var(--text-muted); }

.code-panel {
  display: none;
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  overflow: hidden;
}

.code-panel.active { display: block; }

.code-panel-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid var(--border);
}

.code-lang-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.code-syntax {
  margin: 0;
  padding: 16px 18px;
  background: var(--bg-base);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #5EEAD4;
  overflow-x: auto;
  white-space: pre;
}

.provider-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.provider-pills-label {
  font-size: 12px;
  color: var(--text-dim);
}

.provider-pill {
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(15, 155, 142, 0.1);
  border: 1px solid rgba(15, 155, 142, 0.2);
  color: #2DD4BF;
}

/* ── Flow visualiser ──────────────────────────────────────────────────── */
.flow-vis {
  display: grid;
  grid-template-columns: 210px 1fr 210px;
  min-height: 320px;
  position: relative;
  padding: 20px;
  gap: 0;
}

.flow-vis-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}

.flow-vis-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.flow-vis-col-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
  padding: 0 2px;
}

.flow-vis-hub-col {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

/* Hub */
.flow-hub-outer {
  position: relative;
  width: 110px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-hub-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(15, 155, 142, 0.3);
  animation: hubRingIdle 4s ease-in-out infinite;
  pointer-events: none;
}

.fhr1 { width: 80px;  height: 80px;  animation-delay: 0s;    animation-duration: 3.5s; }
.fhr2 { width: 100px; height: 100px; animation-delay: 0.5s;  animation-duration: 3.5s; opacity: 0.6; }
.fhr3 { width: 130px; height: 130px; animation-delay: 1s;    animation-duration: 3.5s; opacity: 0.3; border-color: rgba(59,158,255,0.2); }

@keyframes hubRingIdle {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%       { opacity: 0.9; transform: scale(1.04); }
}

.flow-hub-outer.is-live .fhr1,
.flow-hub-outer.is-live .fhr2,
.flow-hub-outer.is-live .fhr3 {
  animation-name: hubRingLive;
  animation-duration: 2s;
}

@keyframes hubRingLive {
  0%   { opacity: 0.8; transform: scale(1); }
  60%  { opacity: 0; transform: scale(1.6); }
  100% { opacity: 0; transform: scale(1.6); }
}

.flow-hub-outer.is-queued .fhr1,
.flow-hub-outer.is-queued .fhr2,
.flow-hub-outer.is-queued .fhr3 {
  animation-name: hubRingQueued;
  animation-duration: 1.4s;
  border-color: rgba(251, 191, 36, 0.55);
}

@keyframes hubRingQueued {
  0%   { opacity: 0.9; transform: scale(1); border-color: rgba(251,191,36,0.7); }
  50%  { opacity: 0.5; transform: scale(1.08); border-color: rgba(251,191,36,0.35); }
  100% { opacity: 0.9; transform: scale(1); border-color: rgba(251,191,36,0.7); }
}

.flow-hub-outer.is-queued .flow-hub-body {
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 28px rgba(251,191,36,0.3), inset 0 0 14px rgba(251,191,36,0.08);
}

/* Hub color reflects mediator rate-limit pressure */
.flow-hub-outer.rpm-ok .flow-hub-body {
  border-color: rgba(34, 197, 94, 0.7);
  background: linear-gradient(140deg, rgba(34,197,94,0.26), rgba(34,197,94,0.12));
  box-shadow: 0 0 30px rgba(34,197,94,0.3), inset 0 0 14px rgba(34,197,94,0.08);
  animation: none;
}
.flow-hub-outer.rpm-ok .flow-hub-body svg,
.flow-hub-outer.rpm-ok .flow-hub-body strong { color: #16a34a; }
.flow-hub-outer.rpm-ok .flow-hub-ring { border-color: rgba(34, 197, 94, 0.5); }

.flow-hub-outer.rpm-near .flow-hub-body {
  border-color: rgba(245, 158, 11, 0.7);
  background: linear-gradient(140deg, rgba(245,158,11,0.28), rgba(245,158,11,0.12));
  box-shadow: 0 0 30px rgba(245,158,11,0.32), inset 0 0 14px rgba(245,158,11,0.08);
  animation: none;
}
.flow-hub-outer.rpm-near .flow-hub-body svg,
.flow-hub-outer.rpm-near .flow-hub-body strong { color: #b45309; }
.flow-hub-outer.rpm-near .flow-hub-ring { border-color: rgba(245, 158, 11, 0.5); }

.flow-hub-outer.rpm-maxed .flow-hub-body {
  border-color: rgba(239, 68, 68, 0.78);
  background: linear-gradient(140deg, rgba(239,68,68,0.3), rgba(239,68,68,0.14));
  box-shadow: 0 0 34px rgba(239,68,68,0.42), inset 0 0 16px rgba(239,68,68,0.1);
  animation: none;
}
.flow-hub-outer.rpm-maxed .flow-hub-body svg,
.flow-hub-outer.rpm-maxed .flow-hub-body strong { color: #dc2626; }
.flow-hub-outer.rpm-maxed .flow-hub-ring { border-color: rgba(239, 68, 68, 0.55); }

.flow-hub-body {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(15, 155, 142,0.28), rgba(59,158,255,0.16));
  border: 2px solid rgba(15, 155, 142,0.55);
  box-shadow: 0 0 28px rgba(15, 155, 142,0.25), inset 0 0 14px rgba(15, 155, 142,0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0;
  position: relative;
  z-index: 2;
  animation: hubBodyPulse 4s ease infinite;
}

@keyframes hubBodyPulse {
  0%, 100% { box-shadow: 0 0 22px rgba(15, 155, 142,0.22), inset 0 0 10px rgba(15, 155, 142,0.06); }
  50%       { box-shadow: 0 0 40px rgba(15, 155, 142,0.38), inset 0 0 18px rgba(15, 155, 142,0.12); }
}

.flow-hub-body svg { color: #5EEAD4; opacity: 0.85; margin-bottom: 3px; }

.flow-hub-body strong {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #5EEAD4;
  line-height: 1.2;
}

.flow-hub-body span {
  font-size: 8.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* vis nodes */
.fvis-node {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.fvis-node-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.fvis-node-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.fvis-node-info {
  flex: 1;
  min-width: 0;
}

.fvis-node-info strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.fvis-node-type {
  font-size: 9.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fvis-node-type.chat  { background: rgba(15, 155, 142,0.15); color: #5EEAD4; }
.fvis-node-type.image { background: rgba(249,115,22,0.14);  color: #fb923c; }

.fvis-node-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
}

.fvis-node-status.on  { background: var(--success); }
.fvis-node-status.hot {
  background: #0F9B8E;
  box-shadow: 0 0 6px rgba(15, 155, 142,0.7);
  animation: statusPop 0.4s ease;
}
.fvis-node-status.off { background: var(--danger); opacity: 0.5; }

@keyframes statusPop {
  0%   { transform: scale(2); opacity: 0.3; }
  100% { transform: scale(1); opacity: 1; }
}

.fvis-key-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.15);
}

.fvis-key-prov {
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fvis-node-stats {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.fvis-bar {
  height: 3px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
}

.fvis-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.7s ease;
}

/* RPM pressure meter (public landing provider keys) */
.fvis-rpm-meter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.fvis-rpm-track {
  flex: 1;
  height: 5px;
  background: rgba(148, 163, 184, 0.18);
  border-radius: 3px;
  overflow: hidden;
}

.fvis-rpm-fill {
  height: 100%;
  border-radius: 3px;
  width: 0;
  transition: width 0.7s ease, background 0.3s ease;
  background: #22c55e;
}

.fvis-rpm-caption {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: #16a34a;
}

.fvis-rpm-meter.near .fvis-rpm-fill { background: #f59e0b; }
.fvis-rpm-meter.near .fvis-rpm-caption { color: #d97706; }

.fvis-rpm-meter.maxed .fvis-rpm-fill { background: #ef4444; }
.fvis-rpm-meter.maxed .fvis-rpm-caption { color: #dc2626; }

.fvis-rpm-meter.no-limit .fvis-rpm-fill {
  background: repeating-linear-gradient(90deg, rgba(148,163,184,0.35) 0 6px, transparent 6px 12px);
}
.fvis-rpm-meter.no-limit .fvis-rpm-caption { color: var(--text-dim); }

.fvis-key.is-maxed {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25), 0 0 14px rgba(239, 68, 68, 0.12);
}

.fvis-empty {
  display: block;
  text-align: center;
  padding: 18px 12px;
  font-size: 11.5px;
  color: var(--accent);
  border: 1px dashed rgba(15, 155, 142,0.35);
  border-radius: 10px;
  text-decoration: none;
  margin-top: 4px;
  transition: background 0.2s;
}
.fvis-empty:hover { background: rgba(15, 155, 142,0.07); }

/* Routes bar */
.flow-routes-bar {
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  background: rgba(0,0,0,0.12);
}

.flow-routes-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.flow-routes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.flow-route-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 20px;
  animation: feedSlideIn 0.35s ease;
}

.flow-route-chip .route-arrow { color: var(--text-dim); }
.flow-route-chip .route-meta  { color: var(--text-dim); font-size: 10px; }
.flow-route-chip .route-status.ok  { color: var(--success); font-size: 10px; }
.flow-route-chip .route-status.err { color: var(--danger);  font-size: 10px; }
.flow-routes-empty { font-size: 11.5px; color: var(--text-dim); }

@media (max-width: 860px) {
  .flow-vis { grid-template-columns: 1fr 90px 1fr; padding: 14px 12px; }
  .flow-hub-outer { width: 80px; height: 80px; }
  .flow-hub-body  { width: 54px; height: 54px; }
  .fhr3 { width: 100px; height: 100px; }
  .api-docs-header { flex-direction: column; }
}

/* Pagination */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
}

/* Provider name cell */
.provider-name {
  font-weight: 600;
  font-size: 13.5px;
}

.provider-slug {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
  margin-top: 2px;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
}

.sidebar-overlay.show { display: block; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .content { padding: 20px 16px 32px; }
  .topbar { padding: 14px 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ── Live monitoring ── */
.live-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
}

.live-pulse {
  width: 9px;
  height: 9px;
  background: var(--success);
  border-radius: 50%;
  animation: livePulse 1.5s ease infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}

.live-meta {
  font-size: 12px;
  color: var(--text-dim);
}

.range-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}

.range-btn {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.range-btn.active {
  background: linear-gradient(135deg, rgba(15, 155, 142, 0.25), rgba(59, 158, 255, 0.15));
  color: #5EEAD4;
}

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.chart-card h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-wrap.sm { height: 180px; }

/* Live feed */
.live-feed { max-height: 420px; overflow-y: auto; }

.live-feed tbody tr {
  animation: feedSlideIn 0.35s ease;
}

@keyframes feedSlideIn {
  from { opacity: 0; transform: translateY(-8px); background: rgba(15, 155, 142, 0.08); }
  to { opacity: 1; transform: translateY(0); }
}

.live-feed .row-new td {
  background: rgba(15, 155, 142, 0.06) !important;
}

.status-dot-ok { color: var(--success); }
.status-dot-err { color: var(--danger); }

/* Diagnostics */
.diag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.diag-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.diag-card .diag-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.diag-card .diag-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.diag-card .diag-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.health-ok { color: var(--success); }
.health-warn { color: var(--warning); }
.health-err { color: var(--danger); }

.pool-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pool-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 12.5px;
}

.pool-chip .count {
  font-weight: 700;
  color: #2DD4BF;
}

.warn-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(251, 146, 60, 0.08);
  border: 1px solid rgba(251, 146, 60, 0.25);
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #fdba74;
}

.log-row-expandable { cursor: pointer; }
.log-error-detail {
  display: none;
  padding: 10px 18px 14px 48px;
  font-size: 12px;
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.05);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
}
.log-error-detail.show { display: block; }

@media (max-width: 1100px) {
  .chart-grid { grid-template-columns: 1fr; }
  .diag-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .diag-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════
   Dashboard v2 — panels, pipeline, analytics
   ══════════════════════════════════════════ */

.live-strip-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.dot-sm {
  width: 6px !important;
  height: 6px !important;
  display: inline-block;
  margin-right: 4px;
}

.dash-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.dash-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.dash-panel-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-panel-title h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dash-panel-title p {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.dash-panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.panel-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.panel-icon svg { width: 20px; height: 20px; }
.panel-icon.purple { background: rgba(15, 155, 142,0.15); color: #2DD4BF; }
.panel-icon.blue   { background: rgba(59,158,255,0.15); color: #60a5fa; }
.panel-icon.green  { background: rgba(52,211,153,0.15); color: #34d399; }
.panel-icon.orange { background: rgba(251,146,60,0.15); color: #fb923c; }

.dash-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* (flow pipeline v2 styles consolidated into flow visualiser above) */

/* Pool strip */
.pool-strip-panel { padding: 0; }

.pool-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.pool-strip-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pool-strip-title svg { width: 16px; height: 16px; opacity: 0.7; }

.pool-strip {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  overflow-x: auto;
  flex-wrap: nowrap;
}

.pool-strip-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s;
}

.pool-strip-item.has-keys {
  border-color: rgba(15, 155, 142, 0.25);
}

.pool-strip-item.no-keys { opacity: 0.45; }

.pool-strip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pool-strip-name {
  font-size: 12.5px;
  font-weight: 500;
}

.pool-strip-count {
  font-size: 13px;
  font-weight: 800;
  color: #2DD4BF;
  min-width: 18px;
  text-align: center;
}

/* Analytics grid */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.chart-panel {
  padding: 0;
  position: relative;
  overflow: hidden;
}

.chart-panel::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.chart-panel.accent-purple::before { background: linear-gradient(90deg, #0F9B8E, #2DD4BF); }
.chart-panel.accent-blue::before   { background: linear-gradient(90deg, #3b9eff, #60a5fa); }
.chart-panel.accent-orange::before { background: linear-gradient(90deg, #f97316, #fbbf24); }
.chart-panel.accent-green::before  { background: linear-gradient(90deg, #34d399, #6ee7b7); }

.chart-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 8px;
}

.chart-panel-head h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.chart-panel .chart-wrap {
  height: 200px;
  padding: 0 12px 16px;
}

.chart-panel .chart-wrap-sm {
  height: 180px;
}

/* Feed panel */
.feed-panel .live-feed { max-height: 360px; }

.feed-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.feed-empty {
  padding: 48px 24px;
  text-align: center;
}

.feed-empty h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 12px 0 6px;
}

.feed-empty p {
  font-size: 12px;
  color: var(--text-dim);
}

.api-panel { margin-bottom: 24px; }

@media (max-width: 1100px) {
  .flow-pipeline-inner {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .flow-lane-projects,
  .flow-lane-keys {
    border: none;
    border-bottom: 1px solid var(--border);
  }
  .flow-lane-bridge {
    flex-direction: row;
    padding: 20px;
    min-height: 120px;
  }
  .bridge-line {
    width: auto;
    height: 2px;
    flex: 1;
    min-height: 0;
    background: linear-gradient(90deg, transparent, rgba(15, 155, 142, 0.3), transparent);
  }
  .flow-lane-bridge.is-live .bridge-line {
    background: linear-gradient(90deg, transparent, #0F9B8E, transparent);
  }
  .analytics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .flow-key-grid { grid-template-columns: 1fr; }
}

/* ── Chat Tester ── */
.chatbot-page { padding-bottom: 32px; }

.chatbot-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  min-height: calc(100vh - 180px);
  align-items: stretch;
}

.chatbot-config-body .form-group { margin-bottom: 16px; }
.chatbot-config-body .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chatbot-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.chatbot-meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.chatbot-meta-item code {
  font-family: var(--mono);
  font-size: 12px;
  color: #5EEAD4;
  background: rgba(15, 155, 142, 0.1);
  padding: 2px 8px;
  border-radius: 6px;
}

.chatbot-panel {
  display: flex;
  flex-direction: column;
  min-height: 560px;
}

.chatbot-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.chatbot-status {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}
.chatbot-status.is-loading { color: var(--accent-2); }
.chatbot-status.is-ok { color: var(--success); }
.chatbot-status.is-error { color: var(--danger); }

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 360px;
  max-height: calc(100vh - 320px);
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.chat-welcome {
  margin: auto;
  text-align: center;
  max-width: 380px;
  color: var(--text-muted);
}
.chat-welcome-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: rgba(15, 155, 142, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.chat-welcome-icon svg { width: 24px; height: 24px; }
.chat-welcome h4 {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 8px;
}
.chat-welcome p { font-size: 14px; line-height: 1.6; }
.chat-welcome code {
  font-family: var(--mono);
  font-size: 12px;
  color: #5EEAD4;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}
.chat-msg-user { align-self: flex-end; align-items: flex-end; }
.chat-msg-assistant,
.chat-msg-error { align-self: flex-start; align-items: flex-start; }

.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg-user .chat-bubble {
  background: linear-gradient(135deg, #0F9B8E, #0D8579);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg-assistant .chat-bubble {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-msg-error .chat-bubble {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  border-bottom-left-radius: 4px;
}

.chat-msg-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  padding: 0 4px;
}

.chatbot-composer {
  display: flex;
  gap: 12px;
  padding: 16px 20px;
  align-items: flex-end;
}

.chatbot-input {
  flex: 1;
  resize: none;
  min-height: 48px;
  max-height: 160px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}
.chatbot-input:focus {
  outline: none;
  border-color: rgba(15, 155, 142, 0.5);
  box-shadow: 0 0 0 3px rgba(15, 155, 142, 0.12);
}

.chatbot-send {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  flex-shrink: 0;
}
.chatbot-send svg { width: 16px; height: 16px; }
.chatbot-send:disabled { opacity: 0.5; cursor: not-allowed; }

@media (max-width: 900px) {
  .chatbot-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .chatbot-messages { max-height: 50vh; }
}

.chatbot-layout-simple {
  grid-template-columns: 260px 1fr;
}

/* Mode tabs */
.tester-mode-tabs {
  display: flex;
  gap: 10px;
}
.tester-mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.tester-mode-tab svg { width: 15px; height: 15px; }
.tester-mode-tab.active {
  background: rgba(15, 155, 142, 0.1);
  border-color: rgba(15, 155, 142, 0.4);
  color: #5EEAD4;
}

/* Image results pane */
.image-results {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 24px;
  overflow-y: auto;
}
.image-result-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.image-result-prompt {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}
.image-result-img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: block;
}
.image-result-meta {
  font-size: 11px;
  color: var(--text-dim);
}
.image-result-loading .image-skeleton {
  height: 240px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--bg-surface-2) 25%, var(--bg-hover) 50%, var(--bg-surface-2) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── API Keys page ── */
.api-keys-page { max-width: 1200px; }

.keys-stat-grid { margin-bottom: 20px; }

.keys-flow-wizard {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.keys-flow-wizard .wizard-step {
  min-width: 0;
  flex-direction: row;
  align-items: flex-start;
  padding: 16px 18px;
}

.keys-flow-wizard .wizard-step > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.keys-flow-wizard .wizard-step strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.keys-flow-wizard .wizard-step span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  line-height: 1.4;
}

.keys-section-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: sticky;
  top: 12px;
  z-index: 20;
  backdrop-filter: blur(8px);
}

.keys-section-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.keys-section-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.keys-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 20px;
  background: rgba(15, 155, 142, 0.12);
  color: #5EEAD4;
  font-size: 11px;
  font-weight: 700;
}

.keys-section { scroll-margin-top: 80px; }

.keys-section-header {
  align-items: flex-start;
  gap: 16px;
}

.keys-section-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.keys-section-title h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

.keys-section-title p {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  margin: 0;
  max-width: 560px;
}

.keys-section-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.keys-section-icon svg { width: 20px; height: 20px; }

.keys-section-icon-provider {
  background: rgba(139, 92, 246, 0.12);
  color: #a78bfa;
}

.keys-section-icon-project {
  background: rgba(59, 158, 255, 0.12);
  color: #60a5fa;
}

.keys-section-icon-docs {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
}

.keys-provider-table-wrap {
  border-top: 1px solid var(--border);
}

.keys-provider-table { font-size: 13px; }

.keys-provider-row {
  border-left: 3px solid transparent;
}

.keys-provider-row[data-provider="google"]    { border-left-color: #3b82f6; }
.keys-provider-row[data-provider="groq"]      { border-left-color: #f97316; }
.keys-provider-row[data-provider="openrouter"]{ border-left-color: #8b5cf6; }
.keys-provider-row[data-provider="anthropic"] { border-left-color: #f59e0b; }
.keys-provider-row[data-provider="cloudflare"]{ border-left-color: #f97316; }
.keys-provider-row[data-provider="mistral"]   { border-left-color: #ef4444; }
.keys-provider-row[data-provider="cohere"]    { border-left-color: #10b981; }
.keys-provider-row[data-provider="together"]  { border-left-color: #6366f1; }

.provider-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.provider-pill-google     { background: rgba(59, 130, 246, 0.12); color: #93c5fd; border-color: rgba(59, 130, 246, 0.25); }
.provider-pill-groq       { background: rgba(249, 115, 22, 0.12); color: #fdba74; border-color: rgba(249, 115, 22, 0.25); }
.provider-pill-openrouter { background: rgba(139, 92, 246, 0.12); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.25); }
.provider-pill-cloudflare { background: rgba(249, 115, 22, 0.12); color: #fdba74; border-color: rgba(249, 115, 22, 0.25); }

.keys-cf-account {
  margin-top: 8px;
  min-width: 140px;
  font-family: var(--mono);
  font-size: 11px;
}

.keys-model-input {
  min-width: 160px;
  font-family: var(--mono);
  font-size: 11px;
}

.keys-rpm-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.keys-rpm-group input { width: 64px; text-align: center; }
.keys-rpm-group select { width: 76px; }

.keys-usage-cell {
  font-size: 12px;
  white-space: nowrap;
}

.keys-usage-cell strong {
  font-weight: 700;
  color: var(--text);
}

.keys-secret-preview {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  margin-top: 4px;
}

.keys-actions-cell { width: 1%; white-space: nowrap; }

.keys-row-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.keys-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(251, 191, 36, 0.06);
}

.keys-info-banner svg {
  width: 18px;
  height: 18px;
  color: #fbbf24;
  flex-shrink: 0;
  margin-top: 1px;
}

.keys-info-banner p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

.project-keys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 20px 22px;
}

.project-key-card {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.project-key-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}

.project-key-card.is-revoked,
.project-key-card.is-expired {
  opacity: 0.72;
}

.pkc-top { display: flex; flex-direction: column; gap: 12px; }

.pkc-identity {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pkc-color-form { flex-shrink: 0; }

.pkc-color-input {
  width: 36px;
  height: 36px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: none;
}

.pkc-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.pkc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pkc-key-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.pkc-key {
  flex: 1;
  font-size: 11px;
  color: #c4b5fd;
  word-break: break-all;
  line-height: 1.4;
}

.pkc-copy-btn { flex-shrink: 0; padding: 6px 8px; }
.pkc-copy-btn svg { width: 14px; height: 14px; }

.pkc-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 16px;
  margin: 0;
}

.pkc-meta > div { min-width: 0; }

.pkc-meta dt {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.pkc-meta dd {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
}

.pkc-meta dd code {
  font-size: 11px;
}

.pkc-routing {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.pkc-routing-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.pkc-routing-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pkc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.keys-docs-panel {
  margin-top: 8px;
  scroll-margin-top: 80px;
}

.keys-docs-panel > summary {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid transparent;
  transition: background 0.15s;
}

.keys-docs-panel > summary::-webkit-details-marker { display: none; }

.keys-docs-panel > summary:hover {
  background: rgba(255, 255, 255, 0.02);
}

.keys-docs-panel[open] > summary {
  border-bottom-color: var(--border);
}

.keys-docs-chevron {
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-right: 4px;
}

.keys-docs-panel[open] .keys-docs-chevron {
  transform: rotate(-135deg);
  margin-top: 6px;
}

.keys-docs-body { padding: 0 !important; }

.keys-docs-body .api-docs {
  padding: 20px 22px 24px;
}

.keys-curl-editor {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
  min-height: 200px;
  resize: vertical;
}

.keys-curl-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.keys-curl-preview {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  font-size: 11.5px;
}

.keys-row-actions .btn svg {
  width: 14px;
  height: 14px;
}

.keys-key-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-base);
}

.keys-key-picker label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}

.keys-key-picker label:hover {
  background: var(--bg-hover);
}

@media (max-width: 900px) {
  .keys-flow-wizard { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .keys-section-nav { position: static; }
  .project-keys-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr; }
  .keys-section-header { flex-direction: column; align-items: stretch; }
  .keys-section-header .btn { width: 100%; justify-content: center; }
}

/* Legacy keys flow (kept for compatibility) */
.keys-flow-banner .card-body { padding: 18px 24px; }
.keys-flow-step {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.keys-flow-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(15, 155, 142,.2);
  color: #5EEAD4;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
}
.keys-flow-arrow { color: var(--text-dim); font-size: 18px; }

.form-control-sm {
  padding: 6px 10px;
  font-size: 12px;
  min-height: 32px;
}

.api-endpoints-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.wizard-steps {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.wizard-step {
  flex: 1;
  min-width: 140px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
}
.wizard-step.active {
  border-color: rgba(15, 155, 142,.4);
  background: rgba(15, 155, 142,.08);
  color: var(--text);
}
.wizard-step.done .wizard-num {
  background: rgba(52,211,153,.2);
  color: var(--success);
}
.wizard-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800;
}

/* ── fvis RPM badge ───────────────────────────────────────────────────── */
.fvis-rpm {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
}
.fvis-rpm.hot {
  color: #ef4444;
  background: rgba(239,68,68,0.12);
  animation: rpmPulse 1s ease infinite;
}
@keyframes rpmPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}
.fvis-bar-rpm {
  margin-bottom: 3px;
}
.fvis-node.fvis-key {
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.fvis-node.fvis-key:hover {
  background: rgba(255,255,255,0.04);
  transform: translateX(-2px);
  box-shadow: 2px 0 0 0 var(--kc, #0F9B8E) inset;
}

.fvis-node.fvis-proj {
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.fvis-node.fvis-proj:hover {
  background: rgba(255,255,255,0.04);
  transform: translateX(2px);
  box-shadow: -2px 0 0 0 var(--proj-color, #0F9B8E) inset;
}
.fvis-node.fvis-proj.has-web-context {
  --proj-color: #34d399;
}
.fvis-web-badge {
  font-size: 10px;
  margin-left: 2px;
}

/* ── Key Detail Panel (slide-out) ─────────────────────────────────────── */
.kdp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.kdp-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.kdp-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 96vw;
  height: 100vh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 1101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  box-shadow: -8px 0 32px rgba(0,0,0,0.35);
}
.kdp-panel.open {
  transform: translateX(0);
}

.kdp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.kdp-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.kdp-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #0F9B8E;
  flex-shrink: 0;
}
.kdp-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 2px;
}
.kdp-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
}
.kdp-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.kdp-close:hover { background: var(--bg-elevated); color: var(--text); }

.kdp-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.kdp-loading {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}
.kdp-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.kdp-section:last-child { border-bottom: none; }
.kdp-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 10px;
}
.kdp-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.kdp-stat {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kdp-stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.kdp-stat-lbl {
  font-size: 11px;
  color: var(--text-dim);
}
.kdp-rpm-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.kdp-log-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kdp-log-row {
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: background .15s;
}
.kdp-log-row:hover { background: rgba(255,255,255,0.06); }
.kdp-log-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.kdp-log-preview {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}

/* ── Log detail modal ─────────────────────────────────────────────────── */
.modal-wide {
  width: 820px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
}
.ldm-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 640px) {
  .ldm-cols { grid-template-columns: 1fr; }
}
.ldm-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.ldm-pre {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 360px;
  overflow-y: auto;
  margin: 0;
}

/* ── Clickable log rows ───────────────────────────────────────────────── */
tr.log-row-clickable {
  cursor: pointer;
  transition: background .12s;
}
tr.log-row-clickable:hover td {
  background: rgba(255,255,255,0.03);
}
tr.log-row-error td:first-child {
  border-left: 3px solid #ef4444;
  padding-left: 9px;
}

/* ── Public landing page ─────────────────────────────────────────────── */
.landing-body { overflow-y: auto; }

.landing {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.landing-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 0;
}

.landing-brand { display: flex; align-items: center; gap: 14px; }
.landing-brand .brand-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.landing-brand .brand-icon svg { width: 22px; height: 22px; }
.landing-brand .brand-icon img { width: 100%; height: 100%; object-fit: contain; }
.landing-brand-text h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.03em; font-family: var(--font-display); }
.landing-brand-text p { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }

.landing-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.landing-main { display: flex; flex-direction: column; gap: 24px; flex: 1; }

.landing-hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  align-items: center;
}

.landing-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-text-strong);
  margin-bottom: 14px;
}

.landing-hero-text h2 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-family: var(--font-display);
  margin-bottom: 14px;
}
.landing-hero-text p { font-size: 14.5px; line-height: 1.6; color: var(--text-muted); max-width: 60ch; }

.landing-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.landing-stat {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.landing-stat-val { display: block; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.landing-stat-lbl { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.landing-flow { margin: 0; }

.landing-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--accent-soft), rgba(59, 158, 255, 0.05));
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
}
.landing-cta h3 { font-size: 18px; font-weight: 700; font-family: var(--font-display); margin-bottom: 4px; }
.landing-cta p { font-size: 13.5px; color: var(--text-muted); }

@media (max-width: 860px) {
  .landing-hero { grid-template-columns: 1fr; }
  .landing-hero-text h2 { font-size: 24px; }
}
