/* ========== TOKENS ========== */
:root {
  --bg: #FFFFFF;
  --bg-raised: #FFFFFF;
  --bg-sunken: #FFFFFF;
  --ink: #0E1726;
  --ink-2: #3A4151;
  --ink-3: #6B7280;
  --ink-4: #9CA3AF;
  --line: #E7E5DE;
  --line-2: #D8D6CE;
  --brand: #1E9AE0;
  --brand-ink: #0F73AA;
  --brand-soft: #E6F4FC;
  --success: #0E8A5F;
  --success-soft: #E4F5EC;
  --danger: #C0463A;
  --warn: #B7791F;
  --shadow-sm: 0 1px 2px rgba(14,23,38,.04), 0 0 0 1px rgba(14,23,38,.04);
  --shadow-md: 0 4px 18px rgba(14,23,38,.06), 0 0 0 1px rgba(14,23,38,.05);
  --shadow-lg: 0 24px 60px rgba(14,23,38,.12), 0 0 0 1px rgba(14,23,38,.06);
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  --font-ui: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; width: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; border: 0; background: none; }
input, select { font-family: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ========== LOGIN ========== */
.login-wrap {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FFFFFF;
}
.login-left {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 48px;
  width: 100% !important;
  max-width: none !important;
  flex: 1 1 100% !important;
}
.login-card {
  width: 100%; max-width: 400px;
  margin: 0 auto;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.login-logo { width: 160px; margin-bottom: 48px; }
.login-kicker {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 10px;
}
.login-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  line-height: 1.2;
}
.login-sub { color: var(--ink-3); margin: 0 0 32px; font-size: 14px; }

.login-form { display: flex; flex-direction: column; gap: 18px; width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  display: flex; justify-content: space-between; align-items: center;
  text-align: left;
}
.field-hint { font-size: 12px; color: var(--brand); text-decoration: none; font-weight: 500; }
.field-hint:hover { text-decoration: underline; }
.field input, .pw-wrap input {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: #fff;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .pw-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.pw-wrap { position: relative; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  padding: 6px; color: var(--ink-4); border-radius: var(--r-sm);
}
.pw-toggle:hover { color: var(--ink-2); background: #F5F5F5; }

.check-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 13px; color: var(--ink-2);
  cursor: pointer;
}
.check-row input { accent-color: var(--brand); width: 16px; height: 16px; }

.btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }

.login-foot {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  width: 100%;
  text-align: center;
}

.sso-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0 16px;
  width: 100%;
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.sso-divider::before, .sso-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.sso-box {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #fff;
  display: flex; flex-direction: column; gap: 8px;
}
.sso-box-label {
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em;
  text-align: center;
}

.btn-sso {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: #fff;
  color: #1F1F1F;
  font-size: 14px; font-weight: 500;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  transition: background .1s, border-color .1s;
  line-height: 1;
}
.btn-sso > svg {
  flex-shrink: 0;
  display: block;
}
.btn-sso > span {
  display: inline-block;
  line-height: 1;
}
.btn-sso:hover:not(:disabled) { background: #F5F5F5; border-color: var(--ink-4); }
.btn-sso:disabled { opacity: 0.6; cursor: not-allowed; }

.login-right {
  background: linear-gradient(145deg, #0F73AA, #1E9AE0 60%, #4FB8ED);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-right::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,.14), transparent 40%),
    radial-gradient(circle at 85% 90%, rgba(255,255,255,.08), transparent 50%);
  pointer-events: none;
}
.login-right-inner { position: relative; max-width: 440px; padding: 48px; }
.pattern-mark {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.3em;
  color: rgba(255,255,255,.7);
  margin-bottom: 32px;
}
.right-headline {
  font-size: 38px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15;
  margin-bottom: 48px;
}
.right-headline .mute { color: rgba(255,255,255,.7); }
.right-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 24px; padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,.25);
}
.stat-num {
  font-size: 28px; font-weight: 600; letter-spacing: -0.02em;
  display: flex; align-items: baseline; gap: 2px;
}
.stat-unit { font-size: 15px; color: rgba(255,255,255,.8); font-weight: 500; }
.stat-lbl { font-size: 12px; color: rgba(255,255,255,.75); margin-top: 2px; }

/* ========== APP SHELL ========== */
.app { min-height: 100vh; background: var(--bg); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 32px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-logo { height: 28px; }
.topbar-divider { width: 1px; height: 24px; background: var(--line-2); }
.tp-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.tp-org { font-size: 11px; color: var(--ink-3); }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: var(--r-md);
  cursor: pointer;
  position: relative;
  transition: background .1s;
}
.user-chip:hover { background: #F5F5F5; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 11px; letter-spacing: 0.03em;
}
.user-meta { line-height: 1.15; }
.user-name { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: var(--ink-3); }

