@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

/* ═══════════════════════════════════════
   AI Agent Dashboard — HTML/CSS Kit v1.0.0 — Switchboard design system
   © 2026 Ashlar Studio · https://ohgotit.com/creator/ashlar-studio
   Support: seller-ashlar@ohgotit.com
   ═══════════════════════════════════════ */

/* ── Tokens (dark theme is the default) ── */
:root {
  color-scheme: dark;
  --primary: #06b6d4;
  --primary-strong: #0e7490;
  --primary-text: #67e8f9;
  --primary-muted: rgba(6, 182, 212, 0.13);
  --primary-glow: rgba(6, 182, 212, 0.28);
  --success: #4ade80;
  --success-muted: rgba(34, 197, 94, 0.13);
  --warning: #facc15;
  --warning-muted: rgba(234, 179, 8, 0.13);
  --danger: #f87171;
  --danger-muted: rgba(239, 68, 68, 0.14);
  --info: #a78bfa;
  --info-muted: rgba(139, 92, 246, 0.15);

  --bg-body: #09090b;
  --bg-surface: #111113;
  --bg-card: #17171a;
  --bg-elevated: #232327;
  --bg-input: #0e0e10;
  --bg-hover: rgba(6, 182, 212, 0.07);
  --bg-code: #050506;

  --text-primary: #fafafa;
  --text-secondary: #b4b4bd;
  --text-muted: #8e8e98;
  --text-inverse: #09090b;

  --border: #27272a;
  --border-hover: #3f3f46;

  --sidebar-width: 240px;
  --header-height: 56px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;

  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

[data-theme="light"] {
  color-scheme: light;
  --primary-text: #0e7490;
  --primary-muted: rgba(8, 145, 178, 0.1);
  --primary-glow: rgba(8, 145, 178, 0.22);
  --success: #15803d;
  --success-muted: rgba(21, 128, 61, 0.1);
  --warning: #92400e;
  --warning-muted: rgba(217, 119, 6, 0.13);
  --danger: #b91c1c;
  --danger-muted: rgba(185, 28, 28, 0.08);
  --info: #6d28d9;
  --info-muted: rgba(109, 40, 217, 0.09);

  --bg-body: #f6f6f7;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-elevated: #efeff1;
  --bg-input: #ffffff;
  --bg-hover: rgba(8, 145, 178, 0.06);
  --bg-code: #fafafa;

  --text-primary: #18181b;
  --text-secondary: #4b4b55;
  --text-muted: #62626c;
  --text-inverse: #ffffff;

  --border: #e4e4e7;
  --border-hover: #d0d0d6;

  --shadow-sm: 0 1px 2px rgba(24, 24, 27, 0.06);
  --shadow-md: 0 4px 12px rgba(24, 24, 27, 0.08);
  --shadow-lg: 0 12px 32px rgba(24, 24, 27, 0.12);
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }

/* ── Accessibility ── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  background: var(--primary-strong); color: #fff; font-weight: 600;
  padding: 0.5rem 1rem; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 0.75rem; text-decoration: none; }
:focus-visible { outline: 2px solid var(--primary-text); outline-offset: 2px; }
.form-input:focus-visible, .topbar__search input:focus-visible { outline: none; }
main:focus { outline: none; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
[data-theme="dark"] .icon--moon, [data-theme="light"] .icon--sun { display: none; }

/* ── App shell ── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  transition: transform var(--duration-normal) var(--ease);
}
.sidebar__brand {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
  color: var(--text-primary); font-weight: 700; font-size: 1.05rem;
}
.sidebar__brand:hover { text-decoration: none; }
.sidebar__logo {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
  display: flex; align-items: center; justify-content: center; color: #fff;
}
.sidebar__logo .icon { width: 18px; height: 18px; }
.sidebar__nav { flex: 1; padding: 1rem 0.75rem; overflow-y: auto; }
.sidebar__section { margin-bottom: 1.5rem; }
.sidebar__label {
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); padding: 0 0.75rem; margin-bottom: 0.5rem;
}
.sidebar__link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.75rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
}
.sidebar__link:hover { color: var(--text-primary); background: var(--bg-hover); text-decoration: none; }
.sidebar__link[aria-current="page"] { color: var(--primary-text); background: var(--primary-muted); font-weight: 600; box-shadow: inset 2px 0 0 var(--primary); }
.sidebar__badge {
  margin-left: auto; font-size: 0.7rem; font-weight: 600;
  padding: 0.1rem 0.5rem; border-radius: var(--radius-full);
  background: var(--primary-muted); color: var(--primary-text);
}
.sidebar__footer {
  padding: 0.75rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.25rem;
}
.sidebar__user {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.75rem;
  padding: 0.5rem; border-radius: var(--radius-sm); color: inherit;
}
.sidebar__user:hover { background: var(--bg-hover); text-decoration: none; }
.sidebar__user-name { display: block; font-size: 0.85rem; font-weight: 600; }
.sidebar__user-role { display: block; font-size: 0.72rem; color: var(--text-muted); }
.sidebar__signout {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm); color: var(--text-muted);
}
.sidebar__signout:hover { background: var(--bg-hover); color: var(--danger); }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, 0.5); }

.avatar {
  width: 36px; height: 36px; border-radius: var(--radius-full); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.78rem; color: #fff;
  background: linear-gradient(135deg, #6366f1, #ec4899);
}
.avatar--sm { width: 28px; height: 28px; font-size: 0.68rem; }
.avatar--lg { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar--c1 { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.avatar--c2 { background: linear-gradient(135deg, #10b981, #3b82f6); }
.avatar--c3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.avatar--c4 { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.avatar--c5 { background: linear-gradient(135deg, #14b8a6, #84cc16); }

.main { margin-left: var(--sidebar-width); flex: 1; min-width: 0; min-height: 100vh; }

/* ── Top bar ── */
.topbar {
  height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 2rem; border-bottom: 1px solid var(--border);
  background: var(--bg-surface); position: sticky; top: 0; z-index: 30;
}
.topbar__left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.topbar__title { font-size: 1.05rem; font-weight: 700; white-space: nowrap; }
.topbar__actions { display: flex; align-items: center; gap: 0.75rem; }
.topbar__search {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.875rem; min-width: 240px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.topbar__search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.topbar__search input { background: transparent; border: none; outline: none; font-size: 0.85rem; width: 100%; color: var(--text-primary); }
.topbar__search input::placeholder { color: var(--text-muted); }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); text-decoration: none; }
.icon-btn__dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg-surface); }
.menu-btn { display: none; border: none; }

