/* D-AIR² v3.0 – Corporate Design CSS
   Colors: Dark Blue #1B3A6B, Green #2E7D32
   PHP 7.4 · EO Institut · d-air2.de
*/

/* ─── Imports & Variables ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,600;0,700;1,400&family=Source+Serif+Pro:wght@400;600;700&display=swap');

:root {
  --primary:       #1B3A6B;
  --primary-light: #2A5298;
  --primary-dark:  #0D1F3C;
  --secondary:     #2E7D32;
  --secondary-light:#43A047;
  --secondary-dark: #1B5E20;
  --accent:        #81C784;
  --danger:        #C62828;
  --warning:       #E65100;
  --caution:       #F9A825;
  --info:          #0277BD;
  --white:         #FFFFFF;
  --off-white:     #F8F9FC;
  --gray-50:       #F5F6FA;
  --gray-100:      #EAECF0;
  --gray-200:      #D1D5DB;
  --gray-400:      #9CA3AF;
  --gray-600:      #4B5563;
  --gray-800:      #1F2937;
  --text:          #1F2937;
  --text-muted:    #6B7280;
  --border:        #E5E7EB;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:        0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius-sm:     4px;
  --radius:        8px;
  --radius-lg:     12px;
  --radius-xl:     20px;
  --transition:    all .2s ease;
  --font-body:     'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading:  'Source Serif Pro', Georgia, serif;
  --font-mono:     'Fira Code', 'Courier New', monospace;
}

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--off-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-light); }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* ─── Typography ─────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--primary);
  line-height: 1.3;
  font-weight: 700;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
p { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: .875rem; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container--narrow { max-width: 720px; }
.container--wide { max-width: 1400px; }

.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; padding: 32px 0; }

.grid { display: grid; gap: 24px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex--center { align-items: center; }
.flex--between { justify-content: space-between; }
.flex--gap { gap: 16px; }
.flex--wrap { flex-wrap: wrap; }

/* ─── Header / Navbar ────────────────────────────────────────────────────── */
.navbar {
  background: var(--primary);
  border-bottom: 3px solid var(--secondary);
  padding: 0;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 24px;
  max-width: 1400px;
  margin: 0 auto;
}
.navbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,.96);
  border-radius: 8px;
  padding: 4px 12px 4px 8px;
  text-decoration: none;
}
.navbar__brand:hover { background: #fff; }
.navbar__tagline {
  color: rgba(255,255,255,.5);
  font-size: .7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: none;
}
.navbar__nav { display: flex; align-items: center; gap: 4px; }
.navbar__link {
  color: rgba(255,255,255,.8);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  transition: var(--transition);
}
.navbar__link:hover, .navbar__link.active {
  color: var(--white);
  background: rgba(255,255,255,.12);
}
.navbar__link--accent {
  background: var(--secondary);
  color: var(--white) !important;
  border-radius: var(--radius-sm);
}
.navbar__link--accent:hover { background: var(--secondary-light) !important; }

/* ─── Sidebar layout ─────────────────────────────────────────────────────── */
.app-layout { display: flex; min-height: calc(100vh - 64px); }
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 24px 0;
  position: sticky; top: 64px; height: calc(100vh - 64px);
  overflow-y: auto;
}
.sidebar__section { margin-bottom: 8px; }
.sidebar__label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 20px 4px;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--gray-600);
  font-size: .9rem;
  font-weight: 600;
  border-left: 3px solid transparent;
  transition: var(--transition);
}
.sidebar__link:hover {
  background: var(--gray-50);
  color: var(--primary);
  border-left-color: var(--primary);
}
.sidebar__link.active {
  background: rgba(27,58,107,.06);
  color: var(--primary);
  border-left-color: var(--primary);
}
.sidebar__icon { width: 18px; text-align: center; opacity: .7; }
.app-content { flex: 1; padding: 32px; overflow-x: hidden; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card__header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card__title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: var(--primary);
  font-weight: 700;
  margin: 0;
}
.card__body { padding: 24px; }
.card__footer {
  padding: 16px 24px;
  background: var(--gray-50);
  border-top: 1px solid var(--border);
}

