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

/* ==========================================================================
   Novara CRM — "Blueprint" theme
   Architect's-desk system: cool paper ground, white drawing sheets,
   architectural navy as the primary brand, hi-vis amber as the single accent.
   Display: Space Grotesk (engineered) · UI: Inter · Data: JetBrains Mono.
   NOTE: legacy --gold* variables are retained by name and repurposed as the
   amber ACCENT so existing markup keeps working; --brand* is the navy primary.
   ========================================================================== */
:root {
  /* Accent — hi-vis amber (kept under legacy --gold* names) */
  --gold: #E0842B;
  --gold-mid: #CE741A;
  --gold-light: #F4A64B;
  --gold-pale: rgba(224, 132, 43, 0.12);
  --gold-border: rgba(224, 132, 43, 0.32);
  --gold-glow: rgba(224, 132, 43, 0.30);
  /* Primary — architectural navy */
  --brand: #1C4E7A;
  --brand-dark: #123655;
  --brand-light: #2E72AC;
  --brand-pale: rgba(28, 78, 122, 0.08);
  --brand-border: rgba(28, 78, 122, 0.22);
  --brand-glow: rgba(28, 78, 122, 0.28);
  --white: #FFFFFF;
  --bg: #EAEFF5;
  --bg-alt: #F5F8FB;
  --sidebar-bg: #0E2438;
  --sidebar-border: rgba(255, 255, 255, 0.07);
  --sidebar-text: #94A7BD;
  --sidebar-text-active: #F3F8FC;
  --text: #0F1E2E;
  --text-secondary: #3D4E60;
  --text-muted: #74869A;
  --border: rgba(15, 30, 46, 0.10);
  --border-light: rgba(15, 30, 46, 0.055);
  --shadow-sm: 0 1px 2px rgba(15, 30, 46, 0.05), 0 2px 8px rgba(15, 30, 46, 0.05);
  --shadow-md: 0 4px 8px rgba(15, 30, 46, 0.06), 0 14px 34px rgba(15, 30, 46, 0.10);
  --shadow-lg: 0 10px 20px rgba(15, 30, 46, 0.10), 0 28px 56px rgba(18, 54, 85, 0.18);
  --shadow-card: 0 0 0 1px rgba(15, 30, 46, 0.05), 0 2px 4px rgba(15, 30, 46, 0.04), 0 12px 28px rgba(15, 30, 46, 0.07);
  --success: #0E9F6E;
  --success-bg: #DEF7EC;
  --danger: #E02424;
  --danger-bg: #FDE8E8;
  --warning: #C27803;
  --warning-bg: #FDF6B2;
  --info: #1C64F2;
  --info-bg: #E1EFFE;
  --sidebar-w: 272px;
  --topbar-h: 68px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  /* Blueprint grid used as a subtle texture on dark surfaces */
  --blueprint-grid:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px) 0 0 / 28px 28px;
}

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 100% 70% at 50% -10%, rgba(28, 78, 122, 0.06), transparent 70%),
    radial-gradient(ellipse 60% 50% at 100% 0%, rgba(28, 78, 122, 0.04), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Display type — Space Grotesk carries the engineered, architectural voice */
h1, h2, h3,
.page-header h1, .card-title, .stat-card .value,
.login-card h1, .login-left h2, .modal h2,
.agent-panel h2, .agent-panel h3 {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
}

/* Tabular figures wherever numbers matter */
.stat-card .value, .usage-agent-nums, .usage-chip, table td, .usage-detail-grid strong {
  font-variant-numeric: tabular-nums;
}

a { color: var(--brand); text-decoration: none; font-weight: 500; }
a:hover { color: var(--brand-light); }

/* ===== APP SHELL ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-brand {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  text-align: center;
}

.sidebar-brand img {
  max-width: 170px;
  height: auto;
  filter: brightness(1.08);
}

.sidebar-brand .tagline {
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--gold-mid);
  margin-top: 10px;
  font-weight: 600;
}

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

.nav-section {
  margin-bottom: 20px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
  padding: 0 12px 8px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.sidebar-nav a i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.35);
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text-active);
}

.sidebar-nav a:hover i { color: var(--gold-mid); }

.sidebar-nav a.active {
  background: linear-gradient(90deg, rgba(224, 132, 43, 0.20), rgba(224, 132, 43, 0.02));
  color: var(--sidebar-text-active);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--gold);
}

.sidebar-nav a.active i { color: var(--gold-light); }

.sidebar-footer {
  padding: 16px 12px 20px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  color: #F87171;
  font-size: 13px;
  font-weight: 500;
}

.sidebar-footer a:hover { background: rgba(248, 113, 113, 0.1); }

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

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

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

.breadcrumb {
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb strong { color: var(--text); font-weight: 600; }

.topbar-search {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  gap: 8px;
  width: 280px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.topbar-search:focus-within {
  border-color: var(--brand-border);
  box-shadow: 0 0 0 3px var(--brand-pale);
}

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  width: 100%;
  color: var(--text);
  font-family: inherit;
}

.topbar-search i { color: var(--text-muted); font-size: 13px; }

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

.topbar-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  position: relative;
  transition: all 0.18s;
}

.topbar-btn:hover { border-color: var(--brand-border); color: var(--brand); background: var(--brand-pale); }

.notif-dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--white);
}

/* Global auto-calling system status pill (topbar) */
.sys-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all 0.18s;
}
.sys-pill .sys-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  flex: none;
}
.sys-pill.is-on {
  border-color: rgba(14, 159, 110, 0.35);
  background: var(--success-bg);
  color: #06694a;
}
.sys-pill.is-on .sys-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(14, 159, 110, 0.18);
}
.sys-pill.is-off {
  border-color: rgba(224, 36, 36, 0.35);
  background: var(--danger-bg);
  color: #9b1c1c;
}
.sys-pill.is-off .sys-dot { background: var(--danger); }
.sys-pill:hover { filter: brightness(0.97); }
@media (max-width: 720px) {
  .sys-pill .sys-pill-text { display: none; }
  .sys-pill { padding: 0 13px; }
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-light), var(--brand-dark));
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}