.user-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  min-width: 220px;
  box-shadow: var(--shadow-md);
  z-index: 100;
  cursor: default;
  overflow: hidden;
}
.um-header { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.um-name { font-size: 13px; font-weight: 500; }
.um-email { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.um-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px;
  font-size: 13px; color: var(--ink); text-align: left;
}
.um-item:hover { background: #F5F5F5; }
.menu-backdrop { position: fixed; inset: 0; z-index: 50; }

/* ========== PAGE ========== */
.page { max-width: 1440px; margin: 0 auto; padding: 32px; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 32px;
  margin-bottom: 28px;
}
.eyebrow {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--brand);
  margin-bottom: 8px;
}
.page-title {
  font-size: 30px; font-weight: 600; letter-spacing: -0.025em;
  margin: 0 0 6px;
}
.page-sub { margin: 0; color: var(--ink-3); font-size: 14px; max-width: 56ch; }

.page-head-right { display: flex; gap: 32px; }
.kpi { text-align: right; }
.kpi-num {
  font-size: 28px; font-weight: 600; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-lbl { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }

/* ========== TABS ========== */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 2px; margin-right: 24px;
  font-size: 13px; font-weight: 500; color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--brand); }
.tab-count {
  background: var(--bg-sunken);
  padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 500; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.tab.active .tab-count { background: var(--brand-soft); color: var(--brand-ink); }

/* ========== FILTER BAR ========== */
.filter-bar {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.search-wrap {
  position: relative; flex: 1 1 320px; min-width: 260px;
  display: flex; align-items: center;
}
.search-wrap svg:first-child {
  position: absolute; left: 12px; color: var(--ink-4);
  pointer-events: none;
}
.search-wrap input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  font-size: 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: #fff;
  outline: none;
  transition: border-color .1s, box-shadow .1s;
}
.search-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.search-clear {
  position: absolute; right: 8px;
  padding: 4px; color: var(--ink-4);
}
.search-clear:hover { color: var(--ink-2); }

.select-wrap { display: flex; flex-direction: column; gap: 4px; }
.select-label {
  font-size: 11px; font-weight: 500; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.select-box {
  position: relative; display: flex; align-items: center;
}
.select-box select {
  appearance: none; -webkit-appearance: none;
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: #fff;
  cursor: pointer;
  min-width: 130px;
  outline: none;
}
.select-box select:hover { border-color: var(--ink-4); }
.select-box svg {
  position: absolute; right: 10px; color: var(--ink-4);
  pointer-events: none;
}

.toggle-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  font-size: 13px;
  background: #fff;
  cursor: pointer;
  align-self: flex-end;
  user-select: none;
}
.toggle-chip:hover { border-color: var(--ink-4); }
.toggle-chip input { accent-color: var(--brand); }
.toggle-chip:has(input:checked) {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-ink);
}

