/* Caledonian Leads — team CRM styles
 *
 * Dark-first "cool" UI. Data-viz colors follow the validated reference
 * palette (blue series, reserved status colors, ink tokens for text).
 * Light mode swaps the same roles via prefers-color-scheme. */

:root {
  --page: #0d1117;
  --page-glow: radial-gradient(1200px 600px at 80% -10%, rgba(57, 135, 229, 0.18), transparent 60%),
               radial-gradient(900px 500px at -10% 110%, rgba(12, 163, 12, 0.08), transparent 60%);
  --surface: #161b22;
  --surface-2: #1d242e;
  --border: rgba(255, 255, 255, 0.09);
  --ink: #f0f3f6;
  --ink-2: #b6bfc9;
  --muted: #8b949e;
  --grid: #2c333c;
  --baseline: #3a424c;
  --series: #3987e5;          /* categorical slot 1, dark step */
  --series-strong: #5598e7;
  --good: #0ca30c;
  --good-text: #3fb950;
  --good-wash: rgba(12, 163, 12, 0.13);
  --crit-text: #e66767;
  --warn-text: #fab219;
  --accent: #3987e5;
  --accent-ink: #ffffff;
  --accent-soft: rgba(57, 135, 229, 0.12);
  --accent-line: rgba(57, 135, 229, 0.35);

  /* Elevation scale — low-contrast and layered rather than one hard drop.
     Surfaces should read as lifted, never as outlined boxes. */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.28), 0 1px 3px rgba(0, 0, 0, 0.22);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.44), 0 2px 8px rgba(0, 0, 0, 0.28);

  --radius: 20px;
  --radius-sm: 12px;
  --radius-xs: 10px;
  --pill: 999px;

  /* One motion vocabulary, so nothing feels out of step. */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 0.16s;
  --med: 0.28s;
}

@media (prefers-color-scheme: light) {
  :root {
    --page: #f4f6f9;
    --page-glow: radial-gradient(1200px 600px at 80% -10%, rgba(42, 120, 214, 0.10), transparent 60%);
    --surface: #ffffff;
    --surface-2: #f0f3f7;
    --border: rgba(11, 11, 11, 0.10);
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --muted: #898781;
    --grid: #e1e0d9;
    --baseline: #c3c2b7;
    --series: #2a78d6;
    --series-strong: #1c5cab;
    --good: #0ca30c;
    --good-text: #006300;
    --good-wash: #e9f7e9;
    --crit-text: #d03b3b;
    --warn-text: #8a5a00;
    --accent: #1a73e8;
    --accent-ink: #ffffff;
    --shadow: 0 8px 24px rgba(20, 40, 80, 0.10);
  }
}

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

/* Author display rules (flex/grid) beat the UA [hidden] rule, so make the
   hidden attribute win explicitly wherever it's used to toggle views. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--page);
  background-image: var(--page-glow);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

/* ============ Login ============ */

.login-view {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: center;
}

.brand-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--series), var(--series-strong));
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

.brand-mark.small {
  width: 32px;
  height: 32px;
  font-size: 13px;
  border-radius: 9px;
  margin: 0;
}

/* Brand logo (the real Caledonian Designs mark) */
.login-logo {
  display: block;
  width: 190px;
  max-width: 72%;
  height: auto;
  margin: 0 auto 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 3px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }

.login-card h1 { font-size: 22px; font-weight: 700; }

.login-tagline { color: var(--ink-2); font-size: 13px; margin: 4px 0 20px; }

.demo-banner {
  background: rgba(250, 178, 25, 0.12);
  border: 1px solid rgba(250, 178, 25, 0.45);
  color: var(--warn-text);
  font-size: 12.5px;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 16px;
  line-height: 1.45;
  text-align: left;
}

#loginForm { display: flex; flex-direction: column; gap: 14px; text-align: left; }

#loginForm label { font-size: 12.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 6px; }

#loginForm input {
  padding: 12px 14px;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
}

#loginForm input:focus { border-color: var(--accent); }

.btn-primary {
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  font-size: 15px;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.login-error { color: var(--crit-text); font-size: 13px; text-align: center; }

/* ============ App shell ============ */

.app-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  padding-top: calc(14px + env(safe-area-inset-top));
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-weight: 700; font-size: 16px; }

.header-right { display: flex; align-items: center; gap: 10px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  font-size: 13px;
}

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--series), var(--series-strong));
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 15px;
  cursor: pointer;
}

.icon-btn:hover { color: var(--ink); }

/* Navigation */

.top-nav { display: none; gap: 6px; padding: 0 18px 10px; }

.nav-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

.nav-btn.active { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }

.bottom-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav .nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 0 7px;
  border-radius: 0;
  font-size: 11.5px;
}

.bottom-nav .nav-btn.active { background: transparent; border: none; color: var(--accent); }

.nav-icon { font-size: 19px; }

@media (min-width: 760px) {
  .top-nav { display: flex; }
  .bottom-nav { display: none; }
}

/* Content */

.content {
  flex: 1;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 6px 16px 28px;
}

.view { display: flex; flex-direction: column; gap: 14px; }

/* ============ Tiles & cards ============ */

.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, 1fr); } }

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tile-label { font-size: 12px; color: var(--ink-2); }

.tile-value { font-size: 30px; font-weight: 750; line-height: 1.1; }

.hero-tile .tile-value { font-size: 40px; }

.tile-value.good { color: var(--good-text); }

.tile-sub { font-size: 11.5px; color: var(--muted); }
.tile-sub.goal-met { color: var(--good-text); font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.card h2 { font-size: 14px; font-weight: 650; margin-bottom: 12px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-head h2 { margin-bottom: 0; }

.goal-setting { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); }

.goal-setting input {
  width: 84px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
}

/* Goal progress bar */

.goal-bar-wrap {
  height: 20px;
  background: var(--grid);
  border-radius: 8px;
  overflow: hidden;
}

.goal-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--series), var(--series-strong));
  border-radius: 6px 0 0 6px;
  transition: width 0.5s ease;
}

.goal-bar.goal-met { background: var(--good); }

.goal-bar-caption {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

/* Day chart */

.day-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 140px;
  padding-top: 18px;
  border-bottom: 1px solid var(--baseline);
}

.day-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
}

.day-bar {
  width: 62%;
  max-width: 44px;
  background: var(--series);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
}

.day-bar.zero { background: var(--grid); }

.day-value {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}

.day-labels { display: flex; gap: 10px; margin-top: 6px; }

.day-label { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }
.day-label.today { color: var(--ink); font-weight: 700; }

/* Team list */