.user-chip .name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-chip .role { font-size: 11px; color: var(--text-muted); }

.main-content { padding: 28px 32px 48px; flex: 1; }

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.page-header .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

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

/* ===== CARDS ===== */
.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title i { color: var(--gold); }

.card-title .gold-bar {
  width: 4px; height: 18px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  border-radius: 2px;
  display: inline-block;
}

/* ===== STAT CARDS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.25s, transform 0.25s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light), var(--gold-mid));
}

.stat-card .stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold-pale), rgba(224, 132, 43, 0.06));
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  font-size: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--gold-border);
}

.stat-card .label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-card .value {
  font-size: 30px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin: 4px 0;
}

.stat-card .sub {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-card .trend-up { color: var(--success); font-weight: 600; }
.stat-card .trend-down { color: var(--danger); font-weight: 600; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-light) 0%, var(--brand) 55%, var(--brand-dark) 100%);
  color: var(--white);
  box-shadow: 0 4px 14px var(--brand-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: 0 8px 22px var(--brand-glow);
  transform: translateY(-2px);
}

.btn-outline {
  background: var(--white);
  border: 1.5px solid var(--brand-border);
  color: var(--brand);
}

.btn-outline:hover { background: var(--brand-pale); border-color: var(--brand); }

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

.btn-ghost:hover { border-color: var(--brand-border); color: var(--brand); background: var(--brand-pale); }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #991B1B; }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-icon { padding: 8px 10px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

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

thead {
  background: var(--bg-alt);
}

th {
  text-align: left;
  padding: 13px 16px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: var(--brand-pale); }
tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-new { background: var(--info-bg); color: var(--info); }
.badge-calling { background: var(--warning-bg); color: var(--warning); }
.badge-qualified { background: #E0F2FE; color: #0369A1; }
.badge-scheduled { background: var(--gold-pale); color: var(--gold); border: 1px solid var(--gold-border); }
.badge-won { background: var(--success-bg); color: var(--success); }
.badge-lost { background: var(--danger-bg); color: var(--danger); }
.badge-cancelled { background: #F3F4F6; color: #6B7280; }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-sent { background: var(--success-bg); color: var(--success); }
.badge-high { background: var(--danger-bg); color: var(--danger); }
.badge-medium { background: var(--warning-bg); color: var(--warning); }
.badge-low { background: var(--success-bg); color: var(--success); }

/* Auto-calling workflow statuses */
.badge-stopped { background: rgba(15, 30, 46, 0.07); color: var(--text-secondary); }
.badge-attempt { background: var(--gold-pale); color: var(--gold-mid); border: 1px solid var(--gold-border); }
.badge-manual { background: var(--danger-bg); color: var(--danger); }
.badge-noanswer { background: var(--warning-bg); color: var(--warning); }

