:root {
  --bg: #0e1621;
  --bg-2: #17212b;
  --panel: #1b2733;
  --border: #26333f;
  --text: #e8eef4;
  --muted: #8ba0b2;
  --accent: #25d366;
  --accent-2: #1fa855;
  --warn: #f5a623;
  --danger: #ef5350;
  --pill: #223140;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef2f5; --bg-2: #fff; --panel: #fff; --border: #e2e8ee;
    --text: #12202c; --muted: #62717f; --pill: #eef3f7; --shadow: 0 6px 24px rgba(20,40,60,.10);
  }
}
* { box-sizing: border-box; }
/* The `hidden` attribute must always win over display rules below. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
  /* Horizontal scrolling belongs to .table-wrap only — never the page. */
  overflow-x: clip;
}
a { color: inherit; }
code { background: var(--pill); padding: 1px 6px; border-radius: 5px; font-size: .9em; }

/* ---------- buttons ---------- */
button { font-family: inherit; cursor: pointer; }
.btn-primary {
  background: var(--accent); color: #06231a; border: none; font-weight: 700;
  padding: 10px 18px; border-radius: 10px; font-size: 14px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; transition: background .15s, transform .05s;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary.big { padding: 16px 40px; font-size: 18px; border-radius: 14px; }
.btn-ghost {
  background: transparent; color: var(--text); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 9px; font-size: 13px;
}
.btn-ghost:hover { border-color: var(--accent); }
.btn-ghost.small { padding: 5px 10px; font-size: 12px; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-badge {
  width: 40px; height: 40px; border-radius: 11px; background: var(--accent);
  color: #06231a; font-weight: 800; display: grid; place-items: center; font-size: 16px;
}
.brand h1 { margin: 0; font-size: 20px; }
.brand p { margin: 0; color: var(--muted); font-size: 12px; }

/* ---------- login ---------- */
.login-body { display: grid; place-items: center; }
.login-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px;
  padding: 30px; width: min(380px, 92vw); box-shadow: var(--shadow); margin-top: 10vh;
  display: flex; flex-direction: column;
}
.login-card .brand { margin-bottom: 22px; }
.login-card label { font-size: 13px; color: var(--muted); margin: 10px 0 5px; }
.login-card input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 11px 12px; border-radius: 10px; font-size: 15px;
}
.login-card input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.login-card button { margin-top: 20px; padding: 12px; border-radius: 10px; border: none;
  background: var(--accent); color: #06231a; font-weight: 700; font-size: 15px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }
.login-hint { color: var(--muted); font-size: 12px; text-align: center; margin: 4px 0 0; line-height: 1.6; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: var(--bg-2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand strong { font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.agent-name { font-weight: 600; font-size: 14px; }
.conn { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.conn.conn-on .conn-dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(37,211,102,.2); }
.conn.conn-on { color: var(--text); }

/* ---------- offline gate ---------- */
.offline-gate { display: grid; place-items: center; padding: 8vh 20px; }
.gate-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 18px;
  padding: 44px; text-align: center; width: min(460px, 94vw); box-shadow: var(--shadow);
}
.gate-icon { font-size: 46px; }
.gate-card h2 { margin: 12px 0 8px; }
.gate-card p { color: var(--muted); line-height: 1.6; margin: 0 0 22px; }
.gate-card .big { margin: 6px 0 18px; }
.gate-note { font-size: 12px; }

/* ---------- portal ---------- */
.portal { max-width: 1280px; margin: 0 auto; padding: 22px; }

/* lead banner */
.lead-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(90deg, rgba(37,211,102,.18), rgba(37,211,102,.06));
  border: 1px solid var(--accent); border-radius: 14px; padding: 16px 20px; margin-bottom: 16px;
  animation: pop .25s ease;
}
.banner-left { display: flex; align-items: center; gap: 12px; font-size: 17px; font-weight: 700; }
.ring { font-size: 22px; animation: swing 1s ease-in-out infinite; display: inline-block; transform-origin: top center; }
@keyframes swing { 0%,100%{transform:rotate(-12deg)} 50%{transform:rotate(12deg)} }
@keyframes pop { from{transform:scale(.98);opacity:0} to{transform:scale(1);opacity:1} }
.dispo-lock-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: linear-gradient(90deg, rgba(245,166,35,.18), rgba(245,166,35,.06));
  border: 1px solid var(--warn); border-radius: 14px; padding: 16px 20px; margin-bottom: 16px;
  animation: pop .25s ease;
}
.lock-icon { font-size: 20px; }
.no-leads {
  display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px;
  background: var(--bg-2); border: 1px dashed var(--border); border-radius: 12px;
  padding: 14px 18px; margin-bottom: 16px;
}
.no-leads-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); opacity: .6; }

