:root {
  /* Acceltra dark palette — slightly cooler bg + slightly brighter accent
     than v1; refined for a more premium, "professional law-firm" feel.
     Background uses a vertical gradient so the dashboard doesn't read as
     a flat panel. */
  --bg: #0b0d12;
  --bg-soft: #0f1218;
  --panel: #151922;
  --panel-2: #1c212d;
  --panel-3: #232938;
  --border: #262b3a;
  --border-soft: #1f2430;
  --text: #ebeef7;
  --text-dim: #98a2b8;
  --text-mute: #6b7385;
  --accent: #6691f5;
  --accent-2: #4a76d4;
  --accent-soft: rgba(102, 145, 245, 0.12);
  --success: #4ade80;
  --warning: #f6b955;
  --danger: #ef6b6b;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  /* Subtle vertical gradient — the dashboard background isn't flat black,
     it has a small lift at the top so cards float more readably. */
  background-image: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.005em;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #87aaff; text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ── Auth screens (login, callback) ──────────────────────────────────── */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  /* Subtle inner highlight at the top — adds dimensionality. */
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, transparent 25%);
}

/* Login wordmark — same blue-neon treatment as the app sidebar. */
.auth-brand {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #b9d2ff;
  text-shadow:
    0 0 4px rgba(102, 145, 245, 0.7),
    0 0 12px rgba(102, 145, 245, 0.45),
    0 0 22px rgba(102, 145, 245, 0.28);
}

.auth-sub {
  margin: 0 0 24px;
  color: var(--text-dim);
  font-size: 14px;
}

.auth-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-dim);
}

.auth-input {
  width: 100%;
  padding: 13px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  /* 16px floor prevents iOS auto-zoom on focus (same fix as widget). */
  font-size: 16px;
  margin-bottom: 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.auth-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-cta {
  width: 100%;
  padding: 14px 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  min-height: 48px;
  transition: background var(--transition), transform 80ms ease;
}

.auth-cta:hover:not(:disabled) { background: var(--accent-2); }
.auth-cta:active:not(:disabled) { transform: scale(0.99); }
.auth-cta:disabled { opacity: 0.55; cursor: not-allowed; }

.auth-status {
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--text-dim);
  min-height: 18px;
}

