/* ===================================================================
   Federal Executive Bodies Survey — Modern Government Design System
   =================================================================== */

/* ---------- Design Tokens (Light) ---------- */
:root {
  /* Brand */
  --brand-primary: #0b6e4f;
  --brand-primary-dark: #054d36;
  --brand-primary-light: #e8f3ee;
  --brand-accent: #d4a017;
  --brand-accent-dark: #a07a10;
  --brand-accent-light: #fdf6e3;

  /* Surfaces */
  --bg: #f5f7f8;
  --bg-elevated: #ffffff;
  --bg-subtle: #f9fafb;
  --bg-hover: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #fafbfc;

  /* Text */
  --text-1: #0f1a23;
  --text-2: #475569;
  --text-3: #94a3b8;
  --text-inverse: #ffffff;

  /* Borders */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Status */
  --success: #15803d;
  --success-bg: #dcfce7;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --info: #1d4ed8;
  --info-bg: #dbeafe;

  /* Scale palette (1-5) */
  --s1: #dc2626;
  --s2: #f59e0b;
  --s3: #eab308;
  --s4: #84cc16;
  --s5: #16a34a;

  /* Effects */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.10), 0 4px 8px rgba(15, 23, 42, 0.06);

  /* Radius */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-full: 999px;

  /* Spacing */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* Typography */
  --font-am: 'Noto Sans Ethiopic', system-ui, sans-serif;
  --font-en: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  /* Transitions */
  --t-fast: 120ms ease;
  --t-base: 200ms ease;
}

/* ---------- Dark Mode ---------- */
[data-theme="dark"] {
  --brand-primary: #34d399;
  --brand-primary-dark: #6ee7b7;
  --brand-primary-light: #064e3b;
  --brand-accent: #fbbf24;
  --brand-accent-dark: #fcd34d;
  --brand-accent-light: #451a03;

  --bg: #0a0f14;
  --bg-elevated: #131a22;
  --bg-subtle: #1a2330;
  --bg-hover: #1f2937;
  --surface: #131a22;
  --surface-2: #1a2330;

  --text-1: #f1f5f9;
  --text-2: #cbd5e1;
  --text-3: #64748b;
  --text-inverse: #0f1a23;

  --border: #2d3748;
  --border-strong: #4a5568;

  --success: #4ade80;
  --success-bg: #052e1a;
  --warning: #fbbf24;
  --warning-bg: #451a03;
  --danger: #fca5a5;
  --danger-bg: #4a0e0e;
  --info: #93c5fd;
  --info-bg: #1e293b;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.6);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-am), var(--font-en);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--t-base), color var(--t-base);
}

a { color: var(--brand-primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--brand-primary-dark); }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------- Navbar ---------- */
.navbar {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
  color: var(--text-inverse);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  text-decoration: none;
  min-width: 0;
  flex-shrink: 0;
}
.brand:hover { color: #fff; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--r-md);
  font-size: 1.3rem;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { font-size: 0.96rem; font-weight: 700; }
.brand small { font-size: 0.72rem; font-weight: 400; opacity: 0.82; margin-top: 2px; }

.nav-menu {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}
.nav-links a {
  color: rgba(255, 255, 255, 0.92);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.nav-links a:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.nav-links a.active { background: rgba(255, 255, 255, 0.22); color: #fff; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- Hamburger ---------- */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  padding: 10px 9px;
  transition: background var(--t-fast);
}
.nav-toggle:hover { background: rgba(255, 255, 255, 0.24); }
.nav-toggle .bar {
  display: block;
  width: 100%;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform var(--t-base), opacity var(--t-base);
  transform-origin: center;
}
.nav-toggle.open .bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open .bar:nth-child(2) { opacity: 0; }
.nav-toggle.open .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

body.no-scroll { overflow: hidden; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.18);
  padding: 5px 12px;
  border-radius: var(--r-full);
  font-size: 0.84rem;
  color: #fff;
}

.role-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.role-admin { background: #fef3c7; color: #92400e; }
.role-editor { background: #dbeafe; color: #1e40af; }
.role-viewer { background: #dcfce7; color: #14532d; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-size: 1.05rem;
  transition: background var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.26); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }

/* ---------- Layout ---------- */
.container {
  max-width: 1320px;
  margin: 28px auto;
  padding: 0 24px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 1.7rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text-1);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-subtitle {
  color: var(--text-2);
  font-size: 0.95rem;
  max-width: 760px;
}
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 22px;
  margin-bottom: 22px;
  transition: box-shadow var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); }