/* Low-balance / attention variant for stat cards (e.g. ElevenLabs credits) */
.stat-card--alert {
  border-color: rgba(224, 36, 36, 0.45);
  box-shadow: 0 0 0 1px var(--danger-bg), var(--shadow-card);
}
.stat-card--alert::after { background: linear-gradient(90deg, var(--danger), #F98080); }
.stat-card--alert .stat-icon {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(224, 36, 36, 0.3);
}

/* ===== TOGGLE SWITCH ===== */
.switch { position: relative; display: inline-block; width: 58px; height: 32px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #C6D0DB; border-radius: 999px; transition: background 0.2s;
}
.switch .slider::before {
  content: ''; position: absolute;
  height: 24px; width: 24px; left: 4px; top: 4px;
  background: var(--white); border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15, 30, 46, 0.3); transition: transform 0.2s;
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(26px); }
.switch input:disabled + .slider { opacity: 0.55; cursor: not-allowed; }
.switch input:focus-visible + .slider { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Master system-control card (Settings) */
.system-control {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 24px;
}
.system-control .sc-icon {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.system-control.is-on .sc-icon { background: var(--success-bg); color: var(--success); }
.system-control.is-off .sc-icon { background: var(--danger-bg); color: var(--danger); }
.system-control .sc-body { flex: 1; min-width: 0; }
.system-control .sc-title { font-weight: 700; font-size: 16px; color: var(--text); }
.system-control .sc-desc { font-size: 13px; color: var(--text-muted); margin-top: 3px; line-height: 1.6; }
.system-control .sc-state {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 4px 12px; border-radius: 999px; white-space: nowrap;
}
.system-control.is-on .sc-state { background: var(--success-bg); color: #06694a; }
.system-control.is-off .sc-state { background: var(--danger-bg); color: #9b1c1c; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }

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

.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-pale);
}

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ===== MODAL ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(9, 22, 35, 0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 92%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s ease;
}

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

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

.modal h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--gold-pale);
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* ===== PIPELINE ===== */
.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.pipeline-column {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  min-height: 320px;
  box-shadow: var(--shadow-sm);
}

.pipeline-column h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--brand-pale);
}

.pipeline-card {
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.18s;
}

.pipeline-card:hover {
  border-color: var(--gold-border);
  box-shadow: var(--shadow-sm);
  background: var(--white);
}

/* ===== INTEGRATIONS ===== */
.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.integration-item {
  text-align: center;
  padding: 20px 16px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  transition: all 0.18s;
}

.integration-item:hover { border-color: var(--gold-border); background: var(--gold-pale); }

.integration-item .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-bottom: 10px;
}

.dot-on { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }
.dot-off { background: #D1D5DB; }

.integration-item .int-name { font-weight: 600; font-size: 13px; color: var(--text); }
.integration-item .int-status { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== CALENDAR ===== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.cal-header {
  background: var(--brand-pale);
  padding: 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
}

.cal-day {
  background: var(--white);
  min-height: 100px;
  padding: 10px;
  font-size: 12px;
}

.cal-day.other-month { background: var(--bg); color: var(--text-muted); }
.cal-day.today { background: #EDF3F9; box-shadow: inset 0 0 0 2px var(--brand-border); }
.cal-day .day-num { font-weight: 700; color: var(--text); margin-bottom: 6px; }

.cal-event {
  background: var(--gold-pale);
  border-left: 3px solid var(--gold);
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 10px;
  margin-bottom: 3px;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* ===== TASKS ===== */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--white);
  transition: all 0.18s;
}

.task-item:hover { border-color: var(--gold-border); box-shadow: var(--shadow-sm); }
.task-item.done { opacity: 0.6; }
.task-item.done .task-title { text-decoration: line-through; }

.task-check {
  width: 22px; height: 22px;
  border: 2px solid var(--gold-border);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  margin-top: 2px;
  transition: all 0.18s;
}

.task-check.checked { background: var(--gold); border-color: var(--gold); color: var(--white); }

.task-title { font-weight: 600; color: var(--text); font-size: 14px; }
.task-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ===== ACTIVITY FEED ===== */
.activity-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold-pale);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold);
  flex-shrink: 0;
  font-size: 14px;
}

