/* ─── DARK THEME (default) ────────────────────────────────────────────────────*/
:root,
[data-theme="dark"] {
  --bg-base:    #060d1a;
  --bg-surface: #0d1b2e;
  --bg-card:    #111f35;
  --bg-elevated:#162540;
  --border:     #1e3a5f;
  --border-soft:#162540;
  --text-primary:#e2e8f0;
  --text-muted:  #64748b;
  --text-dim:    #475569;
  --accent:      #4361ee;
  --accent2:     #f72585;
  --success:     #06d6a0;
  --warning:     #ffd166;
  --danger:      #ef476f;
  --sidebar-bg:  #0d1b2e;
  --topbar-bg:   #0d1b2e;
  --scrollbar:   #1e3a5f;
  --input-bg:    #162540;
  --table-hover: #162540;
  --pill-bg:     rgba(67,97,238,.14);
  --pill-color:  #7c9ef5;
  --pill-border: rgba(67,97,238,.28);
  --badge-top-bg:   rgba(6,214,160,.14);
  --badge-top-color:#06d6a0;
  --badge-top-bdr:  rgba(6,214,160,.3);
  --source-live-bg:   rgba(6,214,160,.1);
  --source-live-color:#06d6a0;
  --source-live-bdr:  rgba(6,214,160,.3);
  --source-local-bg:  rgba(67,97,238,.1);
  --source-local-color:#7c9ef5;
  --source-local-bdr: rgba(67,97,238,.3);
}

/* ─── LIGHT THEME ─────────────────────────────────────────────────────────────*/
[data-theme="light"] {
  --bg-base:    #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card:    #ffffff;
  --bg-elevated:#f8fafc;
  --border:     #e2e8f0;
  --border-soft:#f1f5f9;
  --text-primary:#0f172a;
  --text-muted:  #64748b;
  --text-dim:    #94a3b8;
  --accent:      #4361ee;
  --accent2:     #f72585;
  --success:     #059669;
  --warning:     #d97706;
  --danger:      #dc2626;
  --sidebar-bg:  #ffffff;
  --topbar-bg:   #ffffff;
  --scrollbar:   #cbd5e1;
  --input-bg:    #f8fafc;
  --table-hover: #f8fafc;
  --pill-bg:     rgba(67,97,238,.08);
  --pill-color:  #4361ee;
  --pill-border: rgba(67,97,238,.2);
  --badge-top-bg:   rgba(5,150,105,.08);
  --badge-top-color:#059669;
  --badge-top-bdr:  rgba(5,150,105,.2);
  --source-live-bg:   rgba(5,150,105,.08);
  --source-live-color:#059669;
  --source-live-bdr:  rgba(5,150,105,.25);
  --source-local-bg:  rgba(67,97,238,.06);
  --source-local-color:#4361ee;
  --source-local-bdr: rgba(67,97,238,.2);
}

/* ─── RESET / BASE ────────────────────────────────────────────────────────────*/
*, *::before, *::after { box-sizing: border-box; }

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .2s, color .2s;
}

/* Theme-aware utility classes (used in JS-generated HTML) */
.t-primary { color: var(--text-primary) !important; }
.t-muted   { color: var(--text-muted)   !important; }
.fw-600    { font-weight: 600; }
.mono      { font-family: 'SF Mono', 'Fira Code', monospace; }
.phone-ok  { color: var(--success) !important; }
.phone-bad { color: var(--danger)  !important; }

/* ─── SCROLLBAR ───────────────────────────────────────────────────────────────*/
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 4px; }

/* ─── LOADING / ERROR OVERLAYS ───────────────────────────────────────────────*/
.full-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px;
  background: var(--bg-base);
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.overlay-msg {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  max-width: 380px;
  white-space: pre-wrap;
  line-height: 1.6;
}

.overlay-icon { font-size: 36px; }

/* ─── SIDEBAR ─────────────────────────────────────────────────────────────────*/
.sidebar {
  width: 220px; min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  position: fixed; top: 0; left: 0;
  display: flex; flex-direction: column;
  z-index: 100;
  transition: background .2s, border-color .2s;
}

.sidebar-logo {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: #fff;
  flex-shrink: 0;
}