/* ─── Stat cards ─────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.stat-card__label {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  font-family: var(--font-heading);
}
.stat-card__sub { font-size: .875rem; color: var(--text-muted); margin-top: 4px; }
.stat-card--primary { border-top: 3px solid var(--primary); }
.stat-card--green   { border-top: 3px solid var(--secondary); }
.stat-card--warning { border-top: 3px solid var(--caution); }
.stat-card--danger  { border-top: 3px solid var(--danger); }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: .3px;
}
.btn:focus { outline: 2px solid var(--primary-light); outline-offset: 2px; }
.btn--primary { background: var(--primary); color: var(--white); }
.btn--primary:hover { background: var(--primary-light); color: var(--white); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn--secondary { background: var(--secondary); color: var(--white); }
.btn--secondary:hover { background: var(--secondary-light); color: var(--white); }
.btn--outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn--outline:hover { background: var(--primary); color: var(--white); }
.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--gray-100); color: var(--text); }
.btn--danger { background: var(--danger); color: var(--white); }
.btn--danger:hover { background: #B71C1C; }
.btn--sm { padding: 6px 14px; font-size: .8rem; }
.btn--lg { padding: 14px 28px; font-size: 1rem; }
.btn--full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: .875rem;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 6px;
}
.form-label span { color: var(--danger); margin-left: 2px; }
.form-control {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  font-size: .9rem;
  transition: var(--transition);
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27,58,107,.1);
}
.form-control::placeholder { color: var(--gray-400); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .8rem; color: var(--danger); margin-top: 4px; }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  background: var(--gray-50);
  border-bottom: 2px solid var(--border);
  padding: 12px 16px;
  text-align: left;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  color: var(--text);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .3px;
}
.badge--primary  { background: rgba(27,58,107,.1);  color: var(--primary); }
.badge--success  { background: rgba(46,125,50,.1);  color: var(--secondary); }
.badge--warning  { background: rgba(249,168,37,.15);color: #7B5E00; }
.badge--danger   { background: rgba(198,40,40,.1);  color: var(--danger); }
.badge--gray     { background: var(--gray-100);     color: var(--gray-600); }

/* ─── Zone badges ────────────────────────────────────────────────────────── */
.zone-critical  { background: #FFEBEE; color: #C62828; border: 1px solid #EF9A9A; }
.zone-risk      { background: #FBE9E7; color: #E65100; border: 1px solid #FFAB91; }
.zone-moderate  { background: #FFFDE7; color: #7B5E00; border: 1px solid #FFF176; }
.zone-good      { background: #E8F5E9; color: #2E7D32; border: 1px solid #A5D6A7; }
.zone-excellent { background: #E1F0E2; color: #1B5E20; border: 1px solid #66BB6A; }

/* ─── Alerts / Flashes ───────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .9rem;
  font-weight: 600;
}
.alert--success { background: #E8F5E9; color: #1B5E20; border-left: 4px solid var(--secondary); }
.alert--error   { background: #FFEBEE; color: #C62828; border-left: 4px solid var(--danger); }
.alert--info    { background: #E3F2FD; color: #0D47A1; border-left: 4px solid #1565C0; }
.alert--warning { background: #FFF8E1; color: #7B5E00; border-left: 4px solid var(--caution); }

/* ─── Score bar ──────────────────────────────────────────────────────────── */
.score-bar-wrap {
  height: 10px;
  background: var(--gray-100);
  border-radius: 5px;
  overflow: hidden;
}
.score-bar { height: 100%; border-radius: 5px; transition: width .6s ease; }

/* ─── Radar / Charts placeholder ────────────────────────────────────────── */
.chart-container { position: relative; width: 100%; }
.chart-container canvas { max-width: 100%; }

/* ─── Survey question styles ─────────────────────────────────────────────── */
.survey-wrap { max-width: 800px; margin: 0 auto; }
.survey-progress {
  background: var(--gray-100);
  height: 6px;
  border-radius: 3px;
  margin-bottom: 32px;
  overflow: hidden;
}
.survey-progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width .4s ease;
}
.dim-header {
  text-align: center;
  margin-bottom: 32px;
  padding: 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--radius-lg);
  color: var(--white);
}
.dim-header h2 { color: var(--white); font-size: 1.4rem; margin-bottom: 4px; }
.dim-header p  { color: rgba(255,255,255,.7); margin: 0; font-size: .9rem; }

.question-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  transition: var(--transition);
}
.question-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.question-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.5;
}
.question-num {
  display: inline-flex;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  font-size: .8rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
}
.likert-scale { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.likert-option { flex: 1; min-width: 0; }
.likert-option input[type="radio"] { display: none; }
.likert-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: .75rem;
  text-align: center;
  color: var(--text-muted);
  font-weight: 600;
  min-height: 64px;
  justify-content: center;
}
.likert-option label:hover { border-color: var(--primary); background: rgba(27,58,107,.04); color: var(--primary); }
.likert-option input:checked + label { border-color: var(--primary); background: var(--primary); color: var(--white); }
.likert-num { font-size: 1.1rem; font-weight: 700; }
.likert-labels { display: flex; justify-content: space-between; margin-top: 6px; }
.likert-label-text { font-size: .7rem; color: var(--text-muted); }

/* ─── Report styles ──────────────────────────────────────────────────────── */
.report-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  padding: 48px 0;
  margin-bottom: 40px;
}
.composite-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.composite-circle {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  border: 4px solid rgba(255,255,255,.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.composite-num { font-size: 2.5rem; font-weight: 700; color: var(--white); font-family: var(--font-heading); }
.composite-label { font-size: .75rem; color: rgba(255,255,255,.7); text-transform: uppercase; letter-spacing: 1px; }

.dim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin-bottom: 32px; }
.dim-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  border-left: 4px solid var(--primary);
}
.dim-card__title { font-size: .95rem; font-weight: 700; color: var(--primary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.dim-card__score { font-size: 1.75rem; font-weight: 700; font-family: var(--font-heading); margin-bottom: 8px; }
.dim-card__bar { margin-bottom: 8px; }
.dim-card__zone { display: inline-block; }

/* ─── Heatmap ────────────────────────────────────────────────────────────── */
.heatmap-cell {
  padding: 8px;
  text-align: center;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 700;
  color: var(--white);
  transition: var(--transition);
}
.heatmap-cell:hover { transform: scale(1.05); }

/* ─── Gamification ───────────────────────────────────────────────────────── */
.badge-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.achievement-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100px;
  text-align: center;
}
.achievement-badge--locked { opacity: .4; filter: grayscale(1); }
.achievement-badge__icon { font-size: 2rem; }
.achievement-badge__name { font-size: .7rem; font-weight: 700; color: var(--text-muted); }

/* ─── Loading ────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid rgba(27,58,107,.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.6);
  padding: 32px 0;
  margin-top: auto;
  font-size: .85rem;
}
.footer__inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer a { color: rgba(255,255,255,.8); }
.footer a:hover { color: var(--white); }
.footer__brand { color: var(--white); font-weight: 700; font-family: var(--font-heading); }

/* ─── Presentation mode ──────────────────────────────────────────────────── */
.presentation-slide {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
}
.presentation-slide--dark { background: var(--primary); color: var(--white); }
.presentation-slide--light { background: var(--white); }
.presentation-nav {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; gap: 8px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .app-content { padding: 16px; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .navbar__tagline { display: none; }
  .dim-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  .container { padding: 0 16px; }
  .likert-scale { gap: 4px; }
  .likert-option label { font-size: .65rem; padding: 8px 4px; }
}
@media (max-width: 480px) {
  .navbar__nav { gap: 2px; }
  .navbar__link { padding: 6px 8px; font-size: .8rem; }
}

/* ─── Print ──────────────────────────────────────────────────────────────── */
@media print {
  .navbar, .sidebar, .btn, .footer { display: none !important; }
  .app-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 32px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.p-4 { padding: 24px; }
.hidden { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* Clickable card */
.card--link { cursor:pointer; transition:transform .15s, box-shadow .15s; }
.card--link:hover { transform:translateY(-2px); box-shadow:0 8px 24px rgba(27,58,107,.12); }

/* ── Admin Layout ─────────────────────────────────────────────────── */
.admin-layout { display:flex; min-height:calc(100vh - 64px); }
.admin-sidebar { width:220px; flex-shrink:0; background:#1F2937; padding:12px 0; overflow-y:auto; }
.admin-sidebar a { display:flex; align-items:center; gap:8px; padding:8px 16px; color:rgba(255,255,255,.7); font-size:.85rem; font-weight:600; text-decoration:none; border-left:3px solid transparent; transition:all .15s; }
.admin-sidebar a:hover, .admin-sidebar a.active { background:rgba(255,255,255,.08); color:#fff; border-left-color:#2E7D32; }
.admin-sidebar .nav-label { font-size:.62rem; font-weight:700; letter-spacing:1.5px; text-transform:uppercase; color:rgba(255,255,255,.35); padding:10px 16px 3px; }
.admin-main { flex:1; padding:32px; background:#F8F9FC; overflow-x:hidden; }
.main-content:has(.admin-layout) { padding:0; }

/* ═══════════════════════════════════════════════════════════════════════════
   D-AIR² v3.1 – Extended Design System
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Dark Mode ──────────────────────────────────────────────────────────── */

/* ─── Portal Layout (Sidebar + Main) ────────────────────────────────────── */
.portal-layout, .admin-layout {
  display: flex;
  min-height: calc(100vh - 60px);
}

.portal-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1F2937;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.portal-sidebar a,
.portal-sidebar .btn--ghost {
  display: block;
  padding: 9px 16px;
  font-size: .875rem;
  color: #9CA3AF;
  text-decoration: none;
  border-radius: 6px;
  margin: 1px 8px;
  transition: background .15s, color .15s;
}
.portal-sidebar a:hover,
.portal-sidebar a.active {
  background: #374151;
  color: #F9FAFB;
}
.portal-sidebar .nav-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: #6B7280;
  padding: 12px 16px 4px;
}

.portal-main, .admin-main {
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
  background: #F9FAFB;
}

/* Hamburger (mobile only, hidden on desktop) */
.hamburger { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 768px) {
  .portal-layout, .admin-layout { display: block; }
  .portal-sidebar {
    position: fixed;
    top: 0; left: -240px;
    width: 240px;
    height: 100vh;
    z-index: 200;
    transition: left .25s ease;
  }
  .portal-sidebar.is-open { left: 0; }
  .hamburger {
    display: flex !important;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
  }
  .hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
  }
  .sidebar-overlay.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 199;
  }
  .portal-main, .admin-main { padding: 16px; }
}


/* ─── Mobile Navbar ──────────────────────────────────────────────────────── */
.navbar__hamburger,
button.hamburger#nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}
.navbar__hamburger span,
button.hamburger#nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .2s;
}

@media (max-width: 768px) {
  .navbar__hamburger,
  button.hamburger#nav-hamburger { display: flex; }

  .navbar__nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0; right: 0;
    background: var(--primary);
    flex-direction: column;
    padding: 8px 0 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    z-index: 99;
  }
  .navbar__nav.is-open { display: flex; }
  .navbar__link { padding: 10px 24px; }
  .navbar__lang-switcher { padding: 8px 24px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #111827;
    --bg-card:     #1F2937;
    --bg-surface:  #374151;
    --text:        #F9FAFB;
    --text-muted:  #9CA3AF;
    --border:      #374151;
    --gray-50:     #1F2937;
    --gray-100:    #374151;
    --gray-200:    #4B5563;
  }
  body { background: var(--bg, #111827); color: var(--text, #F9FAFB); }
  .navbar { background: #0D1F3C; border-bottom-color: #374151; }
  .card { background: #1F2937; border-color: #374151; }
  .card__header { background: #111827; border-bottom-color: #374151; }
  .table th { background: #374151; color: #E5E7EB; }
  .table td { border-color: #374151; }
  .table tr:nth-child(even) td { background: #1F2937; }
  .form-control { background: #374151; border-color: #4B5563; color: #F9FAFB; }
  .form-control:focus { border-color: #2A5298; }
  .stat-card { background: #1F2937; border-color: #374151; }
  .stat-card__label { color: #9CA3AF; }
  .stat-card__value { color: #F9FAFB; }
  .admin-sidebar { background: #0D1F3C; }
  .portal-sidebar { background: #1F2937; border-right-color: #374151; }
  .portal-sidebar a { color: #9CA3AF; }
  .portal-sidebar a:hover, .portal-sidebar a.active { background: #374151; color: #F9FAFB; }
  .portal-main, .admin-main { background: #111827; }
  .alert--info { background: #0C2340; border-color: #1565C0; color: #93C5FD; }
  .alert--success { background: #052E16; border-color: #166534; color: #86EFAC; }
  .alert--error { background: #2D0A0A; border-color: #991B1B; color: #FCA5A5; }
  .alert--warning { background: #1C1200; border-color: #854D0E; color: #FDE68A; }
  .badge { background: #374151; }
  input, select, textarea { color-scheme: dark; }
  .text-muted { color: #9CA3AF; }
  footer { background: #0D1F3C; border-top-color: #374151; }
}

/* ─── Mobile Hamburger Menu ──────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 6px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text, #1F2937);
  border-radius: 2px;
  transition: all .2s;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
}
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .portal-sidebar, .admin-sidebar {
    position: fixed;
    top: 0; left: -260px;
    height: 100vh;
    width: 240px;
    z-index: 100;
    transition: left .25s ease;
    overflow-y: auto;
  }
  .portal-sidebar.open, .admin-sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }
  .portal-main, .admin-main {
    padding: 16px;
    width: 100%;
  }
  .portal-layout, .admin-layout { display: block; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr !important; }
  .navbar__nav { gap: 4px; }
  .navbar__link { padding: 8px 10px; font-size: .82rem; }
}

/* ─── Workflow stepper (Next-step bar) ───────────────────────────────────── */
.workflow-steps {
  display: flex;
  align-items: center;
  gap: 0;
  background: linear-gradient(135deg, #EEF2FF 0%, #F0FDF4 100%);
  border: 1px solid #C7D2FE;
  border-radius: 10px;
  padding: 14px 20px;
  margin-bottom: 24px;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.workflow-step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.workflow-step__num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #1B3A6B;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.workflow-step__num.done { background: #2E7D32; }
.workflow-step__num.active { background: #1B3A6B; box-shadow: 0 0 0 3px #C7D2FE; }
.workflow-step__label { font-size: .82rem; font-weight: 600; color: #1B3A6B; }
.workflow-step__label a { color: #1B3A6B; text-decoration: none; }
.workflow-step__label a:hover { text-decoration: underline; }
.workflow-step__label.muted { color: #9CA3AF; font-weight: 400; }
.workflow-arrow {
  width: 24px; text-align: center;
  color: #9CA3AF; font-size: .85rem;
  flex-shrink: 0;
}

/* ─── Empty state ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 32px;
}
.empty-state__icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, #EEF2FF, #E0F2F1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
}
.empty-state__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 8px;
}
.empty-state__desc {
  font-size: .875rem;
  color: #6B7280;
  max-width: 380px;
  margin: 0 auto 20px;
  line-height: 1.6;
}
.empty-state__steps {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.empty-state__step {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #F8F9FC;
  border: 1px solid #E5E7EB;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: .8rem;
  color: #374151;
}
.empty-state__step-num {
  width: 18px; height: 18px;
  background: #1B3A6B;
  color: #fff;
  border-radius: 50%;
  font-size: .65rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Psychometrics panel ────────────────────────────────────────────────── */
.psycho-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid #F3F4F6;
  font-size: .875rem;
}
.psycho-alpha {
  min-width: 48px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
}
.alpha-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: .72rem;
  font-weight: 700;
}
.alpha-chip--ok      { background: #D1FAE5; color: #065F46; }
.alpha-chip--warn    { background: #FEF3C7; color: #92400E; }
.alpha-chip--bad     { background: #FEE2E2; color: #991B1B; }
.alpha-chip--na      { background: #F3F4F6; color: #6B7280; }

/* ─── Confidence interval display ────────────────────────────────────────── */
.ci-bar {
  position: relative;
  height: 8px;
  background: #F3F4F6;
  border-radius: 4px;
}
.ci-range {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(27,58,107,.25);
  border-radius: 4px;
}
.ci-point {
  position: absolute;
  top: -3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1B3A6B;
  transform: translateX(-50%);
}

/* ─── Wave comparison / longitudinal ─────────────────────────────────────── */
.wave-diff-pos { color: #2E7D32; font-weight: 700; }
.wave-diff-neg { color: #C62828; font-weight: 700; }
.wave-diff-neu { color: #9CA3AF; }

/* ─── Login page branding ────────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(145deg, #0D1F3C 0%, #1B3A6B 40%, #2E7D32 100%);
}
.login-brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px;
  color: #fff;
}
.login-brand__logo { height: 48px; margin-bottom: 32px; filter: brightness(0) invert(1); }
.login-brand__title { font-size: 2.2rem; font-weight: 900; margin-bottom: 12px; letter-spacing: -.5px; }
.login-brand__sub { font-size: 1rem; opacity: .8; line-height: 1.7; max-width: 380px; }
.login-brand__features { margin-top: 40px; display: flex; flex-direction: column; gap: 12px; }
.login-brand__feature { display: flex; align-items: center; gap: 10px; font-size: .9rem; opacity: .85; }
.login-brand__feature svg { flex-shrink: 0; opacity: .9; }
.login-panel {
  width: 440px;
  flex-shrink: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 48px;
  box-shadow: -20px 0 60px rgba(0,0,0,.25);
}
@media (max-width: 768px) {
  .login-brand { display: none; }
  .login-panel { width: 100%; padding: 40px 24px; box-shadow: none; }
}
@media (prefers-color-scheme: dark) {
  .login-panel { background: #1F2937; }
  .login-panel .form-control { background: #374151; border-color: #4B5563; color: #F9FAFB; }
  .login-panel h2 { color: #F9FAFB; }
  .login-panel .text-muted { color: #9CA3AF; }
}

/* ─── SVG Icon system ─────────────────────────────────────────────────────── */
.icon { display: inline-block; vertical-align: middle; flex-shrink: 0; }
.icon--sm { width: 16px; height: 16px; }
.icon--md { width: 20px; height: 20px; }
.icon--lg { width: 24px; height: 24px; }

/* ─── Nav sidebar icons ──────────────────────────────────────────────────── */
.sidebar-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.admin-sidebar a:hover .sidebar-icon,
.admin-sidebar a.active .sidebar-icon { opacity: 1; }

/* ─── Language Switcher ──────────────────────────────────────────────────── */
.navbar__lang-switcher { display:flex;align-items:center;gap:2px;margin-left:4px; }
.navbar__lang { font-size:.72rem!important;padding:3px 6px!important;opacity:.6;letter-spacing:.5px; }
.navbar__lang--active { font-size:.72rem!important;padding:3px 6px!important;font-weight:700!important;opacity:1;border-bottom:2px solid currentColor; }
