@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');
/* ===== CH Live Leads — "Marina": lagoon teal with turmeric gold ===== */

:root {
  --font-display: "Plus Jakarta Sans", "DM Sans", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px; --radius-sm: 8px; --badge-radius: 50%;

  --bg: #eaf3f3; --panel: #ffffff; --panel-2: #f1f7f7; --stat-bg: #ffffff; --chat-bg: #e3eeee;
  --border: #d5e4e4; --text: #0d2a2e; --muted: #587377;
  --accent: #0b7a80; --accent-2: #075c61; --accent-ink: #ffffff;
  --accent-grad: linear-gradient(180deg, #0f8e95 0%, #0b7a80 100%);
  --accent-soft: rgba(11,122,128,.10); --accent-glow: rgba(11,122,128,.38);
  --gold: #f4b93b; --gold-ink: #3a2700; --gold-soft: rgba(244,185,59,.22); --gold-text: #9a6a00;
  --ok: #158a4d; --ok-soft: rgba(21,138,77,.12);
  --warn: #c67a00; --warn-soft: rgba(244,185,59,.16);
  --danger: #cc3b3b; --danger-soft: rgba(204,59,59,.10);
  --info: #2f6fb5; --info-soft: rgba(47,111,181,.11);
  --c-highly: #158a4d; --c-interested: #6b4fd0; --c-warm: #d98200;
  --nav-bg: #ffffff; --nav-text: #587377; --nav-mobile-bg: #ffffff;
  --toast-bg: #0d2a2e; --toast-text: #ffffff;
  --shadow: 0 18px 40px -20px rgba(8,60,66,.35);
  --shadow-sm: 0 1px 3px rgba(8,60,66,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #071a1c; --panel: #0e2a2d; --panel-2: #123539; --stat-bg: #0e2a2d; --chat-bg: #0a2225;
    --border: #1d4448; --text: #e4f3f3; --muted: #86adb0;
    --accent: #2bbfc6; --accent-2: #1a9aa1; --accent-ink: #032326;
    --accent-grad: linear-gradient(180deg, #38cdd3 0%, #2bbfc6 100%);
    --accent-soft: rgba(43,191,198,.14); --accent-glow: rgba(43,191,198,.35);
    --gold-text: #f4b93b;
    --ok: #4ade80; --ok-soft: rgba(74,222,128,.13);
    --warn: #fbbf24; --warn-soft: rgba(251,191,36,.13);
    --danger: #f87171; --danger-soft: rgba(248,113,113,.13);
    --info: #7db4f0; --info-soft: rgba(125,180,240,.14);
    --c-highly: #4ade80; --c-interested: #a78bfa; --c-warm: #fbbf24;
    --nav-bg: #0e2a2d; --nav-text: #86adb0; --nav-mobile-bg: #0e2a2d;
    --toast-bg: #e4f3f3; --toast-text: #0d2a2e;
    --shadow: 0 18px 40px -20px rgba(0,0,0,.7);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  }
}


/* ===== shared component layer — all colour/shape comes from theme tokens ===== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; overflow-x: clip; }
body {
  font-family: var(--font-body); background: var(--bg); color: var(--text);
  min-height: 100vh; overflow-x: clip; font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.01em; }
a { color: inherit; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 5px; font-size: .9em; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent-soft); }

/* ---------- buttons ---------- */
.btn-primary {
  background: var(--accent-grad); color: var(--accent-ink); border: none; font-weight: 700;
  padding: 10px 18px; border-radius: var(--radius-sm); font-size: 14px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: 0 6px 16px -6px var(--accent-glow);
  transition: filter .15s, transform .08s, box-shadow .15s;
}
.btn-primary:hover { filter: brightness(1.07); box-shadow: 0 10px 22px -8px var(--accent-glow); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; filter: none; }
.btn-primary.big { padding: 16px 44px; font-size: 17px; border-radius: 14px; }
.btn-ghost {
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost.small { padding: 5px 11px; font-size: 12px; }
.btn-ghost.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-badge {
  width: 40px; height: 40px; border-radius: var(--badge-radius); background: var(--accent-grad);
  color: var(--accent-ink); font-family: var(--font-display); font-weight: 800;
  display: grid; place-items: center; font-size: 15px; letter-spacing: .02em;
  box-shadow: 0 8px 18px -8px var(--accent-glow); flex: none;
}
.brand h1 { margin: 0; font-size: 21px; }
.brand p { margin: 0; color: var(--muted); font-size: 12px; }

/* ---------- login ---------- */
.login-body { min-height: 100vh; }
.login-hero-title { font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 32px; width: min(400px, 92vw); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.login-card .brand { margin-bottom: 24px; }
.login-card label { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.login-card input {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: 15px; font-family: inherit;
}
.login-card input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.login-card button {
  margin-top: 22px; padding: 13px; border-radius: var(--radius-sm); border: none;
  background: var(--accent-grad); color: var(--accent-ink); font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 22px -10px var(--accent-glow);
}
.login-card button:disabled { opacity: .6; }
.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 26px; position: sticky; top: 0; z-index: 20;
}
.topbar .brand strong { font-family: var(--font-display); font-size: 17px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.agent-name { font-weight: 700; font-size: 14px; }
.conn { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.conn.conn-on .conn-dot { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }

/* ---------- offline gate ---------- */
.offline-gate { display: grid; place-items: center; padding: 9vh 20px; }
.gate-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 24px;
  padding: 46px; text-align: center; width: min(470px, 94vw); box-shadow: var(--shadow);
}
.gate-icon {
  font-size: 40px; width: 84px; height: 84px; margin: 0 auto 6px; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent-soft);
}
.gate-card h2 { margin: 14px 0 8px; font-size: 24px; }
.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: 1320px; margin: 0 auto; padding: 24px; min-width: 0; }

/* lead banner */
.lead-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 18px 22px; margin-bottom: 16px; animation: pop .25s ease;
}
.banner-left { display: flex; align-items: center; gap: 12px; font-size: 16px; 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: var(--warn-soft); border: 1px solid var(--warn); border-radius: var(--radius);
  padding: 18px 22px; margin-bottom: 16px; animation: pop .25s ease;
}
.lead-banner-older { background: var(--warn-soft); border-color: var(--warn); }
.banner-copy { display: flex; flex-direction: column; gap: 2px; }
.banner-sub { font-size: 12px; font-weight: 500; color: var(--muted); }
.ring-older { font-size: 22px; }
.no-leads {
  display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px;
  background: var(--panel); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 16px;
}
.no-leads-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* claimed card */
.claimed-card {
  background: var(--panel); border: 1px solid var(--accent); border-radius: 20px;
  padding: 24px 26px; margin-bottom: 22px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.claimed-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent-grad); }
.claimed-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.tag-new { background: var(--accent-grad); color: var(--accent-ink); font-weight: 800; font-size: 11px; padding: 3px 10px; border-radius: 20px; letter-spacing: .08em; }
.claimed-time { color: var(--muted); font-size: 12px; }
.repeat-badge { background: var(--warn-soft); color: var(--warn); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; }
.claimed-card h2 { margin: 8px 0 18px; font-size: 26px; }
.claimed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 18px; margin-bottom: 18px; }
.claimed-grid label { display: block; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 5px; }
.phone-link { font-weight: 800; text-decoration: none; color: var(--accent); font-size: 19px; font-variant-numeric: tabular-nums; }
.pill {
  background: var(--panel-2); border: 1px solid var(--border); padding: 3px 11px;
  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; flex-wrap: wrap; }