.team-list { display: flex; flex-direction: column; gap: 8px; }

.team-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
}

.team-row .avatar { flex-shrink: 0; }

.team-name { font-weight: 600; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.team-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.team-stats b { color: var(--ink); font-size: 15px; }

.team-stats .good b { color: var(--good-text); }

.team-empty { color: var(--muted); font-size: 13px; }

/* Outcome chips */

.outcome-chips { display: flex; gap: 10px; flex-wrap: wrap; }

.outcome-chip {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 130px;
  background: var(--surface-2);
}

.chip-icon { font-size: 13px; }
.chip-count { font-size: 20px; font-weight: 700; }
.chip-label { font-size: 12px; color: var(--ink-2); }

.outcome-chip.interested { border-color: var(--good); }
.outcome-chip.interested .chip-icon { color: var(--good-text); }
.outcome-chip.not-interested .chip-icon { color: var(--crit-text); }
.outcome-chip.no-answer .chip-icon { color: var(--warn-text); }

/* ============ Leads view ============ */

.leads-toolbar { display: flex; flex-direction: column; gap: 10px; }

.search-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

.search-input:focus { border-color: var(--accent); }

.tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  overflow-x: auto;
}

.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
}

.tab.active { background: var(--accent); color: var(--accent-ink); }

.chip-filters { display: flex; gap: 8px; }

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.chip.active { border-color: var(--accent); color: var(--accent); font-weight: 650; }

.leads-meta { font-size: 12px; color: var(--muted); padding: 2px 2px 0; }

/* Lead cards */

.lead-list { display: flex; flex-direction: column; gap: 10px; }

.lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-card.interested { border-color: var(--good); background: linear-gradient(0deg, var(--good-wash), var(--good-wash)), var(--surface); }
.lead-card.done { opacity: 0.72; }

.lead-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }

.lead-name { font-size: 16px; font-weight: 700; line-height: 1.25; }

.lead-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

.lead-rating { font-size: 12.5px; color: var(--warn-text); white-space: nowrap; }

.lead-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
}

.action-link.call { border-color: var(--accent); color: var(--accent); }

.action-link.disabled { opacity: 0.5; pointer-events: none; }

.no-site-tag { font-size: 12px; color: var(--warn-text); align-self: center; font-style: italic; }

/* Outcome segmented buttons — big tap targets for phones */

.outcome-seg { display: flex; gap: 6px; }

.seg-btn {
  flex: 1;
  padding: 10px 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.05s ease;
}

.seg-btn:active { transform: scale(0.97); }

.seg-btn.on.interested { background: var(--good); border-color: var(--good); color: #fff; }
.seg-btn.on.not-interested { background: #d03b3b; border-color: #d03b3b; color: #fff; }
.seg-btn.on.no-answer { background: #b97e00; border-color: #b97e00; color: #fff; }

.lead-called-by { font-size: 11.5px; color: var(--muted); }

.list-empty {
  text-align: center;
  color: var(--muted);
  padding: 42px 16px;
  font-size: 14px;
}

/* Desktop: two-column lead grid */

@media (min-width: 760px) {
  .leads-toolbar { flex-direction: row; align-items: center; flex-wrap: wrap; }
  .search-input { max-width: 300px; }
  .tabs { flex: 0 0 auto; }
  .lead-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
}

/* ============ Toast ============ */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(74px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  z-index: 50;
}

@media (min-width: 760px) { .toast { bottom: 28px; } }

/* ============ Staff / admin ============ */

.staff-hint { font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px; line-height: 1.5; }

.staff-form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }

.staff-form label { font-size: 12.5px; color: var(--ink-2); display: flex; flex-direction: column; gap: 6px; }

.staff-form input {
  padding: 11px 13px;
  font-size: 16px; /* no iOS zoom */
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
}

.staff-form input:focus { border-color: var(--accent); }

.staff-form .btn-primary { align-self: flex-start; padding: 11px 22px; }

.staff-msg { font-size: 13px; color: var(--good-text); line-height: 1.5; }
.staff-msg.error { color: var(--crit-text); }

.staff-list { display: flex; flex-direction: column; gap: 8px; }

.staff-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
}

/* Contact details wrap rather than truncate — an admin needs to be able to
   read the whole email and phone, not a "j…" stub. */
.staff-info { flex: 1 1 180px; min-width: 0; }
.staff-name { font-weight: 600; font-size: 14px; }
.staff-email { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

.staff-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-2);
}

.staff-contact a { color: var(--ink-2); text-decoration: none; }
.staff-contact a:hover { color: var(--accent); text-decoration: underline; }
.staff-contact .none { color: var(--muted); font-style: italic; }

.role-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}

.role-badge.admin { background: var(--accent); color: var(--accent-ink); }
.role-badge.staff { background: var(--surface); color: var(--ink-2); border: 1px solid var(--border); }
.role-badge.off { background: transparent; color: var(--crit-text); border: 1px solid var(--crit-text); }

/* A switched-off member stays listed (their calls and earnings still
   count) but reads as inactive at a glance. */
.staff-row.is-disabled { opacity: 0.6; }

/* ============ Lead pool card ============ */

.pool-updated { font-size: 12px; color: var(--muted); }

.pool-top { display: flex; align-items: baseline; gap: 8px; }
.pool-num { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.pool-cap { font-size: 13px; color: var(--ink-2); }

.pool-runway {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
}

/* Amber when the pool won't last the week, red once it's dry — the whole
   point of the card is catching this before the team runs dry. */
.pool-low .pool-runway { color: var(--warn-text); font-weight: 600; }
.pool-low .pool-num { color: var(--warn-text); }
.pool-empty .pool-runway { color: var(--crit-text); font-weight: 600; }
.pool-empty .pool-num { color: var(--crit-text); }

.pool-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.pool-group:empty { display: none; }

.pool-group-title {
  flex-basis: 100%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.pool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--ink-2);
}

.pool-chip b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============ Staff tags (admin-only labels) ============ */