.logo-text { font-size: 12px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.logo-sub  { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }

.sidebar-nav { padding: 10px 0; flex: 1; overflow-y: auto; }

.nav-section-label {
  padding: 8px 16px 3px;
  font-size: 10px;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-dim); font-weight: 600;
}

.nav-link-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px; font-weight: 500;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all .12s;
  user-select: none;
}
.nav-link-item:hover  { color: var(--text-primary); background: var(--bg-elevated); }
.nav-link-item.active { color: var(--accent); background: rgba(67,97,238,.07); border-left-color: var(--accent); }
.nav-icon { width: 16px; text-align: center; font-size: 14px; }

/* ─── LAYOUT ──────────────────────────────────────────────────────────────────*/
.main-wrap {
  margin-left: 220px;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ─── TOPBAR ──────────────────────────────────────────────────────────────────*/
.topbar {
  height: 54px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 50;
  transition: background .2s, border-color .2s;
}

.topbar-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }

.topbar-badge {
  font-size: 10px; font-weight: 600;
  background: rgba(67,97,238,.1);
  color: var(--accent);
  padding: 2px 8px; border-radius: 20px;
  border: 1px solid rgba(67,97,238,.25);
}

.source-badge {
  font-size: 11px; font-weight: 600;
  padding: 2px 9px; border-radius: 20px;
  border: 1px solid;
}
.source-live  { background: var(--source-live-bg);  color: var(--source-live-color);  border-color: var(--source-live-bdr); }
.source-local { background: var(--source-local-bg); color: var(--source-local-color); border-color: var(--source-local-bdr); }
.source-error { background: rgba(239,71,111,.1); color: #ef476f; border-color: rgba(239,71,111,.3); }

.live-dot {
  width: 7px; height: 7px;
  background: var(--success); border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(6,214,160,.15);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(6,214,160,.15); }
  50%      { box-shadow: 0 0 0 6px rgba(6,214,160,.05); }
}

/* Theme toggle button */
.btn-theme {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  white-space: nowrap;
}
.btn-theme:hover { color: var(--text-primary); border-color: var(--accent); }

/* ─── PAGE CONTENT ────────────────────────────────────────────────────────────*/
.page-content  { padding: 22px; flex: 1; }
.page-section  { display: none; }
.page-section.active { display: block; }

/* ─── SECTION HEADER ─────────────────────────────────────────────────────────*/
.section-header { margin-bottom: 18px; }
.section-header h5 {
  font-size: 13px; font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase; letter-spacing: .07em;
  margin: 0 0 2px;
}
.section-header p { font-size: 12px; color: var(--text-muted); margin: 0; }

/* ─── CARDS ───────────────────────────────────────────────────────────────────*/
.card {
  background: var(--bg-card);
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  padding: 18px 20px;
  transition: background .2s, border-color .2s;
}

.card-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); margin-bottom: 5px; font-weight: 600;
}
.card-value { font-size: 27px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.card-sub   { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.card-icon  { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }

/* ─── KPI GRID ────────────────────────────────────────────────────────────────*/
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 12px; margin-bottom: 22px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color .15s, background .2s;
}
.kpi-card:hover { border-color: rgba(67,97,238,.4); }
.kpi-info { flex: 1; min-width: 0; }
.kpi-info .card-value { font-size: 22px; }

/* ─── CHART CARDS ─────────────────────────────────────────────────────────────*/
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px;
  transition: background .2s, border-color .2s;
}

.chart-card-header { margin-bottom: 12px; }
.chart-card-title  { font-size: 13px; font-weight: 700; color: var(--text-primary); margin: 0; }
.chart-card-sub    { font-size: 11px; color: var(--text-muted); margin: 2px 0 0; }
.chart-wrap        { position: relative; }

/* ─── TABLES ──────────────────────────────────────────────────────────────────*/
.data-table {
  width: 100%;
  border-collapse: separate; border-spacing: 0;
}

.data-table thead th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  white-space: nowrap;
}
.data-table thead th:first-child { border-radius: 6px 0 0 0; }
.data-table thead th:last-child  { border-radius: 0 6px 0 0; }

.data-table tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background .1s;
}
.data-table tbody tr:hover { background: var(--table-hover); }

.data-table tbody td {
  padding: 9px 12px; vertical-align: middle;
  color: var(--text-primary); font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
}

