/* Dr. Sandez Chiropractic — AI Receptionist Ops Console
   Dark editorial dashboard ported from the Sky Zone ops-console system.
   Cyan = interactive / AI accent · clinical blue = clinic brand.
   Monospace micro-labels, tabular numerals, subtle grid + glow texture.
   Deliberately single-theme (dark): this is a console to operate, not a doc. */

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

:root {
  /* surfaces */
  --bg: #090d14;
  --surface: #0f1521;
  --surface-2: #141c2b;
  --surface-3: #1a2434;
  --border: #1d2735;
  --border-2: #2a3646;

  /* ink */
  --text: #e8eef6;
  --text-dim: #9aa8ba;
  --muted-ink: #66768a;

  /* accents */
  --accent: #34d3c6;   /* cyan — interactive / AI */
  --accent-2: #22b4a8;
  --brand: #4f8df0;    /* clinical blue — clinic identity */
  --brand-2: #7cabf6;
  --green: #3ecb86;
  --amber: #e8b34c;
  --red: #f26770;
  --purple: #a385ff;
  --blue: #52a2fb;

  /* outcome buckets → semantic tones (dots, bars, badges) */
  --c-booked: var(--green);
  --c-voicemail: var(--blue);
  --c-faq: var(--accent);
  --c-redirected: var(--purple);
  --c-spam: #62758c;
  --c-other: var(--amber);

  /* sentiment tones */
  --s-positive: var(--green);
  --s-neutral: #6b7a90;
  --s-negative: var(--red);

  --radius: 14px;
  --radius-sm: 9px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.55);
}

html { color-scheme: dark; }

body {
  font-family: var(--font-ui);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1100px 560px at 88% -8%, rgba(52, 211, 198, 0.07), transparent 62%),
    radial-gradient(900px 480px at -6% 4%, rgba(79, 141, 240, 0.06), transparent 58%),
    var(--bg);
  background-attachment: fixed;
}

::selection { background: rgba(52, 211, 198, 0.28); color: #fff; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb {
  background: #223047;
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: #2f4260; background-clip: content-box; }

.hidden { display: none !important; }

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 16px;
  background: linear-gradient(180deg, #0c1220 0%, #090d14 100%);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #fff;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted-ink);
}

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.nav-item svg { flex-shrink: 0; opacity: 0.8; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(52, 211, 198, 0.14), rgba(52, 211, 198, 0.03)); color: #fff; }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav-item.active svg { color: var(--accent); opacity: 1; }

.side-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.agent-status {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}
.agent-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-ink);
}
.agent-state { font-size: 12.5px; font-weight: 550; color: var(--text); }

.side-logout {
  width: 100%;
  text-align: left;
  padding: 9px 11px;
  font-size: 12.5px;
  color: var(--muted-ink);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease;
}
.side-logout:hover { border-color: var(--border-2); color: var(--text-dim); }
.side-foot form { margin: 0; }

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(62, 203, 134, 0.55);
  animation: pulse 2.4s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(62, 203, 134, 0.5); }
  70% { box-shadow: 0 0 0 7px rgba(62, 203, 134, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 203, 134, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .pulse { animation: none; }
}

/* ---------- main ---------- */

.main {
  flex: 1;
  min-width: 0;
  padding: 40px 44px 64px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- page header ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--border);
}
.page-head-main { min-width: 0; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-ink);
  margin-bottom: 12px;
}
.eyebrow-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: rgba(52, 211, 198, 0.12);
  border: 1px solid rgba(52, 211, 198, 0.28);
  padding: 2px 8px 2px 7px;
  border-radius: 6px;
}
.eyebrow-live .pulse { width: 6px; height: 6px; background: var(--accent); box-shadow: none; animation: none; }
.page-head h1 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #fff;
  line-height: 1.1;
}
.page-sub { margin-top: 10px; max-width: 68ch; color: var(--text-dim); font-size: 14px; }
.page-head-meta { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-dim);
  white-space: nowrap;
}
.meta-pill b { color: var(--text); font-weight: 600; }

/* ---------- error banner ---------- */

.banner {
  background: rgba(242, 103, 112, 0.09);
  border: 1px solid rgba(242, 103, 112, 0.3);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 13.5px;
}

/* ---------- range picker (segmented) ---------- */

