/* ── Nila Voyages CRM · Stylesheet ──────────────────────────────── */

/* Apply dark immediately to prevent flash */
html.dark { color-scheme: dark; }

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef1f6;
  --border: #e2e8f0;
  --border-med: #cbd5e1;
  --ink: #0d1b2e;
  --ink-2: #1e3a5f;
  --muted: #5a7184;
  --faint: #8fa3b8;
  --accent: #1a3c6e;
  --accent-light: #2563eb;
  --accent-glow: rgba(26, 60, 110, 0.10);
  --accent-press: #122d54;
  --gold: #b8922a;
  --gold-light: #f0c040;
  --gold-bg: #fdf8ee;
  --gold-border: #e8d5a0;
  --success: #166534;
  --success-bg: #f0fdf4;
  --warning: #92400e;
  --warning-bg: #fffbeb;
  --error: #991b1b;
  --error-bg: #fef2f2;
  --radius-sm: 5px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 3px rgba(13, 27, 46, 0.06), 0 1px 2px rgba(13, 27, 46, 0.04);
  --shadow-md: 0 4px 16px rgba(13, 27, 46, 0.08), 0 2px 6px rgba(13, 27, 46, 0.05);
  --shadow-lg: 0 12px 32px rgba(13, 27, 46, 0.10), 0 4px 12px rgba(13, 27, 46, 0.06);
  --nav-h: 58px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: #f4f6f9;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--nav-h);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top Nav ────────────────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: #0d1b2e;
  border-bottom: 1px solid #1a3c6e;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(13, 27, 46, 0.18);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-logo {
  font-size: 1.3rem;
}

.nav-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #f0c040;
  letter-spacing: 0.01em;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  transition: background 150ms, color 150ms;
}

.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(240,192,64,0.15); color: #f0c040; font-weight: 600; }

.nav-refresh {
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Page Shell ─────────────────────────────────────────────────── */
.page-shell {
  width: min(1280px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 0.95rem; }

/* ── Hero ───────────────────────────────────────────────────────── */
.hero {
  padding: 8px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.hero-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.hero h1 {
  font-size: clamp(2rem, 3.8vw, 3.2rem);
  line-height: 1.05;
  color: var(--ink);
}

.lede {
  color: var(--muted);
  font-size: 0.875rem;
  max-width: 60ch;
  line-height: 1.65;
  margin-top: 8px;
}

/* ── Stats Bar ──────────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stat-card {
  flex: 1;
  min-width: 140px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 4px;
}

/* ── Status Strip ───────────────────────────────────────────────── */
.status-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

.status-badge, .pill, .metric-chip, .table-status {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge {
  padding: 5px 12px;
  background: #ebf2ff;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-badge[data-tone="success"] { background: var(--success-bg); color: var(--success); }
.status-badge[data-tone="warning"] { background: var(--warning-bg); color: var(--warning); }
.status-badge[data-tone="error"]   { background: var(--error-bg);   color: var(--error); }

.status-copy { font-size: 0.875rem; font-weight: 500; color: var(--ink-2); }
.helper { color: var(--muted); font-size: 0.8rem; line-height: 1.6; }
.helper-tight { margin-top: 2px; font-size: 0.8rem; }

.status-line {
  min-height: 1.2em;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--muted);
}
.status-line[data-tone="success"] { color: var(--success); }
.status-line[data-tone="error"]   { color: var(--error); }
.status-line[data-tone="info"]    { color: var(--accent); }

/* ── Layout ─────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.panel {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.panel-split {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 28px;
  align-items: start;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2, .panel > h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.panel > h2 {
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

/* ── Forms ──────────────────────────────────────────────────────── */
.upload-form, .stack { display: grid; gap: 12px; }

label {
  display: grid;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
}

input, select, button, textarea { font: inherit; }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-med);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--ink);
  font-size: 0.875rem;
  transition: border-color 180ms, box-shadow 180ms;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

select { cursor: pointer; }

button, a.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 150ms, transform 120ms, box-shadow 150ms, border-color 150ms;
}

button {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(13, 27, 46, 0.18);
}

button:hover {
  background: var(--accent-press);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(13, 27, 46, 0.18);
}

button:active { transform: translateY(0); }

button.ghost, a.ghost {
  color: var(--ink-2);
  background: #fff;
  border-color: var(--border);
  box-shadow: none;
  text-decoration: none;
}

button.ghost:hover, a.ghost:hover {
  background: var(--surface-3);
  color: var(--ink);
  box-shadow: none;
  text-decoration: none;
}

button.danger {
  color: var(--error);
  background: var(--error-bg);
  border-color: #f4c9c9;
  box-shadow: none;
}

button.danger:hover { background: #f9e1e1; box-shadow: none; }

.icon-btn {
  width: 32px; height: 32px;
  padding: 0;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink-2);
  transform: none;
  box-shadow: none;
}

/* ── Kebab Menu ─────────────────────────────────────────────────── */
.kebab-wrap { position: relative; flex-shrink: 0; }

.kebab-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  min-width: 180px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--border-med);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.kebab-item {
  width: 100%;
  justify-content: flex-start;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  box-shadow: none;
}