/* ─── MINI BAR ────────────────────────────────────────────────────────────────*/
.mini-bar-wrap {
  height: 5px; background: var(--bg-elevated);
  border-radius: 10px; overflow: hidden; min-width: 60px;
}
.mini-bar { height: 100%; border-radius: 10px; transition: width .4s ease; }

/* ─── PILLS / BADGES ─────────────────────────────────────────────────────────*/
.count-pill {
  background: var(--pill-bg); color: var(--pill-color);
  font-size: 12px; font-weight: 700;
  padding: 2px 10px; border-radius: 20px;
  border: 1px solid var(--pill-border);
  white-space: nowrap;
}

.badge-top {
  font-size: 9px; font-weight: 700;
  background: var(--badge-top-bg);
  color: var(--badge-top-color);
  padding: 1px 6px; border-radius: 10px;
  border: 1px solid var(--badge-top-bdr);
  vertical-align: middle; margin-left: 4px;
}

.course-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 8px; vertical-align: middle;
}

.district-tag {
  font-size: 11px;
  background: var(--bg-elevated); color: var(--text-muted);
  padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--border); white-space: nowrap;
}

/* ─── COURSE CHIPS ────────────────────────────────────────────────────────────*/
.course-chips  { display: flex; flex-wrap: wrap; gap: 3px; }
.course-chip   {
  font-size: 10px; padding: 1px 6px;
  border-radius: 4px; border: 1px solid;
  white-space: nowrap; opacity: .9;
  background: transparent;
}

/* ─── FILTER BAR ─────────────────────────────────────────────────────────────*/
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  margin-bottom: 14px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  transition: background .2s;
}

.filter-bar .form-control,
.filter-bar .form-select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px; border-radius: 6px;
  padding: 6px 10px;
  transition: background .2s, color .2s, border-color .15s;
}
.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
  background: var(--input-bg);
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: 0 0 0 2px rgba(67,97,238,.18);
  outline: none;
}
.filter-bar .form-select option { background: var(--bg-elevated); color: var(--text-primary); }

.btn-reset {
  padding: 6px 12px; border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all .12s; white-space: nowrap;
}
.btn-reset:hover { color: var(--danger); border-color: var(--danger); }

/* ─── REGISTRANTS WRAPPER ─────────────────────────────────────────────────────*/
.registrants-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden;
  transition: background .2s;
}

/* ─── PAGINATION ─────────────────────────────────────────────────────────────*/
.pagination .page-link {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 12px; padding: 5px 11px;
  transition: all .12s;
}
.pagination .page-item.active .page-link {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.pagination .page-item.disabled .page-link { opacity: .4; }
.pagination .page-link:hover { background: var(--bg-surface); color: var(--text-primary); }

/* ─── DATA QUALITY ────────────────────────────────────────────────────────────*/
.dq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.dq-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; text-align: center;
}
.dq-value { font-size: 26px; font-weight: 800; }
.dq-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.dq-warn  { color: var(--warning); }
.dq-danger{ color: var(--danger);  }
.dq-good  { color: var(--success); }

.completeness-bar-wrap {
  height: 6px; background: var(--bg-elevated);
  border-radius: 10px; overflow: hidden; margin-top: 6px;
}
#dq-completeness-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--success), #4cc9f0);
  border-radius: 10px; transition: width .6s ease;
}

/* ─── RECENT LIST ─────────────────────────────────────────────────────────────*/
.recent-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}
.recent-item:last-child { border-bottom: none; }

.recent-avatar {
  width: 32px; height: 32px; border-radius: 7px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: #fff;
  flex-shrink: 0;
}

/* ─── CROSSTAB TABLE ─────────────────────────────────────────────────────────*/
.crosstab-table { font-size: 11px; color: var(--text-primary); }
.crosstab-table th {
  color: var(--text-muted) !important; font-size: 10px;
  white-space: nowrap; background: var(--bg-elevated) !important;
  border-color: var(--border) !important;
  padding: 8px !important;
}
.crosstab-table td {
  border-color: var(--border-soft) !important;
  padding: 5px 8px !important;
  transition: background .1s;
}