/* ── Page ── */
.page { padding: 2rem; max-width: 1400px; }
.page__header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.page__title { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.page__subtitle { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.25rem; }
.page__actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.breadcrumb { display: flex; gap: 0.5rem; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.breadcrumb a { color: var(--text-secondary); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.55rem 1.1rem; font-size: 0.85rem; font-weight: 600;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  transition: all var(--duration-fast) var(--ease); white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn--primary { background: var(--primary-strong); color: #fff; }
.btn--primary:hover { background: #155e75; box-shadow: 0 4px 14px var(--primary-glow); }
.btn--outline { background: transparent; border-color: var(--border-hover); color: var(--text-secondary); }
.btn--outline:hover { border-color: var(--primary); color: var(--text-primary); }
.btn--danger { background: var(--danger-muted); color: var(--danger); }
.btn--ghost { background: none; color: var(--primary-text); padding-inline: 0.5rem; }
.btn--sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn--block { width: 100%; }

/* ── Cards ── */
.card, .data-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.card { padding: 1.25rem; }
.data-card { overflow: hidden; }
.card__header, .data-card__header {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}
.card__header { margin-bottom: 1rem; }
.data-card__header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card__title, .data-card__title { font-size: 1rem; font-weight: 600; }
.card__subtitle { font-size: 0.8rem; color: var(--text-muted); }
.stack > * + * { margin-top: 1.25rem; }

/* ── KPI cards ── */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 1.5rem; }
.kpi-row--5 { grid-template-columns: repeat(5, 1fr); }
.kpi-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; transition: border-color var(--duration-fast) var(--ease);
}
.kpi-card:hover { border-color: var(--border-hover); }
.kpi-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.kpi-card__icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.kpi-card__icon--primary { background: var(--primary-muted); color: var(--primary-text); }
.kpi-card__icon--success { background: var(--success-muted); color: var(--success); }
.kpi-card__icon--warning { background: var(--warning-muted); color: var(--warning); }
.kpi-card__icon--info { background: var(--info-muted); color: var(--info); }
.kpi-card__trend { font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: var(--radius-full); }
.kpi-card__trend--up { background: var(--success-muted); color: var(--success); }
.kpi-card__trend--down { background: var(--danger-muted); color: var(--danger); }
.kpi-card__value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-card__label { font-size: 0.8rem; color: var(--text-muted); }

/* ── Tables ── */
.table-scroll { position: relative; overflow-x: auto; }
.data-table th {
  padding: 0.7rem 1.25rem; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); text-align: left; background: var(--bg-hover); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table td { padding: 0.75rem 1.25rem; font-size: 0.875rem; color: var(--text-secondary); border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td, .data-table tr.is-selected td { background: var(--bg-hover); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-strong { font-weight: 600; color: var(--text-primary); }
.cell-money { font-weight: 600; color: var(--success); font-variant-numeric: tabular-nums; }
.person { display: flex; align-items: center; gap: 0.75rem; }
.person__name { display: block; font-weight: 600; color: var(--text-primary); }
a.person__name:hover { color: var(--primary-text); }
.person__meta { display: block; font-size: 0.78rem; color: var(--text-muted); }
.check { width: 16px; height: 16px; accent-color: var(--primary-strong); cursor: pointer; }
.row-actions { display: flex; gap: 0.25rem; justify-content: flex-end; }
.row-actions .icon-btn { width: 32px; height: 32px; border-color: transparent; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.75rem 1.25rem; border-top: 1px solid var(--border); font-size: 0.82rem; color: var(--text-muted); }

/* ── Status badges ── */
.status { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; font-weight: 600; padding: 0.2rem 0.65rem; border-radius: var(--radius-full); white-space: nowrap; }
.status__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--live, .status--resolved, .status--pass { background: var(--success-muted); color: var(--success); }
.status--paused { background: var(--bg-elevated); color: var(--text-muted); }
.status--error, .status--fail { background: var(--danger-muted); color: var(--danger); }
.status--escalated, .status--warn { background: var(--warning-muted); color: var(--warning); }
.status--draft { background: var(--info-muted); color: var(--info); }
.status--open { background: var(--primary-muted); color: var(--primary-text); }
.status--live .status__dot { box-shadow: 0 0 0 0 currentColor; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 5px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.tag { display: inline-block; font-size: 0.72rem; font-weight: 500; padding: 0.1rem 0.5rem; border-radius: var(--radius-sm); background: var(--bg-elevated); color: var(--text-secondary); }

/* ── Toolbar & filters ── */
.toolbar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar__search { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.toolbar__search .icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; height: 16px; }
.toolbar__search .form-input { padding-left: 2.25rem; }
.segmented { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 3px; gap: 2px; background: var(--bg-elevated); border-radius: var(--radius-sm); }
.segmented__btn { flex-shrink: 0; }
.segmented__btn { border: none; background: none; padding: 0.35rem 0.8rem; border-radius: 4px; font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); }
.segmented__btn:hover { color: var(--text-primary); }
.segmented__btn[aria-pressed="true"] { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.bulk-bar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.6rem 1.25rem; background: var(--primary-muted); border-bottom: 1px solid var(--border);
  font-size: 0.85rem; font-weight: 600; color: var(--primary-text);
}
.bulk-bar__actions { display: flex; gap: 0.5rem; margin-left: auto; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; scrollbar-width: none; }
.tab {
  padding: 0.7rem 1rem; border: none; background: none; white-space: nowrap;
  font-size: 0.875rem; font-weight: 500; color: var(--text-secondary);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text-primary); }
.tab[aria-selected="true"] { color: var(--primary-text); border-bottom-color: var(--primary); }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 0.4rem; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-input {
  width: 100%; padding: 0.6rem 0.875rem;
  background: var(--bg-input); border: 1px solid var(--border-hover); border-radius: var(--radius-sm);
  color: var(--text-primary); font-size: 0.875rem; outline: none;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
select.form-input { appearance: none; padding-right: 2.25rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e98' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.75rem center; cursor: pointer; }
.form-input--auto { width: auto; }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.75rem; margin-top: 0.5rem; }
.form-status { font-size: 0.85rem; color: var(--success); margin-right: auto; }
.inline-form { display: flex; gap: 0.5rem; }
.inline-form .form-input { flex: 1; }
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--text-secondary); cursor: pointer; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 0; border-top: 1px solid var(--border); }
.card__header + .switch-row { border-top: none; padding-top: 0; }
.switch-row__label { font-size: 0.875rem; font-weight: 500; }
.switch-row__desc { font-size: 0.78rem; color: var(--text-muted); }
.toggle {
  position: relative; flex-shrink: 0; width: 42px; height: 24px; padding: 0; border: none;
  border-radius: var(--radius-full); background: var(--border-hover);
  transition: background var(--duration-fast) var(--ease);
}
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform var(--duration-fast) var(--ease);
}
.toggle[aria-checked="true"] { background: var(--primary-strong); }
.toggle[aria-checked="true"]::after { transform: translateX(18px); }

/* ── Grids ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 1.25rem; align-items: start; }
.grid-2 > *, .grid-3 > *, .grid-2-1 > *, .grid-1-2 > * { min-width: 0; }
.mb { margin-bottom: 1.25rem; }

/* ── Bar chart ── */
.bar-chart { display: grid; grid-template-columns: auto 1fr; gap: 0.6rem; padding: 1.25rem 1.25rem 2.5rem; }
.bar-chart__axis { display: flex; flex-direction: column; justify-content: space-between; height: calc(220px + 0.7rem); margin-top: -0.35rem; font-size: 0.7rem; line-height: 0.7rem; color: var(--text-muted); text-align: right; }
.bar-chart__plot { display: flex; align-items: flex-end; gap: 0.5rem; height: 220px; border-bottom: 1px solid var(--border-hover); background: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px calc(100% / 3)); }
.bar-chart__col { flex: 1; position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; }
.bar-chart__bar { width: 100%; max-width: 34px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, var(--primary), var(--primary-strong)); }
.bar-chart__bar--muted { background: var(--primary-muted); border: 1px dashed var(--primary); border-bottom: none; }
.bar-chart__label { position: absolute; top: 100%; left: 0; right: 0; margin-top: 0.45rem; text-align: center; font-size: 0.7rem; color: var(--text-muted); }
.legend { display: flex; gap: 1rem; font-size: 0.78rem; color: var(--text-secondary); }
.legend__swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; background: var(--primary); }
.legend__swatch--muted { background: var(--primary-muted); }