.kebab-item:hover { background: var(--surface-3); color: var(--ink); transform: none; box-shadow: none; }
.kebab-danger { color: var(--error) !important; }
.kebab-danger:hover { background: var(--error-bg) !important; }
.kebab-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.card-head, .card-head-right { display: flex; gap: 8px; }
.card-head { justify-content: space-between; align-items: flex-start; }
.card-head-right { align-items: center; flex-shrink: 0; }
.card h3 { font-size: 0.95rem; font-weight: 700; color: var(--ink); line-height: 1.3; }
.card p { margin: 0; }
.meta { color: var(--muted); font-size: 0.8rem; margin-top: 3px !important; }

.metric-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.metric-chip {
  padding: 5px 11px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink-2);
}

.chip-success { background: var(--success-bg); color: var(--success); border-color: #cfe7d6; }
.chip-warning { background: var(--warning-bg); color: var(--warning); border-color: #f2d9a6; }
.chip-error   { background: var(--error-bg);   color: var(--error);   border-color: #f2c6c6; }

.pill { padding: 4px 10px; background: #ebf2ff; color: var(--accent); }
.pill-muted { background: #eef2f7; color: var(--muted); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.assign-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.assign-row select { flex: 1; }
.assign-row button { flex-shrink: 0; }
.assign-row-multi { align-items: stretch; }
.assign-row-multi select { min-height: 118px; }

/* ── Table ──────────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-top: 4px;
  background: #fff;
}

table { width: 100%; border-collapse: collapse; }

th {
  padding: 11px 16px;
  background: var(--surface-2);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
  color: var(--ink-2);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8faff; color: var(--ink); }

.table-status { padding: 3px 9px; }
.status-default { background: #ebf2ff; color: var(--accent); }
.status-success { background: var(--success-bg); color: var(--success); }
.status-warning { background: var(--warning-bg); color: var(--warning); }
.status-error   { background: var(--error-bg);   color: var(--error); }

.empty {
  padding: 28px 20px;
  border: 1px dashed var(--border-med);
  border-radius: var(--radius-md);
  color: var(--faint);
  text-align: center;
  font-size: 0.82rem;
  background: #fff;
}

/* ── Lead Score Badges ──────────────────────────────────────────── */
.score-hot {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem; font-weight: 700; white-space: nowrap;
  background: #fff1e6; color: #c2410c; border: 1px solid #fcd9b6;
}

.score-warm {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem; font-weight: 700; white-space: nowrap;
  background: #fffbeb; color: #b45309; border: 1px solid #fde68a;
}

.score-cold {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.76rem; font-weight: 700; white-space: nowrap;
  background: #eff6ff; color: #3b82f6; border: 1px solid #bfdbfe;
}

/* ── Screen Pop Banner ──────────────────────────────────────────── */
@keyframes slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.screen-pop-banner {
  position: fixed;
  top: calc(var(--nav-h) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: #fff;
  border: 2px solid #16a34a;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: slide-down 0.3s ease;
  min-width: 360px;
  max-width: 560px;
}

.screen-pop-icon { font-size: 1.4rem; flex-shrink: 0; }
.screen-pop-body { flex: 1; font-size: 0.9rem; color: var(--ink-2); }
.screen-pop-phone { margin-left: 8px; color: var(--muted); font-size: 0.85rem; }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(21, 128, 61, 0.35); }
  50%       { box-shadow: 0 0 0 6px rgba(21, 128, 61, 0); }
}

.active-call-row {
  border-color: #16a34a !important;
  animation: pulse-green 1.6s ease-in-out infinite;
}

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: min(640px, 100%);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

.modal-head h2 { font-size: 1.1rem; }

.modal-body { padding: 20px 24px 24px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.detail-label {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.detail-value {
  font-size: 0.92rem;
  color: var(--ink);
  font-weight: 500;
}

/* ── Leads Page ─────────────────────────────────────────────────── */
.leads-toolbar, .followups-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 16px 0;
}

.leads-filter-group {
  display: flex;
  gap: 4px;
  background: var(--surface-3);
  padding: 4px;
  border-radius: var(--radius-md);
}

.filter-btn {
  padding: 6px 14px;
  background: transparent;
  color: var(--muted);
  border: 0;
  box-shadow: none;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.filter-btn:hover { background: #fff; color: var(--ink); transform: none; box-shadow: none; }
.filter-btn.active { background: #fff; color: var(--accent); box-shadow: var(--shadow-sm); }

.leads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 4px;
}

.lead-score-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 150ms, transform 150ms;
  cursor: pointer;
}

.lead-score-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.lead-score-card.hot-card { border-left: 4px solid #f97316; }
.lead-score-card.warm-card { border-left: 4px solid #eab308; }
.lead-score-card.cold-card { border-left: 4px solid #3b82f6; }

.lead-score-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.lead-score-number {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

.hot-card .lead-score-number { color: #c2410c; }
.warm-card .lead-score-number { color: #b45309; }
.cold-card .lead-score-number { color: #3b82f6; }

.lead-score-bar-wrap {
  height: 4px;
  background: #e8eef7;
  border-radius: 99px;
  overflow: hidden;
  margin: 8px 0;
}

.lead-score-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}

.hot-card .lead-score-bar { background: linear-gradient(90deg, #f97316, #ef4444); }
.warm-card .lead-score-bar { background: linear-gradient(90deg, #eab308, #f97316); }
.cold-card .lead-score-bar { background: linear-gradient(90deg, #3b82f6, #6366f1); }

/* ── Score Legend ───────────────────────────────────────────────── */
.score-legend-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.score-factors {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.6;
}

/* ── Follow-Ups ─────────────────────────────────────────────────── */
.overdue td { color: var(--error) !important; }
.overdue { background: #fdeeee !important; border-left: 3px solid var(--error); }
.due-today td { color: var(--warning) !important; }
.due-today { background: var(--warning-bg) !important; }

/* ── Progress Bar ───────────────────────────────────────────────── */
.progress-bar-wrap {
  margin-top: 14px;
  height: 5px;
  background: #e8eef7;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #22c55e 100%);
  border-radius: 99px;
}

/* ── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid, .panel-split, .detail-grid { grid-template-columns: 1fr; }
  .page-shell { width: calc(100vw - 32px); padding-top: 24px; }
  .hero h1 { font-size: 2.2rem; }
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: fixed; top: var(--nav-h); left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 8px; z-index: 199; box-shadow: var(--shadow-md); }
  .leads-grid { grid-template-columns: 1fr; }
  .nav-hamburger { display: flex !important; }
}

.nav-hamburger {
  display: none;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.8);
  font-size: 1.1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  flex-shrink: 0;
}

.nav-hamburger:hover { background: rgba(255,255,255,0.10); transform: none; box-shadow: none; }

/* ── Dark Mode ──────────────────────────────────────────────────── */
html.dark {
  color-scheme: dark;
  --bg: #080f1a;
  --surface: #0f1c2e;
  --surface-2: #162236;
  --surface-3: #1e2f42;
  --border: #1e3050;
  --border-med: #2a4060;
  --ink: #e8f0f8;
  --ink-2: #b8cfe8;
  --muted: #7a9ab8;
  --faint: #4a6a88;
  --accent-glow: rgba(96, 165, 250, 0.12);
  --success-bg: #052e16;
  --warning-bg: #1c0a00;
  --error-bg: #1c0505;
}

html.dark body { background: #080f1a; }

html.dark .top-nav,
html.dark .emp-nav {
  background: #060d18;
  border-color: #1a3c6e;
}

html.dark .panel,
html.dark .card,
html.dark .lead-score-card,
html.dark .modal,
html.dark .screen-pop-banner,
html.dark .workspace-section,
html.dark .emp-stat,
html.dark .log-entry {
  background: #0f1c2e;
  border-color: #1e3050;
}

html.dark .stat-card {
  background: #0f1c2e;
  border-color: #1e3050;
}

html.dark table th {
  background: #0a1525;
  color: #7a9ab8;
  border-color: #1e3050;
}

html.dark td {
  color: #b8cfe8;
  border-color: #1e3050;
}

html.dark tbody tr:hover td {
  background: #162236;
  color: #e8f0f8;
}

html.dark .table-wrap {
  background: #0f1c2e;
  border-color: #1e3050;
}

html.dark input[type="text"],
html.dark input[type="password"],
html.dark input[type="email"],
html.dark input[type="date"],
html.dark input[type="datetime-local"],
html.dark input[type="number"],
html.dark input[type="file"],
html.dark select,
html.dark textarea {
  background: #162236;
  border-color: #2a4060;
  color: #e8f0f8;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
  color: #4a6a88;
}

html.dark button.ghost,
html.dark a.ghost {
  background: #0f1c2e;
  border-color: #2a4060;
  color: #b8cfe8;
}

html.dark button.ghost:hover,
html.dark a.ghost:hover {
  background: #1e2f42;
  color: #e8f0f8;
}

html.dark .kebab-menu {
  background: #0f1c2e;
  border-color: #2a4060;
}

html.dark .kebab-item {
  color: #b8cfe8;
}

html.dark .kebab-item:hover {
  background: #1e2f42;
  color: #e8f0f8;
}

html.dark .empty {
  background: #0f1c2e;
  border-color: #2a4060;
  color: #4a6a88;
}

html.dark .leads-filter-group {
  background: #1e2f42;
}

html.dark .filter-btn {
  color: #7a9ab8;
}

html.dark .filter-btn.active,
html.dark .filter-btn:hover {
  background: #0f1c2e;
  color: #e8f0f8;
}

html.dark .modal-head {
  background: #0f1c2e;
  border-color: #1e3050;
}

html.dark .modal-overlay {
  background: rgba(0, 0, 0, 0.75);
}

html.dark .score-legend-inner,
html.dark .score-factors {
  color: #7a9ab8;
}

html.dark .lead-item {
  background: #0f1c2e;
  border-color: #1e3050;
}

html.dark .lead-item:hover,
html.dark .lead-item.selected {
  border-color: #2563eb;
  background: #162236;
}

html.dark .nav-link {
  color: rgba(255,255,255,0.55);
}

html.dark .nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

html.dark .nav-link.active {
  background: rgba(240,192,64,0.15);
  color: #f0c040;
}

html.dark .pill {
  background: #0f2a4a;
  color: #93c5fd;
}

html.dark .pill-muted {
  background: #1e2f42;
  color: #7a9ab8;
}

html.dark .status-strip {
  background: rgba(15,28,46,0.95);
  border-color: #1e3050;
}

html.dark .progress-bar-wrap {
  background: #1e2f42;
}

html.dark .disp-btn {
  background: #1e2f42;
  border-color: #2a4060;
  color: #b8cfe8;
}

html.dark .disp-btn:hover {
  background: var(--accent);
  color: #fff;
}

html.dark .login-card {
  background: #0f1c2e;
  border-color: #1e3050;
}

html.dark .login-brand h1 {
  color: #e8f0f8;
}

html.dark .login-brand p {
  color: #7a9ab8;
}

/* ── Monitor Grid ───────────────────────────────────────────────── */
.monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

@media (max-width: 600px) {
  .monitor-grid { grid-template-columns: 1fr; }
}
html.admin-auth-pending body {
  visibility: hidden;
}

.admin-login-shell {
  min-height: calc(100vh - var(--nav-h));
  display: grid;
  place-items: center;
}

.admin-login-panel {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.admin-login-form {
  display: grid;
  gap: 14px;
  margin: 18px 0 12px;
}

/* ── Campaign Code Badge ────────────────────────────────────────── */
.code-badge {
  background: var(--gold-bg);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

html.dark .code-badge {
  background: #2a1f00;
  color: #f0c040;
  border-color: #5a4200;
}

/* ── Inactive row ───────────────────────────────────────────────── */
.row-inactive td {
  opacity: 0.55;
}

/* ── Dashboard Layout ───────────────────────────────────────────── */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 8px 0 20px;
  flex-wrap: wrap;
}

.dash-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin: 0;
}

.dash-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.dash-panel-wide { grid-column: 1; }

@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ── Health dot ─────────────────────────────────────────────────── */
.health-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--faint);
  flex-shrink: 0;
}
.health-dot--ok  { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.2); }
.health-dot--err { background: var(--error); box-shadow: 0 0 0 3px rgba(185,28,28,0.2); }

/* ── KPI Strip ──────────────────────────────────────────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 4px;
}

@media (max-width: 900px) {
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 500px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}

.kpi-card {
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--border);
  border-top: none;
}

.kpi-card.kpi-accent  { border-left-color: var(--accent); }
.kpi-card.kpi-warning { border-left-color: #d97706; }
.kpi-card.kpi-info    { border-left-color: #2563eb; }
.kpi-card.kpi-success { border-left-color: #16a34a; }
.kpi-card.kpi-muted   { border-left-color: var(--faint); }

.kpi-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.03em;
}

.kpi-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 6px;
}

/* ── Agent Monitor Grid ─────────────────────────────────────────── */
.agent-monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.agent-card {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 150ms;
}

.agent-card--oncall {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.15);
  animation: pulse-green 2s ease-in-out infinite;
}

.agent-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.agent-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.agent-card--oncall .agent-avatar {
  background: rgba(34,197,94,0.15);
  color: #15803d;
}

.agent-info { flex: 1; min-width: 0; }
.agent-name { font-weight: 700; font-size: 0.9rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-meta { font-size: 0.75rem; color: var(--muted); }

.agent-status-badge { flex-shrink: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-oncall { background: var(--success-bg); color: var(--success); }
.badge-idle   { background: var(--surface-3); color: var(--muted); }

.agent-call-info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: var(--success-bg);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  font-size: 0.82rem;
}

.agent-call-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.agent-call-name { font-weight: 700; color: var(--ink); }
.agent-call-meta { color: var(--muted); font-size: 0.78rem; }

.agent-stats-row {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 8px;
}

.agent-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border-right: 1px solid var(--border);
}

.agent-stat:last-child { border-right: 0; }

.agent-stat-val {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.agent-stat-lbl {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.agent-progress-wrap {
  height: 4px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}

.agent-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.agent-progress-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
  text-align: right;
}

/* ── On-call pill ───────────────────────────────────────────────── */
.pill-oncall {
  background: var(--success-bg);
  color: var(--success);
  animation: pulse-green 2s ease-in-out infinite;
}

/* ── Campaign summary rows ──────────────────────────────────────── */
.campaign-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.campaign-row:last-child { border-bottom: 0; }
.campaign-row--inactive { opacity: 0.5; }

.campaign-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.campaign-row-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  min-width: 0;
}

.campaign-row-pct {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.campaign-row-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

/* ── Dark mode additions ────────────────────────────────────────── */
html.dark .kpi-card,
html.dark .agent-card {
  background: #0f1c2e;
  border-color: #1e3050;
}

html.dark .agent-stats-row {
  border-color: #1e3050;
}

html.dark .agent-stat {
  border-color: #1e3050;
}

html.dark .agent-progress-wrap {
  background: #1e2f42;
}

html.dark .agent-call-info {
  background: #052e16;
}

html.dark .badge-idle {
  background: #1e2f42;
  color: #7a9ab8;
}

/* ── Kanban Board ───────────────────────────────────────────────── */
.kanban-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}

.kanban-tab {
  padding: 8px 20px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0;
  box-shadow: none;
  transition: color 150ms;
}

.kanban-tab:hover { color: var(--ink); background: transparent; transform: none; box-shadow: none; }
.kanban-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

@media (max-width: 1100px) { .kanban-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .kanban-board { grid-template-columns: 1fr; } }

.kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 200px;
}

.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  color: #fff;
}

.kanban-col-header--red    { background: #ef4444; }
.kanban-col-header--blue   { background: #3b82f6; }
.kanban-col-header--orange { background: #f97316; }
.kanban-col-header--green  { background: #22c55e; }

.kanban-col-title { font-weight: 700; font-size: 0.88rem; }

.kanban-col-count {
  background: rgba(255,255,255,0.25);
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 800;
}

.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
}

.kanban-empty {
  text-align: center;
  color: var(--faint);
  font-size: 0.78rem;
  padding: 20px 12px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: box-shadow 150ms, transform 150ms;
  box-shadow: var(--shadow-sm);
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.kanban-card--overdue {
  border-left: 3px solid #ef4444;
  background: #fff8f8;
}

html.dark .kanban-card--overdue { background: #2d1515; }

.kanban-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 5px;
}

.kanban-card-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.3;
}

.kanban-disp-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}

.kanban-card-phone {
  font-size: 0.8rem;
  margin-bottom: 5px;
}

.kanban-card-phone a { color: var(--accent); text-decoration: none; }
.kanban-card-phone a:hover { text-decoration: underline; }

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.kanban-agent {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.kanban-overdue-banner {
  font-size: 0.72rem;
  color: #b91c1c;
  font-weight: 600;
  margin-top: 4px;
}

.kanban-card-ago {
  font-size: 0.7rem;
  color: var(--faint);
  margin-top: 3px;
  text-align: right;
}

html.dark .kanban-card { background: #0f1c2e; border-color: #1e3050; }
html.dark .kanban-col  { background: #080f1a; border-color: #1e3050; }

/* ── Employee lead card overdue ─────────────────────────────────── */
.emp-lead-card--overdue {
  border-left: 3px solid #ef4444;
  background: #fff8f8;
}
html.dark .emp-lead-card--overdue { background: #2d1515; }

/* ── Nav icon buttons ───────────────────────────────────────────── */
.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  background: transparent;
  border: 1px solid transparent;
  transition: background 150ms, color 150ms, border-color 150ms;
}

.nav-icon-btn:hover {
  background: rgba(255,255,255,0.10);
  color: #fff;
  border-color: rgba(255,255,255,0.15);
  transform: none;
  box-shadow: none;
}

.nav-icon-btn svg {
  display: block;
  flex-shrink: 0;
}

.nav-logout-btn {
  color: #fca5a5 !important;
}

.nav-logout-btn:hover {
  background: rgba(239,68,68,0.15) !important;
  border-color: rgba(239,68,68,0.3) !important;
  color: #fca5a5 !important;
}

html.dark .nav-icon-btn:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.15); }
html.dark .nav-logout-btn:hover { background: rgba(239,68,68,0.15) !important; border-color: rgba(239,68,68,0.3) !important; }
