@font-face { font-family: Geologica; src: url('/brand/Geologica.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: Onest; src: url('/brand/Onest.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #F6F5F1;
  --surface-alt: #EAEAE5;
  --tile: #F8FAF5;
  --white: #FFFFFF;
  --border: #E8EBE4;
  --border-strong: #D3D8CE;
  --ink: #16171B;
  --muted: #5A5F59;
  --green: #167348;
  --green-hover: #115B39;
  --green-soft: #E9F5EE;
  --signal: #2FC775;
  --forest: #142A20;
  --danger: #B43E2B;
  --danger-soft: #FDF0ED;
  --warn: #8C5319;
  --warn-soft: #FBF3E7;
  --amo: #1D5587;
  --amo-soft: #EDF4FC;
  --b24: #126273;
  --b24-soft: #EAF6F8;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 42, 32, 0.05);
  --shadow: 0 8px 28px -12px rgba(20, 42, 32, 0.10), 0 1px 2px rgba(20, 42, 32, 0.04);
  --font-display: 'Geologica', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  font: 15px/1.5 var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
body { margin: 0; min-height: 100dvh; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.mono { font-family: var(--font-mono); font-size: 0.84rem; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ---- Brand ---- */
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-tile {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--tile); border: 1px solid var(--border);
  display: grid; place-items: center; flex: none; box-shadow: var(--shadow-sm);
}
.brand-tile svg { width: 24px; height: 24px; display: block; }
.wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  line-height: 1; letter-spacing: -0.02em; color: var(--ink); user-select: none;
}
.wordmark .ii { color: var(--green); }
.mode-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600;
}
.mode-badge.live { background: var(--green-soft); color: var(--green); }
.mode-badge.demo { background: var(--warn-soft); color: var(--warn); }
.mode-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mode-badge.live .dot { background: var(--signal); }

/* ---- Boot & Login ---- */
.boot-screen {
  min-height: 100dvh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
}
.boot-text { color: var(--muted); font-size: 0.92rem; }
.login-shell {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(640px 360px at 50% -10%, rgba(47, 199, 117, 0.11), transparent 70%), var(--bg);
}
.login-card {
  width: 100%; max-width: 430px; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px 26px 26px; box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.login-card h1 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
.login-desc { color: var(--muted); font-size: 0.9rem; margin-bottom: 20px; }
.login-form { display: grid; gap: 14px; }
.login-foot {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; font-size: 0.84rem;
}

/* ---- Topbar & Layout ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(234, 234, 229, 0.94); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-strong);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 10px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.nav-tabs {
  display: flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, 0.65); padding: 4px;
  border-radius: 12px; border: 1px solid var(--border);
}
.nav-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font-weight: 600; font-size: 0.86rem; white-space: nowrap;
}
.nav-tab:hover { color: var(--ink); background: rgba(255,255,255,0.75); }
.nav-tab[aria-selected="true"] {
  background: var(--white); color: var(--ink); box-shadow: var(--shadow-sm);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }

.demo-ribbon {
  background: var(--forest); color: #E8F6EE;
  padding: 8px 22px; font-size: 0.84rem;
}
.demo-ribbon-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.demo-ribbon strong { color: var(--signal); font-weight: 600; }

.container { max-width: 1180px; margin: 0 auto; padding: 24px 22px 54px; }

/* ---- Hero / Header Cards ---- */
.hero-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 24px;
  box-shadow: var(--shadow-sm); margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
}
.hero-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-card h1 {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.15;
}
.hero-sub { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 0.87rem; color: var(--muted); }

/* ---- Kill-switch ---- */
.kill-switch {
  display: inline-flex; align-items: center; gap: 11px;
  padding: 8px 14px 8px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--tile);
  font-size: 0.9rem; font-weight: 600; color: var(--ink);
  transition: background 0.14s ease, border-color 0.14s ease;
}
.kill-switch[aria-checked="true"] { background: var(--green-soft); border-color: #C3E3D0; color: var(--green); }
.kill-switch[aria-checked="false"] { background: var(--danger-soft); border-color: #F0CBC3; color: var(--danger); }
.sw-track {
  width: 42px; height: 24px; border-radius: 999px;
  background: #C6BBB8; position: relative; flex: none;
}
.kill-switch[aria-checked="true"] .sw-track { background: var(--green); }
.sw-thumb {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: var(--white); box-shadow: 0 1px 2px rgba(0,0,0,0.22);
  transition: transform 0.14s ease;
}
.kill-switch[aria-checked="true"] .sw-thumb { transform: translateX(18px); }

/* ---- KPI & Grid ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 5px;
}
.kpi-label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.kpi-value {
  font-family: var(--font-display); font-size: 1.45rem; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums;
}
.kpi-value.accent { color: var(--green); }
.kpi-value.danger { color: var(--danger); }
.kpi-sub { font-size: 0.79rem; color: var(--muted); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 14px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head h2 {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; letter-spacing: -0.015em;
}

/* ---- Buttons & Pills ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 7px 13px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--white);
  color: var(--ink); font-weight: 600; font-size: 0.86rem; text-decoration: none; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--tile); border-color: #BFC7BA; }
.btn.primary { background: var(--green); border-color: var(--green); color: var(--white); }
.btn.primary:hover:not(:disabled) { background: var(--green-hover); border-color: var(--green-hover); }
.btn.subtle { background: var(--surface-alt); border-color: transparent; }
.btn.subtle:hover:not(:disabled) { background: #DFE0D9; }
.btn.sm { min-height: 31px; padding: 5px 10px; font-size: 0.81rem; border-radius: 8px; }
.btn.full { width: 100%; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 600; white-space: nowrap;
}
.pill.active { background: var(--green-soft); color: var(--green); }
.pill.pilot { background: var(--warn-soft); color: var(--warn); }
.pill.paused { background: var(--danger-soft); color: var(--danger); }
.pill.neutral { background: var(--surface-alt); color: var(--muted); }
.pill.amo { background: var(--amo-soft); color: var(--amo); }
.pill.b24 { background: var(--b24-soft); color: var(--b24); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.active .dot { background: var(--signal); }

.ext-link { color: var(--green); text-decoration: none; font-weight: 600; }
.ext-link:hover { text-decoration: underline; }

/* ---- Tables & Lists ---- */
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th, td { padding: 10px 12px; text-align: left; border-top: 1px solid var(--border); vertical-align: top; }
th {
  border-top: 0; background: var(--tile); color: var(--muted);
  font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.num-col { text-align: right; font-variant-numeric: tabular-nums; }

.event-list { display: grid; gap: 8px; }
.event-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 11px 13px; border-radius: 10px;
  background: var(--tile); border: 1px solid var(--border);
}
.event-main { display: grid; gap: 3px; min-width: 0; }
.event-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.83rem; }
.event-summary { font-size: 0.89rem; color: var(--ink); }
.event-time { font-size: 0.79rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- Demo Dialogs & Calls ---- */
.segmented {
  display: inline-flex; background: var(--surface-alt);
  padding: 3px; border-radius: 10px; border: 1px solid var(--border);
}
.segmented button {
  padding: 5px 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-weight: 600; font-size: 0.83rem;
}
.segmented button[aria-pressed="true"] { background: var(--white); color: var(--ink); box-shadow: var(--shadow-sm); }

.dialog-card {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--tile); padding: 14px 16px; display: grid; gap: 10px;
}
.dialog-card + .dialog-card { margin-top: 10px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dialog-title { font-weight: 700; font-size: 0.94rem; }
.dialog-thread {
  display: grid; gap: 7px; padding-top: 10px; border-top: 1px solid var(--border);
}
.msg-bubble {
  padding: 9px 12px; border-radius: 10px; background: var(--white);
  border: 1px solid var(--border); font-size: 0.86rem;
}
.msg-bubble.ai { background: var(--green-soft); border-color: #CEE6D8; }
.msg-actor { font-size: 0.75rem; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.call-audio { width: 100%; max-width: 420px; height: 36px; }
.transcript {
  white-space: pre-wrap; font-size: 0.84rem; color: var(--ink);
  background: var(--white); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
}

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; }
.field-label { font-size: 0.84rem; font-weight: 600; }
.field-hint { font-size: 0.78rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--white); font-size: 0.9rem;
}
.textarea { min-height: 86px; resize: vertical; }
.check-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.check-item { display: inline-flex; align-items: center; gap: 7px; font-size: 0.88rem; cursor: pointer; }
.check-item input { accent-color: var(--green); width: 16px; height: 16px; flex: 0 0 16px; }
.billing-form { display: grid; gap: 12px; margin-top: 20px; }
.billing-form .btn { justify-self: start; }
.billing-grid { align-items: start; }
.billing-grid > .card { margin-top: 0; }
.billing-grid + .card { margin-top: 16px; }
.billing-facts { margin-block: 14px; }
.billing-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.billing-dialog { width: min(440px, calc(100% - 32px)); padding: 22px; border: 0; border-radius: 14px; color: var(--ink); }
.billing-dialog::backdrop { background: rgb(22 23 27 / 55%); }
.billing-dialog h2 { margin: 0; }
.billing-dialog p { line-height: 1.5; }

.plan-price { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.plan-price small { font-size: 0.82rem; font-weight: 500; color: var(--muted); }

/* ---- Empty / Alerts / Toast ---- */
.empty-box {
  padding: 28px 20px; border-radius: 12px;
  background: var(--tile); border: 1px dashed var(--border-strong);
  text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center;
}
.empty-box h3 { color: var(--ink); font-family: var(--font-display); font-size: 1rem; }
.alert-box {
  padding: 10px 13px; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger);
  border: 1px solid #F0CBC3; font-size: 0.86rem;
}
.info-box {
  padding: 12px 14px; border-radius: 10px;
  background: var(--green-soft); color: var(--forest);
  border: 1px solid #CBE4D5; font-size: 0.86rem;
}
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  max-width: min(360px, calc(100% - 32px));
  padding: 10px 15px; border-radius: 10px;
  background: var(--forest); color: var(--white);
  font-size: 0.86rem; font-weight: 500; box-shadow: 0 14px 34px rgba(20,42,32,0.28);
}
.toast:empty { display: none; }

@media (max-width: 960px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar-inner { padding: 10px 14px; }
  .container { padding: 16px 14px 40px; }
  .nav-tabs { width: 100%; flex-wrap: wrap; order: 3; }
  .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