.activity-body .act-action { font-weight: 600; color: var(--text); font-size: 13px; }
.activity-body .act-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.activity-body .act-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.login-left {
  background:
    var(--blueprint-grid),
    radial-gradient(ellipse 80% 80% at 22% 18%, rgba(46, 114, 172, 0.35), transparent 60%),
    linear-gradient(155deg, #0B1E30 0%, #123655 55%, #1C4E7A 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--white);
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
}

.login-left img {
  max-width: 260px;
  margin-bottom: 32px;
  filter: brightness(1.05);
}

.login-left h2 { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.login-left p { font-size: 15px; opacity: 0.9; line-height: 1.7; max-width: 360px; text-align: center; }

.login-features { margin-top: 40px; display: flex; flex-direction: column; gap: 14px; }
.login-features .feat { display: flex; align-items: center; gap: 12px; font-size: 14px; opacity: 0.95; }
.login-features .feat i { width: 32px; height: 32px; background: rgba(255,255,255,0.15); border-radius: 8px; display: flex; align-items: center; justify-content: center; }

.login-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  background: var(--bg);
  background-image: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(28, 78, 122, 0.07), transparent);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.9);
  padding: 40px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
}

.login-card h1 { font-size: 26px; font-weight: 800; color: var(--text); margin-bottom: 6px; letter-spacing: -0.4px; }
.login-card .subtitle { color: var(--text-muted); margin-bottom: 32px; font-size: 14px; }

.login-error {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  display: none;
  border: 1px solid #FECACA;
}

.cred-box {
  margin-top: 24px;
  padding: 16px;
  background: var(--gold-pale);
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  font-size: 13px;
}

.cred-box .cred-title { font-weight: 700; color: var(--gold); margin-bottom: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.cred-box p { margin: 4px 0; color: var(--text-secondary); }
.cred-box strong { color: var(--text); }

/* ===== QUICK ACTIONS ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.22s ease;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.quick-action i {
  font-size: 22px;
  color: var(--gold);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-pale);
  border-radius: 12px;
  border: 1px solid var(--gold-border);
  transition: transform 0.22s;
}

.quick-action:hover {
  border-color: var(--gold-border);
  background: var(--white);
  color: var(--gold);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.quick-action:hover i {
  transform: scale(1.08);
  background: linear-gradient(135deg, var(--gold-pale), rgba(224, 132, 43, 0.08));
}

/* ===== SCRIPTS ===== */
.script-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}

.script-card h4 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.script-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.7; white-space: pre-line; }

/* ===== UTILITIES ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); font-weight: 600; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state i { font-size: 40px; color: var(--gold-border); margin-bottom: 16px; display: block; }

/* Toast */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item {
  padding: 14px 22px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); color: var(--white); }
.toast-error { background: var(--danger); color: var(--white); }
.toast-info { background: var(--brand); color: var(--white); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Live auto-refresh indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.live-indicator .live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: livePulse 2s infinite;
}
.live-indicator.refreshing .live-dot { animation-duration: 0.8s; }
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Agent panel */
.agent-panel { text-align: center; padding: 40px 32px; }
.agent-orb {
  width: 140px; height: 140px; border-radius: 50%; margin: 0 auto 24px;
  background: linear-gradient(145deg, rgba(255,255,255,0.95), var(--gold-pale));
  border: 2px solid var(--gold-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: var(--gold);
  box-shadow: 0 8px 32px rgba(224, 132, 43, 0.2), inset 0 1px 0 rgba(255,255,255,0.8);
  transition: all 0.3s;
  position: relative;
}
.agent-orb::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), transparent, var(--gold-light));
  z-index: -1;
  opacity: 0.4;
}
.agent-orb.calling {
  border-color: var(--gold-mid);
  box-shadow: 0 0 0 12px rgba(224, 132, 43, 0.12), 0 8px 40px rgba(224, 132, 43, 0.3);
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }

/* Responsive */
@media (max-width: 1024px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-left { display: none; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-wrap { margin-left: 0; }
  .main-content { padding: 20px 16px; }
  .topbar { padding: 0 16px; }
  .topbar-search { display: none; }
  .form-row { grid-template-columns: 1fr; }
}

/* ===== Usage & Price (aligned to Novara shell) ===== */
.usage-page { --usage-gap: 16px; --usage-panel-h: 420px; }
.usage-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--usage-gap);
  margin-bottom: var(--usage-gap);
  align-items: stretch;
}
.usage-kpis .stat-card {
  display: flex;
  flex-direction: column;
  min-height: 148px;
  height: 100%;
  margin: 0;
}
.usage-kpis .stat-card .sub {
  margin-top: auto;
  min-height: 2.4em;
  line-height: 1.35;
}
.usage-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--usage-gap);
  align-items: stretch;
}

/* Call history stands alone now that the per-agent breakdown is gone. */
.usage-split--single { grid-template-columns: minmax(0, 1fr); }
.usage-agents-card,
.usage-calls-card {
  display: flex;
  flex-direction: column;
  height: var(--usage-panel-h);
  min-height: var(--usage-panel-h);
  max-height: var(--usage-panel-h);
  margin-bottom: 0;
  overflow: hidden;
}
.usage-agents-card .card-header,
.usage-calls-card .card-header {
  flex-shrink: 0;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.usage-hint { margin: 0; font-size: 12px; color: var(--text-muted); text-align: right; }
.usage-agents,
.usage-calls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 2px;
}
.usage-agents:has(.empty-state),
.usage-calls:has(.empty-state) {
  justify-content: center;
  align-items: center;
}
.usage-agent {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.18s, background 0.18s;
}
.usage-agent:hover { border-color: var(--gold-border); }
.usage-agent.is-active {
  border-color: var(--gold-border);
  background: var(--gold-pale);
}
.usage-agent-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800;
  background: var(--gold-pale); color: var(--gold); border: 1px solid var(--gold-border);
}
.usage-agent-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.usage-agent-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usage-agent-meta span { font-size: 11px; color: var(--text-muted); }
.usage-bar { margin-top: 6px; height: 4px; border-radius: 999px; background: var(--border-light); overflow: hidden; }
.usage-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.usage-agent-nums { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-variant-numeric: tabular-nums; }
.usage-num-el { font-size: 12px; font-weight: 700; color: var(--gold); }
.usage-num-tw { font-size: 11px; color: var(--text-muted); }
.usage-call {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  overflow: hidden;
  flex-shrink: 0;
}
.usage-call[open] { border-color: var(--gold-border); box-shadow: var(--shadow-card); }
.usage-call-summary {
  list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; cursor: pointer; user-select: none;
}
.usage-call-summary::-webkit-details-marker { display: none; }
.usage-call-main { min-width: 0; }
.usage-call-main strong { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usage-call-sub { font-size: 12px; color: var(--text-muted); }
.usage-call-chips { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.usage-chip { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 8px; background: var(--bg-alt); color: var(--text); }
.usage-chip--el { background: var(--gold-pale); color: var(--gold); }
.usage-chip--tw { background: var(--bg-alt); color: var(--text-secondary); }
.usage-chip--tx { background: var(--success-bg); color: var(--success); }
.usage-chevron { font-size: 11px; color: var(--text-muted); transition: transform 0.2s; }
.usage-call[open] .usage-chevron { transform: rotate(180deg); }
.usage-call-detail { padding: 0 16px 16px; border-top: 1px solid var(--border-light); }
.usage-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 14px 0 8px; }
.usage-detail-grid .label { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.usage-detail-grid strong { font-size: 13px; font-weight: 600; }
.usage-detail-grid .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; word-break: break-all; }
.usage-transcript-wrap { margin-top: 8px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-alt); }
.usage-transcript-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.usage-chat { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; }
.usage-bubble { max-width: 92%; padding: 10px 12px; border-radius: 14px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.usage-bubble p { margin: 0; }
.usage-bubble-role { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; opacity: 0.7; }
.usage-bubble--agent { align-self: flex-start; background: var(--gold-pale); border: 1px solid var(--gold-border); border-bottom-left-radius: 4px; }
.usage-bubble--user { align-self: flex-end; background: var(--white); border: 1px solid var(--border); border-bottom-right-radius: 4px; }
.usage-bubble--system { align-self: center; max-width: 100%; border: 1px dashed var(--border); color: var(--text-muted); font-size: 12px; text-align: center; }
.usage-transcript-empty { padding: 18px; text-align: center; color: var(--text-muted); font-size: 13px; }
.usage-detail-actions { margin-top: 12px; display: flex; gap: 8px; }

@media (max-width: 1100px) {
  .usage-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-split { grid-template-columns: 1fr; }
  .usage-agents-card, .usage-calls-card { height: auto; min-height: 280px; max-height: none; }
  .usage-agents, .usage-calls { max-height: 360px; }
}
@media (max-width: 640px) {
  .usage-kpis { grid-template-columns: 1fr; }
  .usage-detail-grid { grid-template-columns: 1fr; }
}

/* ===== Show more / Show less (shared) ===== */
.show-more-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}
.show-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--gold-border);
  background: var(--gold-pale);
  color: var(--gold);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.show-more-btn:hover {
  background: rgba(224, 132, 43, 0.2);
  border-color: var(--gold);
}
.show-more-btn-all {
  background: var(--white);
  border-style: dashed;
}
.show-more-btn-less {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.show-more-btn-less:hover {
  border-color: var(--gold-border);
  color: var(--gold);
}
.pipeline-column .show-more-bar {
  flex-direction: column;
  border-top: none;
  padding-top: 8px;
  margin-top: 8px;
}
.pipeline-column .show-more-btn {
  width: 100%;
  border-radius: 10px;
}

/* ===== Accessibility & motion (quality floor) ===== */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible { outline-offset: 3px; }
.sidebar-nav a:focus-visible,
.quick-action:focus-visible,
.usage-agent:focus-visible { outline-offset: -2px; }
/* On the dark navy sidebar, a light ring reads better than the navy one */
.sidebar-nav a:focus-visible,
.sidebar-footer a:focus-visible { outline-color: var(--gold-light); }

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

/* ============================================================
   ANALYTICS COMMAND CENTER  (analytics.html / performance.html)
   A "blueprint" reading of the funnel: a dark, grid-textured
   command band as the thesis, quiet disciplined panels below.
   Built entirely from the Blueprint tokens (navy + amber). All
   classes are .an-* scoped so nothing else in the app is touched.
   ============================================================ */

/* ---- Blueprint command band (hero) ---- */
.an-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 30px 34px 34px;
  margin-bottom: 26px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(224, 132, 43, 0.16), transparent 46%),
    var(--blueprint-grid),
    linear-gradient(160deg, #123655 0%, var(--sidebar-bg) 60%, #0A1C2C 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-lg);
  color: #EAF2FA;
  animation: an-rise 0.5s ease both;
}
/* faint amber baseline, like an annotation rule on a drawing */
.an-hero::after {
  content: '';
  position: absolute; left: 34px; right: 34px; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent 70%);
  opacity: 0.5;
}
.an-hero-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 26px;
}
.an-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 2.4px;
  text-transform: uppercase; color: var(--gold-light);
  display: flex; align-items: center; gap: 8px;
}
.an-eyebrow::before {
  content: ''; width: 22px; height: 2px; background: var(--gold); display: inline-block;
}
.an-hero h1 {
  font-size: 27px; font-weight: 800; letter-spacing: -0.4px;
  color: #fff; margin: 8px 0 4px;
}
.an-hero .an-sub { font-size: 13.5px; color: #9DB6CE; max-width: 46ch; }

.an-live {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: #B9CEE2;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 7px 13px; border-radius: 999px; white-space: nowrap;
}
.an-live .an-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success); box-shadow: 0 0 0 3px rgba(14, 159, 110, 0.25);
  animation: an-pulse 2s ease-in-out infinite;
}