.staff-tags {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.tag-x {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.tag-x:hover { color: var(--crit-text); }

.tag-input {
  width: 110px;
  padding: 4px 10px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-size: 11.5px;
  font-family: inherit;
}

.tag-input:focus {
  outline: none;
  border-style: solid;
  border-color: var(--accent);
}

/* ============ Call script ============ */

.script-hint { font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px; line-height: 1.5; }

.script-box {
  width: 100%;
  min-height: 340px;
  resize: vertical;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  white-space: pre-wrap;
}

.script-box:focus { border-color: var(--accent); }

.script-box.readonly {
  background: var(--surface);
  cursor: default;
  border-style: dashed;
}

.script-meta { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ============ Shared form rows (account / clients) ============ */

.form-row { display: flex; gap: 12px; }
.form-row > label { flex: 1; min-width: 0; }
@media (max-width: 480px) { .form-row { flex-direction: column; gap: 12px; } }

.staff-form select {
  padding: 11px 13px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
}
.staff-form select:focus { border-color: var(--accent); }
.staff-form textarea.note-box { min-height: 80px; }

/* ============ Clients CRM ============ */

.client-list { display: flex; flex-direction: column; gap: 10px; }

.client-card {
  padding: 13px 15px;
  border-radius: 12px;
  background: var(--surface-2);
  border-left: 4px solid var(--muted);
}
.client-card.status-new         { border-left-color: var(--series); }
.client-card.status-in-progress { border-left-color: var(--warn-text); }
.client-card.status-review      { border-left-color: #a855f7; }
.client-card.status-completed   { border-left-color: var(--good); }
.client-card.status-on-hold     { border-left-color: var(--muted); }

.client-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.client-name { font-weight: 700; font-size: 15px; }
.client-value { font-weight: 700; font-size: 14px; color: var(--good-text); white-space: nowrap; }
.client-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.client-notes { font-size: 13px; color: var(--ink-2); margin-top: 8px; line-height: 1.5; white-space: pre-wrap; }

.client-ctrl { display: flex; gap: 8px; align-items: center; margin-top: 11px; }
.client-status-sel {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.client-del {
  margin-left: auto;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--crit-text);
  font-size: 12.5px;
  cursor: pointer;
}
.client-del:hover { background: color-mix(in srgb, var(--crit-text) 12%, transparent); }

/* ============ Team chat ============ */

.chat-container { display: flex; gap: 14px; height: calc(100vh - 200px); min-height: 420px; }

.online-users {
  width: 180px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  overflow-y: auto;
}
.online-users h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 10px; }
.online-user { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 14px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 20%, transparent); }
.online-empty { font-size: 13px; color: var(--muted); }

.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.chat-header { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chat-header h2 { font-size: 15px; }

.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 78%; align-self: flex-start; }
.msg.mine { align-self: flex-end; text-align: right; }
.msg-meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; padding: 0 4px; }
.msg-bubble {
  display: inline-block;
  padding: 9px 13px;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.mine .msg-bubble { background: var(--accent); color: var(--accent-ink); }

.typing-indicator { min-height: 18px; padding: 0 16px; font-size: 12px; color: var(--muted); font-style: italic; }

.chat-input { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.chat-input input {
  flex: 1;
  padding: 11px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
}
.chat-input input:focus { border-color: var(--accent); }
.chat-input button {
  padding: 11px 20px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.chat-input button:hover { filter: brightness(1.05); }

@media (max-width: 620px) {
  .chat-container { height: calc(100vh - 170px); }
  .online-users { display: none; }
}

/* ============ Dashboard date + per-person goal ============ */

.dash-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 12px;
  letter-spacing: 0.2px;
}

.goal-perperson {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ============ Leads caller filter ============ */

.caller-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

.caller-filter select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.caller-filter select:focus { border-color: var(--accent); }

/* ============ Table / Map view toggle ============ */

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-left: auto;
}
.vt-btn {
  padding: 7px 14px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.vt-btn.active { background: var(--accent); color: var(--accent-ink); }

.lead-map {
  position: relative;
  height: calc(100vh - 240px);
  min-height: 420px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.lead-map .leaflet-container { height: 100%; width: 100%; background: var(--surface-2); }
.map-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.map-count {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 500;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow);
}
/* Leaflet popups follow the app surface colours */
.leaflet-popup-content { font-size: 13px; line-height: 1.5; }

/* ============ In-progress claim ============ */

.claim-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.claim-btn:hover { border-color: var(--warn-text); color: var(--ink); }
.claim-btn.on {
  border-style: solid;
  border-color: var(--warn-text);
  background: color-mix(in srgb, var(--warn-text) 14%, transparent);
  color: var(--warn-text);
}

.lead-claimed {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

/* ============ Lead note ============ */

.lead-note {
  margin-top: 8px;
  padding: 8px 11px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
}

/* ============ Staff role toggle ============ */

.role-toggle {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.role-toggle:hover { border-color: var(--accent); color: var(--ink); }
.role-toggle:disabled { opacity: 0.5; cursor: default; }

/* Disable / enable a member's access. Danger-tinted when it switches
   someone off, positive when it lets them back in. */
.access-toggle {
  padding: 6px 12px;
  border: 1px solid var(--crit-text);
  border-radius: 999px;
  background: transparent;
  color: var(--crit-text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.access-toggle:hover { background: rgba(208, 59, 59, 0.12); }
.access-toggle:disabled { opacity: 0.5; cursor: default; }

.access-toggle.on {
  border-color: var(--good-text);
  color: var(--good-text);
}
.access-toggle.on:hover { background: var(--good-wash); }

/* Deleting is permanent, so it stays quiet until you reach for it —
   Disable is the button that should catch your eye first. */
.staff-del {
  padding: 6px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.staff-del:hover {
  border-color: var(--crit-text);
  color: var(--crit-text);
}

.staff-del:disabled { opacity: 0.5; cursor: default; }

/* ============ Modal (outcome note) ============ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: color-mix(in srgb, var(--page) 70%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal-card h3 { font-size: 17px; margin-bottom: 4px; }
.note-sub { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

.note-box {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}

.note-box:focus { border-color: var(--accent); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.btn-ghost {
  padding: 11px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* ============ Wallet / earnings ============ */

.wallet-card { text-align: center; }
.wallet-balance {
  font-size: 40px;
  font-weight: 800;
  color: var(--good-text);
  letter-spacing: -0.5px;
  margin: 6px 0 2px;
}
.wallet-note { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }

.wallet-history { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.wallet-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 8px;
}
.wallet-amt { font-weight: 700; color: var(--good-text); white-space: nowrap; }
.wallet-desc { font-size: 12.5px; color: var(--ink-2); }

/* Wallet controls in the Staff list */
.staff-wallet {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-basis: 100%;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.wallet-bal {
  font-weight: 700;
  color: var(--good-text);
  min-width: 64px;
}
.wallet-input {
  width: 90px;
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
}
.wallet-input:focus { border-color: var(--accent); outline: none; }
.wallet-add {
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: var(--good);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.wallet-add:hover { filter: brightness(1.05); }
.wallet-add:disabled { opacity: 0.5; cursor: default; }

/* Staff rows now wrap so the wallet row sits underneath */
.staff-row { flex-wrap: wrap; }

/* ============ Welcome / daily quote overlay ============ */

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--page) 80%, transparent);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  animation: overlay-in 0.4s ease;
}

@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.welcome-card {
  width: 100%;
  max-width: 460px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 34px 30px 26px;
  animation: card-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.welcome-greeting {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 18px;
}

.quote-sketch {
  color: var(--accent);
  margin: 0 auto 6px;
  width: 130px;
}

.quote-sketch svg { width: 100%; height: auto; display: block; opacity: 0.9; }

.quote-text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  line-height: 1.4;
  font-style: italic;
  color: var(--ink);
  margin: 10px 6px 8px;
}

.quote-author { font-size: 13px; color: var(--muted); margin-bottom: 22px; }

.welcome-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.countdown { position: relative; width: 44px; height: 44px; flex-shrink: 0; }

.countdown svg { width: 44px; height: 44px; transform: rotate(-90deg); }

.cd-track { fill: none; stroke: var(--grid); stroke-width: 4; }

.cd-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.cd-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.welcome-continue { padding: 13px 26px; transition: opacity 0.2s ease; }
.welcome-continue:disabled { opacity: 0.45; cursor: wait; }

@media (max-width: 480px) {
  .quote-text { font-size: 19px; }
  .welcome-card { padding: 28px 22px 22px; }
}

/* ============ Walkthrough ============ */

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  animation: overlay-in 0.35s ease;
}

.tour-card {
  width: 100%;
  max-width: 480px;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 26px 26px 20px;
}

.tour-card.step-in { animation: card-in 0.34s cubic-bezier(0.2, 0.8, 0.2, 1); }

.tour-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.tour-title { font-size: 21px; font-weight: 750; line-height: 1.25; margin-bottom: 12px; }

.tour-body { font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.tour-body p + p { margin-top: 10px; }
.tour-body b, .tour-body strong { color: var(--ink); font-weight: 650; }

.tour-list { margin: 10px 0 0; padding-left: 18px; }
.tour-list li { margin-bottom: 6px; }

/* The one line we most want read — a quiet amber flag, not a shout. */
.tour-warn {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--warn-text);
  border-radius: 0 8px 8px 0;
  background: color-mix(in srgb, var(--warn-text) 10%, transparent);
  font-size: 13px;
  color: var(--ink);
}

.tour-note { margin-top: 12px; font-size: 12.5px; color: var(--muted); }

/* --- step illustrations --- */

.tour-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
}

.tv-logo img { width: 62px; height: 62px; border-radius: 12px; background: #fff; padding: 5px; object-fit: contain; }

.tv-outcomes, .tv-filters, .tv-claim { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.tv-btn {
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  border: 1px solid var(--border);
}
.tv-yes { color: var(--good-text); border-color: var(--good-text); }
.tv-no { color: var(--crit-text); border-color: var(--crit-text); }
.tv-na { color: var(--warn-text); border-color: var(--warn-text); }

.tv-chip {
  padding: 7px 12px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.tv-chip-on { border-style: solid; border-color: var(--warn-text); color: var(--warn-text); font-weight: 650; }
.tv-arrow { color: var(--muted); align-self: center; }

.tv-pill {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.tv-pill-on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }

.tv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
  font-size: 12px;
  color: var(--ink-2);
  text-align: center;
}
.tv-grid span { padding: 8px 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; }

/* --- progress + actions --- */

.tour-dots { display: flex; gap: 6px; justify-content: center; margin: 18px 0 14px; }

.tour-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  transition: width 0.25s ease, background 0.25s ease;
}
.tour-dot.on { width: 20px; border-radius: 999px; background: var(--accent); }

.tour-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-nav { display: flex; gap: 8px; margin-left: auto; }

.tour-replay { margin-top: 4px; align-self: flex-start; }

@media (max-width: 480px) {
  .tour-card { padding: 22px 18px 16px; }
  .tour-title { font-size: 19px; }
  .tv-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ Ambient lighting ============
   Two large, very low-opacity brand-blue washes that drift slowly behind
   everything, plus a hairline top highlight on cards. Restrained on purpose:
   the aim is depth, not decoration — nothing above 6% opacity, nothing that
   moves fast enough to notice while reading. */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient span {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}

.ambient .amb-1 {
  width: 46vw; height: 46vw;
  min-width: 340px; min-height: 340px;
  top: -14vw; right: -10vw;
  background: radial-gradient(circle, rgba(57, 135, 229, 0.30), transparent 68%);
  animation: amb-drift-a 34s ease-in-out infinite alternate;
}

.ambient .amb-2 {
  width: 40vw; height: 40vw;
  min-width: 300px; min-height: 300px;
  bottom: -16vw; left: -12vw;
  background: radial-gradient(circle, rgba(85, 152, 231, 0.22), transparent 68%);
  animation: amb-drift-b 44s ease-in-out infinite alternate;
}

@keyframes amb-drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-5vw, 5vh, 0) scale(1.10); }
}
@keyframes amb-drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.06); }
  to   { transform: translate3d(5vw, -4vh, 0) scale(1); }
}

/* Light mode: the same shapes, dialled right down so the page stays white. */
@media (prefers-color-scheme: light) {
  .ambient span { opacity: 0.28; filter: blur(80px); }
}

/* A 1px lit edge along the top of each surface — the detail that reads as
   "lit" rather than "flat", and the reason this looks considered up close. */
.card, .tile, .welcome-card, .tour-card, .login-card, .modal-card {
  position: relative;
}

.card::before, .tile::before, .welcome-card::before,
.tour-card::before, .login-card::before, .modal-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16) 30%,
              rgba(255, 255, 255, 0.16) 70%, transparent);
  pointer-events: none;
}