.auth-status.success { color: var(--success); }
.auth-status.error { color: #ef6b6b; }

/* ── App shell (post-login pages) ────────────────────────────────────── */

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.app-sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  padding: 24px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

/* Blue-neon wordmark — replaces the logo icon. Glowing accent text. */
.app-brand {
  display: block;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 28px;
  padding: 2px 8px;
  color: #b9d2ff;
  text-shadow:
    0 0 4px rgba(102, 145, 245, 0.7),
    0 0 12px rgba(102, 145, 245, 0.45),
    0 0 22px rgba(102, 145, 245, 0.28);
  transition: color var(--transition), text-shadow var(--transition);
}
.app-brand:hover {
  text-decoration: none;
  color: #dceaff;
  text-shadow:
    0 0 5px rgba(122, 162, 255, 0.85),
    0 0 16px rgba(102, 145, 245, 0.55),
    0 0 28px rgba(102, 145, 245, 0.35);
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.app-nav-link {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background var(--transition), color var(--transition);
}

.app-nav-link:hover {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.app-nav-link.active {
  background: var(--accent-soft);
  color: var(--text);
  position: relative;
}
/* Subtle accent stripe on the active nav item. */
.app-nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.app-logout {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.app-user {
  padding: 8px;
  margin-bottom: 8px;
}

.app-user-email {
  font-size: 13px;
  font-weight: 500;
}

.app-user-role {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.app-logout-btn {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.app-logout-btn:hover { color: var(--text); border-color: var(--text-dim); }

.app-main {
  padding: 40px 48px;
  max-width: 1200px;
}

.app-header h1 {
  margin: 0 0 28px;
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.app-content p {
  color: var(--text-dim);
  margin: 0 0 20px;
  max-width: 640px;
  line-height: 1.55;
}

.callout {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.5;
}

.callout-demo {
  background: rgba(246, 185, 85, 0.08);
  border: 1px solid rgba(246, 185, 85, 0.25);
  color: #ecc789;
}

.callout-demo strong { color: var(--warning); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.card {
  display: block;
  padding: 22px 22px 20px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  color: var(--text);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition),
              box-shadow var(--transition);
  /* Subtle inner highlight at the top edge — adds depth. */
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, transparent 30%);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  pointer-events: none;
  box-shadow: 0 0 0 0 var(--accent-soft);
  transition: box-shadow var(--transition);
}

.card:hover {
  border-color: var(--accent);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.card:hover::after { box-shadow: 0 0 0 4px var(--accent-soft); }

.card:active { transform: translateY(0); }

.card h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ── Embed snippet copy block ────────────────────────────────────────── */

.embed-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 16px;
}

.embed-code {
  background: #0a0d12;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  color: #b9c2d4;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 12px;
}

.embed-copy {
  padding: 10px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  min-height: 40px;
  transition: background var(--transition), transform 80ms ease;
}

.embed-copy:hover { background: var(--accent-2); }
.embed-copy:active { transform: scale(0.98); }
.embed-copy.copied { background: var(--success); }

/* ── Leads table ─────────────────────────────────────────────────────── */

.leads-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.leads-table th,
.leads-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.leads-table th {
  background: var(--panel-2);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.leads-table tr:last-child td { border-bottom: none; }
.leads-table tr:hover td { background: rgba(91,141,239,0.04); }
.leads-table a { color: var(--text); }

.tier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tier-t0 { background: rgba(239, 107, 107, 0.15); color: #ef6b6b; }
.tier-t1 { background: rgba(246, 185, 85, 0.15); color: var(--warning); }
.tier-t2 { background: rgba(74, 222, 128, 0.12); color: var(--success); }
.tier-t3 { background: rgba(154, 163, 184, 0.12); color: var(--text-dim); }

.empty-state {
  padding: 32px;
  margin-bottom: 24px;
  text-align: center;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  line-height: 1.55;
}

/* ── Test chat embed page ────────────────────────────────────────────── */

.test-chat-mount {
  margin-top: 16px;
  min-height: 600px;
}

/* ── Lead detail ─────────────────────────────────────────────────────── */

.lead-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.lead-meta-item {
  font-size: 13px;
}

.lead-meta-item .k {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.lead-meta-item .v {
  color: var(--text);
}

.transcript {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

/* ─────────────────────────────────────────────────────────────────────
   Mobile responsive
   ─────────────────────────────────────────────────────────────────────
   The desktop layout is a fixed 248px sidebar + content. On phones that
   eats most of the viewport. Below 768px:
     - .app-shell flips to flex-column
     - .app-sidebar becomes a top app-bar with a horizontal nav row
     - Sticky positioning so nav stays accessible during long scrolls
     - .app-main padding shrinks to 16-20px
     - Headings shrink slightly for mobile legibility */

/* ── Mobile (<=768px) ──────────────────────────────────────────────────
   Clean two-line layout: top bar = logo + wordmark + sign-out (NO nav),
   bottom tab bar = the 4 nav links. Mirrors native-app patterns visitors
   already know from iOS/Android apps; the header reads as a logo strip
   instead of a crowded toolbar. */
@media (max-width: 768px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
  }

  /* TOP: clean header with logo + wordmark on left, sign-out on right. */
  .app-sidebar {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    padding: 12px 16px;
    /* Respect notched-device top safe area so the logo isn't behind
       the notch on phones in portrait. */
    padding-top: max(12px, env(safe-area-inset-top, 12px));
    background: rgba(11, 13, 18, 0.86);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    z-index: 10;
  }

  .app-brand {
    margin-bottom: 0;
    padding: 0;
    font-size: 16px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
  }
  .app-brand::before {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    transform: translateY(0);
  }

  /* BOTTOM: nav becomes a fixed tab bar. Position fixed so it stays
     anchored to the viewport regardless of DOM order in the template. */
  .app-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    flex-direction: row;
    justify-content: space-around;
    align-items: stretch;
    gap: 0;
    padding: 6px 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
    background: rgba(11, 13, 18, 0.92);
    backdrop-filter: saturate(140%) blur(16px);
    -webkit-backdrop-filter: saturate(140%) blur(16px);
    border-top: 1px solid var(--border-soft);
    z-index: 20;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
  }

  .app-nav-link {
    flex: 1;
    min-width: 0;
    text-align: center;
    padding: 8px 6px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.005em;
    color: var(--text-mute);
    border-radius: var(--radius-sm);
    justify-content: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .app-nav-link:hover { background: transparent; color: var(--text); }

  /* Active state on the tab bar: accent text + a small dot indicator
     above the label. No left-stripe (that's a vertical-nav pattern). */
  .app-nav-link.active {
    background: transparent;
    color: var(--accent);
  }
  .app-nav-link.active::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
  }
  .app-nav-link { position: relative; }

  /* Sign-out: small, right-aligned in the header. The user-email block
     hides on mobile to avoid header crowding (sign-in identity is in
     /api/me + the dashboard greeting). */
  .app-logout {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    flex-shrink: 0;
  }
  .app-user { display: none; }
  .app-logout-btn {
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
    min-height: 36px;
  }

  /* Main: leave bottom room so the fixed tab bar doesn't cover content. */
  .app-main {
    padding: 20px 16px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    max-width: 100%;
  }

  .app-header h1 {
    margin: 0 0 18px;
    font-size: 22px;
  }

  .app-content p { font-size: 14.5px; }

  .callout { padding: 12px 14px; font-size: 13.5px; }

  .card-grid {
    gap: 12px;
    margin-top: 20px;
    grid-template-columns: 1fr;
  }

  .card {
    padding: 18px;
  }

  /* Embed snippet: tighter padding, smaller code font on mobile so the
     full <script> tag is visible without horizontal scroll. */
  .embed-block { padding: 16px; }
  .embed-code  { font-size: 12.5px; padding: 12px; }
}

/* Tablet/landscape phone — slightly tighter than desktop but not yet
   stacked. Just shrink padding and brand size a touch. */
@media (min-width: 769px) and (max-width: 1024px) {
  .app-shell { grid-template-columns: 220px 1fr; }
  .app-main  { padding: 32px 28px; }
}

/* Leads table → card list on phones. Tables don't fit horizontally
   below ~640px even when reduced. Reflow each row into a stacked card. */
@media (max-width: 640px) {
  .leads-table {
    border: none;
    background: transparent;
    border-radius: 0;
  }
  .leads-table thead { display: none; }
  .leads-table tr {
    display: block;
    background: var(--panel);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 12px;
    transition: border-color var(--transition);
  }
  .leads-table tr:hover {
    border-color: var(--accent);
  }
  .leads-table tr:hover td { background: transparent; }
  .leads-table td {
    display: block;
    border: none;
    padding: 4px 0;
    font-size: 14px;
  }
  /* Prepend the column name as a small label so each cell is self-describing.
     The labels are injected via :before content matched to the cell's
     position with nth-child. Phone-friendly definition-list feel. */
  .leads-table td:nth-of-type(1)::before { content: "When · "; color: var(--text-mute); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
  .leads-table td:nth-of-type(2)::before { content: "Caller · "; color: var(--text-mute); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
  .leads-table td:nth-of-type(3)::before { content: "Practice · "; color: var(--text-mute); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
  .leads-table td:nth-of-type(4)::before { content: "Tier · ";  color: var(--text-mute); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
  .leads-table td:nth-of-type(5)::before { content: "Disposition · "; color: var(--text-mute); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
  .leads-table td:nth-of-type(6)::before { content: "Summary · "; color: var(--text-mute); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

  /* Lead-detail meta-grid: single column on phones. */
  .lead-meta {
    grid-template-columns: 1fr 1fr;
    padding: 14px;
    gap: 10px;
  }
  .transcript {
    padding: 16px;
    font-size: 13.5px;
  }
}

/* Phone login screen: lighter padding for narrow viewports. */
@media (max-width: 480px) {
  .auth-shell { padding: 16px; }
  .auth-card {
    padding: 32px 24px;
    border-radius: var(--radius-lg);
  }
  .auth-brand { font-size: 20px; }
}

/* ─────────────────────────────────────────────────────────────────────
   Redesign components: settings link, stats page, range filter,
   settings page, test-chat scenarios.
   ───────────────────────────────────────────────────────────────────── */

/* Settings link, pinned in the sidebar foot above sign-out. nav's flex:1
   pushes this group to the bottom. */
.app-settings { margin-top: 8px; }

/* Stats header: title + range filter on one row. */
.app-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  /* Restore the breathing room below the header that the h1-margin reset
     (below) removes — otherwise the stat cards / content butt right up
     against the title + date filter row. */
  margin-bottom: 28px;
}
.app-header-row h1 { margin-bottom: 0; }

.range-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Segmented preset control — connected pills in a single track. */
.range-presets {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.range-chip {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 550;
  line-height: 1.3;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.range-chip:hover { color: var(--text); text-decoration: none; background: var(--panel-3); }
.range-chip.active,
.range-chip.active:hover { background: var(--accent); color: #fff; }

/* Custom date range — two dark date fields with an arrow between. */
.range-custom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.range-date {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  /* Renders the native calendar-picker glyph light on the dark field. */
  color-scheme: dark;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.range-date:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.range-custom.is-active .range-date { border-color: var(--accent); }
.range-date::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.65; }
.range-date::-webkit-calendar-picker-indicator:hover { opacity: 1; }
.range-dash { color: var(--text-mute); }
.range-go {
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}
.range-go:hover { background: var(--accent-2); }

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 30%);
}
.stat-k { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.stat-v { font-size: 34px; font-weight: 680; letter-spacing: -0.02em; line-height: 1.1; margin: 10px 0 6px; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-mute); }

/* Breakdown panels */
.stat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.stat-panel-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  margin: 0 0 16px;
}
.stat-muted { color: var(--text-mute); font-size: 13px; margin: 0; }

.bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 32px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}
.bar-label { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--panel-3); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width var(--transition); }
.bar-count { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.tier-fill-t0 { background: #ef6b6b; }
.tier-fill-t1 { background: var(--warning); }
.tier-fill-t2 { background: var(--success); }
.tier-fill-t3 { background: var(--text-mute); }

/* Settings page sections */
.setting-section {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 16px;
  max-width: 720px;
}
.setting-title { font-size: 15px; font-weight: 650; margin: 0 0 6px; }
.setting-desc { font-size: 13.5px; color: var(--text-dim); margin: 0 0 14px; }
.setting-foot { font-size: 13px; color: var(--text-dim); margin: 12px 0 0; }
.setting-muted { opacity: 0.7; }

/* Test-chat scenario cards */
.scenario-title { font-size: 15px; font-weight: 650; margin: 28px 0 4px; }
.scenario-sub { font-size: 13.5px; color: var(--text-dim); margin: 0 0 14px; }
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.scenario-card {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: border-color var(--transition), transform var(--transition);
}
.scenario-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.scenario-card.copied { border-color: var(--success); }
.scenario-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scenario-tag { font-size: 12px; font-weight: 650; color: var(--text); }
.scenario-tier {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-mute);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 8px;
}
.scenario-text { font-size: 13px; color: var(--text-dim); line-height: 1.45; }
.scenario-copy { font-size: 11.5px; font-weight: 600; color: var(--accent); align-self: flex-start; }
.scenario-card.copied .scenario-copy { color: var(--success); }

/* Redesign components — mobile */
@media (max-width: 768px) {
  .stat-cols { grid-template-columns: 1fr; }
  .app-header-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .range-bar { flex-wrap: wrap; }
  .bar-row { grid-template-columns: 110px 1fr 28px; }

  /* Settings sits as a small text link in the top header, next to sign-out. */
  .app-brand { flex: 1; }
  .app-settings {
    flex: 0 0 auto;
    width: auto;
    margin-top: 0;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text-dim);
    order: 2;
  }
  .app-settings:hover { background: transparent; color: var(--text); }
  .app-settings.active { color: var(--accent); background: transparent; }
  .app-settings.active::before { display: none; }
}