/* ─── COURSE FIX CARDS ───────────────────────────────────────────────────────*/
.fix-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 12px;
}
.fix-card-bad  { background: rgba(239,71,111,.05); border-color: rgba(239,71,111,.2); }
.fix-card-good { background: rgba(6,214,160,.05);  border-color: rgba(6,214,160,.2); }
.fix-card-note { background: rgba(255,209,102,.05); border-color: rgba(255,209,102,.2); }

/* ─── COURSE PLAN ────────────────────────────────────────────────────────────*/
.cp-kpi-strip {
  display: flex; align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 24px;
  gap: 0;
  transition: background .2s, border-color .2s;
}
.cp-kpi-item  { flex: 1; text-align: center; }
.cp-kpi-val   { font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1; }
.cp-kpi-lbl   { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: 4px; font-weight: 600; }
.cp-kpi-sep   { width: 1px; min-height: 40px; background: var(--border); margin: 0 8px; }

.cp-courses-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

.cp-course-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 160px 110px;
  align-items: center; gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-soft);
}
.cp-course-row:last-child { border-bottom: none; }

.cp-course-info {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; min-width: 0;
}
.cp-course-name { font-size: 13px; }

.cp-type-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 10px;
  border: 1px solid; white-space: nowrap; flex-shrink: 0;
}
.cp-type-bootcamp {
  background: rgba(247,37,133,.1); color: var(--accent2);
  border-color: rgba(247,37,133,.3);
}
.cp-type-course {
  background: rgba(67,97,238,.1); color: var(--accent);
  border-color: rgba(67,97,238,.3);
}

.cp-batch-badge {
  font-size: 10px; font-weight: 700;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-muted); padding: 2px 8px; border-radius: 10px;
  white-space: nowrap; flex-shrink: 0;
}
.cp-batch-multi {
  background: rgba(6,214,160,.1); border-color: rgba(6,214,160,.3);
  color: var(--success);
}

.cp-bar-wrap {
  height: 6px; background: var(--bg-elevated);
  border-radius: 10px; overflow: hidden;
}
.cp-bar {
  height: 100%; border-radius: 10px;
  transition: width .5s ease;
}

.cp-enroll-col {
  display: flex; align-items: center; gap: 6px;
  justify-content: flex-end;
}

/* Course fix merge label */
.fix-merge-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-dim); margin-bottom: 8px; margin-top: 4px;
}

@media (max-width: 640px) {
  .cp-course-row { grid-template-columns: 1fr; gap: 6px; }
  .cp-bar-wrap, .cp-enroll-col { display: none; }
  .cp-kpi-strip { flex-wrap: wrap; gap: 12px; padding: 14px; }
  .cp-kpi-sep   { display: none; }
  .cp-kpi-item  { min-width: 80px; }
}

/* ─── SETTINGS PAGE ──────────────────────────────────────────────────────────*/
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 6px;
}

.settings-field { display: flex; flex-direction: column; gap: 5px; }

.settings-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .055em;
  color: var(--text-muted);
}

.settings-hint { font-size: 11px; color: var(--text-dim); line-height: 1.4; }

.settings-input {
  background: var(--input-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  font-size: 13px; border-radius: 7px;
  padding: 8px 12px;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.settings-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(67,97,238,.13) !important;
  outline: none !important;
}
.settings-input option { background: var(--bg-elevated); color: var(--text-primary); }

.settings-divider {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin: 22px 0 16px;
}

.settings-info-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}
.settings-info-box strong { color: var(--text-primary); }

.input-pw-wrap { position: relative; }
.input-pw-wrap .settings-input { padding-right: 42px; }
.btn-toggle-pw {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  font-size: 14px; color: var(--text-muted); padding: 4px;
  line-height: 1;
}
.btn-toggle-pw:hover { color: var(--text-primary); }