/* ---- Hero body: gauge + KPI readouts ---- */
.an-hero-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 30px; align-items: center;
}
.an-gauge { position: relative; width: 168px; height: 168px; flex: none; }
.an-gauge svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.an-gauge .an-gauge-track { fill: none; stroke: rgba(255, 255, 255, 0.10); }
.an-gauge .an-gauge-arc {
  fill: none; stroke: url(#anGaugeGrad); stroke-linecap: round;
  transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.an-gauge-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.an-gauge-center .g-val { font-size: 40px; font-weight: 800; color: #fff; line-height: 1; letter-spacing: -1px; }
.an-gauge-center .g-lab {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--gold-light); margin-top: 6px;
}

.an-readouts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.an-readout {
  position: relative;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 15px 16px 15px 20px;
  overflow: hidden;
}
.an-readout::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold)); border-radius: 0 3px 3px 0;
}
.an-readout .k {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: #8FA7BF; display: flex; align-items: center; gap: 7px;
}
.an-readout .k i { color: var(--gold); font-size: 11px; }
.an-readout .v { font-size: 25px; font-weight: 800; color: #fff; line-height: 1.1; margin-top: 5px; letter-spacing: -0.5px; }
.an-readout .d { font-size: 11.5px; color: #93AABF; margin-top: 2px; }
.an-readout .d .up { color: #5FD6A6; font-weight: 700; }

/* ---- Funnel (the signature data-viz) ---- */
.an-funnel { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.an-fn-row { display: grid; grid-template-columns: 116px 1fr; align-items: center; gap: 14px; }
.an-fn-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); text-align: right; }
.an-fn-track { position: relative; height: 34px; display: flex; align-items: center; }
.an-fn-bar {
  height: 100%; min-width: 3px; border-radius: 8px;
  background: linear-gradient(90deg, var(--brand-dark), var(--brand-light));
  display: flex; align-items: center; justify-content: flex-end;
  padding: 0 12px; color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  white-space: nowrap;
}
.an-fn-row:last-child .an-fn-bar { background: linear-gradient(90deg, var(--gold-mid), var(--gold-light)); }
.an-fn-pct { font-size: 11.5px; color: var(--text-muted); font-weight: 600; margin-left: 10px; white-space: nowrap; }

/* ---- Horizontal bars (leads/appointments by status) ---- */
.an-bars { display: flex; flex-direction: column; gap: 15px; }
.an-bar-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.an-bar-name { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); text-transform: capitalize; }
.an-bar-val { font-size: 13px; font-weight: 700; color: var(--text); }
.an-bar-val small { color: var(--text-muted); font-weight: 600; margin-left: 5px; }
.an-bar-track { height: 9px; border-radius: 6px; background: var(--border-light); overflow: hidden; }
.an-bar-fill {
  height: 100%; border-radius: 6px; width: 0;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---- Donut (call outcomes) ---- */
.an-donut-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.an-donut { position: relative; width: 158px; height: 158px; flex: none; }
.an-donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.an-donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.an-donut-center .dc-val { font-size: 30px; font-weight: 800; color: var(--text); line-height: 1; }
.an-donut-center .dc-lab { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); margin-top: 4px; }
.an-legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 10px; }
.an-legend-item { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.an-legend-item .an-dot { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.an-legend-item .lg-name { color: var(--text-secondary); text-transform: capitalize; flex: 1; }
.an-legend-item .lg-val { font-weight: 700; color: var(--text); }
.an-legend-item .lg-pct { color: var(--text-muted); font-size: 11.5px; margin-left: 6px; }

/* ---- Activity timeline ---- */
.an-feed { display: flex; flex-direction: column; }
.an-feed-item { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-light); }
.an-feed-item:last-child { border-bottom: none; }
.an-feed-mark { display: flex; justify-content: center; position: relative; }
.an-feed-mark i {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand-pale); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  border: 1px solid var(--brand-border);
}
.an-feed-body { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.an-feed-body strong { color: var(--text); font-weight: 700; }
.an-feed-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

@keyframes an-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes an-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

@media (max-width: 900px) {
  .an-hero-body { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .an-readouts { grid-template-columns: repeat(2, 1fr); width: 100%; }
  .an-readout { text-align: left; }
}
@media (max-width: 520px) {
  .an-readouts { grid-template-columns: 1fr; }
  .an-fn-row { grid-template-columns: 90px 1fr; }
}