.card h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
}
.card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.hero-card {
  background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-dark) 100%);
  color: #fff;
  border: none;
  padding: 38px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(212, 160, 23, 0.18) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-card h1 { color: #fff; font-size: 1.85rem; margin-bottom: 10px; font-weight: 700; letter-spacing: -0.02em; }
.hero-card p { opacity: 0.92; max-width: 720px; margin-bottom: 22px; font-size: 1rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; position: relative; z-index: 1; }

/* ---------- Stat grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  position: relative;
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--brand-primary);
  border-radius: var(--r-lg) 0 0 var(--r-lg);
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  color: var(--text-2);
  font-size: 0.85rem;
  margin-top: 6px;
  font-weight: 500;
}

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-1);
  font-size: 0.9rem;
}
.form-group .help {
  font-size: 0.82rem;
  color: var(--text-2);
  margin-top: 4px;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text-1);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.form-control:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-primary-light);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--r-md);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  text-decoration: none;
  letter-spacing: -0.005em;
  white-space: nowrap;
}
.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
  background: var(--brand-primary-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text-1);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-1); }
.btn-accent {
  background: var(--brand-accent);
  color: #1f2937;
}
.btn-accent:hover { background: var(--brand-accent-dark); color: #1f2937; transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text-1);
}
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #991b1b; color: #fff; }
.btn-warning { background: var(--brand-accent); color: #1f2937; }
.btn-warning:hover { background: var(--brand-accent-dark); color: #1f2937; }

.btn-lg { padding: 13px 24px; font-size: 1rem; }
.btn-sm { padding: 5px 11px; font-size: 0.8rem; }

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.92rem;
}
.table th, .table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--bg-subtle);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
}
.table tr:hover td { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------- Questionnaire ---------- */
.theme-block {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 5px solid var(--brand-primary);
}
.theme-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}
.theme-title .num {
  display: inline-block;
  background: var(--brand-primary);
  color: #fff;
  border-radius: var(--r-full);
  padding: 2px 12px;
  font-size: 0.82rem;
  margin-right: 8px;
  font-weight: 700;
}