.range-picker {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 22px;
}
.range-btn {
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  padding: 6px 14px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.range-btn:hover { color: var(--text); }
.range-btn.active {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #04211f;
  font-weight: 650;
}

/* ---------- stats grid (KPI tiles) ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(224px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 17px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--tone, var(--accent)), transparent 78%);
  opacity: 0.85;
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-2); }
.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-ink);
  line-height: 1.4;
}
.stat-ic {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border-radius: 8px;
  color: var(--tone, var(--accent));
  background: color-mix(in srgb, var(--tone, var(--accent)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 26%, transparent);
}
.stat-n {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.stat-hint {
  margin-top: 7px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
  min-height: 1.2em;
}
.stat-hint.up { color: var(--green); }
.stat-hint.down { color: var(--red); }

.stat[data-tone="cyan"] { --tone: var(--accent); }
.stat[data-tone="blue"] { --tone: var(--blue); }
.stat[data-tone="green"] { --tone: var(--green); }
.stat[data-tone="amber"] { --tone: var(--amber); }
.stat[data-tone="purple"] { --tone: var(--purple); }
.stat[data-tone="red"] { --tone: var(--red); }

/* ---------- sentiment band ---------- */

.sentiment {
  display: flex;
  align-items: center;
  gap: 36px;
  flex-wrap: wrap;
  padding: 22px 24px;
  background:
    linear-gradient(120deg, rgba(62, 203, 134, 0.08), transparent 46%),
    linear-gradient(300deg, rgba(79, 141, 240, 0.06), transparent 42%),
    var(--surface);
}
.sentiment-figure { min-width: 172px; }
.sentiment-figure .eyebrow { margin-bottom: 10px; }
.sentiment-n {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.sentiment-n small {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
  margin-left: 8px;
  letter-spacing: 0;
}
.sentiment-sub { margin-top: 9px; font-size: 12.5px; color: var(--text-dim); }
.sentiment-viz { flex: 1; min-width: 260px; }
.meter {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-3);
}
.meter .seg { height: 100%; }
.meter .seg + .seg { box-shadow: -1px 0 0 rgba(9, 13, 20, 0.5); }
.s-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.s-leg { display: inline-flex; align-items: center; gap: 7px; }
.s-leg .dot { width: 8px; height: 8px; }
.s-leg b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.s-leg.faint { color: var(--muted-ink); }

/* ---------- panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
}
.panel-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 14.5px;
  font-weight: 620;
  letter-spacing: -0.01em;
  color: #fff;
}
.section-idx {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted-ink);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  padding: 2px 7px;
  border-radius: 5px;
}
.count-chip {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- outcome barlist ---------- */

.barlist { display: flex; flex-direction: column; gap: 2px; padding: 4px 18px 16px; }
.barrow {
  display: grid;
  grid-template-columns: 190px 1fr 44px;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.barrow:last-child { border-bottom: none; }
.barrow .k {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--tone, var(--accent));
  min-width: 4px;
  transition: width 0.3s ease;
}
.barrow.zero .bar-fill { opacity: 0.25; }
.barrow .v {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--tone, var(--muted-ink));
}

/* ---------- table ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  padding: 11px 18px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-ink);
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
}
thead th.num { text-align: right; }
tbody td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
  white-space: nowrap;
}
tbody td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-dim); }
tbody tr.call-row { transition: background 0.12s ease; }
tbody tr.call-row.clickable { cursor: pointer; }
tbody tr.call-row:hover td { background: rgba(52, 211, 198, 0.03); }
td.caller { font-weight: 600; color: #fff; }
td.phone { color: var(--text-dim); font-family: var(--font-mono); font-size: 12.5px; }
td.when { color: var(--text-dim); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--tone, var(--text-dim));
  background: color-mix(in srgb, var(--tone, var(--muted-ink)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--muted-ink)) 28%, transparent);
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

tr.detail-row td {
  white-space: normal;
  background: rgba(255, 255, 255, 0.015);
  color: var(--text-dim);
  font-size: 13px;
  padding: 12px 18px 16px;
  border-bottom: 1px solid var(--border);
}
tr.detail-row .detail-meta {
  color: var(--muted-ink);
  font-family: var(--font-mono);
  font-size: 11.5px;
  margin-top: 8px;
}
.s-inline { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); }
.s-inline .dot { width: 7px; height: 7px; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted-ink); font-size: 13.5px; }

.footer {
  text-align: center;
  color: var(--muted-ink);
  font-size: 11.5px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  margin-top: 10px;
}
.footer a { color: var(--text-dim); }
.footer a:hover { color: var(--accent); }

/* ---------- login ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(52, 211, 198, 0.1), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--bg);
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 34px 32px;
  width: 400px;
  max-width: 100%;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }
.login-brand .brand-name { font-size: 15px; }
.login-box h1 {
  font-size: 19px;
  font-weight: 680;
  letter-spacing: -0.02em;
  color: #fff;
  margin-bottom: 4px;
}
.login-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-ink);
  margin-bottom: 22px;
}
.login-box label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-ink);
  margin-bottom: 7px;
}
.login-box input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 9px;
  color: var(--text);
  margin-bottom: 16px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.login-box input::placeholder { color: var(--muted-ink); }
.login-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(52, 211, 198, 0.16);
}
.login-box button[type="submit"] {
  width: 100%;
  padding: 11px;
  margin-top: 4px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #04211f;
  border: none;
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  transition: filter 0.14s ease;
}
.login-box button[type="submit"]:hover { filter: brightness(1.06); }
.login-box .error {
  color: var(--red);
  background: rgba(242, 103, 112, 0.1);
  border: 1px solid rgba(242, 103, 112, 0.28);
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
.login-box .login-foot {
  margin-top: 22px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted-ink);
}

/* ---------- focus visibility ---------- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    overflow-x: auto;
  }
  .brand { border-bottom: none; padding: 0; margin: 0; }
  .nav { flex-direction: row; margin: 0; }
  .nav-item span { display: none; }
  .nav-item.active::before { display: none; }
  .side-foot { display: none; }
  .main { padding: 26px 20px 48px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
  .barrow { grid-template-columns: 130px 1fr 36px; gap: 10px; }
  .stat-n { font-size: 26px; }
}