@media (prefers-color-scheme: light) {
  .card::before, .tile::before, .welcome-card::before,
  .tour-card::before, .login-card::before, .modal-card::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9) 30%,
                rgba(255, 255, 255, 0.9) 70%, transparent);
  }
}

/* Motion is decorative here — drop it entirely when it isn't wanted. */
@media (prefers-reduced-motion: reduce) {
  .ambient span { animation: none; }
  .tour-card.step-in { animation: none; }
}

/* ===================================================================
   PREMIUM LAYER
   A visual refinement pass over the working app. Layered last so it
   wins on equal specificity without rewriting the sheet above.
   Nothing here changes behaviour — spacing, type, elevation, motion.
   =================================================================== */

/* --- Softer borders throughout --- */
:root { --border: rgba(255, 255, 255, 0.07); }
@media (prefers-color-scheme: light) { :root { --border: rgba(11, 11, 11, 0.08); } }

/* --- Rhythm: more air between everything --- */
.content { max-width: 1080px; padding: 14px 20px 40px; }
.view { gap: 20px; }

@media (min-width: 760px) {
  .content { padding: 20px 28px 48px; }
  .view { gap: 24px; }
}

/* --- Surfaces --- */
.card {
  padding: 22px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--surface);
}

@media (min-width: 760px) { .card { padding: 26px; } }

