/* ─────────────────────────────────────────────────────────────
   Knowtis Admin Dashboard — Standalone Styles
   ───────────────────────────────────────────────────────────── */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FBFBFA;
  --surface: #FFFFFF;
  --surface-2: #F4F3EF;
  --border: #E9E9E6;
  --border-soft: #F0F0ED;
  --text-1: #171717;
  --text-2: #5F5F59;
  --text-3: #A3A29C;
  --primary: #FF5A36;
  --primary-hover: #e04b2b;
  --primary-dim: #FFF0EB;
  --primary-mid: #FFD8CD;
  --danger: #DC2626;
  --danger-dim: #FEE2E2;
  --success: #059669;
  --success-dim: #D1FAE5;
  --warning: #D97706;
  --warning-dim: #FEF3C7;
  --info: #4F46E5;
  --info-dim: #EEF2FF;
  --purple: #7C3AED;
  --purple-dim: #F3E8FF;
  --amber: #D97706;
  --amber-dim: #FFFBEB;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.08);
  --shadow-xl: 0 24px 48px rgba(0,0,0,0.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { font-family: var(--font); background: var(--bg); color: var(--text-1); line-height: 1.5; min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Login Overlay ── */
.login-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 100%; max-width: 420px; padding: 40px;
  background: var(--surface); border-radius: var(--radius-xl);
  border: 1px solid var(--border); box-shadow: var(--shadow-xl);
  text-align: center;
}
.login-card h1 { font-size: 24px; font-weight: 900; margin-bottom: 8px; }
.login-card p { font-size: 14px; color: var(--text-3); margin-bottom: 24px; }
.login-input {
  width: 100%; height: 48px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); font-size: 14px; font-weight: 500;
  outline: none; transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--primary); }
.login-input + .login-input { margin-top: 12px; }

.password-input-wrapper {
  position: relative;
  width: 100%;
  margin-top: 12px;
}
.password-input-wrapper .login-input {
  margin-top: 0;
  padding-right: 46px;
}
.toggle-password-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-3);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.toggle-password-btn:hover {
  color: var(--text-1);
  background: rgba(0,0,0,0.04);
}
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
}

.login-btn {
  width: 100%; height: 48px; margin-top: 20px;
  border-radius: var(--radius-sm); background: var(--text-1);
  color: white; font-size: 14px; font-weight: 800;
  transition: background 0.2s;
}
.login-btn:hover { background: #292929; }
.login-error {
  margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--danger-dim); color: var(--danger);
  font-size: 12px; font-weight: 600; display: none;
}

/* ── Layout ── */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.main { flex: 1; padding: 16px; max-width: 1280px; width: 100%; margin: 0 auto; }

@media (min-width: 768px) { .main { padding: 32px; } }

/* ── Header Banner ── */
.header-banner {
  position: relative; overflow: hidden;
  border-radius: var(--radius-xl);
  background: linear-gradient(to right, #171717, #2A2928, #171717);
  color: white; padding: 24px; box-shadow: var(--shadow-xl);
}
@media (min-width: 768px) { .header-banner { padding: 32px; } }
.header-banner .glow {
  position: absolute; right: -40px; top: -40px; opacity: 0.1;
  width: 256px; height: 256px; background: var(--primary);
  border-radius: 50%; filter: blur(40px); pointer-events: none;
}
.header-banner .inner { position: relative; z-index: 1; }
.header-banner .top-row {
  display: flex; flex-direction: column; gap: 16px;
  align-items: flex-start; justify-content: space-between;
}
@media (min-width: 768px) {
  .header-banner .top-row { flex-direction: row; align-items: center; }
}
.header-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px; border-radius: var(--radius-pill);
  background: rgba(255,90,54,0.2); border: 1px solid rgba(255,90,54,0.4);
  color: var(--primary); font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px;
}
.header-banner h1 { font-size: 24px; font-weight: 900; letter-spacing: -0.02em; }
@media (min-width: 768px) { .header-banner h1 { font-size: 30px; } }
.header-banner .subtitle { font-size: 13px; color: #d1d5db; margin-top: 4px; max-width: 560px; }

/* ── Refresh Button ── */
.btn-refresh {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 14px;
  background: var(--primary); color: white;
  font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-md); transition: background 0.2s;
  white-space: nowrap;
}
.btn-refresh:hover { background: var(--primary-hover); }
.btn-refresh:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-refresh svg.spinning { animation: spin 1s linear infinite; }