/* claimed card */
.claimed-card {
  background: var(--bg-2); border: 1px solid var(--accent); border-radius: 16px;
  padding: 20px 22px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.claimed-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.tag-new { background: var(--accent); color: #06231a; font-weight: 800; font-size: 11px;
  padding: 3px 9px; border-radius: 20px; letter-spacing: .5px; }
.claimed-time { color: var(--muted); font-size: 12px; }
.repeat-badge { background: rgba(245,166,35,.18); color: var(--warn); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.claimed-card h2 { margin: 6px 0 16px; font-size: 24px; }
.claimed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 18px; }
.claimed-grid label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.phone-link { font-weight: 700; text-decoration: none; color: var(--accent); font-size: 17px; }
.pill {
  background: var(--pill); border: 1px solid var(--border); padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  display: inline-block; white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.claimed-actions { display: flex; gap: 12px; align-items: center; }
.call-prompt { font-weight: 600; color: var(--muted); }

/* panels */
.panel { background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px; padding: 18px 20px; margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.filters { display: flex; align-items: center; gap: 14px; }
.chk { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.admin-tag { background: var(--warn); color: #201400; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 10px; vertical-align: middle; margin-left: 6px; }

/* tables */
.table-wrap { overflow-x: auto; }
.leads-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.leads-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.leads-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
/* Long names get trimmed instead of stretching the row to two lines. */
.leads-table td:first-child { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.leads-table tr:last-child td { border-bottom: none; }
.row-pending { background: rgba(245,166,35,.06); }
.muted { color: var(--muted); }
.dispo-set { color: var(--accent); font-weight: 600; }
.dispo-pending { color: var(--warn); font-weight: 600; }
.dispo-overdue { color: var(--danger); font-weight: 700; }
.row-overdue { background: rgba(239,83,80,.07); }
.stat.stat-warn { border-color: var(--danger); }
.stat.stat-warn .stat-num { color: var(--danger); }
.grace-note { font-size: 12px; color: var(--muted); }
.load-more-row { display: flex; justify-content: center; margin-top: 14px; }
.status { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.status-queued { background: rgba(245,166,35,.18); color: var(--warn); }
.status-claimed { background: rgba(37,211,102,.16); color: var(--accent); }

/* presence */
.online-count { font-size: 12px; font-weight: 700; color: var(--accent); background: rgba(37,211,102,.15); padding: 2px 10px; border-radius: 20px; margin-left: 8px; }
.pres { font-weight: 700; font-size: 13px; }
.pres-on { color: var(--accent); }
.pres-off { color: var(--muted); }

/* user management */
.user-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.user-form input, .user-form select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 9px 11px; border-radius: 9px; font-size: 14px; font-family: inherit; flex: 1 1 150px; min-width: 120px;
}
.user-form button { flex: 0 0 auto; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.row-actions { display: flex; gap: 8px; white-space: nowrap; }
.btn-ghost.danger:hover { border-color: var(--danger); color: var(--danger); }
.role-tag { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.role-agent { background: var(--pill); color: var(--muted); }
.role-admin { background: rgba(245,166,35,.18); color: var(--warn); }

/* admin stats */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px 18px; min-width: 96px; }
.stat-num { display: block; font-size: 24px; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 12px; }

/* modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 40; padding: 12px; }
.modal { background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px; padding: 24px; width: min(440px, 94vw); box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 4px; }
.modal-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
.modal select, .modal textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 10px; font-size: 14px; font-family: inherit;
}
.dispo-hold-note {
  margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--warn);
  background: rgba(245,166,35,.12); border: 1px solid var(--warn); border-radius: 9px;
  padding: 9px 12px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 20px; border-radius: 12px; box-shadow: var(--shadow); z-index: 50;
  opacity: 0; transition: opacity .2s, transform .2s; font-size: 14px;
  width: max-content; max-width: 92vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: var(--accent); }
.toast.warn { border-color: var(--warn); }
.toast.error { border-color: var(--danger); }

/* ---------- admin portal shell (sidebar nav) ---------- */
.admin-shell { display: flex; gap: 22px; align-items: flex-start; }
.admin-sidebar {
  flex: 0 0 190px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 76px;
}
.admin-nav-item {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 600;
  width: 100%;
}
.admin-nav-item:hover { background: var(--pill); color: var(--text); }
.admin-nav-item.active { background: var(--bg-2); border-color: var(--border); color: var(--text); box-shadow: var(--shadow); }
.admin-nav-icon { font-size: 16px; }
.admin-content { flex: 1; min-width: 0; }

/* shared date filter */
.date-filter-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; margin-bottom: 20px;
}
.date-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.date-preset {
  background: var(--pill); border: 1px solid var(--border); color: var(--muted);
  padding: 6px 13px; border-radius: 20px; font-size: 13px; font-weight: 600;
}
.date-preset:hover { color: var(--text); }
.date-preset.active { background: var(--accent); border-color: var(--accent); color: #06231a; }
.date-range-inputs { display: flex; align-items: center; gap: 8px; }
.date-range-inputs input[type="date"] {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 9px; font-size: 13px; font-family: inherit;
}
.date-sep { color: var(--muted); font-size: 13px; }
.date-range-label { color: var(--muted); font-size: 13px; font-weight: 600; margin-left: auto; }

/* ---------- lead categories ---------- */
.cat-badge {
  display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 10px;
  border-radius: 20px; letter-spacing: .3px; white-space: nowrap;
}
.cat-highly { background: rgba(37,211,102,.18); color: var(--accent); border: 1px solid rgba(37,211,102,.45); }
.cat-interested { background: rgba(79,168,247,.16); color: #4fa8f7; border: 1px solid rgba(79,168,247,.4); }
.cat-warm { background: rgba(245,166,35,.15); color: var(--warn); border: 1px solid rgba(245,166,35,.4); }
.status-dnd { background: rgba(239,83,80,.16); color: var(--danger); }
.stat.stat-cat-highly { border-color: rgba(37,211,102,.5); }
.stat.stat-cat-highly .stat-num { color: var(--accent); }
.stat.stat-cat-interested { border-color: rgba(79,168,247,.5); }
.stat.stat-cat-interested .stat-num { color: #4fa8f7; }
.stat.stat-cat-warm { border-color: rgba(245,166,35,.5); }
.stat.stat-cat-warm .stat-num { color: var(--warn); }
.filter-select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 9px; font-size: 13px; font-family: inherit;
}

/* ---------- chat transcript modal ---------- */
.chat-modal { width: min(560px, 94vw); display: flex; flex-direction: column; max-height: 80vh; }
.chat-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.chat-modal-head h3 { margin: 0; }
.chat-modal-head .modal-sub { margin: 4px 0 0; }
.chat-messages {
  overflow-y: auto; flex: 1; min-height: 160px; display: flex; flex-direction: column;
  gap: 8px; padding: 14px; border-radius: 12px; background: var(--bg);
  border: 1px solid var(--border);
}
.chat-day {
  align-self: center; font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--pill); padding: 3px 12px; border-radius: 20px; margin: 6px 0 2px;
}
.chat-bubble {
  align-self: flex-start; max-width: 85%; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 4px 14px 14px 14px;
  padding: 8px 12px 6px; font-size: 14px; line-height: 1.45;
}
.chat-bubble.chat-button { border-color: var(--accent); background: rgba(37,211,102,.08); }
.chat-kind { display: block; font-size: 10px; font-weight: 800; color: var(--accent); letter-spacing: .4px; text-transform: uppercase; margin-bottom: 2px; }
.chat-text { word-break: break-word; white-space: pre-wrap; }
.chat-time { display: block; text-align: right; font-size: 10px; color: var(--muted); margin-top: 3px; }

/* ---------- stars ---------- */
.star-select {
  background: var(--bg); border: 1px solid var(--border); color: var(--warn);
  padding: 5px 8px; border-radius: 8px; font-size: 14px; font-family: inherit; font-weight: 700;
  cursor: pointer;
}
.limit-select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 5px 8px; border-radius: 8px; font-size: 13px; font-family: inherit; font-weight: 600;
  cursor: pointer;
}
.star-legend { font-size: 12px; margin: 0 0 12px; }

/* ---------- DND tab ---------- */
.dnd-count { font-size: 12px; font-weight: 700; color: var(--danger); background: rgba(239,83,80,.14); padding: 2px 10px; border-radius: 20px; margin-left: 8px; }
.small-note { font-size: 13px; margin: 0 0 12px; line-height: 1.5; }
.dnd-msg { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dnd-add-row { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.dnd-add-row textarea {
  flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 10px; font-size: 14px; font-family: inherit; resize: vertical;
}
.dnd-keyword-list { display: flex; flex-wrap: wrap; gap: 8px; }
.dnd-keyword {
  display: inline-flex; align-items: center; gap: 8px; background: var(--pill);
  border: 1px solid var(--border); border-radius: 20px; padding: 5px 6px 5px 13px;
  font-size: 13px; max-width: 100%;
}
.dnd-keyword-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dnd-keyword-del {
  background: transparent; border: none; color: var(--muted); font-size: 12px;
  padding: 2px 7px; border-radius: 50%; line-height: 1;
}
.dnd-keyword-del:hover { color: var(--danger); background: rgba(239,83,80,.14); }

/* held (hold agent) */
.held-badge { color: var(--danger); font-weight: 700; font-size: 13px; }
.row-held { background: rgba(239,83,80,.06); }
.user-search-row { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.user-search-row input[type="search"] {
  flex: 1; max-width: 320px; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 9px 12px; border-radius: 9px; font-size: 14px; font-family: inherit;
}

/* ---------- mobile responsive (agent + admin) ---------- */
@media (max-width: 780px) {
  /* Block, not column-flex: a column flex line grows to its widest item's
     intrinsic width (the wide tables), pushing .admin-content past the
     viewport and making the WHOLE PAGE scroll sideways. Block children
     stay at page width and wide tables scroll inside .table-wrap only.
     The sidebar is position:fixed here, so flex served no purpose. */
  .admin-shell { display: block; }
  .admin-sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 30;
    flex-direction: row; gap: 0; background: var(--bg-2); border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 20px rgba(0,0,0,.15);
  }
  .admin-nav-item { flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 11px; text-align: center; }
  .admin-nav-icon { font-size: 18px; }
  .admin-content { padding-bottom: 70px; } /* clear the fixed bottom tab bar */
  .date-filter-bar { flex-direction: column; align-items: stretch; }
  .date-range-label { margin-left: 0; }
}

@media (max-width: 560px) {
  .topbar { padding: 10px 12px; }
  .topbar-right { gap: 10px; }
  .topbar .btn-ghost { padding: 6px 11px; font-size: 12px; }
  .brand-badge { width: 34px; height: 34px; font-size: 14px; }
  .agent-name { display: none; }
  .portal { padding: 14px; }

  /* 16px form controls stop iOS Safari from auto-zooming on focus. */
  .login-card input, .modal select, .modal textarea, .user-form input,
  .user-form select, .filter-select, .dnd-add-row textarea,
  .user-search-row input[type="search"], .date-range-inputs input[type="date"] {
    font-size: 16px;
  }
  /* Bigger tap targets for the small action buttons. */
  .btn-ghost.small { padding: 8px 12px; font-size: 13px; }

  /* Denser tables — they pan horizontally, so keep rows compact. */
  .leads-table { font-size: 13px; }
  .leads-table td { padding: 9px 8px; }
  .leads-table td:first-child { max-width: 140px; }
  .dnd-msg { max-width: 200px; }
  .phone-link { font-size: 15px; }

  .stat { padding: 10px 12px; }
  .stat-num { font-size: 20px; }

  .gate-card { padding: 28px 22px; }
  .claimed-card { padding: 16px; }
  .claimed-grid { grid-template-columns: 1fr; gap: 12px; }
  .claimed-actions { flex-wrap: wrap; }
  .claimed-actions .btn-primary { flex: 1 1 100%; justify-content: center; }
  .claimed-card h2 { font-size: 20px; }

  .lead-banner, .dispo-lock-banner, .no-leads { flex-direction: column; align-items: stretch; text-align: center; }
  .lead-banner .btn-primary, .dispo-lock-banner .btn-primary { width: 100%; justify-content: center; }

  .panel { padding: 14px; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .table-wrap { -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; width: calc(100% + 28px); }

  .user-form { flex-direction: column; }
  .user-form input, .user-form select, .user-form button { width: 100%; flex: 1 1 auto; }
  .user-search-row { flex-direction: column; align-items: stretch; }
  .user-search-row input[type="search"] { max-width: none; }

  .modal { padding: 18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }

  .chat-modal { max-height: 88vh; }
  .chat-bubble { max-width: 95%; }
  .dnd-add-row { flex-direction: column; }
  .dnd-add-row button { width: 100%; }

  /* Grid, not flex-wrap: 4 fixed buttons in a guaranteed 2x2, no overflow
     risk from long labels like "This week" refusing to shrink/wrap. */
  .date-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .date-preset { text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .date-range-inputs { flex-wrap: wrap; }
  .date-range-inputs input[type="date"] { flex: 1 1 120px; min-width: 0; }

  .stat-row { gap: 8px; }
  .stat { flex: 1 1 calc(50% - 8px); min-width: 0; }

  .waiting-list { grid-template-columns: 1fr; }
  .trend-row { gap: 6px; }
}

/* ============================ Waiting Room ============================ */
.trend-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.trend-chip {
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--pill); border: 1px solid var(--border);
  padding: 4px 12px; border-radius: 20px;
}
.trend-chip b { color: var(--text); }
.trend-now { background: rgba(37,211,102,.13); color: var(--accent); border-color: rgba(37,211,102,.4); }
.trend-incoming { background: rgba(79,168,247,.12); color: #4fa8f7; border-color: rgba(79,168,247,.4); font-variant-numeric: tabular-nums; }
.chip-highly { color: var(--accent); }
.chip-interested { color: #4fa8f7; }
.chip-warm { color: var(--warn); }
.chip-dnd { color: #e05d5d; }

.waiting-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px;
}
.wait-card {
  background: var(--bg-2); border: 1px solid var(--border); border-left: 4px solid var(--muted);
  border-radius: 12px; padding: 12px 14px; cursor: pointer;
  transition: opacity .4s ease, transform .4s ease, border-color .4s ease, box-shadow .2s ease;
}
.wait-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.wc-warm { border-left-color: var(--warn); }
.wc-interested { border-left-color: #4fa8f7; }
.wc-highly { border-left-color: var(--accent); }

.wait-enter { opacity: 0; transform: translateY(14px) scale(.97); }
.wait-leave { opacity: 0; transform: translateY(-10px) scale(.95); pointer-events: none; }
@keyframes waitFlash {
  0% { box-shadow: 0 0 0 0 rgba(37,211,102,.55); }
  100% { box-shadow: 0 0 0 14px rgba(37,211,102,0); }
}
.wait-flash { animation: waitFlash .8s ease-out; }
@keyframes waitBump {
  0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); }
}
.wait-bump { display: inline-block; animation: waitBump .45s ease; }
@keyframes waitPop {
  0% { transform: scale(.6); } 60% { transform: scale(1.2); } 100% { transform: scale(1); }
}
.wait-pop { animation: waitPop .5s cubic-bezier(.34,1.56,.64,1); }

.wait-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wait-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-phone { color: var(--muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-preview {
  margin-top: 7px; font-size: 12px; font-style: italic; color: var(--text);
  background: var(--pill); border-radius: 8px; padding: 5px 9px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wait-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.wait-msgs b { color: var(--text); font-size: 13px; }

.wait-bar { height: 5px; background: var(--pill); border-radius: 4px; margin-top: 9px; overflow: hidden; }
.wait-bar-fill {
  height: 100%; width: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #4fa8f7);
  transition: width 1s linear;
}
.wait-eta { font-size: 11px; color: var(--muted); margin-top: 5px; font-variant-numeric: tabular-nums; }
.wait-eta-due { color: var(--accent); font-weight: 700; animation: waitBump .45s ease infinite alternate; }

.waiting-empty { display: block; }
.wait-none { color: var(--muted); font-size: 13px; padding: 6px 2px; }

/* ==================== Overview: disposition blocks ==================== */
.stat-section-title {
  margin: 18px 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.stat-pct { border: 1px solid rgba(37,211,102,.45); }
.stat-pct .stat-num { color: var(--accent); }