/* ── Horizontal bars / progress ── */
.hbar { margin-bottom: 0.9rem; }
.hbar:last-child { margin-bottom: 0; }
.hbar__head { display: flex; justify-content: space-between; font-size: 0.82rem; margin-bottom: 0.3rem; }
.hbar__label { color: var(--text-secondary); }
.hbar__value { font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar__track { height: 8px; border-radius: var(--radius-full); background: var(--bg-elevated); overflow: hidden; }
.hbar__fill { height: 100%; border-radius: inherit; background: var(--primary); }
.hbar__fill--success { background: var(--success); }
.hbar__fill--warning { background: var(--warning); }
.hbar__fill--info { background: var(--info); }

/* ── Activity feed / timeline ── */
.activity-feed { padding: 0.5rem 1.25rem 1rem; }
.activity-item { display: flex; gap: 0.75rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-item__icon { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.activity-item__icon .icon { width: 14px; height: 14px; }
.activity-item__icon--escalation { background: var(--warning-muted); color: var(--warning); }
.activity-item__icon--error { background: var(--danger-muted); color: var(--danger); }
.activity-item__icon--deploy { background: var(--primary-muted); color: var(--primary-text); }
.activity-item__icon--eval { background: var(--success-muted); color: var(--success); }
.activity-item__text { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; }
.activity-item__text strong { color: var(--text-primary); font-weight: 600; }
.activity-item__time { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
.activity-item__body { margin-top: 0.4rem; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); background: var(--bg-elevated); font-size: 0.85rem; color: var(--text-secondary); white-space: pre-wrap; }

.empty-note { padding: 2rem 1.25rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.muted { color: var(--text-muted); }
.detail-list { border-top: 1px solid var(--border); padding-top: 0.75rem; }
.detail-list div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; font-size: 0.85rem; }
.detail-list dt { color: var(--text-muted); }
.detail-list dd { color: var(--text-primary); text-align: right; overflow-wrap: anywhere; }

/* ── Agent cards ── */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.agent-card { display: flex; flex-direction: column; gap: 1rem; }
.agent-card__head { display: flex; align-items: flex-start; gap: 0.75rem; }
.agent-card__icon { width: 40px; height: 40px; border-radius: var(--radius-md); flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--primary-muted); color: var(--primary-text); }
.agent-card__icon--c2 { background: var(--success-muted); color: var(--success); }
.agent-card__icon--c3 { background: var(--warning-muted); color: var(--warning); }
.agent-card__icon--c4 { background: var(--info-muted); color: var(--info); }
.agent-card__icon--c5 { background: var(--danger-muted); color: var(--danger); }
.agent-card__title { flex: 1; min-width: 0; }
.agent-card__name { display: block; font-weight: 600; color: var(--text-primary); }
.agent-card__model { display: block; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); }
.agent-card__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; padding: 0.75rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.stat-label { font-size: 0.68rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.stat-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.agent-card__foot { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; font-size: 0.8rem; color: var(--text-muted); }
.agent-card__foot .switch-inline { display: flex; align-items: center; gap: 0.5rem; }
.health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--success); margin-right: 0.5rem; }
.health-dot--paused { background: var(--text-muted); }
.health-dot--error { background: var(--danger); }
.health-dot--draft { background: var(--info); }

