:root {
  --navy-950: #030d1c;
  --navy-900: #061a34;
  --navy-800: #0b2a4f;
  --navy-700: #133b6a;
  --navy-line: #16294a;

  --teal-600: #009aa2;
  --teal-500: #00b0b9;
  --teal-400: #24c8d1;
  --teal-300: #7ce0e6;
  --teal-100: #cff3f6;
  --teal-50:  #ecfafb;

  --bg: #f5f7fb;
  --panel: #ffffff;
  --border: #e5e9f0;
  --border-strong: #cfd6e0;
  --divider: #eef1f5;

  --text: #0c1e37;
  --text-2: #334660;
  --muted: #63738b;
  --muted-2: #96a1b3;

  --ok: #16a34a;
  --err: #dc2626;
  --code-bg: #f4f6fb;

  --radius: 10px;
  --radius-lg: 14px;

  --shadow-1: 0 1px 2px rgba(11, 42, 79, 0.05);
  --shadow-2: 0 2px 6px rgba(11, 42, 79, 0.06), 0 1px 2px rgba(11, 42, 79, 0.04);
  --shadow-3: 0 8px 24px rgba(11, 42, 79, 0.10), 0 2px 6px rgba(11, 42, 79, 0.06);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, textarea { font-family: inherit; }
code { font-family: var(--font-mono); font-size: 0.92em; }

/* ─── App shell ──────────────────────────────────────────────────── */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background:
    radial-gradient(900px 500px at 20% -200px, rgba(0, 176, 185, 0.10) 0%, transparent 60%),
    radial-gradient(700px 500px at 100% 100%, rgba(19, 59, 106, 0.08) 0%, transparent 60%),
    linear-gradient(180deg, #f6f9fd 0%, #eef2f8 100%);
}

/* ─── Topbar ─────────────────────────────────────────────────────── */

.topbar {
  height: 60px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(11, 42, 79, 0.06);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  flex-shrink: 0;
  z-index: 3;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-logo {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--teal-400) 0%, var(--teal-600) 100%);
  color: var(--navy-950);
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 176, 185, 0.35);
}

.brand-title {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}
.brand-sub {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 1px;
  font-weight: 600;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.env-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--navy-800);
  background: var(--teal-50);
  border: 1px solid var(--teal-300);
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 600;
}
.env-dot {
  width: 6px; height: 6px;
  background: var(--ok);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.22);
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  color: #fff;
  border: 0;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-2);
  transition: transform 0.12s, box-shadow 0.12s;
}
.topbar-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-3); }
.topbar-btn svg { color: var(--teal-300); }

/* ─── Conversation strip ─────────────────────────────────────────── */

.agent-conv-strip {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
  flex-shrink: 0;
}
.agent-conv-strip .conv-scroll {
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 24px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
}
.agent-conv-strip .conv-scroll:empty { display: none; }
.agent-conv-strip:has(.conv-scroll:empty) { display: none; }

.conv-chip {
  flex-shrink: 0;
  padding: 4px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  transition: all 0.12s;
}
.conv-chip:hover {
  border-color: var(--teal-400);
  color: var(--navy-800);
  background: var(--teal-50);
}
.conv-chip.active {
  background: var(--navy-800);
  color: #fff;
  border-color: var(--navy-800);
  font-weight: 600;
}

/* ─── Agent main area (scrolls) ──────────────────────────────────── */

.agent-inner {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ─── Hero ──────────────────────────────────────────────────────── */

.agent-hero {
  width: 100%;
  max-width: 720px;
  padding: 44px 24px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.agent-hero.hidden { display: none; }

.ah-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--teal-600);
  background: var(--teal-50);
  border: 1px solid var(--teal-300);
  padding: 5px 11px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.ah-title {
  font-size: 34px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.028em;
  color: var(--text);
  margin: 4px 0 0;
  max-width: 640px;
}
.ah-title .accent {
  background: linear-gradient(90deg, var(--teal-500) 0%, var(--navy-700) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ah-sub {
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 14px;
  max-width: 560px;
  line-height: 1.55;
}

/* Three loop cards on the hero */

.loops-grid {
  width: 100%;
  max-width: 960px;
  margin-top: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  text-align: left;
}

.loop-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-2);
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s, border-color 0.14s;
  font-family: inherit;
  color: inherit;
  text-align: left;
  overflow: hidden;
  isolation: isolate;
}
.loop-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(260px 160px at 100% 0%, rgba(0, 176, 185, 0.10) 0%, transparent 70%);
  opacity: 0.9;
  transition: opacity 0.15s;
}
.loop-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-3);
  border-color: var(--teal-300);
}
.loop-card:hover::before { opacity: 1; }