/* ========== SELECTION BAR ========== */
.sel-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: #0E1726;
  color: #fff;
  border-radius: var(--r-md);
  margin-bottom: 12px;
  animation: slide-in .18s ease-out;
}
@keyframes slide-in {
  from { transform: translateY(-4px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.sel-info { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.sel-info svg { color: #7DDBA3; }
.sel-clear {
  margin-left: 8px;
  font-size: 12px; color: rgba(255,255,255,.7);
  text-decoration: underline; padding: 2px 0;
}
.sel-clear:hover { color: #fff; }
.sel-actions { display: flex; align-items: center; gap: 16px; }
.sel-note { font-size: 12px; color: rgba(255,255,255,.65); }

/* ========== TABLE ========== */
.table-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.log-table thead th {
  text-align: left;
  padding: 11px 14px;
  font-size: 11px; font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #fff;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.log-table tbody tr {
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .08s;
}
.log-table tbody tr:last-child { border-bottom: 0; }
.log-table tbody tr:hover { background: #FAFAFA; }
.log-table tbody tr.row-selected { background: var(--brand-soft); }
.log-table tbody tr.row-selected:hover { background: #D9EDF8; }
.log-table td {
  padding: 14px;
  vertical-align: middle;
}
.density-compact .log-table td { padding: 8px 14px; }
.density-compact .log-table thead th { padding: 8px 14px; }

.col-check { width: 36px; padding-right: 0 !important; }
.col-date { min-width: 130px; }
.col-dir { width: 50px; text-align: center; }
.col-dur { width: 80px; text-align: right; }
.col-rec { width: 120px; }
.col-act { width: 130px; text-align: right; }

.date-rel { font-weight: 500; font-size: 13px; }
.date-exact { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

.caller-name { font-weight: 500; }
.caller-num { font-size: 11px; color: var(--ink-3); margin-top: 1px; }

.dir-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-sunken);
}
.dir-inbound { background: var(--success-soft); color: var(--success); }
.dir-outbound { background: var(--brand-soft); color: var(--brand-ink); }

.queue-pill {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px; font-weight: 500;
  background: var(--bg-sunken);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  white-space: nowrap;
}

.rec-yes {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--success); font-weight: 500;
}
.rec-yes .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--success);
}
.rec-no { color: var(--ink-4); font-size: 12px; }

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  background: var(--bg-sunken);
  border-radius: var(--r-sm);
  color: var(--ink-2);
  margin-right: 4px;
}

.empty {
  padding: 56px 24px;
  text-align: center;
}
.empty-title { font-weight: 500; margin-bottom: 6px; }
.empty-sub { color: var(--ink-3); font-size: 13px; margin-bottom: 16px; }

.table-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: #fff;
  font-size: 12px; color: var(--ink-3);
}
.page-ctrls { display: flex; align-items: center; gap: 8px; }
.page-num { color: var(--ink-2); font-weight: 500; padding: 0 8px; }

/* ========== BUTTONS ========== */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  background: var(--brand);
  color: #fff;
  font-size: 13px; font-weight: 500;
  border-radius: var(--r-md);
  transition: background .1s;
  white-space: nowrap;
}
.btn-primary:hover:not(:disabled) { background: var(--brand-ink); }
.btn-primary:disabled { background: var(--ink-4); cursor: not-allowed; opacity: 0.6; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 12px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  transition: background .1s, border-color .1s;
  white-space: nowrap;
}
.btn-ghost:hover:not(:disabled) { background: #F5F5F5; border-color: var(--ink-4); }
.btn-ghost:disabled { color: var(--ink-4); cursor: not-allowed; }

.btn-done {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 13px; font-weight: 500;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  cursor: default;
}

.btn-sm { padding: 6px 10px; font-size: 12px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
}
.icon-btn:hover { background: #F5F5F5; color: var(--ink); }

/* ========== CHECKBOX ========== */
.cbx {
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.cbx input { display: none; }
.cbx-box {
  width: 16px; height: 16px;
  border: 1.5px solid var(--line-2);
  border-radius: 3px;
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: background .1s, border-color .1s;
}
.cbx input:checked + .cbx-box {
  background: var(--brand); border-color: var(--brand);
}
.cbx-box:hover { border-color: var(--brand); }
.cbx-dash {
  width: 8px; height: 2px; background: #fff; border-radius: 1px;
}
.cbx:has(input:indeterminate) .cbx-box {
  background: var(--brand); border-color: var(--brand);
}

/* ========== MODAL ========== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(14, 23, 38, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 24px;
  animation: fade-in .12s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: var(--r-lg);
  max-width: 560px; width: 100%;
  max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: scale-in .15s ease-out;
}
@keyframes scale-in {
  from { transform: scale(.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 24px 24px 0;
}
.modal-eyebrow {
  font-size: 11px; color: var(--ink-3); letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.modal-eyebrow.mono { text-transform: none; letter-spacing: 0.02em; color: var(--brand-ink); font-weight: 500;}
.modal-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; }
.modal-sub { color: var(--ink-3); font-size: 13px; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-text { font-size: 14px; color: var(--ink-2); margin: 0 0 16px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: #fff;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

.bulk-preview {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  overflow: hidden;
}
.bulk-row {
  display: grid;
  grid-template-columns: 90px 1fr 90px 60px;
  gap: 12px;
  padding: 10px 14px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.bulk-row:last-child { border-bottom: 0; }
.bulk-id { color: var(--brand-ink); font-size: 11px; }
.bulk-caller { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-date { color: var(--ink-3); }
.bulk-dur { color: var(--ink-3); text-align: right; }
.bulk-more { padding: 8px 14px; font-size: 12px; color: var(--ink-3); background: var(--bg-sunken); }

/* Call detail grid */
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.dg-label {
  font-size: 11px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.dg-val { font-size: 13px; font-weight: 500; display: flex; align-items: center; }

.player {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 12px;
}
.player-play {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding-left: 2px;
}
.player-play:hover { background: var(--brand-ink); }
.player-track { flex: 1; }
.player-bar {
  height: 4px; background: var(--line-2); border-radius: 2px;
  overflow: hidden; margin-bottom: 6px;
}
.player-fill { height: 100%; width: 0%; background: var(--brand); }
.player-times {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--ink-3);
}
.detail-tags { display: flex; gap: 4px; flex-wrap: wrap; }

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: #0E1726; color: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  font-size: 13px;
  animation: toast-in .22s ease-out;
}
.toast-success svg { color: #7DDBA3; }
@keyframes toast-in {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ========== TWEAKS PANEL ========== */
.tweaks {
  position: fixed; right: 20px; bottom: 20px;
  width: 300px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  overflow: hidden;
}
.tweaks-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}
.tweaks-kicker {
  font-size: 10px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  margin-bottom: 2px;
}
.tweaks-title { font-weight: 600; font-size: 14px; }
.tweaks-body { padding: 16px; }
.tw-group + .tw-group { margin-top: 16px; }
.tw-label { font-size: 12px; font-weight: 500; margin-bottom: 8px; }
.tw-hint { font-size: 11px; color: var(--ink-3); margin-top: 8px; }

.seg {
  display: flex;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  overflow: hidden;
}
.seg button {
  flex: 1; padding: 7px 10px;
  font-size: 12px; font-weight: 500;
  background: #fff; color: var(--ink-2);
  border-right: 1px solid var(--line-2);
}
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--ink); color: #fff; }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .page { padding: 20px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 20px; }
  .col-tags, .col-queue { display: none; }
}

/* ========== PHASE 4 ADDITIONS ========== */

.boot {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; color: var(--ink-3); font-size: 16px;
}

.login-error, .banner-error {
  background: #FEE7E5; color: var(--danger);
  padding: 10px 14px; border-radius: var(--r-md); font-size: 13px;
  border: 1px solid #F5C5C0;
}
.banner { padding: 10px 14px; border-radius: var(--r-md); font-size: 13px; margin: 12px 0; }
.banner-error { background: #FEE7E5; color: var(--danger); border: 1px solid #F5C5C0; }

.pw-wrap { position: relative; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); padding: 4px;
}
.pw-toggle:hover { color: var(--ink-2); }

/* Top bar nav */
.topbar-nav {
  display: flex; gap: 4px; align-items: center;
  flex: 1; justify-content: center;
}
.navbtn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-md);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  transition: background 0.15s;
}
.navbtn:hover { background: var(--brand-soft); color: var(--brand-ink); }
.navbtn.active { background: var(--brand-soft); color: var(--brand-ink); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 16px 0 20px; }
.tab {
  padding: 10px 16px; font-size: 13.5px; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-weight: 500;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--brand-ink); border-bottom-color: var(--brand); }