.btn-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.08); color: #f3f4f6;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 13px; font-weight: 700;
  transition: all 0.2s; white-space: nowrap;
  cursor: pointer;
}
.btn-logout:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Tab Navigation ── */
.tab-nav {
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; padding-top: 24px; margin-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.tab-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 14px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  color: #d1d5db; transition: all 0.2s;
}
@media (min-width: 768px) { .tab-btn { font-size: 13px; } }
.tab-btn:hover { color: white; background: rgba(255,255,255,0.1); }
.tab-btn.active { background: white; color: var(--text-1); box-shadow: var(--shadow-lg); }
.tab-btn.active svg { color: var(--primary); }

/* ── Content Area ── */
.tab-content { display: none; margin-top: 24px; }
.tab-content.active { display: block; }
.tab-content > .content-inner { animation: fadeIn 0.3s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-sm);
  padding: 24px;
}
.card-strong { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-md); }

/* ── KPI Grid ── */
.kpi-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }

.kpi-card {
  padding: 20px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.kpi-card .kpi-header { display: flex; align-items: center; justify-content: space-between; }
.kpi-card .kpi-label { font-size: 11px; font-weight: 800; color: var(--text-3); text-transform: uppercase; }
.kpi-card .kpi-icon {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.kpi-card .kpi-value { font-size: 30px; font-weight: 900; margin-top: 8px; }
.kpi-card .kpi-sub { font-size: 12px; font-weight: 500; color: var(--text-3); margin-top: 4px; }
.kpi-card .kpi-sub strong { font-weight: 800; }

/* ── Broadcast Banner ── */
.broadcast-banner {
  padding: 24px; border-radius: var(--radius-xl);
  background: linear-gradient(to right, #FF5A36, #FF7A5C, #FF5A36);
  color: white; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 16px;
  align-items: flex-start; justify-content: space-between;
}
@media (min-width: 768px) { .broadcast-banner { flex-direction: row; align-items: center; } }
.broadcast-banner .bc-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.2); font-size: 11px;
  font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.broadcast-banner h2 { font-size: 20px; font-weight: 900; }
.broadcast-banner .bc-desc { font-size: 13px; color: rgba(255,255,255,0.9); margin-top: 4px; max-width: 560px; }
.broadcast-banner .bc-btn {
  padding: 12px 20px; border-radius: 14px;
  background: white; color: var(--text-1); font-size: 13px; font-weight: 900;
  box-shadow: var(--shadow-md); transition: background 0.2s; white-space: nowrap;
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.broadcast-banner .bc-btn:hover { background: #f3f4f6; }

/* ── WhatsApp Connector Card ── */
.connector-card { padding: 24px; }
.connector-header {
  display: flex; flex-direction: column; gap: 12px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
@media (min-width: 640px) { .connector-header { flex-direction: row; align-items: center; justify-content: space-between; } }
.connector-title { display: flex; align-items: center; gap: 8px; }
.connector-title h2 { font-size: 18px; font-weight: 900; }
.connector-title .subtitle { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.status-badge {
  padding: 4px 12px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 800;
}
.status-connected { background: #d1fae5; color: #047857; }
.status-awaiting { background: #fef3c7; color: #92400e; }
.status-offline { background: #fee2e2; color: #b91c1c; }

.connector-msg {
  padding: 12px; border-radius: var(--radius-sm);
  background: #eff6ff; border: 1px solid #bfdbfe;
  color: #1e40af; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  margin-top: 16px;
}
.connector-body {
  display: flex; flex-direction: column; gap: 24px;
  padding-top: 8px; margin-top: 16px;
}
@media (min-width: 768px) { .connector-body { flex-direction: row; align-items: center; } }

.qr-container {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 16px; border-radius: var(--radius-lg); background: var(--surface-2);
  border: 1px solid var(--border); min-width: 260px; min-height: 260px;
}
.qr-container img { width: 224px; height: 224px; border-radius: var(--radius-sm); border: 1px solid white; background: white; padding: 8px; box-shadow: var(--shadow-md); }
.qr-placeholder { text-align: center; padding: 24px; color: var(--text-3); }
.qr-placeholder svg { width: 40px; height: 40px; margin: 0 auto 8px; opacity: 0.3; }
.qr-placeholder p { font-size: 11px; font-weight: 800; }

.connector-details { flex: 1; display: flex; flex-direction: column; gap: 16px; width: 100%; }
.detail-box { padding: 16px; border-radius: var(--radius-md); background: var(--surface-2); }
.detail-row { display: flex; justify-content: space-between; font-size: 12px; font-weight: 500; color: var(--text-2); padding: 4px 0; }
.detail-row strong { color: var(--text-1); font-weight: 800; }

.connector-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-qr {
  flex: 1; min-width: 150px; padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--primary); color: white; font-size: 12px; font-weight: 900;
  box-shadow: var(--shadow-md); transition: background 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-qr:hover { background: var(--primary-hover); }
.btn-qr:disabled { opacity: 0.5; }
.btn-reset {
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: #f59e0b; color: white; font-size: 12px; font-weight: 700;
  transition: background 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-reset:hover { background: #d97706; }
.btn-reset:disabled { opacity: 0.5; }
.btn-disconnect {
  padding: 10px 16px; border-radius: var(--radius-sm);
  background: #fee2e2; color: #b91c1c; font-size: 12px; font-weight: 700;
  transition: background 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-disconnect:hover { background: #fecaca; }
.btn-disconnect:disabled { opacity: 0.5; }

/* ── Two-Column Grid ── */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 1024px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ── Stat Mini Box ── */
.stat-box { padding: 16px; border-radius: var(--radius-md); background: var(--surface-2); }
.stat-box .stat-label { font-size: 11px; font-weight: 800; color: var(--text-3); text-transform: uppercase; }
.stat-box .stat-value { font-size: 24px; font-weight: 900; color: var(--text-1); margin-top: 4px; }

/* ── Progress Bar ── */
.progress-bar { width: 100%; background: #f3f4f6; border-radius: var(--radius-pill); height: 12px; display: flex; overflow: hidden; }
.progress-bar .seg-processed { background: #10b981; }
.progress-bar .seg-pending { background: #fbbf24; }
.progress-bar .seg-failed { background: #ef4444; }

.progress-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 8px; text-align: center; }
.progress-legend .legend-item { padding: 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 800; }

/* ── Section Title ── */
.section-title { font-size: 18px; font-weight: 900; display: flex; align-items: center; gap: 8px; }
.section-title svg { width: 20px; height: 20px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; text-align: left; font-size: 14px; border-collapse: collapse; }
thead { background: var(--surface-2); font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--border); }
thead th { padding: 16px; }
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:hover { background: #fafaf9; }
tbody td { padding: 16px; }

/* ── Filters Bar ── */
.filters-bar {
  padding: 16px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 12px;
  align-items: center; justify-content: space-between;
}
@media (min-width: 768px) { .filters-bar { flex-direction: row; } }
.search-wrap { position: relative; flex: 1; width: 100%; }
.search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.search-input {
  width: 100%; padding: 8px 16px 8px 40px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: none; font-size: 13px; font-weight: 500;
  outline: none; transition: box-shadow 0.2s;
}
.search-input:focus { box-shadow: 0 0 0 2px var(--primary); }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
@media (min-width: 768px) { .filter-group { width: auto; } }
.filter-select {
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: none; font-size: 12px; font-weight: 700;
  outline: none; cursor: pointer;
}

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 800;
}
.badge-admin { background: #f3e8ff; color: #7c3aed; border: 1px solid #e9d5ff; }
.badge-student { background: #f3f4f6; color: #4b5563; }
.badge-premium { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-free { background: #f3f4f6; color: #6b7280; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-suspended { background: #fee2e2; color: #991b1b; }
.badge-coverage-active { background: #d1fae5; color: #065f46; }
.badge-coverage-degraded { background: #fef3c7; color: #92400e; }
.badge-coverage-paused { background: #fee2e2; color: #991b1b; }

/* ── User Avatar ── */
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--text-1); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 900; flex-shrink: 0;
}
.user-info { display: flex; align-items: center; gap: 12px; }
.user-info .name { font-weight: 700; color: var(--text-1); }
.user-info .meta { font-size: 12px; color: var(--text-3); }

/* ── Action Buttons ── */
.action-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.action-btn svg { width: 16px; height: 16px; }
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-view { background: #f3f4f6; color: #4b5563; }
.btn-view:hover { background: #e5e7eb; }
.btn-suspend { background: #ef4444; color: white; }
.btn-suspend:hover { background: #dc2626; }
.btn-activate { background: #059669; color: white; }
.btn-activate:hover { background: #047857; }
.btn-role { background: #f3e8ff; color: #7c3aed; }
.btn-role:hover { background: #ede9fe; }
.btn-tier { background: #fffbeb; color: #92400e; }
.btn-tier:hover { background: #fef3c7; }
.actions-cell { text-align: right; display: flex; gap: 8px; justify-content: flex-end; }

/* ── State Override Buttons ── */
.state-btn {
  padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 700;
  transition: all 0.15s; background: var(--surface-2); color: var(--text-1);
}
.state-btn:hover { background: var(--primary); color: white; }
.state-btn:disabled { background: #e5e7eb; color: var(--text-3); cursor: default; }
.state-btn:disabled:hover { background: #e5e7eb; color: var(--text-3); }

/* ── AI Audit Entries ── */
.audit-entry {
  padding: 16px; display: flex; flex-direction: column; gap: 8px;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) { .audit-entry { flex-direction: row; justify-content: space-between; align-items: center; } }
.audit-entry .msg-text { font-size: 14px; font-weight: 600; color: var(--text-1); }
.audit-entry .msg-meta { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.audit-entry .msg-meta strong { color: var(--info); }

/* ── Health Cards ── */
.health-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .health-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .health-grid { grid-template-columns: repeat(3, 1fr); } }

.health-card {
  padding: 20px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.health-card .hc-header { display: flex; align-items: center; justify-content: space-between; }
.health-card .hc-label { font-size: 11px; font-weight: 800; color: var(--text-3); text-transform: uppercase; }
.health-card .hc-status { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.health-card .hc-detail { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ── Health Log Entries ── */
.health-log-entry {
  padding: 16px; display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; border-bottom: 1px solid var(--border);
}
.health-log-entry .hle-name { font-weight: 700; color: var(--text-1); }
.health-log-entry .hle-msg { font-size: 12px; color: var(--text-3); }

/* ── Broadcast Form ── */
.broadcast-form { max-width: 640px; margin: 0 auto; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-2); margin-bottom: 4px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 12px; border-radius: 14px;
  background: var(--surface-2); border: none; font-size: 14px; font-weight: 500;
  outline: none; transition: box-shadow 0.2s;
}
.form-input:focus, .form-textarea:focus { box-shadow: 0 0 0 2px var(--primary); }
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { font-weight: 700; cursor: pointer; }
.btn-send {
  width: 100%; height: 52px; border-radius: 14px;
  background: var(--primary); color: white;
  font-size: 14px; font-weight: 900;
  box-shadow: var(--shadow-lg); transition: background 0.2s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-send:hover { background: var(--primary-hover); }
.btn-send:disabled { opacity: 0.5; }
.broadcast-success {
  padding: 16px; border-radius: var(--radius-md);
  background: var(--success-dim); border: 1px solid #a7f3d0;
  color: #065f46; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}

/* ── Template Cards Grid ── */
.template-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .template-grid { grid-template-columns: repeat(2, 1fr); } }
.template-card {
  padding: 16px; border-radius: var(--radius-md);
  background: var(--surface-2); border: 1px solid var(--border);
}
.template-card .tc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.template-card .tc-name { font-size: 14px; font-weight: 900; }
.template-card .tc-detail { font-size: 12px; color: var(--text-3); }
.template-card .tc-detail strong { color: var(--text-2); }
.template-card .tc-detail .tc-vars { color: var(--info); }

/* ── Rate Limit Grid ── */
.rl-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .rl-grid { grid-template-columns: repeat(4, 1fr); } }
.rl-card {
  padding: 20px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.rl-card .rl-header { display: flex; align-items: center; justify-content: space-between; }
.rl-card .rl-label { font-size: 11px; font-weight: 800; color: var(--text-3); text-transform: uppercase; }
.rl-card .rl-value { font-size: 30px; font-weight: 900; margin-top: 8px; }

.endpoint-list { display: flex; flex-direction: column; gap: 12px; }
.endpoint-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2);
}
.endpoint-item .ep-name { font-size: 12px; font-weight: 700; color: var(--text-1); max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.endpoint-item .ep-blocked { font-size: 12px; color: var(--text-3); }
.endpoint-item .ep-blocked strong { color: #ef4444; font-weight: 700; }
.endpoint-item .ep-count { font-size: 14px; font-weight: 900; }

.blocked-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.blocked-card { padding: 16px; border-radius: var(--radius-md); }
.blocked-card .bc-label { font-size: 11px; font-weight: 800; text-transform: uppercase; display: block; margin-bottom: 4px; }
.blocked-card .bc-value { font-size: 24px; font-weight: 900; }
.blocked-card .bc-sub { font-size: 12px; display: block; }

/* ── Error Banner ── */
.error-banner {
  padding: 16px; border-radius: var(--radius-md);
  background: var(--primary-dim); border: 1px solid var(--primary-mid);
  color: #C83C21; display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 600; margin-top: 24px;
}

/* ── Loading State ── */
.loading-overlay {
  display: flex; align-items: center; justify-content: center;
  padding: 80px 0; color: var(--text-3);
  font-size: 14px; font-weight: 600;
}
.loading-spinner {
  width: 24px; height: 24px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin-right: 12px;
}

/* ── User Detail Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-card {
  background: white; border-radius: 28px; padding: 24px;
  max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-xl); position: relative; animation: fadeIn 0.2s ease-out;
}
.modal-close {
  position: absolute; right: 16px; top: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: #f3f4f6; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: #e5e7eb; }
.modal-title { font-size: 20px; font-weight: 900; margin-bottom: 16px; }
.modal-user-info {
  padding: 16px; border-radius: var(--radius-md); background: var(--surface-2);
  margin-bottom: 16px;
}
.modal-user-info .mu-name { font-weight: 700; color: var(--text-1); }
.modal-user-info .mu-meta { font-size: 12px; color: var(--text-3); }
.modal-user-info .mu-badges { display: flex; gap: 8px; margin-top: 4px; }

.modal-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.modal-stat { padding: 12px; border-radius: var(--radius-sm); background: #fafaf9; font-size: 12px; font-weight: 700; }

.modal-groups { margin-top: 16px; }
.modal-groups h4 { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--text-3); margin-bottom: 8px; }
.modal-group-item {
  padding: 10px; border-radius: var(--radius-sm); background: #fafaf9;
  font-size: 12px; font-weight: 600;
  display: flex; justify-content: space-between; margin-bottom: 4px;
}
.modal-group-item .mg-state { color: var(--success); font-weight: 700; }

/* ── Onboarding Survey Insights ── */
.survey-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .survey-grid { grid-template-columns: repeat(3, 1fr); } }
.survey-card {
  padding: 16px; border-radius: var(--radius-md); background: #fafaf9;
  display: flex; align-items: center; justify-content: space-between;
}
.survey-card .sc-label { font-size: 12px; font-weight: 700; color: var(--text-2); }
.survey-card .sc-value { font-size: 18px; font-weight: 900; }

/* ── Empty State ── */
.empty-state { padding: 32px; text-align: center; color: var(--text-3); font-size: 14px; font-weight: 500; }

/* ── Spacing Utilities ── */
.space-y-4 > * + * { margin-top: 16px; }
.space-y-6 > * + * { margin-top: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

/* ── SVG Icon Sizing ── */
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