.loop-num {
  position: absolute;
  top: 14px;
  right: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--teal-600);
  background: var(--teal-50);
  border: 1px solid var(--teal-300);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.06em;
}

.loop-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--teal-400) 0%, var(--teal-600) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(0, 176, 185, 0.28);
  margin-bottom: 6px;
}

.loop-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
}

.loop-sub {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.loop-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--navy-800);
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.005em;
}
.loop-card:hover .loop-cta { color: var(--teal-600); }
.loop-arr {
  display: inline-block;
  transition: transform 0.15s;
}
.loop-card:hover .loop-arr { transform: translateX(3px); }

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

/* ─── Chat surface ──────────────────────────────────────────────── */

.chat-surface {
  width: 100%;
  max-width: 820px;
  padding: 0 24px 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.messages {
  padding: 8px 0 20px;
  background: transparent;
}

.messages-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Sticky composer */

.composer-wrap {
  position: sticky;
  bottom: 0;
  padding: 12px 0 20px;
  margin-top: auto;
  background: linear-gradient(to bottom, transparent 0%, rgba(246, 249, 253, 0.92) 30%, #eef2f8 60%);
  z-index: 2;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
  justify-content: center;
}
.suggestions button {
  background: var(--panel);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11.5px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.12s;
}
.suggestions button:hover {
  background: var(--teal-50);
  border-color: var(--teal-300);
  color: var(--navy-800);
  transform: translateY(-1px);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  background: var(--panel);
  border: 1.5px solid var(--border-strong);
  border-radius: 24px;
  padding: 8px 8px 8px 18px;
  box-shadow: var(--shadow-3);
  transition: border-color 0.15s;
}
.composer:focus-within {
  border-color: var(--teal-400);
  box-shadow: var(--shadow-3), 0 0 0 3px rgba(0, 176, 185, 0.12);
}

#input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  resize: none;
  max-height: 160px;
  min-height: 24px;
  padding: 7px 0;
  line-height: 1.5;
}
#input::placeholder { color: var(--muted-2); }

#send-btn {
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  color: #fff;
  border: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  transition: transform 0.12s, background 0.12s;
}
#send-btn:hover {
  background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-600) 100%);
  transform: scale(1.05);
}
#send-btn:disabled {
  background: var(--border-strong);
  cursor: not-allowed;
  transform: none;
}

.disclaimer {
  text-align: center;
  font-size: 10.5px;
  color: var(--muted-2);
  margin-top: 6px;
}

/* ─── Messages ──────────────────────────────────────────────────── */

.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg.user { justify-content: flex-end; }

.msg .avatar {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--teal-400);
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-900) 100%);
  flex-shrink: 0;
}
.msg.user .avatar { display: none; }