.btn-save-settings {
  padding: 8px 20px; border-radius: 7px;
  background: var(--accent); border: none; color: #fff;
  font-size: 12px; font-weight: 700; cursor: pointer;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.btn-save-settings:hover  { opacity: .88; transform: translateY(-1px); }
.btn-save-settings:active { transform: translateY(0); }

.btn-outline-sm {
  padding: 7px 14px; border-radius: 7px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.btn-outline-sm:hover { border-color: var(--accent); color: var(--accent); }

.danger-zone { border-color: rgba(239,71,111,.3) !important; background: rgba(239,71,111,.03) !important; }

.btn-danger-sm {
  padding: 7px 16px; border-radius: 7px;
  background: rgba(239,71,111,.1); border: 1px solid rgba(239,71,111,.3);
  color: var(--danger); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.btn-danger-sm:hover { background: rgba(239,71,111,.18); }

/* ─── EMAIL PAGE ─────────────────────────────────────────────────────────────*/
.setup-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: rgba(255,209,102,.07);
  border: 1px solid rgba(255,209,102,.3);
  border-radius: 9px; padding: 13px 16px;
  font-size: 13px; color: var(--text-muted); line-height: 1.5;
}
.setup-banner-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.setup-banner strong { color: var(--warning); }

.nav-link-item-inline {
  color: var(--accent); font-weight: 600; cursor: pointer;
  text-decoration: underline; background: none; border: none; padding: 0; font-size: inherit;
}
.nav-link-item-inline:hover { opacity: .8; }

.rcpt-count-badge {
  font-weight: 800; color: var(--accent); font-size: 14px;
}

.recipients-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 172px; overflow-y: auto;
  padding: 2px 0 4px;
}

.rcpt-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 10px; border-radius: 22px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  transition: border-color .12s;
}
.rcpt-chip:hover { border-color: rgba(67,97,238,.35); }
.rcpt-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: #fff;
}
.rcpt-name  { font-size: 12px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.rcpt-email { font-size: 10px; color: var(--text-muted); }

.rcpt-more {
  padding: 5px 12px; border-radius: 22px;
  background: var(--bg-elevated); border: 1px dashed var(--border);
  font-size: 11px; color: var(--text-muted);
  display: flex; align-items: center;
}

.compose-form  { display: flex; flex-direction: column; gap: 14px; }
.compose-row   { display: flex; flex-direction: column; gap: 5px; }
.compose-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .055em;
  color: var(--text-muted);
}

.compose-form .form-control,
.compose-form .settings-input {
  background: var(--input-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-primary) !important;
  font-size: 13px; border-radius: 7px;
}
.compose-form .form-control:focus,
.compose-form .settings-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(67,97,238,.13) !important;
  outline: none !important;
}

.compose-textarea {
  min-height: 188px; resize: vertical;
  font-family: inherit; line-height: 1.65;
  padding: 10px 12px;
}

.ph {
  font-family: 'SF Mono','Fira Code',monospace; font-size: 10px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--accent); padding: 1px 6px; border-radius: 4px;
  margin-right: 3px; white-space: nowrap;
}

.btn-send {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 22px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border: none; color: #fff;
  font-size: 13px; font-weight: 700; cursor: pointer;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.btn-send:hover   { opacity: .88; transform: translateY(-1px); }
.btn-send:active  { transform: translateY(0); }
.btn-send:disabled{ opacity: .5; cursor: not-allowed; transform: none; }

.send-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.email-log-entry {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border-soft);
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
}
.email-log-entry:last-child { border-bottom: none; }
.log-ok   { color: var(--success); font-weight: 700; flex-shrink: 0; }
.log-fail { color: var(--danger);  font-weight: 700; flex-shrink: 0; }

/* ─── TOAST ──────────────────────────────────────────────────────────────────*/
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 99999; pointer-events: none;
}
.toast-item {
  padding: 10px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: 1px solid; pointer-events: auto;
  animation: toastIn .2s ease;
  max-width: 340px; line-height: 1.4;
}
.toast-success { background:rgba(6,214,160,.12);  color:var(--success); border-color:rgba(6,214,160,.3); }
.toast-error   { background:rgba(239,71,111,.12); color:var(--danger);  border-color:rgba(239,71,111,.3); }
.toast-info    { background:rgba(67,97,238,.12);  color:var(--accent);  border-color:rgba(67,97,238,.3); }

@keyframes toastIn {
  from { opacity:0; transform:translateX(16px); }
  to   { opacity:1; transform:translateX(0); }
}

/* ─── INTERVIEW STATS ────────────────────────────────────────────────────────*/
.iv-slots { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }

.iv-slot-row {
  display: grid;
  grid-template-columns: 76px minmax(0,1fr) 130px 100px;
  align-items: center; gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
}
.iv-slot-row:last-child { border-bottom: none; }

.iv-slot-time {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-align: right; white-space: nowrap;
}

.iv-slot-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 6px;
  font-size: 12px; line-height: 1.3;
  max-width: 100%; overflow: hidden;
}