.question-row {
  display: grid;
  grid-template-columns: 60px 1fr 380px;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.question-row:last-child { border-bottom: none; }
.question-row:hover { background: var(--surface-2); }
.q-code { font-weight: 700; color: var(--brand-primary); text-align: center; font-size: 0.93rem; }
.q-text { font-size: 0.94rem; color: var(--text-1); }

.likert {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.likert label {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: var(--r-sm);
  font-size: 0.72rem;
  color: var(--text-2);
  transition: all var(--t-fast);
  text-align: center;
  font-weight: 500;
}
.likert label:hover {
  background: var(--brand-primary-light);
  color: var(--brand-primary);
}
.likert input[type="radio"] {
  margin-bottom: 4px;
  cursor: pointer;
  accent-color: var(--brand-primary);
  width: 16px;
  height: 16px;
}
.likert input[type="radio"]:checked + .lk-text {
  font-weight: 700;
  color: var(--brand-primary);
}

.scale-key {
  background: var(--brand-primary-light);
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: 0.85rem;
  color: var(--brand-primary-dark);
  margin-bottom: 18px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  border: 1px solid var(--brand-primary);
}
[data-theme="dark"] .scale-key { background: var(--brand-primary-light); color: #d4f7e3; }

/* ---------- Heatmap ---------- */
.heatmap-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.heatmap {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
}
.heatmap th, .heatmap td {
  padding: 9px;
  text-align: center;
  border: 1px solid var(--border);
}
.heatmap th {
  background: var(--brand-primary);
  color: #fff;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.heatmap td.label {
  text-align: left;
  background: var(--surface-2);
  color: var(--text-1);
  font-weight: 500;
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 220px;
}
.heatmap td.cell {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
  transition: filter var(--t-fast), outline var(--t-fast);
}
.heatmap td.cell:hover {
  filter: brightness(1.18);
  outline: 2px solid var(--text-1);
  outline-offset: -2px;
}

/* ---------- Charts ---------- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 20px;
}
.chart-card {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base);
}
.chart-card:hover { box-shadow: var(--shadow-md); }
.chart-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.chart-wrap { position: relative; height: 320px; }
.chart-wrap-lg { position: relative; height: 460px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-ministry { background: var(--info-bg); color: var(--info); }
.badge-reporting { background: var(--brand-accent-light); color: var(--brand-accent-dark); }
.badge-low { background: var(--danger-bg); color: var(--danger); }
.badge-mid { background: var(--warning-bg); color: var(--warning); }
.badge-high { background: var(--success-bg); color: var(--success); }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert::before { font-size: 1.1rem; line-height: 1; flex-shrink: 0; }
.alert-info { background: var(--info-bg); color: var(--info); border-color: rgba(29, 78, 216, 0.2); }
.alert-info::before { content: 'ℹ️'; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(21, 128, 61, 0.2); }
.alert-success::before { content: '✅'; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: rgba(185, 28, 28, 0.2); }
.alert-error::before { content: '⚠️'; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: rgba(180, 83, 9, 0.2); }
.alert-warning::before { content: '⚠️'; }

/* ---------- Misc ---------- */
.text-muted { color: var(--text-2); }
.text-center { text-align: center; }
.mt-3 { margin-top: 1rem; }
.mb-3 { margin-bottom: 1rem; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }

footer {
  text-align: center;
  padding: 28px;
  color: var(--text-2);
  font-size: 0.85rem;
  margin-top: 40px;
  border-top: 1px solid var(--border);
}

/* ---------- Filter card ---------- */
.filter-card { background: var(--surface-2); border: 1px solid var(--border); }
.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}

/* ---------- Leaderboard ---------- */
.leaderboard { list-style: none; padding: 0; margin: 0; }
.leaderboard li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
  transition: background var(--t-fast);
  border-radius: var(--r-sm);
}
.leaderboard li:hover { background: var(--bg-hover); }
.leaderboard li:last-child { border-bottom: none; }
.leaderboard li .rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  background: var(--brand-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  margin-right: 10px;
  flex-shrink: 0;
}
.leaderboard li:nth-child(1) .rank { background: var(--brand-accent); color: #4a2c00; }
.leaderboard li:nth-child(2) .rank { background: #94a3b8; }
.leaderboard li:nth-child(3) .rank { background: #d4a574; }
.leaderboard li .name { flex: 1; padding: 0 8px; color: var(--text-1); }
.leaderboard li .metric {
  font-weight: 700;
  color: var(--brand-primary);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(4px);
  animation: fadeIn 150ms ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-content {
  background: var(--surface);
  border-radius: var(--r-xl);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 200ms ease;
}
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-2);
}
.modal-header h2 { margin: 0; color: var(--text-1); font-size: 1.1rem; padding: 0; border: none; }
.modal-close {
  background: transparent;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--text-2);
  width: 32px;
  height: 32px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-1); }
.modal-body { padding: 22px 24px; overflow: auto; }

/* ---------- Progress ---------- */
.progress-row {
  background: var(--bg-hover);
  height: 10px;
  border-radius: var(--r-full);
  overflow: hidden;
}
.progress-row .bar {
  background: var(--brand-primary);
  height: 100%;
  transition: width 0.4s ease;
  border-radius: var(--r-full);
}
.progress-row .bar.complete { background: var(--success); }
.progress-row .bar.in_progress { background: var(--brand-accent); }
.progress-row .bar.not_started { background: var(--danger); }

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.76rem;
  font-weight: 700;
}
.status-complete { background: var(--success-bg); color: var(--success); }
.status-in_progress { background: var(--warning-bg); color: var(--warning); }
.status-not_started { background: var(--danger-bg); color: var(--danger); }