.msg .stream { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.msg.user .stream { max-width: 78%; align-items: flex-end; }
.msg.assistant .stream { flex: 1; }

.body {
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.6;
  font-size: 14px;
}
.msg.user .body {
  background: linear-gradient(135deg, var(--navy-800) 0%, var(--navy-700) 100%);
  color: #fff;
  padding: 10px 16px;
  border-radius: 18px 18px 4px 18px;
  box-shadow: var(--shadow-2);
}
.msg.assistant .body { padding: 2px 0; color: var(--text); }
.msg.assistant .body:empty { display: none; }

/* Markdown rendered inside assistant messages */
.msg.assistant .body h3,
.msg.assistant .body h4,
.msg.assistant .body h5 {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 12px 0 6px;
}
.msg.assistant .body h3 { font-size: 16px; }

.msg.assistant .body p { margin: 6px 0; }
.msg.assistant .body p:first-child { margin-top: 0; }
.msg.assistant .body p:last-child  { margin-bottom: 0; }

.msg.assistant .body ul,
.msg.assistant .body ol {
  margin: 6px 0;
  padding-left: 22px;
}
.msg.assistant .body li { margin: 3px 0; }
.msg.assistant .body li::marker { color: var(--teal-500); }

.msg.assistant .body strong { font-weight: 700; color: var(--text); }
.msg.assistant .body em { font-style: italic; }

.msg.assistant .body code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--navy-800);
}

.msg.assistant .body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  overflow: auto;
  margin: 8px 0;
}
.msg.assistant .body pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 12px;
}

.msg.assistant .body a {
  color: var(--teal-600);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.msg.assistant .body table.md-tbl {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 13px;
}
.msg.assistant .body .md-tbl th {
  background: #fafbfd;
  color: var(--muted);
  text-align: left;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.msg.assistant .body .md-tbl td {
  padding: 10px 12px;
  border-top: 1px solid var(--divider);
  color: var(--text);
  vertical-align: top;
}

.thinking {
  color: var(--muted);
  font-style: italic;
  font-size: 12.5px;
  padding: 8px 12px;
  border-left: 2px solid var(--teal-300);
  background: var(--code-bg);
  border-radius: 4px;
  white-space: pre-wrap;
}

.tool-call {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  overflow: hidden;
}
.tool-call .name {
  color: var(--navy-800);
  font-weight: 700;
}
.tool-call .name::before {
  content: "▸";
  color: var(--teal-500);
  font-family: sans-serif;
  margin-right: 4px;
}
.tool-call .args {
  color: var(--muted);
  margin-top: 5px;
  white-space: pre-wrap;
  max-height: 100px;
  overflow: auto;
}
.tool-call .result {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  white-space: pre-wrap;
  max-height: 180px;
  overflow: auto;
  color: var(--text);
}
.tool-call .result.ok { color: var(--ok); }
.tool-call .result.err { color: var(--err); }

/* ─── Scrollbars ────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(99, 115, 139, 0.24);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(99, 115, 139, 0.4); }

/* ─── Mode toggle (segmented control) ───────────────────────────── */

.mode-switch {
  display: inline-flex;
  background: rgba(11, 42, 79, 0.06);
  border: 1px solid rgba(11, 42, 79, 0.08);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.mode-btn:hover { color: var(--text-2); }
.mode-btn.active {
  background: var(--panel);
  color: var(--navy-800);
  box-shadow: var(--shadow-1), inset 0 0 0 1px rgba(11, 42, 79, 0.06);
}
.mode-btn.active svg { color: var(--teal-500); }

/* Which shell is visible? Driven by body.mode-* */
body.mode-agent   .classic-body   { display: none !important; }
body.mode-agent   .agent-conv-strip,
body.mode-agent   .agent-inner    { display: flex; }
body.mode-classic .agent-conv-strip,
body.mode-classic .agent-inner    { display: none !important; }
body.mode-classic .classic-body   { display: grid; }

/* ─── Classic shell ─────────────────────────────────────────────── */

.classic-body {
  flex: 1;
  min-height: 0;
  grid-template-columns: 248px 1fr;
  overflow: hidden;
}

.sidebar {
  background: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 60%, var(--navy-800) 100%);
  color: #d6e0ee;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--navy-950);
  position: relative;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 400px at 50% -200px, rgba(0, 176, 185, 0.10), transparent 70%),
    radial-gradient(400px 300px at 100% 100%, rgba(0, 176, 185, 0.05), transparent 60%);
  pointer-events: none;
}
.sidebar > * { position: relative; z-index: 1; }

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 24px;
}
.nav::-webkit-scrollbar { width: 4px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); }