.call-prompt { font-weight: 600; color: var(--muted); }

/* panels */
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 20px; min-width: 0; max-width: 100%; box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.panel-head h3 { margin: 0; font-size: 17px; }
.filters { display: flex; align-items: center; gap: 14px; }
.chk { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.chk input { accent-color: var(--accent); }
.admin-tag { background: var(--gold); color: var(--gold-ink); font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 10px; vertical-align: middle; margin-left: 6px; letter-spacing: .05em; }

/* 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: 700; font-size: 11px; letter-spacing: .07em;
  text-transform: uppercase; padding: 9px 12px; border-bottom: 2px solid var(--border); white-space: nowrap;
}
.leads-table td { padding: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.leads-table td:first-child { max-width: 210px; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.leads-table tbody tr { transition: background .12s; }
.leads-table tbody tr:hover { background: var(--panel-2); }
.leads-table tr:last-child td { border-bottom: none; }
.row-pending { background: var(--warn-soft); }
.muted { color: var(--muted); }
.dispo-set { color: var(--ok); font-weight: 700; }
.dispo-pending { color: var(--warn); font-weight: 700; }
.dispo-overdue { color: var(--danger); font-weight: 800; }
.row-overdue { background: var(--danger-soft); }
.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: 11px; font-weight: 800; padding: 3px 10px; border-radius: 20px; letter-spacing: .03em; }
.status-queued { background: var(--warn-soft); color: var(--warn); }
.status-claimed { background: var(--ok-soft); color: var(--ok); }
.status-held { background: var(--danger-soft); color: var(--danger); }
.status-dnd { background: var(--danger-soft); color: var(--danger); }
.lead-row-actions { display: flex; gap: 6px; flex-wrap: wrap; white-space: nowrap; }

/* presence */
.online-count { font-size: 12px; font-weight: 800; color: var(--ok); background: var(--ok-soft); padding: 2px 10px; border-radius: 20px; margin-left: 8px; }
.pres { font-weight: 800; font-size: 13px; }
.pres-on { color: var(--ok); }
.pres-off { color: var(--muted); }
.presence-wrap { overflow: visible; }
#presenceBody tr { position: relative; }
#presenceBody tr.row-online { background: var(--ok-soft); }
@keyframes presEnter { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
.pres-enter { animation: presEnter .4s ease; }
@keyframes presWentOn { 0% { box-shadow: inset 3px 0 0 var(--ok); } 100% { box-shadow: inset 3px 0 0 transparent; } }
@keyframes presWentOff { 0% { box-shadow: inset 3px 0 0 var(--muted); } 100% { box-shadow: inset 3px 0 0 transparent; } }
.pres-went-on { animation: presWentOn .7s ease; }
.pres-went-off { animation: presWentOff .7s ease; }

/* user management + form controls */
.user-form { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
input, select, textarea { font-family: inherit; }
.user-form input, .user-form select {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; flex: 1 1 150px; min-width: 120px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.u-fast-dispo { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.row-actions { display: flex; gap: 8px; white-space: nowrap; }
.role-tag { font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 20px; letter-spacing: .03em; }
.role-agent { background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.role-admin { background: var(--gold-soft); color: var(--gold-text); }
.role-director { background: var(--info-soft); color: var(--info); }

/* stats */
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
  background: var(--stat-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 20px; min-width: 110px; position: relative; overflow: hidden;
}
.stat-num { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat-section-title { margin: 20px 0 10px; font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.stat-pct { border-color: var(--accent); }
.stat-pct .stat-num { color: var(--accent); }
.stat.stat-cat-highly { border-color: var(--c-highly); }
.stat.stat-cat-highly .stat-num { color: var(--c-highly); }
.stat.stat-cat-interested { border-color: var(--c-interested); }
.stat.stat-cat-interested .stat-num { color: var(--c-interested); }
.stat.stat-cat-warm { border-color: var(--c-warm); }
.stat.stat-cat-warm .stat-num { color: var(--c-warm); }

/* modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(10,12,24,.55); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 40; padding: 12px; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 20px; padding: 26px; width: min(450px, 94vw); box-shadow: var(--shadow); }
.modal h3 { margin: 0 0 4px; font-size: 19px; }
.modal-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.modal label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.modal select, .modal textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 11px 13px; border-radius: var(--radius-sm); font-size: 14px;
}
.dispo-hold-note {
  margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--warn);
  background: var(--warn-soft); border: 1px solid var(--warn); border-radius: 10px; padding: 10px 13px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--toast-bg); color: var(--toast-text); padding: 13px 22px; border-radius: 14px;
  box-shadow: var(--shadow); z-index: 50; opacity: 0; transition: opacity .2s, transform .2s;
  font-size: 14px; font-weight: 600; width: max-content; max-width: 92vw; text-align: center;
  border-left: 4px solid var(--muted);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }

/* admin shell */
.admin-content { flex: 1; min-width: 0; max-width: 100%; }
.admin-nav-item {
  display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid transparent;
  padding: 11px 14px; font-size: 14px; font-weight: 700; width: 100%; transition: background .15s, color .15s;
}
.admin-nav-icon { font-size: 16px; }

/* date filter */
.date-filter-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.date-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.date-preset {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  padding: 7px 14px; border-radius: 20px; font-size: 13px; font-weight: 700; transition: all .15s;
}
.date-preset:hover { color: var(--text); }
.date-preset.active { background: var(--accent-grad); border-color: transparent; color: var(--accent-ink); }
.date-range-inputs { display: flex; align-items: center; gap: 8px; }
.date-range-inputs input[type="date"] {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 9px; font-size: 13px;
}
.date-sep { color: var(--muted); font-size: 13px; }
.date-range-label { color: var(--muted); font-size: 13px; font-weight: 700; margin-left: auto; }

/* categories */
.cat-badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 20px; letter-spacing: .03em; white-space: nowrap; }
.cat-highly { background: color-mix(in srgb, var(--c-highly) 15%, transparent); color: var(--c-highly); border: 1px solid color-mix(in srgb, var(--c-highly) 45%, transparent); }
.cat-interested { background: color-mix(in srgb, var(--c-interested) 15%, transparent); color: var(--c-interested); border: 1px solid color-mix(in srgb, var(--c-interested) 45%, transparent); }
.cat-warm { background: color-mix(in srgb, var(--c-warm) 15%, transparent); color: var(--c-warm); border: 1px solid color-mix(in srgb, var(--c-warm) 45%, transparent); }
.filter-select, .filters input[type="search"] {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 7px 11px; border-radius: 9px; font-size: 13px;
}
.filters input[type="search"] { flex: 1; min-width: 140px; max-width: 280px; }

/* chat modal */
.chat-modal { width: min(570px, 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: 16px; border-radius: 14px; background: var(--chat-bg); border: 1px solid var(--border);
}
.chat-day { align-self: center; font-size: 11px; font-weight: 700; color: var(--muted); background: var(--panel); padding: 3px 12px; border-radius: 20px; margin: 6px 0 2px; box-shadow: var(--shadow-sm); }
.chat-bubble {
  align-self: flex-start; max-width: 85%; background: var(--panel); border: 1px solid var(--border);
  border-radius: 4px 16px 16px 16px; padding: 9px 13px 6px; font-size: 14px; line-height: 1.45; box-shadow: var(--shadow-sm);
}
.chat-bubble.chat-button { border-color: var(--accent); background: var(--accent-soft); }
.chat-kind { display: block; font-size: 10px; font-weight: 800; color: var(--accent); letter-spacing: .06em; 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 / limits */
.star-select, .limit-select {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 5px 8px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.star-select { color: var(--gold-text); }
.star-legend { font-size: 12px; margin: 0 0 12px; }

/* DND */
.dnd-count { font-size: 12px; font-weight: 800; color: var(--danger); background: var(--danger-soft); 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(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; resize: vertical;
}
.dnd-keyword-list { display: flex; flex-wrap: wrap; gap: 8px; }
.dnd-keyword {
  display: inline-flex; align-items: center; gap: 8px; background: var(--panel-2);
  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: var(--danger-soft); }
.held-badge { color: var(--danger); font-weight: 800; font-size: 13px; }
.row-held { background: var(--danger-soft); }
.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(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 13px; border-radius: var(--radius-sm); font-size: 14px;
}

/* ============================ Waiting Room ============================ */
.trend-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.trend-chip { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); padding: 5px 13px; border-radius: 20px; }
.trend-chip b { color: var(--text); }
.trend-now { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.trend-incoming { background: var(--info-soft); color: var(--info); border-color: var(--info); font-variant-numeric: tabular-nums; }
.chip-highly { color: var(--c-highly); }
.chip-interested { color: var(--c-interested); }
.chip-warm { color: var(--c-warm); }
.chip-dnd { color: var(--danger); }

.waiting-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; position: relative; }
.wait-card {
  background: var(--panel); border: 1px solid var(--border); border-left: 5px solid var(--muted);
  border-radius: var(--radius-sm); padding: 14px 16px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: opacity .4s ease, transform .55s cubic-bezier(.22,1,.36,1), border-color .4s ease, box-shadow .2s ease;
}
.wait-card:hover { box-shadow: var(--shadow); }
.wc-warm { border-left-color: var(--c-warm); }
.wc-interested { border-left-color: var(--c-interested); }
.wc-highly { border-left-color: var(--c-highly); }
.crm-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 4px 0 14px; min-width: 0; max-width: 100%; }
.crm-kicker { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.crm-box .claimed-grid { margin-bottom: 0; }
.crm-box span, .crm-email { overflow-wrap: anywhere; word-break: break-word; }
.crm-inline { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 3px; overflow-wrap: anywhere; }
.wait-crm { margin: 8px 0 0; padding: 8px 10px; }
.wait-crm-co { font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.wait-crm-dir, .wait-crm-em { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

.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 var(--accent-glow); } 100% { box-shadow: 0 0 0 14px transparent; } }
.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: 8px; font-size: 12px; font-style: italic; background: var(--panel-2); border-radius: 8px; padding: 6px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wait-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.wait-msgs b { color: var(--text); font-size: 13px; }
.wait-hold-btn { margin-left: auto; }
.wait-held { border-color: var(--danger); opacity: .92; }
.wait-held .wait-bar-fill { background: var(--danger); }
.wait-bar { height: 6px; background: var(--panel-2); border-radius: 4px; margin-top: 10px; overflow: hidden; }
.wait-bar-fill { height: 100%; width: 100%; border-radius: 4px; background: var(--accent-grad); 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: 800; animation: waitBump .45s ease infinite alternate; }
.waiting-empty { display: block; }
.wait-none { color: var(--muted); font-size: 13px; padding: 6px 2px; }

/* ============================ Insights ============================ */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: 175px 1fr 150px; align-items: center; gap: 12px; }
.funnel-label { font-size: 13px; color: var(--muted); font-weight: 700; }
.funnel-track { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; height: 24px; overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 7px 0 0 7px; transition: width .5s ease; }
.fn-received { background: #7c8798; }
.fn-claimed { background: var(--info); }
.fn-dispo { background: var(--c-interested); }
.fn-interested { background: var(--c-warm); }
.fn-converted { background: var(--ok); }
.funnel-num { font-size: 13px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.barchart { display: flex; align-items: stretch; gap: 4px; height: 170px; padding-top: 16px; overflow-x: auto; }
.bar-col { flex: 1 1 0; min-width: 16px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.bar-stack { width: 100%; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 5px 5px 0 0; overflow: hidden; }
.bar-seg { width: 100%; transition: height .4s ease; }
.seg-highly { background: var(--c-highly); }
.seg-interested { background: var(--c-interested); }
.seg-warm { background: var(--c-warm); }
.seg-hour { background: var(--accent); border-radius: 3px 3px 0 0; }
.bar-total { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; min-height: 10px; }
.bar-label { font-size: 10px; color: var(--muted); white-space: nowrap; min-height: 13px; line-height: 1.2; }
.barchart.hours .bar-col { min-width: 9px; }
.chart-legend { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.legend-item { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-highly { background: var(--c-highly); }
.sw-interested { background: var(--c-interested); }
.sw-warm { background: var(--c-warm); }
.kw-count { background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 1px 9px; font-weight: 700; font-size: 12px; }

.director-mode #leadBanner, .director-mode #olderBanner, .director-mode #noLeads, .director-mode #claimedCard,
.director-mode #dispoLockBanner, .director-mode #myLeadsPanel { display: none !important; }

/* notices */
.notice-overlay { z-index: 80; background: rgba(8,10,22,.75); }
body.notice-blocking { overflow: hidden; }
.notice-modal { width: min(520px, 94vw); text-align: left; }
.notice-modal.nm-warning { border-color: var(--danger); }
.notice-modal.nm-maintenance { border-color: var(--warn); }
.notice-kind-tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 20px; margin-bottom: 10px; }
.nk-notice { background: var(--info-soft); color: var(--info); }
.nk-warning { background: var(--danger-soft); color: var(--danger); }
.nk-maintenance { background: var(--warn-soft); color: var(--warn); }
.notice-body { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.55; margin: 12px 0 22px; }
.notice-form { display: flex; flex-direction: column; gap: 10px; min-width: 0; max-width: 100%; }
.notice-form-row { display: flex; gap: 10px; flex-wrap: wrap; min-width: 0; }
.notice-form-row select, .notice-form input, .notice-form textarea {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; min-width: 0; max-width: 100%;
}
.notice-form-row select { flex: 1 1 140px; }
.notice-form input, .notice-form textarea { width: 100%; }
.notice-users { display: flex; flex-wrap: wrap; gap: 8px 14px; max-height: 160px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; max-width: 100%; min-width: 0; }
.notice-users .chk { max-width: 100%; min-width: 0; white-space: normal; }
.grace-note, .star-legend, .small-note { overflow-wrap: anywhere; }

/* ============================ responsive ============================ */
@media (max-width: 780px) {
  .admin-shell { display: block !important; min-width: 0; max-width: 100%; }
  .admin-sidebar {
    position: fixed !important; left: 0; right: 0; bottom: 0; top: auto !important; z-index: 30;
    width: 100% !important; max-width: 100%; flex-direction: row !important; gap: 0 !important; border-radius: 0 !important;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)) !important; margin: 0 !important;
    overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
    background: var(--nav-mobile-bg) !important; border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(0,0,0,.14);
  }
  .admin-sidebar .admin-nav-item {
    flex: 1 1 0; min-width: 0; width: auto; max-width: none; overflow: hidden;
    flex-direction: column; gap: 3px; padding: 6px 2px; font-size: 10px; text-align: center;
    color: var(--muted) !important; background: transparent !important; box-shadow: none !important;
  }
  .admin-sidebar .admin-nav-item.active { color: var(--accent) !important; }
  .admin-nav-label { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .admin-nav-icon { font-size: 18px; }
  .admin-content, .admin-tab-panel, .panel { min-width: 0; max-width: 100%; }
  .admin-content { padding-bottom: 74px; }
  .date-filter-bar { flex-direction: column; align-items: stretch; }
  .date-range-label { margin-left: 0; }
  .filters { flex-wrap: wrap; }
  .presence-wrap { overflow-x: auto; }
  .funnel-row { grid-template-columns: 110px 1fr 110px; gap: 8px; }
  .notice-form-row { flex-direction: column; }
  .notice-form-row select { width: 100%; flex: 1 1 auto; }
  .user-form input, .user-form select { min-width: 0; }
}
@media (max-width: 560px) {
  .topbar { padding: 10px 14px; }
  .topbar-right { gap: 10px; }
  .topbar .btn-ghost { padding: 6px 11px; font-size: 12px; }
  .brand-badge { width: 34px; height: 34px; font-size: 13px; }
  .agent-name { display: none; }
  .portal { padding: 14px; }
  .login-card input, .modal select, .modal textarea, .user-form input, .user-form select, .filter-select,
  .filters input[type="search"], .dnd-add-row textarea, .user-search-row input[type="search"],
  .date-range-inputs input[type="date"], .notice-form-row select, .notice-form input, .notice-form textarea { font-size: 16px; }
  .btn-ghost.small { padding: 8px 12px; font-size: 13px; }
  .leads-table { font-size: 13px; }
  .leads-table td { padding: 10px 8px; }
  .leads-table td:first-child { max-width: 140px; }
  .dnd-msg { max-width: 200px; }
  .phone-link { font-size: 16px; }
  .stat { padding: 10px 12px; }
  .stat-num { font-size: 22px; }
  .gate-card { padding: 30px 22px; }
  .claimed-card { padding: 18px; }
  .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: 21px; }
  .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: 16px; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .table-wrap { -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; width: calc(100% + 32px); }
  .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: 20px; }
  .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%; }
  .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; }
  .funnel-row { grid-template-columns: 96px 1fr 92px; gap: 8px; }
  .funnel-label, .funnel-num { font-size: 11px; }
  .bar-col { min-width: 12px; }
  .barchart.hours .bar-col { min-width: 7px; }
  .u-fast-dispo { white-space: normal; }
}

/* --- page backdrop: subtle kolam-dot lattice --- */
body {
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--accent) 16%, transparent) 1.2px, transparent 1.6px) 0 0 / 26px 26px,
    var(--bg);
}

/* --- topbar: solid lagoon band with gold underline --- */
.topbar { background: linear-gradient(90deg, #075c61 0%, #0b7a80 60%, #12909a 100%); color: #fff; border-bottom: 3px solid var(--gold); }
.topbar .brand strong { color: #fff; letter-spacing: .01em; }
.topbar .brand-badge { background: var(--gold); color: var(--gold-ink); box-shadow: none; }
.topbar .conn, .topbar .agent-name { color: #eaffff; }
.topbar .btn-ghost { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.28); color: #fff; }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.22); color: #fff; border-color: #fff; }
.btn-primary { border-radius: 8px; }

/* --- admin shell: horizontal tab strip on top, content below --- */
.admin-shell { display: flex; flex-direction: column; gap: 18px; align-items: stretch; }
.admin-sidebar {
  flex-direction: row; flex-wrap: wrap; gap: 4px; display: flex; position: static;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: var(--shadow-sm);
}
.admin-nav-item { width: auto; flex: 0 0 auto; background: transparent; color: var(--nav-text); border-radius: 8px; padding: 9px 16px; }
.admin-nav-item:hover { background: var(--panel-2); color: var(--text); }
.admin-nav-item.active { background: var(--accent-grad); color: var(--accent-ink); box-shadow: inset 0 -3px 0 var(--gold); }

/* --- flat stat cards, left accent rail --- */
.stat { border-radius: 10px; border-left: 4px solid var(--accent); }
.stat.stat-cat-highly { border-left-color: var(--c-highly); }
.stat.stat-cat-interested { border-left-color: var(--c-interested); }
.stat.stat-cat-warm { border-left-color: var(--c-warm); }
.stat.stat-warn { border-left-color: var(--danger); }
.panel { border-top: 3px solid var(--accent); }
.panel-head h3 { font-weight: 800; }
.leads-table th { background: var(--panel-2); }
.leads-table th:first-child { border-radius: 8px 0 0 0; }
.leads-table th:last-child { border-radius: 0 8px 0 0; }
.claimed-card { border-color: var(--border); border-top: 4px solid var(--gold); }
.claimed-card::before { display: none; }

/* --- login: centered card over a lagoon wave --- */
.login-body {
  display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.16) 1.4px, transparent 1.8px) 0 0 / 28px 28px,
    linear-gradient(160deg, #06484d 0%, #0b7a80 55%, #17a0a8 100%);
}
.login-body::after {
  content: ""; position: absolute; left: -10%; right: -10%; bottom: -120px; height: 260px; border-radius: 50%;
  background: rgba(244,185,59,.18); filter: blur(2px);
}
.login-hero { position: relative; z-index: 1; text-align: center; color: #fff; margin-bottom: 22px; max-width: 460px; }
.login-hero .brand { display: none; }
.login-hero-title { font-size: clamp(30px, 5vw, 44px); line-height: 1.05; margin: 0 0 10px; }
.login-hero-sub { font-size: 15px; line-height: 1.55; color: rgba(255,255,255,.85); margin: 0; }
.login-hero-foot { display: none; }
.login-pane { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.login-card { border-radius: 14px; border-top: 4px solid var(--gold); }
.login-wrap { display: flex; flex-direction: column; align-items: center; position: relative; z-index: 1; }
.login-body { align-content: center; }