.iv-slot-meta { font-size: 10px; opacity: 0.72; white-space: nowrap; }

.iv-slot-bar-wrap {
  height: 7px; background: var(--bg-elevated);
  border-radius: 10px; overflow: hidden; position: relative;
}
.iv-slot-bar {
  height: 100%; border-radius: 10px; transition: width .4s ease;
}
.iv-slot-bar-stripe {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    -45deg, transparent, transparent 3px,
    rgba(239,71,111,.5) 3px, rgba(239,71,111,.5) 6px
  );
  border-radius: 10px;
}

.iv-slot-count {
  font-size: 13px; color: var(--text-primary);
  display: flex; align-items: center; gap: 3px;
  justify-content: flex-end; white-space: nowrap;
}
.iv-cap { font-size: 11px; color: var(--text-dim); font-weight: 500; }

.iv-over { color: var(--danger) !important; }

.iv-over-badge {
  font-size: 9px; font-weight: 700;
  background: rgba(239,71,111,.14);
  color: var(--danger);
  padding: 1px 5px; border-radius: 8px;
  border: 1px solid rgba(239,71,111,.3);
  white-space: nowrap;
}

.count-pill-danger {
  background: rgba(239,71,111,.12) !important;
  color: var(--danger) !important;
  border-color: rgba(239,71,111,.3) !important;
}

/* ── Seat fill summary grid ──────────────────────────────────────────────── */
.iv-fill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  padding: 4px 0 6px;
}

.iv-fill-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  transition: border-color .2s;
}

.iv-fill-card.iv-fill-urgent {
  border-color: rgba(239,71,111,.35);
  background: rgba(239,71,111,.04);
}

.iv-fill-card.iv-fill-full {
  border-color: rgba(6,214,160,.3);
  background: rgba(6,214,160,.04);
  opacity: .75;
}

.iv-fill-header {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}

.iv-fill-week {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(67,97,238,.1);
  border-radius: 4px;
  padding: 1px 5px;
}

.iv-fill-slot {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.iv-fill-course {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
}

.iv-fill-dates { font-size: 10px; }

.iv-fill-bar-wrap {
  height: 5px;
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  margin: 5px 0;
}

.iv-fill-bar { height: 100%; border-radius: 8px; transition: width .4s ease; }

.iv-fill-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.iv-fill-gender { font-size: 10px; }

.iv-fill-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(67,97,238,.12);
  color: var(--accent);
}

.iv-fill-tag-urgent {
  background: rgba(239,71,111,.14);
  color: var(--danger);
}

.iv-fill-tag-full {
  background: rgba(6,214,160,.14);
  color: #06d6a0;
}

.iv-slot-gender {
  font-size: 10px;
  margin-left: 4px;
}

/* ── Interview week filter tabs ───────────────────────────────────────────── */
.iv-week-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 8px;
}

.iv-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}

.iv-filter-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.iv-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.iv-filter-count {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,255,255,.25);
  border-radius: 10px;
  padding: 1px 5px;
}

.iv-filter-btn:not(.active) .iv-filter-count {
  background: var(--bg-card);
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .iv-slot-row { grid-template-columns: 60px 1fr 80px; }
  .iv-slot-bar-wrap { display: none; }
}

/* ─── MERIT LIST ─────────────────────────────────────────────────────────────*/
.ml-batch-card .chart-card-header { padding: 14px 18px 10px; }
.ml-fill-bar-wrap {
  height: 5px;
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  margin: 6px 0 0;
}
.ml-fill-bar { height: 100%; border-radius: 8px; transition: width .4s ease; }

@media print {
  .sidebar, .topbar, #ml-print-btn { display: none !important; }
  .main-wrap { margin-left: 0 !important; }
  .page-section { display: block !important; }
  .page-section:not(#section-merit) { display: none !important; }
  .chart-card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────────*/
@media (max-width: 768px) {
  .sidebar { width: 56px; }
  .logo-text, .logo-sub, .nav-link-item span:not(.nav-icon), .nav-section-label { display: none; }
  .main-wrap { margin-left: 56px; }
  .kpi-grid  { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 12px; }
  .topbar-title { font-size: 12px; }
  .settings-grid { grid-template-columns: 1fr; }
}