/* Admin toolbar */
.admin-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; flex-wrap: wrap;
}
.admin-toolbar .muted { flex: 1; }

.muted { color: var(--ink-3); }

/* Pills/chips */
.loc-pill {
  display: inline-block; padding: 2px 8px;
  background: var(--brand-soft); color: var(--brand-ink);
  border-radius: 12px; font-size: 12px; font-weight: 500;
}
.status-pill {
  display: inline-block; padding: 2px 8px;
  border-radius: 12px; font-size: 12px; font-weight: 500;
}
.pill-ok   { background: var(--success-soft); color: var(--success); }
.pill-err  { background: #FEE7E5; color: var(--danger); }
.pill-warn { background: #FFF3DE; color: var(--warn); }

/* Chip picker for region/location multi-select */
.chip-pick {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px; background: var(--bg-sunken);
  border: 1px solid var(--line); border-radius: var(--r-md);
  max-height: 240px; overflow-y: auto;
}
.chip {
  padding: 6px 10px; font-size: 12.5px;
  border: 1px solid var(--line-2); border-radius: 16px;
  background: var(--bg); color: var(--ink-2);
  transition: all 0.15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand-ink); }
.chip.active {
  background: var(--brand); color: white; border-color: var(--brand);
}

/* Row actions in admin tables */
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions .btn-sm { padding: 4px 10px; font-size: 12px; }

/* Copy box for setup link */
.copy-box {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: var(--bg-sunken); border: 1px solid var(--line);
  border-radius: var(--r-md); margin: 12px 0;
}
.copy-box code {
  flex: 1; overflow-x: auto; white-space: nowrap;
  font-size: 12px; color: var(--ink-2);
}

/* Request block in call detail modal */
.request-block {
  margin-top: 18px; padding: 16px;
  background: var(--bg-sunken); border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.rb-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.rb-sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 12px; }

/* Toast close button */
.toast-close { color: inherit; opacity: 0.7; margin-left: 8px; padding: 2px; }
.toast-close:hover { opacity: 1; }

/* Mobile responsiveness — quick & dirty */
@media (max-width: 800px) {
  .topbar-nav { display: none; }
  .filter-bar { flex-wrap: wrap; }
}

/* Date range inputs in the filter bar */
.date-input {
  appearance: none;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  min-width: 150px;
}
.date-input:hover { border-color: var(--ink-4); }
.date-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }


/* ========== ANALYTICS DASHBOARD (integrated, on-demand) ========== */
.asof { color: var(--ink-4); }
.kpi-cards-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .kpi-cards-5 { grid-template-columns: repeat(2, 1fr); } }

.org-total-row td { font-weight: 600; background: var(--bg-sunken); border-top: 2px solid var(--line-2); }
.q-link { color: var(--brand-ink); font-weight: 500; }
.log-table tbody tr:hover .q-link { text-decoration: underline; }

.crumb { color: var(--brand-ink); cursor: pointer; }
.crumb:hover { text-decoration: underline; }
.crumb-sep { color: var(--ink-4); margin: 0 4px; }

.ubar { width: 120px; height: 6px; background: var(--bg-sunken); border-radius: 3px; overflow: hidden; }
.ubar-fill { height: 100%; background: var(--brand); border-radius: 3px; }

/* Individual analytics slide-over drawer (right side) */
.panel-backdrop {
  position: fixed; inset: 0; background: rgba(14,23,38,.35);
  z-index: 220; display: flex; justify-content: flex-end;
  animation: fade-in .12s ease-out;
}
.ind-panel {
  width: 460px; max-width: 92vw; height: 100%;
  background: #fff; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: panel-in .18s ease-out;
}
@keyframes panel-in { from { transform: translateX(24px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
.ip-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 22px 22px 16px; border-bottom: 1px solid var(--line);
}
.ip-sub { margin-top: 6px; font-size: 12px; color: var(--ink-3); display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.ip-body { padding: 20px 22px; overflow-y: auto; }
.ip-period { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.svc-list { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.svc-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--line);
}
.svc-row:last-child { border-bottom: 0; }
.svc-row > span:first-child { color: var(--ink-2); }
.svc-row > span:last-child { font-weight: 600; }

/* ========== ANALYTICS — KPI CARDS + SECTION HEADERS (base) ========== */
.kpi-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 6px 0 4px;
}
.kpi-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  border-top: 2px solid var(--brand); padding: 16px 18px;
}
.kpi-card-val {
  font-size: 30px; font-weight: 600; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.kpi-card-lbl {
  font-size: 12px; color: var(--ink-3); text-transform: uppercase;
  letter-spacing: .06em; margin-top: 6px;
}
.kpi-card-note { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
 
.section-title {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-2); margin: 24px 0 10px;
}
.log-table th.num, .log-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
 
.analytics-locpick { margin-bottom: 14px; }
.alp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }

/* ========== ANALYTICS — LOCATIONS-TO-INCLUDE CHECKBOX BOX ========== */
.loc-box {
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: #fff; margin-bottom: 16px; overflow: hidden;
}
.loc-box-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.loc-all { color: var(--brand-ink); font-size: 12px; font-weight: 600; }
.loc-all:hover { text-decoration: underline; }
.loc-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 2px 18px; padding: 10px 14px;
  max-height: 210px; overflow-y: auto;
}
.loc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer;
  font-size: 13px;
}
.loc-item:hover { background: var(--bg-sunken); }
.loc-item input { accent-color: var(--brand); width: 15px; height: 15px; flex-shrink: 0; }
.loc-item-name { flex: 1; color: var(--ink); }
.loc-item.on .loc-item-name { font-weight: 500; }
.loc-item-count { color: var(--ink-4); font-variant-numeric: tabular-nums; font-size: 12px; }
.loc-summary {
  padding: 10px 14px; border-top: 1px solid var(--line);
  background: var(--bg-sunken); font-size: 12px; color: var(--ink-3);
}

/* ========== ANALYTICS — missed-call breakdown cell sub-percentages ========== */
.cell-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 400;
  margin-top: 1px;
}


/* ========== ANALYTICS — collapsible sections (#8) ========== */
.section-title.collapsible {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
  transition: color .1s;
}
.section-title.collapsible:hover { color: var(--brand-ink); }
.section-title .sec-chev {
  color: var(--ink-4);
  transition: transform .15s ease;
  flex-shrink: 0;
}
.section-title.collapsible:hover .sec-chev { color: var(--brand-ink); }

.seg.seg-hours {
  align-self: flex-end;
  height: 34px;
}
.seg.seg-hours button {
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}