.card h2 {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  margin-bottom: 16px;
}

.card-head { margin-bottom: 16px; }
.card-head h2 { margin-bottom: 0; }

/* --- Typography hierarchy --- */
body { font-size: 15px; line-height: 1.5; }

.tile-value, .metric-value, .pool-num, .chip-count,
.wallet-balance, .lb-calls b {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  font-weight: 700;
}

/* ============ Hero metrics ============ */

.tiles { gap: 14px; }
@media (min-width: 760px) { .tiles { gap: 16px; } }

.tile {
  padding: 22px 22px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  gap: 8px;
  transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease);
}

.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.tile-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Much larger numbers — these are the four things people scan for. */
.tile-value { font-size: 42px; line-height: 1; }
.hero-tile .tile-value { font-size: 52px; }

@media (min-width: 760px) {
  .tile-value { font-size: 46px; }
  .hero-tile .tile-value { font-size: 58px; }
}

.tile-sub { font-size: 12px; color: var(--muted); line-height: 1.4; }

/* ============ Weekly progress ============ */

.goal-bar-wrap {
  height: 14px;
  border-radius: var(--pill);
  background: var(--surface-2);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.goal-bar {
  height: 100%;
  border-radius: var(--pill);
  background: linear-gradient(90deg, var(--series), var(--series-strong));
  transition: width 0.9s var(--ease);
}

.goal-bar.goal-met { background: linear-gradient(90deg, var(--good), var(--good-text)); }

.goal-bar-caption { margin-top: 12px; font-size: 13px; }
.goal-bar-caption span:first-child { font-weight: 650; color: var(--ink); }
.goal-perperson { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ============ Lead pool ============ */

.pool-num { font-size: 46px; }
.pool-group { gap: 8px; margin-top: 18px; }
.pool-group-title { margin-bottom: 4px; }

.pool-chip {
  padding: 7px 14px;
  border-radius: var(--pill);
  background: var(--surface-2);
  border-color: transparent;
  transition: border-color var(--fast) var(--ease);
}

.pool-chip:hover { border-color: var(--border); }

/* ============ Leaderboard ============ */

.team-list { gap: 6px; }

.team-row {
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  transition: background var(--fast) var(--ease);
}

.team-row:hover { background: var(--surface-2); }

.lb-rank {
  width: 22px;
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Top three get a warmer rank marker — enough to spot, not a trophy case. */
.team-row.top-1 .lb-rank { color: #e8c15f; }
.team-row.top-2 .lb-rank { color: #c8cdd4; }
.team-row.top-3 .lb-rank { color: #d09668; }

.team-row.top-1 { background: linear-gradient(90deg, rgba(232, 193, 95, 0.07), transparent 55%); }

/* Your own row, quietly marked. */
.team-row.is-me {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.team-row.is-me:hover { background: var(--accent-soft); }

.team-row .avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
  box-shadow: 0 0 0 1px var(--border);
}

.team-name { font-size: 14.5px; font-weight: 650; }

.team-meta { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.team-meta-lines { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.team-stats { gap: 18px; }
.team-stats b { font-size: 17px; }
.team-stats span { display: flex; align-items: baseline; gap: 5px; }

.lb-hint { font-size: 11.5px; color: var(--muted); }

/* ============ Outcome KPI cards ============ */

.outcome-chips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.outcome-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  min-width: 0;
  position: relative;
  overflow: hidden;
  transition: transform var(--med) var(--ease);
}

.outcome-chip:hover { transform: translateY(-2px); }

/* A 2px status rail rather than a full coloured border — keeps the wall
   of cards monochrome while still reading at a glance. */
.outcome-chip::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--muted);
}
.outcome-chip.interested::after { background: var(--good-text); }
.outcome-chip.not-interested::after { background: var(--crit-text); }
.outcome-chip.no-answer::after { background: var(--muted); }

.outcome-chip.interested { border-color: var(--border); }

.chip-icon { font-size: 12px; opacity: 0.75; }
.chip-count { font-size: 34px; line-height: 1; }
.chip-label { font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.outcome-chip.interested .chip-count { color: var(--good-text); }

/* ============ Team status widget ============ */

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good-text) 20%, transparent);
  animation: pulse-dot 2.4s ease-in-out infinite;
}

@keyframes pulse-dot { 50% { opacity: 0.45; } }

.status-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.status-tile {
  padding: 14px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  text-align: center;
}

.status-tile b { display: block; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.status-tile span { font-size: 11px; color: var(--muted); }

.status-people { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.status-people:empty { display: none; }

.who-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 8px;
  border-radius: var(--pill);
  background: var(--surface-2);
  font-size: 12.5px;
  color: var(--ink-2);
}

.who-dot { width: 7px; height: 7px; border-radius: 50%; }
.who-dot.calling { background: var(--good-text); }
.who-dot.break { background: var(--warn-text); }
.who-dot.offline { background: var(--baseline); }

/* ============ Activity feed ============ */

.activity-feed { display: flex; flex-direction: column; }

.act-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--border);
  animation: act-in 0.4s var(--ease) backwards;
}

.act-row:last-child { border-bottom: 0; }

@keyframes act-in { from { opacity: 0; transform: translateY(-4px); } }

.act-icon {
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 12px;
}

.act-text { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }
.act-text b { color: var(--ink); font-weight: 650; }
.act-when { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.act-empty, .list-empty { color: var(--muted); font-size: 13px; padding: 6px 0; }

/* ============ Streaks & badges ============ */

.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: var(--pill);
  background: color-mix(in srgb, var(--warn-text) 14%, transparent);
  color: var(--warn-text);
  font-size: 12px;
  font-weight: 700;
}

.lb-streak { font-size: 11.5px; color: var(--warn-text); font-weight: 650; white-space: nowrap; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat-cell { padding: 14px 12px; border-radius: var(--radius-sm); background: var(--surface-2); }
.stat-cell b { display: block; font-size: 24px; line-height: 1.15; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-cell span { font-size: 11px; color: var(--muted); }

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid transparent;
  opacity: 0.42;
  filter: grayscale(1);
  transition: opacity var(--med) var(--ease), filter var(--med) var(--ease);
}

.badge.earned { opacity: 1; filter: none; border-color: var(--border); }

.badge-ico { font-size: 19px; line-height: 1; }
.badge-name { font-size: 12.5px; font-weight: 650; line-height: 1.3; }
.badge-sub { font-size: 11px; color: var(--muted); }

/* ============ Leads page — polish only ============ */

.lead-list { gap: 12px; }

.lead-card {
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--med) var(--ease), box-shadow var(--med) var(--ease);
}

.lead-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

.seg-btn, .claim-btn, .lead-link {
  border-radius: var(--radius-xs);
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}

/* ============ Search & filters ============ */

.leads-toolbar { gap: 14px; }

.search-input {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

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

.chip, .tab, .vt-btn {
  border-radius: var(--pill);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}

/* Active filters read as filled, not merely tinted. */
.chip.active, .tab.active, .vt-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}

.caller-filter select, .client-status-sel, #accCountry, #clStatus {
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}

/* ============ Chat ============ */

.messages { display: flex; flex-direction: column; gap: 14px; padding: 4px 2px; }

.msg { max-width: 76%; }
.msg.mine { align-self: flex-end; }

.msg-meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.msg.mine .msg-meta { text-align: right; }

.msg-bubble {
  padding: 11px 15px;
  border-radius: 18px 18px 18px 6px;
  background: var(--surface-2);
  font-size: 14px;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
  animation: msg-in 0.26s var(--ease) backwards;
}

.msg.mine .msg-bubble {
  border-radius: 18px 18px 6px 18px;
  background: var(--accent);
  color: var(--accent-ink);
}

@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } }

.chat-input input {
  border-radius: var(--pill);
  padding: 12px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.chat-input input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.chat-input button { border-radius: var(--pill); padding: 11px 20px; }

.typing-indicator { font-size: 12px; color: var(--muted); min-height: 18px; font-style: italic; }

.online-users h2 { margin-bottom: 12px; }

/* ============ Script & Account ============ */

.script-box, .note-box {
  border-radius: var(--radius-sm);
  padding: 18px;
  line-height: 1.65;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.script-box:focus, .note-box:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.staff-form { gap: 16px; }

.staff-form input, .staff-form select, .staff-form textarea {
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.staff-form input:focus, .staff-form select:focus, .staff-form textarea:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.wallet-card .wallet-balance { font-size: 44px; letter-spacing: -0.03em; }
.staff-row { padding: 14px; border-radius: var(--radius-sm); gap: 14px; }

/* ============ Prices tab ============ */

.pkg-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.pkg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 20px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

/* The tier we want callers leading with. */
.pkg-card.popular {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, var(--accent-soft), transparent 45%), var(--surface-2);
}

.pkg-card-tag {
  position: absolute;
  top: -9px;
  left: 20px;
  padding: 3px 10px;
  border-radius: var(--pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pkg-card-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.pkg-card-price { display: flex; align-items: baseline; gap: 6px; }
.pkg-card-from { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pkg-card-amt { font-size: 38px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.pkg-card.popular .pkg-card-amt { color: var(--accent); }

.pkg-card-blurb { margin-top: 10px; font-size: 13px; color: var(--ink-2); line-height: 1.5; }

.pkg-card-list { list-style: none; margin: 16px 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.pkg-card-list li { position: relative; padding-left: 22px; font-size: 13.5px; color: var(--ink-2); line-height: 1.4; }
.pkg-card-list li::before {
  content: '';
  position: absolute;
  left: 2px; top: 5px;
  width: 11px; height: 6px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.pkg-card-best {
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}
.pkg-card-best b { color: var(--ink-2); font-weight: 650; }

/* Add-ons read as a price list, not more cards — quicker to scan mid-call. */
.addon-rows { display: flex; flex-direction: column; }

.addon-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 2px;
  border-bottom: 1px solid var(--border);
}
.addon-row:last-child { border-bottom: 0; }

.addon-row-ico { font-size: 15px; width: 22px; text-align: center; }
.addon-row-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.addon-row-price {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.price-facts { display: flex; flex-direction: column; gap: 16px; }
.fact-q { font-size: 13.5px; font-weight: 650; margin-bottom: 3px; }
.fact-a { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }

/* ============ Motion ============ */

.btn-primary, .btn-ghost, .seg-btn, .claim-btn, .chip, .tab,
.vt-btn, .wallet-add, .role-toggle, .access-toggle, .staff-del {
  transition: transform var(--fast) var(--ease), filter var(--fast) var(--ease),
              background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

/* Buttons dip slightly on press — the one bit of feedback worth having. */
.btn-primary:active, .btn-ghost:active, .seg-btn:active, .claim-btn:active,
.chip:active, .tab:active, .vt-btn:active, .wallet-add:active,
.role-toggle:active, .access-toggle:active, .staff-del:active { transform: scale(0.97); }

.btn-primary { border-radius: var(--radius-xs); box-shadow: var(--shadow-sm); }

/* Cards rise in on view change, staggered just enough to feel sequential. */
.view > * { animation: card-rise 0.42s var(--ease) backwards; }
.view > *:nth-child(2) { animation-delay: 0.04s; }
.view > *:nth-child(3) { animation-delay: 0.08s; }
.view > *:nth-child(4) { animation-delay: 0.12s; }
.view > *:nth-child(5) { animation-delay: 0.16s; }
.view > *:nth-child(n+6) { animation-delay: 0.2s; }

@keyframes card-rise { from { opacity: 0; transform: translateY(10px); } }

@media (prefers-reduced-motion: reduce) {
  .view > *, .act-row, .msg-bubble { animation: none; }
  .goal-bar { transition: none; }
  .tile:hover, .lead-card:hover, .outcome-chip:hover { transform: none; }
}

/* ===================================================================
   CALLING — dialler, floor view and the active-call bar
   Built from the same tokens as the rest of the app so the phone
   system reads as native rather than bolted on.
   =================================================================== */

/* --- Dialler toolbar --- */
.dialler-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}

.dl-queue { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.dl-status { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.dl-state {
  border-radius: var(--radius-xs);
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}
.dl-state:disabled { opacity: 0.55; }

.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.conn-dot.on {
  background: var(--good-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good-text) 20%, transparent);
}

.dl-error {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--crit-text) 12%, transparent);
  color: var(--crit-text);
  font-size: 13.5px;
}

/* --- Empty state --- */
.dl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 64px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.dl-empty-title { font-weight: 650; }
.dl-empty-body { font-size: 13.5px; color: var(--muted); max-width: 34ch; }

/* --- Workspace --- */
.dl-workspace { display: grid; gap: 20px; }
@media (min-width: 900px) { .dl-workspace { grid-template-columns: 1.4fr 1fr; } }

.dl-side { display: flex; flex-direction: column; gap: 20px; }

.dl-lead-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dl-lead-name { font-size: 20px; font-weight: 750; letter-spacing: -0.01em; margin: 0; }

.dl-attempt {
  flex: none;
  padding: 3px 10px;
  border-radius: var(--pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--ink-2);
}

.dl-contact { margin-top: 2px; font-size: 13.5px; color: var(--ink-2); }

.dl-facts { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.dl-fact { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.dl-fact dt { flex: none; width: 20px; text-align: center; opacity: 0.8; }
.dl-fact dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.dl-fact a { color: var(--accent); text-decoration: none; }
.dl-fact a:hover { text-decoration: underline; }
.dl-no-site { color: var(--good-text); }

.dl-prev-title {
  margin-top: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.dl-prev { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.dl-prev-note {
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  font-size: 13.5px;
  line-height: 1.5;
}
.dl-prev-meta { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); }

.dl-actions { display: flex; gap: 10px; margin-top: 14px; }
.dl-call-btn { flex: 1; padding: 15px; font-size: 15.5px; }

/* --- Outcome buttons ---
   Three large targets rather than a dropdown: this is pressed several hundred
   times a day per agent, and a dropdown makes "leave it as it was" the
   fastest path, which is how outcome data rots. */
.dl-outcomes { display: flex; flex-direction: column; gap: 10px; }

.dl-outcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.dl-outcome:hover:not(:disabled) { border-color: var(--accent-line); }
.dl-outcome:active:not(:disabled) { transform: scale(0.98); }
.dl-outcome:disabled { opacity: 0.5; cursor: default; }

/* Green only for a real conversion, red only for a hard no. */
.dl-outcome.good { border-color: color-mix(in srgb, var(--good-text) 45%, transparent); color: var(--good-text); }
.dl-outcome.bad { border-color: color-mix(in srgb, var(--crit-text) 45%, transparent); color: var(--crit-text); }

.dl-outcome kbd {
  flex: none;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
}

/* --- Manual dial pad ---
   Same round keys as the in-call keypad, so there is one keypad in this product
   and not two that look different. */
.dial-pad {
  max-width: 300px;
  margin: 24px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.dp-display { display: flex; align-items: center; gap: 8px; width: 100%; }

.dp-number {
  flex: 1;
  min-width: 0;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  color: var(--ink);
  text-align: center;
  /* 16px minimum, or iOS zooms the whole page on focus. */
  font-size: 26px;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}
.dp-number:focus { outline: none; border-bottom-color: var(--accent-line); }
.dp-number::placeholder { font-size: 16px; letter-spacing: 0; color: var(--muted); }

.dp-back {
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
}
.dp-back:hover { background: var(--surface-2); color: var(--ink); }

.dp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }

.dp-call {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--good-text);
  color: #fff;
  cursor: pointer;
  transition: transform var(--fast) var(--ease), filter var(--fast) var(--ease);
}
.dp-call svg { width: 28px; height: 28px; }
.dp-call:hover { filter: brightness(1.08); }
.dp-call:active { transform: scale(0.93); }
.dp-call:disabled { opacity: 0.4; cursor: default; }

.dl-pad-toggle { margin-top: 10px; }

/* --- In-call screen ---
   Deliberately shaped like the iPhone call screen: the name large and central,
   a grid of round controls, and Hang up alone below them. Agents already know
   this layout, so there is nothing to learn while a customer is on the line. */
.call-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* A short phone in landscape, or a long business name wrapping to three
     lines, must never push Hang up off the bottom. */
  overflow-y: auto;
  background: color-mix(in srgb, var(--page) 74%, transparent);
  backdrop-filter: blur(26px) saturate(1.3);
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  animation: cs-fade 0.24s var(--ease);
}

@keyframes cs-fade { from { opacity: 0; } }

.cs-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  padding: 36px 24px 32px;
  border-radius: 34px;
  border: 1px solid var(--border);
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--accent) 15%, transparent), transparent 62%),
    var(--surface);
  box-shadow: var(--shadow-lg);
  animation: cs-rise 0.32s var(--ease);
}

@keyframes cs-rise { from { transform: translateY(14px) scale(0.97); opacity: 0; } }

.cs-head { text-align: center; }
.cs-name { font-size: 26px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; text-wrap: balance; }
.cs-number { margin-top: 4px; font-size: 14px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cs-timer { margin-top: 10px; font-size: 17px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cs-status { margin-top: 2px; font-size: 13px; color: var(--muted); }
.cs-status.ringing { color: var(--accent); }
.cs-status.hold { color: var(--warn-text); }

.cs-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 16px;
  width: 100%;
}

.cs-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
}

.cs-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.cs-icon svg { width: 26px; height: 26px; }

.cs-btn:hover:not(:disabled) .cs-icon { background: color-mix(in srgb, var(--ink) 18%, transparent); }
.cs-btn:active:not(:disabled) .cs-icon { transform: scale(0.92); }

/* Engaged controls invert, the way they do on the phone. */
.cs-btn.on .cs-icon { background: var(--ink); color: var(--page); }

.cs-btn:disabled { opacity: 0.35; cursor: default; }

.cs-label { font-size: 12.5px; color: var(--ink-2); }

/* The nine-dot keypad glyph, drawn rather than carried as an icon. */
.cs-dots { display: grid; grid-template-columns: repeat(3, 4px); gap: 5px; place-content: center; }
.cs-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

/* Hang up sits alone below everything else — it is the control people reach for
   fastest and under most pressure, and separating it is what stops a mis-tap on
   Hold in front of a customer. */
.cs-hangup {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--crit-text);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--crit-text) 38%, transparent);
  transition: transform var(--fast) var(--ease), filter var(--fast) var(--ease);
}
.cs-hangup svg { width: 30px; height: 30px; }
.cs-hangup:hover { filter: brightness(1.08); }
.cs-hangup:active { transform: scale(0.93); }

/* --- In-call keypad (DTMF) --- */
.cs-keypad { width: 100%; }

.cs-keypad-sent {
  min-height: 26px;
  margin-bottom: 12px;
  text-align: center;
  font-family: ui-monospace, monospace;
  font-size: 20px;
  letter-spacing: 0.24em;
}

.cs-keypad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.cs-key {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.cs-key:hover { background: color-mix(in srgb, var(--ink) 18%, transparent); }
.cs-key:active { transform: scale(0.9); background: var(--accent); color: var(--accent-ink); }

.cs-key-digit { font-size: 25px; line-height: 1; }
.cs-key-letters { font-size: 9px; letter-spacing: 0.16em; color: var(--muted); }

/* --- Minimised call bar ---
   So the agent can read the lead and take notes while staying one tap from the
   controls. */
.call-mini {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.28);
}

.call-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.call-dot.ringing { background: var(--accent); animation: pulse-dot 1.4s ease-in-out infinite; }
.call-dot.live { background: var(--good-text); }
.call-dot.hold { background: var(--warn-text); }

.cm-name { flex: 1; min-width: 0; font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-timer { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.cm-open {
  padding: 8px 14px;
  border-radius: var(--pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.cm-open:hover { border-color: var(--accent-line); color: var(--ink); }

.cm-hangup {
  padding: 8px 18px;
  border-radius: var(--pill);
  border: 0;
  background: var(--crit-text);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* The bar overlays the bottom nav on mobile, so lift the page clear of both. */
body:has(.call-mini:not([hidden])) .content { padding-bottom: 160px; }

.transfer-input {
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
}
.transfer-input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }

/* --- Floor view --- */
.floor-list { display: flex; flex-direction: column; gap: 6px; }

.floor-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.floor-info { flex: 1; min-width: 0; }
.floor-name { font-weight: 650; font-size: 14px; }
.floor-meta { font-size: 12px; color: var(--muted); }

.floor-btn {
  padding: 6px 12px;
  border-radius: var(--pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.floor-btn:hover { border-color: var(--accent-line); color: var(--ink); }
.floor-btn.danger { color: var(--crit-text); border-color: transparent; }
.floor-btn.danger:hover { border-color: var(--crit-text); }

.floor-campaigns { display: flex; flex-direction: column; gap: 18px; }
.fc-head { display: flex; align-items: center; gap: 12px; }
.fc-name { flex: 1; font-weight: 650; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-rate { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fc-bar { height: 8px; margin-top: 10px; }
.fc-caption { margin-top: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fc-warn { margin-top: 6px; font-size: 12px; color: var(--warn-text); font-weight: 600; }

@media (max-width: 420px) {
  .cs-card { padding: 28px 18px 26px; gap: 22px; }
  .cs-controls { gap: 16px 12px; }
  .cs-icon { width: 60px; height: 60px; }
  .cs-name { font-size: 23px; }
  .call-mini { padding-inline: 14px; gap: 10px; }
}

/* --- CSV import --- */
.imp-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.imp-drop:hover { border-color: var(--accent-line); background: var(--surface); }
.imp-drop-icon { font-size: 30px; }
.imp-drop-title { font-weight: 650; font-size: 15px; }
.imp-drop-hint { font-size: 12.5px; color: var(--muted); }

.imp-file { font-weight: 650; font-size: 14px; }
.imp-note { margin-top: 4px; font-size: 13px; color: var(--muted); line-height: 1.5; }

.imp-mapping {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}
@media (min-width: 700px) { .imp-mapping { grid-template-columns: 1fr 1fr; } }

.imp-map-row { display: flex; flex-direction: column; gap: 5px; }
.imp-map-label { font-size: 12.5px; color: var(--ink-2); }
.imp-required { color: var(--crit-text); }

.imp-map-select {
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
}
.imp-map-select:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }

.imp-campaign { margin-top: 18px; display: block; max-width: 340px; }

/* The preview scrolls inside itself — a wide sheet must never make the whole
   page scroll sideways. */
.imp-preview-wrap {
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.imp-preview { width: 100%; border-collapse: collapse; font-size: 13px; }
.imp-preview th,
.imp-preview td {
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.imp-preview th {
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.imp-preview tbody tr:last-child td { border-bottom: 0; }
.imp-preview td { color: var(--ink-2); max-width: 240px; overflow: hidden; text-overflow: ellipsis; }

.imp-actions { margin-top: 20px; display: flex; gap: 10px; justify-content: flex-end; }

.imp-progress { padding: 20px 0; }
.imp-prog-title { font-weight: 650; margin-bottom: 12px; }
.imp-prog-meta { margin-top: 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.imp-result { margin-top: 18px; }
.imp-summary { font-size: 15px; font-weight: 650; color: var(--good-text); }
.imp-err-title { margin-top: 16px; font-size: 13px; font-weight: 650; color: var(--warn-text); }
.imp-err-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.7;
  max-height: 240px;
  overflow-y: auto;
}
.imp-err-more { margin-top: 6px; font-size: 12.5px; color: var(--muted); }

#impDone { margin-top: 18px; }

.imp-history { display: flex; flex-direction: column; gap: 6px; }
.imp-hist-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.imp-hist-info { flex: 1; min-width: 0; }
.imp-hist-name { font-weight: 650; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-hist-meta { font-size: 11.5px; color: var(--muted); }
.imp-hist-stats { flex: none; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.imp-hist-stats.failed { color: var(--crit-text); }

/* --- Call admin: reports, suppression, providers, audit --- */
.ca-panel { display: flex; flex-direction: column; gap: 20px; }

.ca-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ca-range label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.ca-range input[type="date"] {
  padding: 7px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
}

.ca-search { max-width: 220px; }

.ca-list { display: flex; flex-direction: column; gap: 4px; }

.ca-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.ca-row.audit { background: transparent; border-bottom: 1px solid var(--border); border-radius: 0; }
.ca-row.audit:last-child { border-bottom: 0; }

.ca-row-main { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.ca-row-main.mono { font-family: ui-monospace, monospace; font-weight: 500; }
.ca-row-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.ca-badge {
  padding: 2px 8px;
  border-radius: var(--pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.ca-badge.off { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }

/* Statutory suppressions cannot be removed, so they show a label rather than
   a button that would only fail. */
.ca-locked { font-size: 11.5px; color: var(--muted); font-style: italic; }

.ca-add { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.ca-add input {
  flex: 1;
  min-width: 160px;
  padding: 11px 14px;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
}
.ca-add input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }

.ca-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.ca-check input { accent-color: var(--accent); }

.ca-more { margin-top: 14px; width: 100%; }

/* Report chart: total bar with the answered portion filled inside it, so the
   gap between dialled and answered reads without a legend. */
.ca-bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; margin-top: 18px; }
.ca-bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; min-width: 4px; }
.ca-bar {
  width: 100%;
  background: var(--surface-2);
  border-radius: 3px 3px 0 0;
  display: flex;
  align-items: flex-end;
  min-height: 2px;
  transition: height var(--med) var(--ease);
}
.ca-bar-answered { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; }