/* ── Log viewer ── */
.log-view { background: var(--bg-code); font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.55; max-height: 560px; overflow-y: auto; }
.log-view--compact { max-height: none; }
.log-view--compact .log-line__msg { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-line { display: grid; grid-template-columns: 92px 58px 150px 1fr; gap: 0.75rem; padding: 0.3rem 1.25rem; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.log-line:hover { background: var(--bg-hover); }
.log-line__time { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.log-line__source { color: var(--primary-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-line__msg { overflow-wrap: anywhere; }
.log-level { font-weight: 500; }
.log-level--info { color: var(--primary-text); }
.log-level--warn { color: var(--warning); }
.log-level--error { color: var(--danger); }
.log-level--debug { color: var(--text-muted); }
.log-line.is-new { animation: flash 1.2s var(--ease); }
@keyframes flash { from { background: var(--primary-muted); } to { background: transparent; } }
.log-view--compact .log-line { grid-template-columns: 70px 50px 1fr; }
.log-view--compact .log-line__source { display: none; }
.live-indicator { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.78rem; font-weight: 600; color: var(--success); }
.live-indicator::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }
.live-indicator.is-paused { color: var(--text-muted); }
.live-indicator.is-paused::before { animation: none; }

/* ── Conversations ── */
.convo { display: grid; grid-template-columns: 340px 1fr; min-height: 620px; }
.convo__list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 720px; }
.convo__filters { padding: 0.9rem; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 0.6rem; }
.thread { display: block; width: 100%; text-align: left; padding: 0.85rem 1rem; border: none; border-bottom: 1px solid var(--border); border-left: 2px solid transparent; background: none; color: inherit; }
.thread:hover { background: var(--bg-hover); }
.thread[aria-selected="true"] { background: var(--primary-muted); border-left-color: var(--primary); }
.thread__top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; }
.thread__name { font-weight: 600; font-size: 0.875rem; color: var(--text-primary); }
.thread__time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.thread__preview { display: block; font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0.15rem 0 0.4rem; }
.thread__meta { display: flex; gap: 0.5rem; align-items: center; font-size: 0.72rem; color: var(--text-muted); }
.convo__panel { display: flex; flex-direction: column; min-width: 0; }
.convo__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--border); }
.convo__title { font-weight: 600; }
.convo__sub { font-size: 0.78rem; color: var(--text-muted); }
.transcript { flex: 1; display: flex; flex-direction: column; gap: 0.9rem; padding: 1.25rem; overflow-y: auto; max-height: 560px; }
.msg { max-width: 78%; }
.msg__bubble { padding: 0.65rem 0.9rem; border-radius: var(--radius-lg); font-size: 0.875rem; line-height: 1.55; background: var(--bg-elevated); color: var(--text-primary); }
.msg__meta { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.25rem; }
.msg--user { align-self: flex-end; }
.msg--user .msg__bubble { background: var(--primary-strong); color: #fff; border-bottom-right-radius: 2px; }
.msg--user .msg__meta { text-align: right; }
.msg--agent .msg__bubble { border-bottom-left-radius: 2px; }
.msg--human .msg__bubble { background: var(--warning-muted); border: 1px solid var(--warning); }
.msg--system { align-self: center; max-width: 90%; font-size: 0.75rem; color: var(--text-muted); text-align: center; padding: 0.25rem 0.75rem; border: 1px dashed var(--border-hover); border-radius: var(--radius-full); }
.tool-call { max-width: 78%; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-code); font-family: var(--font-mono); font-size: 0.75rem; }
.tool-call summary { padding: 0.45rem 0.75rem; cursor: pointer; color: var(--text-secondary); list-style: none; display: flex; gap: 0.5rem; align-items: center; }
.tool-call summary::-webkit-details-marker { display: none; }
.tool-call summary::before { content: '▸'; color: var(--text-muted); }
.tool-call[open] summary::before { content: '▾'; }
.tool-call__name { color: var(--primary-text); }
.tool-call__time { margin-left: auto; color: var(--text-muted); }
.tool-call pre { margin: 0; padding: 0.6rem 0.75rem; border-top: 1px solid var(--border); white-space: pre-wrap; color: var(--text-secondary); }
.convo__reply { padding: 0.9rem 1.25rem; border-top: 1px solid var(--border); }