.nav-section {
  font-size: 10px;
  color: #6f89ad;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  padding: 18px 22px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 22px;
  font-size: 13px;
  color: #b7c3d6;
  cursor: pointer;
  border-left: 3px solid transparent;
  user-select: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  font-weight: 500;
  text-decoration: none;
}
.nav-item .ico {
  width: 17px; height: 17px;
  color: #7891ac;
  flex-shrink: 0;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.nav-item:hover .ico { color: var(--teal-300); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(0, 176, 185, 0.16) 0%, rgba(0, 176, 185, 0.02) 100%);
  color: #fff;
  border-left-color: var(--teal-500);
  font-weight: 600;
}
.nav-item.active .ico { color: var(--teal-400); }

/* ─── Page canvas ──────────────────────────────────────────────── */

.page {
  overflow-y: auto;
  padding: 24px 28px 60px;
  background: var(--bg);
}

.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}
.page-sub {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 22px;
  max-width: 720px;
}

/* Stat cards for the dashboard */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
  transition: transform 0.12s, box-shadow 0.12s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--teal-300);
}
.stat-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--teal-50);
  color: var(--teal-600);
  display: grid;
  place-items: center;
  margin-bottom: 10px;
}
.stat-n {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-k {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-top: 6px;
}

.two-col {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px 16px;
  box-shadow: var(--shadow-1);
  margin-bottom: 16px;
}
.panel:last-child { margin-bottom: 0; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.panel-hint {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

.mini-list { display: flex; flex-direction: column; }
.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px;
  border-bottom: 1px solid var(--divider);
  font-size: 13px;
  gap: 8px;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row .mr-name {
  color: var(--text);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.mini-row .mr-val {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 1fr 50px;
  gap: 12px;
  padding: 8px 0;
  align-items: center;
  font-size: 13px;
}
.bar-row .bar-label { color: var(--text); font-weight: 500; }
.bar-row .bar-count {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.bar-row .bar-track {
  grid-column: 1 / -1;
  height: 4px;
  background: var(--code-bg);
  border-radius: 2px;
  overflow: hidden;
  margin-top: -2px;
}
.bar-row .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal-500), var(--teal-400));
  border-radius: 2px;
}

/* ─── Tables ─────────────────────────────────────────────────────── */

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th {
  text-align: left;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  background: #fafbfd;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: 14px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--divider);
  vertical-align: top;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #fbfcfe; }
.tbl td.mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}
.tbl td.right {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.tbl td .name {
  font-weight: 600;
  color: var(--text);
  display: block;
}
.tbl td .sub {
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 3px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  background: #fff;
  font-weight: 600;
  white-space: nowrap;
  margin-right: 4px;
}
.pill.teal  { background: var(--teal-50);   border-color: var(--teal-300); color: var(--teal-600); }
.pill.ok    { background: #ecfdf4;           border-color: #86efac;         color: #046c37; }
.pill.err   { background: #fef2f2;           border-color: #fca5a5;         color: #991b1b; }
.pill.warn  { background: #fffbeb;           border-color: #fcd34d;         color: #92400e; }
.pill.muted { background: #fbfcfe;           border-color: var(--border);   color: var(--muted); }

.rule-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  background: var(--code-bg);
  padding: 8px 10px;
  border-radius: 6px;
  margin-top: 6px;
  max-width: 400px;
  overflow: auto;
  white-space: pre;
  border: 1px solid var(--border);
  line-height: 1.5;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .es-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  background: var(--teal-50);
  color: var(--teal-500);
  display: grid;
  place-items: center;
  border: 1px solid var(--teal-100);
}
.empty-state .es-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

/* ─── Responsive ────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .classic-body { grid-template-columns: 200px 1fr; }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 16px; height: 54px; }
  .brand-sub { display: none; }
  .agent-hero { padding: 24px 16px 8px; }
  .ah-title { font-size: 26px; }
  .ah-sub { font-size: 14px; }
  .chat-surface { padding: 0 16px; }
  .agent-conv-strip .conv-scroll { padding: 8px 16px; }
  body.mode-classic .classic-body { grid-template-columns: 1fr; }
  body.mode-classic .sidebar { display: none; }
}