/* ---------- Action row ---------- */
.actions-row { display: flex; gap: 6px; align-items: center; }
.actions-row form { display: inline; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  max-width: 440px;
  width: 100%;
  background: var(--surface);
  padding: 40px 36px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  border-top: 5px solid var(--brand-primary);
}
.login-card .logo {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark));
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 1.8rem;
  color: #fff;
  box-shadow: var(--shadow-md);
}
.login-card h2 { text-align: center; font-size: 1.4rem; color: var(--text-1); margin-bottom: 4px; padding: 0; border: none; }
.login-card .sub { text-align: center; color: var(--text-2); margin-bottom: 24px; font-size: 0.92rem; }

/* ---------- Loading skeletons ---------- */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-hover) 0%,
    var(--bg-subtle) 50%,
    var(--bg-hover) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.lg { height: 22px; width: 60%; }
.skeleton-chart { width: 100%; height: 300px; border-radius: var(--r-md); }
.skeleton-row { height: 38px; margin-bottom: 6px; }
.skeleton-stat { height: 70px; border-radius: var(--r-lg); margin-bottom: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .nav-toggle { display: flex; }
  .nav-menu {
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 0;
    width: min(320px, 86vw);
    background: var(--brand-primary-dark);
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 20px 16px 24px;
    box-shadow: -10px 0 30px rgba(0,0,0,0.25);
    transform: translateX(105%);
    transition: transform 240ms ease;
    overflow-y: auto;
  }
  .nav-menu.open { transform: translateX(0); }
  .nav-links {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    width: 100%;
    margin-bottom: 16px;
  }
  .nav-links a {
    padding: 12px 14px;
    font-size: 0.95rem;
    border-radius: var(--r-md);
  }
  .nav-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.18);
  }
  .nav-actions .user-chip,
  .nav-actions .icon-btn,
  .nav-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .nav-actions .icon-btn { height: 42px; }
  .brand-title { font-size: 0.92rem; }
  .brand small { display: none; }
}

@media (max-width: 768px) {
  .navbar-inner { padding: 10px 14px; }
  .container { margin: 16px auto; padding: 0 14px; }
  .page-title { font-size: 1.4rem; }
  .hero-card { padding: 24px; }
  .hero-card h1 { font-size: 1.4rem; }
  .hero-card p { font-size: 0.92rem; }
  .question-row { grid-template-columns: 1fr; gap: 8px; }
  .q-code { text-align: left; }
  .filter-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-value { font-size: 1.4rem; }
  .stat-card { padding: 14px; }
  .charts-grid { grid-template-columns: 1fr; gap: 14px; }
  .chart-wrap, .chart-wrap-lg { height: 280px; }
  .card { padding: 16px; }
  .card h2 { font-size: 1rem; }
  .scale-key { font-size: 0.78rem; gap: 10px; }
  .table th, .table td { padding: 8px 10px; font-size: 0.85rem; }
  .modal { padding: 12px; }
  .modal-content { max-height: 95vh; }
  .modal-body { padding: 14px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .brand-text { display: none; }
  .brand-mark { width: 36px; height: 36px; font-size: 1.1rem; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .login-card { padding: 28px 22px; }
}

/* ---------- Print Styles ---------- */
@media print {
  .no-print { display: none !important; }
  :root { --bg: #fff; --surface: #fff; --text-1: #000; --text-2: #333; --border: #ccc; --shadow-sm: none; --shadow-md: none; --shadow-lg: none; --shadow-xs: none; }
  body { background: #fff; color: #000; }
  .navbar, footer, .icon-btn, .btn, .page-actions, .modal, .filter-card { display: none !important; }
  .container { max-width: 100%; margin: 0; padding: 12px; }
  .card, .stat-card, .chart-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }
  .hero-card {
    background: #f5f5f5 !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
  }
  .hero-card h1, .hero-card p { color: #000 !important; opacity: 1 !important; }
  .heatmap th { background: #333 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .heatmap td.cell { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: #000; text-decoration: none; }
  .page-title { font-size: 1.4rem; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .stat-card { padding: 10px; }
  .stat-value { font-size: 1.3rem; }
  .charts-grid { grid-template-columns: 1fr; gap: 10px; }
  .chart-wrap, .chart-wrap-lg { height: 280px; }
}

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-2);
}
.empty-state .icon {
  font-size: 3.5rem;
  opacity: 0.4;
  margin-bottom: 12px;
}
.empty-state h3 {
  color: var(--text-1);
  margin-bottom: 6px;
  font-size: 1.1rem;
}