/* ── Trace waterfall ── */
.trace__scale { display: grid; grid-template-columns: 280px 1fr 72px; gap: 0.75rem; padding: 0.5rem 1.25rem; font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.trace__ticks { display: flex; justify-content: space-between; }
.trace__row { display: grid; grid-template-columns: 280px 1fr 72px; gap: 0.75rem; align-items: center; width: 100%; padding: 0.5rem 1.25rem; border: none; border-bottom: 1px solid var(--border); background: none; color: inherit; text-align: left; font-size: 0.82rem; }
.trace__row:hover { background: var(--bg-hover); }
.trace__row[aria-pressed="true"] { background: var(--primary-muted); }
.trace__label { display: flex; align-items: center; gap: 0.5rem; min-width: 0; padding-left: calc(var(--depth, 0) * 1.1rem); }
.trace__name { font-family: var(--font-mono); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trace__track { position: relative; height: 16px; background: repeating-linear-gradient(to right, var(--border) 0 1px, transparent 1px 25%); }
.trace__bar { position: absolute; top: 2px; bottom: 2px; left: var(--start); width: var(--width); min-width: 3px; border-radius: 2px; background: var(--primary); }
.trace__duration { text-align: right; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.kind { display: inline-block; flex-shrink: 0; font-family: var(--font-mono); font-size: 0.64rem; font-weight: 500; text-transform: uppercase; padding: 0.05rem 0.35rem; border-radius: var(--radius-sm); background: var(--primary-muted); color: var(--primary-text); }
.kind--llm { background: var(--info-muted); color: var(--info); }
.kind--tool { background: var(--success-muted); color: var(--success); }
.kind--retrieval { background: var(--warning-muted); color: var(--warning); }
.kind--guardrail { background: var(--bg-elevated); color: var(--text-secondary); }
.trace__bar--llm { background: var(--info); }
.trace__bar--tool { background: var(--success); }
.trace__bar--retrieval { background: var(--warning); }
.trace__bar--guardrail { background: var(--text-muted); }
.code-block { margin: 0.5rem 0 0; padding: 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-code); font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.55; white-space: pre-wrap; color: var(--text-secondary); overflow-x: auto; }
.section-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-top: 1rem; }

/* ── Agent config ── */
.code-input { font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.6; background: var(--bg-code); min-height: 260px; }
.char-count { font-size: 0.72rem; color: var(--text-muted); text-align: right; margin-top: 0.3rem; font-variant-numeric: tabular-nums; }
.range-row { display: flex; align-items: center; gap: 0.75rem; }
.range-row output { min-width: 3.5ch; font-family: var(--font-mono); font-size: 0.82rem; text-align: right; color: var(--text-primary); }
input[type="range"] { flex: 1; accent-color: var(--primary-strong); }
.tool-row { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 0; border-top: 1px solid var(--border); }
.tool-row:first-of-type { border-top: none; padding-top: 0; }
.tool-row__info { flex: 1; min-width: 0; }
.tool-row__name { font-family: var(--font-mono); font-size: 0.82rem; color: var(--text-primary); }
.tool-row__desc { font-size: 0.78rem; color: var(--text-muted); }
.console { display: flex; flex-direction: column; }
.console .transcript { min-height: 320px; max-height: 420px; padding: 1rem; }
.console .msg { max-width: 90%; }
.typing { display: inline-flex; gap: 4px; padding: 0.75rem 0.9rem; border-radius: var(--radius-lg); background: var(--bg-elevated); }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }

/* ── Evaluations ── */
.suite-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.suite { display: flex; flex-direction: column; gap: 0.75rem; }
.suite__score { font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.suite__meta { font-size: 0.78rem; color: var(--text-muted); }
.progress { height: 6px; border-radius: var(--radius-full); background: var(--bg-elevated); overflow: hidden; }
.progress__bar { height: 100%; width: 0; background: var(--primary); transition: width 200ms linear; }
.diff { font-family: var(--font-mono); font-size: 0.75rem; }
.diff__exp { color: var(--success); }
.diff__got { color: var(--danger); }

/* ── Keys & tiles ── */
.key-cell { display: flex; align-items: center; gap: 0.5rem; }
.key-value { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-primary); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.tile { display: flex; flex-direction: column; gap: 0.75rem; }
.tile__head { display: flex; align-items: center; gap: 0.75rem; }
.tile__logo { width: 40px; height: 40px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; background: var(--bg-elevated); color: var(--text-secondary); flex-shrink: 0; }
.tile__name { font-weight: 600; font-size: 0.95rem; }
.tile__desc { font-size: 0.8rem; color: var(--text-muted); }
.tile__foot { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: auto; }

/* ── Auth & error ── */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(ellipse at top, var(--primary-muted), transparent 60%), var(--bg-body);
}
.auth__theme { position: fixed; top: 1rem; right: 1rem; z-index: 5; }
.auth__card { width: 100%; max-width: 400px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; box-shadow: var(--shadow-lg); }
.auth__brand { display: flex; align-items: center; justify-content: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; color: var(--text-primary); margin-bottom: 1.5rem; }
.auth__brand:hover { text-decoration: none; }
.auth__title { font-size: 1.35rem; font-weight: 700; text-align: center; }
.auth__subtitle { font-size: 0.875rem; color: var(--text-muted); text-align: center; margin: 0.25rem 0 1.5rem; }
.auth__row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; font-size: 0.85rem; }
.auth__reset { display: none; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.auth__reset:target { display: block; }
.auth__reset-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.75rem; }
.auth__footer { text-align: center; font-size: 0.78rem; color: var(--text-muted); margin-top: 1.5rem; }
.error-page { text-align: center; max-width: 440px; }
.error-page__code { font-family: var(--font-mono); font-size: 5rem; font-weight: 500; line-height: 1; color: var(--primary-text); }
.error-page__title { font-size: 1.6rem; font-weight: 700; margin: 1rem 0 0.5rem; }
.error-page__text { color: var(--text-secondary); margin-bottom: 1.5rem; }
.error-page__actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }


/* ── Responsive ── */
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .kpi-row--5 { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
  .grid-2-1, .grid-1-2 { grid-template-columns: 1fr; }
  .convo { grid-template-columns: 280px 1fr; }
  .trace__scale, .trace__row { grid-template-columns: 200px 1fr 64px; }
}
@media (min-width: 769px) { .sidebar-backdrop { display: none !important; } }
@media (max-width: 768px) {
  .sidebar { width: min(var(--sidebar-width), 85vw); transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar--open { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 0.75rem; }
  .topbar__search { display: none; }
  .topbar__new-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .page { padding: 1rem; }
  .kpi-row, .kpi-row--5, .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .data-table { min-width: 640px; }
  .toolbar__search { max-width: none; flex-basis: 100%; }
  .convo { grid-template-columns: 1fr; }
  .convo__list { border-right: none; border-bottom: 1px solid var(--border); max-height: 320px; }
  .msg, .tool-call { max-width: 92%; }
  .log-line { grid-template-columns: 70px 46px 1fr; gap: 0.5rem; padding-inline: 0.75rem; }
  .log-line__source { display: none; }
  .trace__scale { display: none; }
  .trace__row { grid-template-columns: 1fr 56px; }
  .trace__track { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 480px) {
  .kpi-row, .kpi-row--5, .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
