@import './tokens.css';

/* ── CSS Layer-arkitektur — eksplicit kaskade-rækkefølge ─────────────────
 * tokens   — design tokens (variabler, font-stack)
 * reset    — universal-reset
 * base     — html/body, headers, navigation
 * features — mode-specifik styling (logbook, sparring, admin, refleksion)
 * a11y     — accessibility-overrides (skip-link, focus-rings, reduced-motion)
 * utility  — small utility-classes (.hidden, .sr-only, .text-muted)
 *
 * Note: hele filen er stadig én flad fil for at undgå breaking refactor.
 * @layer-deklarationen sikrer at fremtidig migration til separate filer
 * (logbook.css, sparring.css osv.) bevarer specifitets-rækkefølgen.
 */
@layer tokens, reset, base, features, a11y, utility;

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

html {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }

button {
  cursor: pointer; border: none; background: none; font: inherit; color: inherit;
  min-height: var(--touch-min); min-width: var(--touch-min);
}

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Layout */
.app { max-width: 640px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

/* Header */
.app-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--color-bg); z-index: 10;
}
.app-header h1 { font-size: var(--text-base); font-weight: 600; }

/* Mode nav */
.mode-nav { display: flex; gap: var(--space-2); }
.mode-btn {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  border: 1px solid var(--color-border);
  min-height: 32px;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.mode-btn.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }

/* Tag grid */
.tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--space-2);
  padding: var(--space-4);
}

.tag-tile {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-1);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  min-height: var(--touch-min);
  transition: transform var(--duration-fast) var(--ease-out),
              background var(--duration-fast), border-color var(--duration-fast);
}
.tag-tile:active { transform: scale(0.95); }
.tag-tile.logged { background: var(--color-accent-subtle); border-color: var(--color-accent); }
.tag-tile .icon { font-size: 1.5rem; }
.tag-tile .label { font-size: var(--text-xs); text-align: center; line-height: 1.2; }

/* Log feedback */
.log-feedback {
  text-align: center; padding: var(--space-2);
  font-size: var(--text-sm); color: var(--color-text-muted);
  min-height: 2rem;
}

/* Sparring btn */
.sparring-bar {
  padding: var(--space-4);
  border-top: 1px solid var(--color-border);
  margin-top: auto;
}
.btn-primary {
  width: 100%; padding: var(--space-3);
  background: var(--color-accent); color: #fff;
  border-radius: var(--radius-md); font-weight: 600;
  font-size: var(--text-base);
  transition: opacity var(--duration-fast);
}
.btn-primary:disabled { opacity: 0.5; }

/* Sheet (bottom drawer) */
.sheet-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; justify-content: flex-end;
}
.sheet-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.45);
}
.sheet-panel {
  position: relative;
  background: var(--color-surface-elevated);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-6);
  max-height: 85dvh; overflow-y: auto;
}
.sheet-panel h2 { margin-bottom: var(--space-4); }

/* Intervention card */
.intervention-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-3);
}
.intervention-card .action { font-weight: 500; line-height: 1.4; }
.intervention-idea-label {
  display: inline-flex; align-items: center;
  font-size: var(--text-xs); font-weight: 600;
  color: var(--color-accent);
  gap: var(--space-1);
  flex-shrink: 0;
}
.rationale-box {
  font-size: var(--text-sm); color: var(--color-text-muted);
  background: var(--color-accent-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3); line-height: 1.6; margin: 0;
}
.sparring-theory-chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.sparring-theory-chip {
  font-size: var(--text-xs); font-weight: 500;
  background: oklch(93% 0.04 250); color: oklch(35% 0.12 250);
  border: 1px solid oklch(82% 0.08 250);
  border-radius: var(--radius-full);
  padding: 2px var(--space-2);
}
.sparring-analysis {
  font-size: var(--text-sm); color: var(--color-text-muted);
  margin-bottom: var(--space-4); line-height: 1.6;
}
.sparring-hypothesis {
  background: var(--color-accent-subtle); border-radius: var(--radius-sm);
  padding: var(--space-3); font-size: var(--text-sm);
  margin-bottom: var(--space-4); line-height: 1.5;
}
.sparring-question-echo {
  display: flex; gap: var(--space-2); align-items: baseline;
  border-left: 3px solid var(--color-accent, #6366f1);
  background: var(--color-surface-muted, #f8fafc);
  padding: var(--space-2) var(--space-3);
  margin: 0 0 var(--space-4) 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--text-sm);
}
.sparring-question-echo-lbl {
  font-weight: 600; color: var(--color-text-muted, #64748b);
  flex-shrink: 0;
}
.sparring-question-echo q {
  color: var(--color-text, #1e293b); font-style: italic;
}

/* Reflection */
.reflection-form {
  padding: var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-4);
}
.reflection-form textarea {
  width: 100%; padding: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: var(--text-base); resize: vertical;
}

/* Reflection history */
.reflection-history {
  padding: var(--space-5) var(--space-6) var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.reflection-history-title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
}
.reflection-history-loading,
.reflection-history-empty {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  font-style: italic;
}
.reflection-entry {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.reflection-entry-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.reflection-entry-del {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  padding: 0; border: none;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity .15s, background .15s, color .15s;
}
.reflection-entry:hover .reflection-entry-del { opacity: 0.85; }
.reflection-entry-del:hover {
  opacity: 1;
  background: oklch(95% 0.05 35);
  color: oklch(50% 0.18 35);
}
.reflection-entry-del:disabled { opacity: 0.3; cursor: not-allowed; }
.reflection-entry-date {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
}
.reflection-entry-subject {
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}
.reflection-entry-note {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.55;
  color: var(--color-text);
  white-space: pre-wrap;
}

/* Login */
.login-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: var(--space-6); min-height: 100dvh;
  padding: var(--space-8);
}
.btn-google {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base); font-weight: 500;
  background: var(--color-surface-elevated);
  min-height: var(--touch-min);
}
.login-form {
  display: flex; flex-direction: column; gap: var(--space-3);
  width: 100%; max-width: 320px;
}
.login-input {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  background: var(--color-surface-elevated);
  min-height: var(--touch-min);
}
.login-input:focus {
  outline: 2px solid var(--color-accent, #4285F4);
  outline-offset: 2px;
}
.btn-login {
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-accent, #1a73e8);
  color: #fff;
  font-size: var(--text-base); font-weight: 500;
  min-height: var(--touch-min);
  cursor: pointer;
}
.btn-login:hover { filter: brightness(1.05); }
.login-error {
  color: var(--color-danger, #c5221f);
  font-size: var(--text-sm);
  margin: 0;
}

/* === Observation mode toggle (Elev ↔ Klasserum) === */
.obs-mode-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--color-surface, #f4f4f4);
  border: 1px solid var(--color-border, #e4e4e4);
  border-radius: 999px;
  margin-bottom: var(--space-4);
  align-self: flex-start;
}
.obs-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: none;
  background: transparent;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted, #555);
  cursor: pointer;
  transition: all .15s ease;
}
.obs-mode-btn:hover { color: var(--color-text, #111); }
.obs-mode-btn.active {
  background: var(--color-surface-elevated, #fff);
  color: var(--color-text, #111);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

/* === Klasserum-bar (vises i classroom mode) === */
.obs-classroom-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: linear-gradient(135deg, #f0f7ff 0%, #fff 100%);
  border: 1px solid #d7e6ff;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.obs-classroom-name {
  font-size: var(--text-sm);
  color: var(--color-text-muted, #555);
  font-style: italic;
}

/* === Tier-grupperinger i klasse-tag-grid === */
.tag-tier-hd {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: var(--space-3) 0 var(--space-2) 0;
  margin-top: var(--space-3);
}
.tag-tier-hd::before {
  content: '';
  width: 10px; height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.tag-tier-hd--climate       { color: #b45309; }  /* varm amber */
.tag-tier-hd--climate::before       { background: #f59e0b; }
.tag-tier-hd--management    { color: #1e40af; }  /* blue */
.tag-tier-hd--management::before    { background: #3b82f6; }
.tag-tier-hd--instruction   { color: #166534; }  /* green */
.tag-tier-hd--instruction::before   { background: #22c55e; }

.tag-tile--classroom {
  border: 1px solid #d7dee8;
}
.tag-tile--classroom[data-tier="climate"].selected    { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.2); }
.tag-tile--classroom[data-tier="management"].selected { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.2); }
.tag-tile--classroom[data-tier="instruction"].selected{ border-color: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.2); }

/* === Classroom sparring-kort === */
.sparring-classroom-hd {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border, #e4e4e4);
}
.sparring-classroom-icon {
  font-size: 1.8rem;
}
.sparring-classroom-title {
  flex: 1;
  font-size: var(--text-lg, 1.1rem);
  font-weight: 600;
  margin: 0;
}
.sparring-tier-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--text-xs, .75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.sparring-tier-badge--climate    { background: #fef3c7; color: #92400e; }
.sparring-tier-badge--management { background: #dbeafe; color: #1e40af; }
.sparring-tier-badge--instruction{ background: #dcfce7; color: #166534; }

.intervention-card--classroom {
  border-left: 3px solid #3b82f6;
}

/* === Logbook classroom block === */
.lb-classroom-block {
  background: linear-gradient(135deg, #f0f7ff 0%, #fafdff 100%);
  border: 1px solid #d7e6ff;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
}
.lb-classroom-hd {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid #d7e6ff;
}
.lb-classroom-icon { font-size: 1.1rem; }
.lb-classroom-title {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  color: #1e40af;
}
.lb-obs-badge--classroom {
  background: #dbeafe;
  color: #1e40af;
}
.lb-obs-row--classroom {
  border-left: 2px solid #3b82f6;
  padding-left: var(--space-3);
}
.lb-chip.lb-tier-climate     { outline: 1px dashed #f59e0b; outline-offset: -1px; }
.lb-chip.lb-tier-management  { outline: 1px dashed #3b82f6; outline-offset: -1px; }
.lb-chip.lb-tier-instruction { outline: 1px dashed #22c55e; outline-offset: -1px; }

/* === Teori-bibliotek === */
.th-root {
  display: flex; flex-direction: column; gap: var(--space-4);
  max-width: 800px; margin: 0 auto; padding: var(--space-4) var(--space-2);
}

/* Tabs */
.th-tabnav {
  display: flex; gap: 4px; padding: 4px;
  background: var(--color-surface, #f4f4f5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  align-self: flex-start;
}
.th-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: transparent; border: none;
  border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
  min-height: 36px;
}
.th-tab:hover { color: var(--color-text); }
.th-tab--active {
  background: var(--color-surface-elevated);
  color: var(--color-text);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.th-tab-icon { font-size: 1rem; line-height: 1; }
.th-tab-panel { display: flex; flex-direction: column; gap: var(--space-4); }

/* === Daglig log === */
.dl-header {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.dl-title-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap;
}
.dl-title-block { display: flex; flex-direction: column; gap: 2px; }
.dl-date {
  margin: 0; font-size: 1.25rem; font-weight: 600;
  color: var(--color-text); text-transform: capitalize;
}
.dl-sub {
  margin: 0; font-size: var(--text-xs); color: var(--color-text-muted);
}
.dl-date-controls {
  display: inline-flex; align-items: stretch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface);
}
.dl-date-arrow {
  width: 36px; padding: 0;
  background: transparent; border: none;
  font-size: 1.1rem; color: var(--color-text);
  cursor: pointer;
  transition: background .12s;
}
.dl-date-arrow:hover:not(:disabled) { background: var(--color-accent-subtle); }
.dl-date-arrow:disabled { color: var(--color-border); cursor: not-allowed; }
.dl-date-picker {
  border: none; border-left: 1px solid var(--color-border); border-right: 1px solid var(--color-border);
  padding: 6px 10px;
  background: var(--color-surface);
  font: inherit; font-size: var(--text-sm); color: var(--color-text);
  min-height: 36px;
}
.dl-date-picker:focus { outline: 2px solid var(--color-accent); outline-offset: -2px; }

.dl-classroom-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding-top: var(--space-2);
  border-top: 1px dashed var(--color-border);
}
.dl-cc {
  padding: 5px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.8rem; font-weight: 500;
  min-height: 30px;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.dl-cc:hover { border-color: var(--color-accent); color: var(--color-accent); }
.dl-cc--active {
  background: var(--color-accent); border-color: var(--color-accent); color: #fff;
}

.dl-summary-bar {
  display: flex; height: 6px; border-radius: var(--radius-full);
  overflow: hidden; background: var(--color-border);
}
.dl-sb-fill { transition: flex .25s; }
.dl-sb-fill--pos { background: oklch(58% 0.16 145); }
.dl-sb-fill--neu { background: oklch(70% 0 0); }
.dl-sb-fill--neg { background: oklch(62% 0.18 35); }

.dl-summary-legend {
  display: flex; gap: var(--space-3); flex-wrap: wrap;
  font-size: var(--text-xs); font-weight: 500;
}
.dl-leg--pos { color: oklch(45% 0.16 145); }
.dl-leg--neu { color: var(--color-text-muted); }
.dl-leg--neg { color: oklch(50% 0.18 35); }

/* Empty state */
.dl-empty {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-2); padding: var(--space-8) var(--space-4);
  color: var(--color-text-muted); text-align: center;
}
.dl-empty-icon { font-size: 2.4rem; opacity: 0.6; }
.dl-empty p { margin: 0; font-size: var(--text-base); font-weight: 500; }
.dl-empty small { color: var(--color-text-muted); }

/* Student list (Approach 1: dense list with tag strip) */
.dl-list {
  display: flex; flex-direction: column;
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.dl-student + .dl-student { border-top: 1px solid var(--color-border); }
.dl-student--open { background: var(--color-surface); }

.dl-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: var(--space-3);
  width: 100%; padding: 12px var(--space-4);
  background: transparent; border: none;
  cursor: pointer; text-align: left;
  min-height: 56px;
  transition: background .12s;
}
.dl-row:hover { background: var(--color-accent-subtle); }
.dl-student--open .dl-row { background: transparent; }

.dl-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-radius: var(--radius-full);
  font-size: 0.7rem; font-weight: 700;
  flex-shrink: 0;
}
.dl-alias {
  display: none;
  font-size: var(--text-sm); font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
}
.dl-tag-strip {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  min-width: 0;
}

.dl-meta {
  display: inline-flex; align-items: center; gap: var(--space-2);
  flex-shrink: 0; font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.dl-vbadge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: var(--radius-full);
  font-size: 0.7rem; font-weight: 600;
}
.dl-vbadge--pos { background: oklch(94% 0.06 145); color: oklch(40% 0.16 145); }
.dl-vbadge--neg { background: oklch(95% 0.05 35); color: oklch(45% 0.18 35); }
.dl-time { font-variant-numeric: tabular-nums; }
.dl-chevron {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; transition: transform .18s;
  color: var(--color-text-muted);
}
.dl-student--open .dl-chevron { transform: rotate(180deg); }

/* Tag chips (compact, semantic colors) */
.dl-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 0.72rem; font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
}
.dl-chip--positive {
  background: oklch(96% 0.04 145); color: oklch(35% 0.16 145);
  border-color: oklch(88% 0.08 145);
}
.dl-chip--negative {
  background: oklch(96% 0.04 35); color: oklch(40% 0.16 35);
  border-color: oklch(88% 0.08 35);
}
.dl-chip--neutral {
  background: var(--color-surface); color: var(--color-text-muted);
  border-color: var(--color-border);
}
.dl-chip--more {
  background: var(--color-accent-subtle); color: var(--color-accent);
  font-weight: 600;
}

/* Detail (expanded) */
.dl-detail {
  padding: 4px var(--space-4) var(--space-4) calc(var(--space-4) + 32px + var(--space-3));
  display: flex; flex-direction: column; gap: var(--space-3);
  background: var(--color-surface);
  border-top: 1px dashed var(--color-border);
}
.dl-obs {
  display: flex; flex-direction: column; gap: 6px;
  padding: var(--space-2) 0;
}
.dl-obs + .dl-obs { border-top: 1px dotted var(--color-border); padding-top: var(--space-3); }
.dl-obs-meta {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); color: var(--color-text-muted);
}
.dl-obs-time {
  font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--color-text);
}
.dl-d-phase {
  padding: 1px 7px; border-radius: var(--radius-sm);
  background: var(--color-accent-subtle); color: var(--color-accent);
  font-size: 0.7rem; font-weight: 500;
}
.dl-d-tags {
  display: flex; flex-direction: column; gap: 6px;
}
.dl-d-tag {
  display: flex; align-items: center; gap: var(--space-2);
  flex-wrap: wrap;
}
.dl-d-theories {
  font-size: 0.68rem; color: var(--color-text-muted);
  font-style: italic;
}
.dl-d-theories abbr { text-decoration: none; cursor: help; }
.dl-d-note {
  margin: 0; padding: var(--space-2) var(--space-3);
  border-left: 3px solid var(--color-accent);
  background: var(--color-surface-elevated);
  font-size: var(--text-sm); color: var(--color-text);
  line-height: 1.5; font-style: italic;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

@media (min-width: 480px) {
  .dl-row { grid-template-columns: auto auto 1fr auto; }
  .dl-alias { display: inline; }
}

.th-header { display: flex; flex-direction: column; gap: var(--space-2); }
.th-header h2 { margin: 0; font-size: var(--text-xl, 1.4rem); }
.th-lede { color: var(--color-text-muted, #555); margin: 0; font-size: var(--text-sm); }
.th-search {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border, #e4e4e4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  background: var(--color-surface-elevated, #fff);
  min-height: var(--touch-min);
}
.th-search:focus {
  outline: 2px solid #3b82f6; outline-offset: 2px;
}
.th-count { font-size: var(--text-xs); color: var(--color-text-muted); }
.th-loading, .th-empty {
  text-align: center; color: var(--color-text-muted);
  padding: var(--space-6);
}

.th-list { display: flex; flex-direction: column; gap: var(--space-3); }

.th-card {
  background: var(--color-surface-elevated, #fff);
  border: 1px solid var(--color-border, #e4e4e4);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.th-card:hover:not(.th-card--open) {
  border-color: #3b82f6;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.th-card--open {
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59,130,246,.12);
}
.th-card-hd {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; padding: var(--space-4);
  background: transparent; border: none; cursor: pointer;
  text-align: left;
}
.th-card-hd-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.th-card-titles { display: flex; align-items: baseline; gap: var(--space-2); flex-wrap: wrap; }
.th-short {
  display: inline-block;
  background: #eff6ff; color: #1e40af;
  padding: 2px 10px; border-radius: 999px;
  font-size: var(--text-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.th-full { margin: 0; font-size: var(--text-base); font-weight: 600; }
.th-authors { margin: 0; font-size: var(--text-xs); color: var(--color-text-muted); font-style: italic; }
.th-chevron { font-size: 1.2rem; color: var(--color-text-muted); transition: transform .15s ease; }

.th-card-body {
  padding: 0 var(--space-4) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-4);
  border-top: 1px solid var(--color-border, #e4e4e4);
  padding-top: var(--space-4);
}
.th-section { display: flex; flex-direction: column; gap: var(--space-2); }
.th-section-hd {
  margin: 0;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #1e40af;
}
.th-core { margin: 0; line-height: 1.55; }
.th-bullets { margin: 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); }
.th-bullets li { line-height: 1.45; }
.th-bullets--actions li { color: #166534; }
.th-bullets--actions li::marker { color: #22c55e; content: '▸  '; }
.th-quotes {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: var(--space-2);
}
.th-quotes li {
  padding: var(--space-2) var(--space-3);
  background: #f0f7ff;
  border-left: 3px solid #3b82f6;
  border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
  font-style: italic;
  font-size: var(--text-sm);
}

.th-chunks { display: flex; flex-direction: column; gap: var(--space-2); }
.th-chunk {
  border: 1px solid var(--color-border, #e4e4e4);
  border-radius: var(--radius-sm, 6px);
  background: #fafbfc;
}
.th-chunk[open] { border-color: #3b82f6; background: #fff; }
.th-chunk-summary {
  padding: var(--space-3);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
  list-style: none;
}
.th-chunk-summary::-webkit-details-marker { display: none; }
.th-chunk-summary::before { content: '▸'; color: var(--color-text-muted); margin-right: var(--space-2); }
.th-chunk[open] .th-chunk-summary::before { content: '▾'; }
.th-chunk-source { color: var(--color-text-muted); font-style: italic; font-size: var(--text-xs); }
.th-chunk-body {
  padding: 0 var(--space-4) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-3);
}
.th-chunk-core { margin: 0; line-height: 1.55; font-size: var(--text-sm); }
.th-chunk-body h5 {
  margin: 0 0 var(--space-1) 0;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #1e40af;
}
.th-nochunks { color: var(--color-text-muted); font-style: italic; }

/* === Peer-dynamik sparring === */
.sparring-peer-hd {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
  border-bottom: 2px solid #8b5cf6;
}
.sparring-peer-icon { font-size: 1.8rem; }
.sparring-peer-titles { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sparring-peer-title {
  margin: 0;
  font-size: var(--text-lg, 1.1rem);
  font-weight: 600;
  color: #5b21b6;
}
.sparring-peer-badges { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.sparring-peer-code {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--text-xs, .75rem);
  font-weight: 600;
  letter-spacing: .04em;
  background: #ede9fe;
  color: #5b21b6;
  font-family: ui-monospace, monospace;
}
.sparring-phase-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--text-xs, .75rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sparring-phase-badge--forming    { background: #e0e7ff; color: #3730a3; }
.sparring-phase-badge--storming   { background: #fee2e2; color: #991b1b; }
.sparring-phase-badge--norming    { background: #fef3c7; color: #92400e; }
.sparring-phase-badge--performing { background: #dcfce7; color: #166534; }
.sparring-phase-badge--unclear    { background: #f3f4f6; color: #4b5563; }

.peer-focus {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: #faf5ff;
  border: 1px solid #ede9fe;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}
.peer-focus-lbl { font-weight: 600; color: #5b21b6; }
.peer-focus-chip {
  padding: 2px 10px;
  border-radius: 999px;
  background: #8b5cf6;
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 500;
}

.peer-evidence {
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: #fafbfc;
  border: 1px solid var(--color-border, #e4e4e4);
  border-radius: var(--radius-md);
}
.peer-evidence summary {
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #5b21b6;
}
.peer-evidence summary::-webkit-details-marker { display: none; }
.peer-evidence summary::before { content: '▸'; margin-right: var(--space-2); }
.peer-evidence[open] summary::before { content: '▾'; }
.peer-evidence-list {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
  line-height: 1.5;
  display: flex; flex-direction: column; gap: 4px;
}

.intervention-card--peer {
  border-left: 3px solid #8b5cf6;
}

/* === Sparring-picker (3-kort layout) === */
.sparring-picker {
  margin-top: var(--space-5, 1.5rem);
  padding-top: var(--space-5, 1.5rem);
  border-top: 1px solid var(--color-border, #e4e4e4);
}
.sparring-picker-hd {
  display: flex; flex-direction: column; gap: var(--space-1);
  margin-bottom: var(--space-4, 1rem);
}
.sparring-picker-title {
  margin: 0; font-size: var(--text-lg, 1.125rem); font-weight: 600;
}
.sparring-picker-lede {
  margin: 0; color: var(--color-text-muted, #555);
  font-size: var(--text-sm, .9rem); line-height: 1.45;
}
/* ── Admin/skole-dashboard ────────────────────────────────────────────── */
.adm-root {
  display: flex; flex-direction: column;
  max-width: 980px; margin: 0 auto;
  padding: var(--space-5);
  gap: var(--space-5);
}
.adm-hd { display: flex; flex-direction: column; gap: 4px; }
.adm-hd h2 { margin: 0; font-size: 1.5rem; font-weight: 600; }
.adm-sub { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); }

.adm-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}
.adm-kpi {
  display: flex; flex-direction: column;
  padding: var(--space-4);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.adm-kpi-value {
  font-size: 1.8rem; font-weight: 700; color: var(--color-text);
  line-height: 1;
}
.adm-kpi-value--warn { color: oklch(50% 0.18 50); }
.adm-kpi-label {
  font-size: var(--text-xs); color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .04em;
  margin-top: 6px;
}

.adm-section {
  display: flex; flex-direction: column; gap: var(--space-3);
}
.adm-section h3 {
  margin: 0;
  font-size: var(--text-base); font-weight: 600;
  color: var(--color-text);
}

.adm-bar {
  display: flex; height: 18px;
  border-radius: var(--radius-full);
  overflow: hidden;
  background: var(--color-border);
}
.adm-bar-seg { transition: width .3s; }
.adm-bar-seg--accept { background: oklch(60% 0.16 145); }
.adm-bar-seg--modify { background: oklch(60% 0.18 230); }
.adm-bar-seg--reject { background: oklch(60% 0.18 35); }

.adm-bar-legend {
  display: flex; gap: var(--space-3); flex-wrap: wrap;
  font-size: var(--text-xs);
}
.adm-leg--accept { color: oklch(40% 0.16 145); font-weight: 500; }
.adm-leg--modify { color: oklch(40% 0.18 230); font-weight: 500; }
.adm-leg--reject { color: oklch(40% 0.18 35); font-weight: 500; }

.adm-tags {
  display: flex; flex-direction: column; gap: 6px;
}
.adm-tag-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.adm-tag-label {
  font-size: var(--text-sm); font-weight: 500;
}
.adm-tag-label--positive::before { content: '✓ '; color: oklch(50% 0.16 145); }
.adm-tag-label--negative::before { content: '⚠ '; color: oklch(50% 0.18 35); }
.adm-tag-count {
  font-weight: 600; color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.adm-teacher-table {
  width: 100%; border-collapse: collapse;
  font-size: var(--text-sm);
}
.adm-teacher-table th, .adm-teacher-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.adm-teacher-table th {
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--color-text-muted);
}
.adm-teacher-table code {
  font-size: 0.7rem;
  padding: 1px 5px;
  background: var(--color-surface);
  border-radius: 3px;
}
.adm-status {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 500;
}
.adm-status--active { background: oklch(94% 0.06 145); color: oklch(40% 0.16 145); }
.adm-status--warn { background: oklch(94% 0.06 50); color: oklch(45% 0.18 50); }
.adm-status--inactive { background: oklch(94% 0.05 35); color: oklch(45% 0.18 35); }
.adm-status--none { background: var(--color-surface); color: var(--color-text-muted); }

/* Bias-monitor sektion */
.adm-bias-alert {
  background: oklch(97% 0.03 25);
  border: 1px solid oklch(80% 0.12 25);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.adm-bias-alert-hd { font-weight: 600; color: oklch(45% 0.18 25); margin-bottom: var(--space-1); }
.adm-bias-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.adm-bias-table th {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 2px solid var(--color-border);
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.adm-bias-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
}
.adm-bias-chip {
  display: inline-block;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}
.adm-bias-chip--ok     { background: oklch(94% 0.06 145); color: oklch(40% 0.16 145); }
.adm-bias-chip--warn   { background: oklch(94% 0.06 50);  color: oklch(45% 0.18 50); }
.adm-bias-chip--alert  { background: oklch(94% 0.05 25);  color: oklch(45% 0.18 25); }

/* MFA-advarsel til school_admin */
.adm-mfa-warn {
  background: oklch(97% 0.04 70);
  border: 1px solid oklch(80% 0.12 70);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  color: oklch(40% 0.16 60);
}
.adm-mfa-link {
  display: inline-block;
  margin-left: var(--space-2);
  font-weight: 600;
  color: oklch(40% 0.16 60);
  text-decoration: underline;
}

.adm-empty {
  padding: var(--space-6);
  text-align: center;
  max-width: 480px; margin: 0 auto;
}
.adm-footer {
  margin-top: var(--space-3);
  font-size: 0.7rem;
  font-style: italic;
  border-top: 1px dashed var(--color-border);
  padding-top: var(--space-3);
}

.mode-btn.hidden { display: none; }

/* ── Logbog søgefelt ──────────────────────────────────────────────────── */
.lb-search-wrap {
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border);
}
.lb-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  font: inherit;
  font-size: var(--text-sm);
  transition: border-color .15s, box-shadow .15s;
}
.lb-search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.lb-search-results {
  margin-top: var(--space-3);
  max-height: 480px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.lb-search-results.hidden { display: none; }
.lb-search-loading,
.lb-search-error,
.lb-search-empty,
.lb-search-count {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.lb-search-count { font-weight: 600; padding-bottom: 4px; }
.lb-search-error { color: var(--color-negative); }

.lb-search-hit {
  padding: 10px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent-subtle);
  border-radius: var(--radius-sm);
  display: flex; flex-direction: column; gap: 4px;
}
.lb-search-hit--student-observation { border-left-color: oklch(60% 0.16 250); }
.lb-search-hit--classroom-observation { border-left-color: oklch(60% 0.16 195); }
.lb-search-hit--reflection { border-left-color: oklch(60% 0.16 95); }
.lb-search-hit-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}
.lb-search-hit-kind {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text);
}
.lb-search-hit-time { margin-left: auto; }
.lb-search-hit-note {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--color-text);
}
.lb-search-hit-tags {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.lb-search-tag {
  font-size: 0.65rem;
  padding: 1px 6px;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-radius: var(--radius-full);
}

/* ── Logbog analytics: trends + heatmap ───────────────────────────────── */
.lb-analytics {
  display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-5) var(--space-5);
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border);
}
.lb-analytics-title {
  margin: 0 0 4px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.lb-analytics-sub {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.trend-spark {
  width: 100%; max-width: 380px; height: auto;
}
.spark-dot {
  fill: oklch(35% 0.16 145);
  cursor: help;
}
.heatmap-wrap {
  display: flex; flex-direction: column; gap: 8px;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14px, 1fr));
  gap: 3px;
  max-width: 480px;
}
.hm-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  transition: transform .12s;
  min-width: 14px;
  cursor: help;
}
.hm-cell:hover { transform: scale(1.4); z-index: 1; position: relative; }

@media (prefers-reduced-motion: reduce) {
  .hm-cell { transition: none; }
  .hm-cell:hover { transform: none; outline: 2px solid var(--color-accent); }
}
.heatmap-legend {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3);
  font-size: 0.7rem;
  color: var(--color-text-muted);
}
.heatmap-scale {
  display: inline-flex; gap: 2px;
}
.heatmap-scale span {
  display: inline-block; width: 10px; height: 10px; border-radius: 2px;
}
.chart-empty {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-style: italic;
  padding: var(--space-2) 0;
}

/* Inactivity nudges */
.lb-nudge {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid;
  margin: 0;
  font-size: var(--text-sm);
}
.lb-nudge-icon { font-size: 1.2rem; }
.lb-nudge.nudge-gentle {
  background: oklch(96% 0.04 230);
  border-left-color: oklch(60% 0.16 230);
  color: oklch(35% 0.14 230);
}
.lb-nudge.nudge-strong {
  background: oklch(96% 0.06 50);
  border-left-color: oklch(60% 0.18 50);
  color: oklch(35% 0.16 50);
  font-weight: 500;
}

/* ── WCAG 2.2 AA — accessibility baseline ─────────────────────────────── */

/* Synlig focus-ring på alle interaktive elementer (WCAG 2.4.7) */
*:focus-visible {
  outline: 2px solid var(--color-accent, #2563eb);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Touch target minimum 44x44px (WCAG 2.5.5 / Apple HIG) */
button, [role="button"], [role="radio"], a {
  min-height: 24px;  /* fallback — concrete buttons har deres egen min-height */
}

/* Skip-to-content link (WCAG 2.4.1) — synlig ved tab */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 12px 20px;
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  outline: 3px solid #fff;
}

/* High-contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-border: oklch(40% 0 0);
    --color-text-muted: oklch(25% 0 0);
  }
  .dl-chip, .lb-chip { border-width: 2px; }
}

/* Reduced motion — disable spinners, animations, transitions */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Hide visually but keep available for screen readers */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── PWA install button ───────────────────────────────────────────────── */
.pwa-install-btn {
  position: fixed;
  bottom: 16px; right: 16px;
  z-index: 999;
  padding: 10px 16px;
  background: var(--color-accent, #2563eb);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
  transition: transform .15s, box-shadow .15s;
}
.pwa-install-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37,99,235,0.4);
}
.pwa-install-btn.hidden { display: none; }

/* ── Offline banner ───────────────────────────────────────────────────── */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  padding: 10px 16px;
  background: oklch(70% 0.18 50);
  color: #fff;
  font-size: var(--text-sm); font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.offline-banner.hidden { display: none; }

/* ── Empty classroom state ────────────────────────────────────────────── */
.classroom-empty {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4) 0;
  align-items: flex-start;
}

/* ── EU AI Act compliance UI ──────────────────────────────────────────── */
.ai-disclosure-panel {
  margin-bottom: var(--space-3);
}
.ai-disclosure-card {
  padding: var(--space-4);
  background: linear-gradient(180deg, oklch(95% 0.06 95) 0%, var(--color-surface-elevated) 100%);
  border: 1px solid oklch(80% 0.12 95);
  border-left: 3px solid oklch(60% 0.15 95);
  border-radius: var(--radius-md);
}
.ai-disclosure-card h3 { margin: 0 0 var(--space-2); font-size: var(--text-base); font-weight: 600; }
.ai-disclosure-card ul { margin: 0 0 var(--space-3); padding-left: 1.2em; font-size: var(--text-sm); line-height: 1.6; }
.ai-disclosure-card li { margin-bottom: 4px; }
.ai-disc-ok { padding: 8px 16px; }

.ai-decision-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px;
  margin-bottom: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
}
.ai-decision-lbl {
  flex: 1 1 100%;
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ai-dec-btn {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  background: transparent;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  min-height: 32px;
}
.ai-dec-btn:hover:not(:disabled) { border-color: var(--color-accent); }
.ai-dec-btn:disabled { opacity: 0.5; cursor: default; }
.ai-dec-btn--accept:hover:not(:disabled) { color: oklch(45% 0.16 145); border-color: oklch(60% 0.16 145); }
.ai-dec-btn--reject:hover:not(:disabled) { color: oklch(45% 0.18 35); border-color: oklch(60% 0.18 35); }
.ai-decision-status {
  font-weight: 600; font-size: 0.78rem;
}
.ai-decision-status--accepted { color: oklch(45% 0.16 145); }
.ai-decision-status--rejected { color: oklch(45% 0.18 35); }
.ai-decision-status--modified { color: var(--color-accent); }

/* ── Sparring loading state ───────────────────────────────────────────── */
.sparring-loading {
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-3);
  padding: var(--space-6, 1.5rem) var(--space-4, 1rem);
  text-align: center;
}
.sparring-spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--color-accent-subtle, rgba(37,99,235,.15));
  border-top-color: var(--color-accent, #2563eb);
  border-radius: 50%;
  animation: sparring-spin 0.9s linear infinite;
}
@keyframes sparring-spin { to { transform: rotate(360deg); } }
.sparring-loading-title {
  margin: 0; font-size: var(--text-base, 1rem); font-weight: 600;
  color: var(--color-text);
}
.sparring-loading-sub {
  margin: 0; font-size: var(--text-sm, .875rem);
  color: var(--color-text-muted);
  max-width: 36ch; line-height: 1.45;
}
@media (prefers-reduced-motion: reduce) {
  .sparring-spinner { animation: none; border-top-color: var(--color-accent); }
}

/* ── Sparring question field ──────────────────────────────────────────── */
.sparring-question {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: var(--space-3, .8rem);
  padding: var(--space-3, .75rem);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--color-accent) 6%, var(--color-surface-elevated)) 0%,
    var(--color-surface-elevated) 100%);
  border: 1px solid var(--color-accent-subtle, rgba(37,99,235,.15));
  border-left: 3px solid var(--color-accent, #2563eb);
  border-radius: var(--radius-md, 10px);
}
.sparring-question-lbl {
  font-size: var(--text-xs, .75rem);
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: .04em;
  display: flex; align-items: baseline; gap: var(--space-2);
  flex-wrap: wrap;
}
.sparring-question-hint {
  font-weight: 400; text-transform: none; letter-spacing: 0;
  font-size: 0.7rem;
  color: var(--color-text-muted);
}
.sparring-question-input {
  width: 100%;
  padding: var(--space-2, .5rem) var(--space-3, .75rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm, 6px);
  background: var(--color-surface, #fff);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm, .9rem);
  line-height: 1.4;
  resize: vertical;
  min-height: 56px;
  transition: border-color .15s, box-shadow .15s;
}
.sparring-question-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.sparring-question-input::placeholder {
  color: var(--color-text-muted);
  font-style: italic;
  opacity: 0.7;
}

/* ── Focus selector ───────────────────────────────────────────────────── */
.focus-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2, .5rem);
  margin-bottom: var(--space-3, .8rem);
}
.focus-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2, .5rem);
  padding: var(--space-3, .75rem) var(--space-2, .5rem);
  background: var(--color-surface-elevated, #fff);
  border: 2px solid var(--color-border, #e4e4e4);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  text-align: center;
  min-height: 96px;
}
.focus-option:hover {
  border-color: var(--color-accent, #2563eb);
  background: var(--color-accent-subtle, rgba(37,99,235,.05));
}
.focus-option--selected[data-scope="student"] {
  border-color: #2563eb;
  background: rgba(37,99,235,.07);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.focus-option--selected[data-scope="classroom"] {
  border-color: #0891b2;
  background: rgba(8,145,178,.07);
  box-shadow: 0 0 0 3px rgba(8,145,178,.12);
}
.focus-option--selected[data-scope="peer"] {
  border-color: #8b5cf6;
  background: rgba(139,92,246,.07);
  box-shadow: 0 0 0 3px rgba(139,92,246,.12);
}
.focus-option-icon {
  font-size: 1.6rem;
  line-height: 1;
}
.focus-option-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.focus-option-title {
  display: block;
  font-size: var(--text-sm, .9rem);
  font-weight: 600;
  color: var(--color-text, #111);
}
.focus-option-sub {
  display: block;
  font-size: .65rem;
  color: var(--color-text-muted, #64748b);
  line-height: 1.3;
}
/* Student context (hides when other scope selected) */
.focus-student-ctx {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-3, .8rem);
}
.focus-student-ctx.hidden { display: none; }
.focus-student-lbl {
  font-size: var(--text-xs, .7rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted, #64748b);
}
/* Action row */
.sparring-action-row {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3, .8rem);
  flex-wrap: wrap;
}
.sparring-range {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sparring-range-lbl {
  font-size: var(--text-xs, .7rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted, #64748b);
}
.sparring-range select {
  padding: var(--space-1, .25rem) var(--space-2, .5rem);
  border: 1px solid var(--color-border, #e4e4e4);
  border-radius: 6px;
  background: var(--color-surface, #fff);
  font-size: var(--text-sm, .875rem);
  min-width: 180px;
}
.sparring-submit-btn { margin-left: auto; white-space: nowrap; }
.sparring-main-error {
  margin: var(--space-2, .5rem) 0 0;
  color: var(--color-negative, #dc2626);
  font-size: var(--text-sm, .875rem);
}
.sparring-main-error.hidden { display: none; }
.sparring-pill-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 6px;
  background: #f8fafc;
  border: 1px solid var(--color-border, #e4e4e4);
  border-radius: 10px;
  min-height: 44px;
  align-items: center;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.sparring-pill-row--error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220,38,38,.15);
  animation: shake-select .4s ease;
}
.sparring-pill {
  padding: 6px 14px;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 999px;
  font-size: var(--text-sm, .9rem);
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all .12s ease;
  white-space: nowrap;
  min-height: 32px;
}
.sparring-pill:hover {
  border-color: #2563eb;
  color: #2563eb;
}
.sparring-pill:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
.sparring-pill--selected,
.sparring-pill--selected:hover {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 1px 4px rgba(37,99,235,.3);
}
.sparring-pill-empty {
  font-size: var(--text-sm, .9rem);
  color: var(--color-text-muted, #64748b);
  font-style: italic;
  padding: 0 var(--space-2, .5rem);
}
.sparring-pill-error {
  margin: 0;
  font-size: var(--text-xs, .75rem);
  color: #dc2626;
  font-weight: 500;
}
@keyframes shake-select {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

@media (max-width: 520px) {
  .focus-selector { grid-template-columns: 1fr; }
  .sparring-action-row { flex-direction: column; align-items: stretch; }
  .sparring-submit-btn { margin-left: 0; }
}

/* Nudge banner */
.nudge-banner {
  position: fixed; top: var(--space-4); left: var(--space-4); right: var(--space-4);
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: 0 4px 24px rgba(0,0,0,0.12);
  z-index: 50;
  display: flex; flex-direction: column; gap: var(--space-2);
}

/* Classroom screen */
.classroom-screen {
  display: flex; flex-direction: column; min-height: 100dvh;
  max-width: 640px; margin: 0 auto; padding: var(--space-6);
  gap: var(--space-6);
}
.classroom-screen h1 { font-size: var(--text-lg); font-weight: 700; }
.classroom-list { display: flex; flex-direction: column; gap: var(--space-3); }
.classroom-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
  transition: border-color var(--duration-fast), background var(--duration-fast);
}
.classroom-card:hover { border-color: var(--color-accent); background: var(--color-accent-subtle); }
.classroom-card .classroom-name { font-weight: 600; }
.classroom-card .classroom-meta { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }
.classroom-card-actions { display: flex; gap: var(--space-2); }
.btn-icon {
  background: none; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted);
  min-height: 32px; min-width: 32px; cursor: pointer;
}
.btn-icon:hover { border-color: var(--color-negative); color: var(--color-negative); }
.btn-add-classroom {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted); font-size: var(--text-sm);
  background: none; cursor: pointer; width: 100%;
  transition: border-color var(--duration-fast), color var(--duration-fast);
}
.btn-add-classroom:hover { border-color: var(--color-accent); color: var(--color-accent); }
.classroom-cache-banner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
  background: #fef3c7; border: 1px solid #f59e0b; border-radius: var(--radius-md);
  font-size: var(--text-sm); color: #92400e;
}
.classroom-cache-banner button {
  flex-shrink: 0; padding: var(--space-1) var(--space-3);
  background: #f59e0b; color: #fff; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: var(--text-xs);
}
.classroom-cache-banner button:hover { background: #d97706; }
.btn-export {
  display: inline-flex; align-items: center; gap: 6px;
  align-self: flex-start;
  padding: 8px 14px;
  border: 1.5px solid var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  border-radius: var(--radius-full, 999px);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
  margin-top: var(--space-3);
}
.btn-export:hover:not(:disabled) {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}
.btn-export:disabled { opacity: 0.6; cursor: not-allowed; }

/* Create classroom modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.45);
}
.modal-box {
  background: var(--color-surface-elevated);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  width: min(400px, calc(100vw - var(--space-8)));
  display: flex; flex-direction: column; gap: var(--space-4);
}
.modal-box h2 { font-size: var(--text-base); font-weight: 600; }
.modal-box input[type="text"] {
  width: 100%; padding: var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: var(--text-base);
}
.modal-box input[type="text"]:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.modal-actions { display: flex; gap: var(--space-3); justify-content: flex-end; }
.btn-secondary {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: none; font-size: var(--text-sm); min-height: 40px;
}

/* Student list (classroom detail) */
.student-list {
  list-style: none; display: flex; flex-direction: column;
  gap: var(--space-2); margin-bottom: var(--space-3);
}
.student-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
.student-alias { font-weight: 500; }
.add-student-row {
  display: flex; gap: var(--space-2);
}
.add-student-row input[type="text"] {
  flex: 1; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: var(--text-sm); min-height: var(--touch-min);
}
.add-student-row input[type="text"]:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Global select fallback (used in classroom detail) */
select {
  flex: 1; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: var(--text-sm); min-height: 40px;
  cursor: pointer;
}
select:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ── Observation input panel ─────────────────────── */
.obs-input-panel {
  display: flex; flex-direction: column; gap: 0;
  flex: 1;
}

/* Student bar */
.obs-student-bar {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border);
  position: sticky; top: 60px; z-index: 5;
}
.obs-student-lbl {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--color-text-muted);
  white-space: nowrap; flex-shrink: 0;
}
.obs-student-bar select {
  flex: 1; border: none; background: none;
  font: inherit; font-weight: 600; font-size: var(--text-sm);
  color: var(--color-text); padding: 0; min-height: auto;
  border-radius: 0;
}

/* Student bar — pill-variant */
.obs-student-bar--pills {
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.obs-pill-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  flex: 1;
  min-width: 0;
  padding: 4px;
  border-radius: 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.obs-pill-row--error {
  background: rgba(220,38,38,.06);
  box-shadow: inset 0 0 0 1px #dc2626;
  animation: shake-select .4s ease;
}
.obs-pill {
  padding: 6px 14px;
  border: 1px solid var(--color-border, #e4e4e4);
  background: var(--color-surface-elevated, #fff);
  border-radius: 999px;
  font-size: var(--text-sm, .9rem);
  font-weight: 500;
  color: var(--color-text, #111);
  cursor: pointer;
  transition: all .12s ease;
  white-space: nowrap;
  min-height: 32px;
}
.obs-pill:hover {
  border-color: #2563eb;
  color: #2563eb;
}
.obs-pill:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
.obs-pill--selected,
.obs-pill--selected:hover {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  box-shadow: 0 1px 4px rgba(37,99,235,.3);
}
.obs-pill-empty {
  font-size: var(--text-sm, .9rem);
  color: var(--color-text-muted, #64748b);
  font-style: italic;
}

/* Tags section */
.obs-tags-section { padding: var(--space-3) var(--space-4) var(--space-2); }
.obs-section-hd {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-2);
}
.obs-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--color-text-muted);
}
.obs-tag-count {
  font-size: var(--text-xs); font-weight: 600; color: var(--color-accent);
  background: var(--color-accent-subtle); padding: 2px 10px;
  border-radius: var(--radius-full);
}
.obs-tag-count.hidden { display: none; }

/* Tag groups */
#obs-tag-grid { display: flex; flex-direction: column; gap: var(--space-1); }
.tag-group-hd {
  font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: var(--space-2) 0 var(--space-1);
}
.tag-group-hd--positive { color: oklch(42% 0.16 145); }
.tag-group-hd--negative { color: oklch(46% 0.16 35); }

/* Kategori-headers — pædagogisk gruppering */
.tag-cat-hd {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) 0 var(--space-1);
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase;
  color: #334155;
  border-bottom: 1px solid var(--color-border, #e4e4e4);
  margin-bottom: var(--space-1);
}
.tag-cat-hd::before {
  content: ''; width: 4px; height: 14px; border-radius: 2px;
  background: currentColor;
  flex-shrink: 0;
}
.tag-cat-hd--task-engagement       { color: #1d4ed8; }
.tag-cat-hd--emotion-mindset       { color: #b45309; }
.tag-cat-hd--help-relation         { color: #0d9488; }
.tag-cat-hd--peer-dynamics         { color: #7c3aed; }
.tag-cat-hd--learning-environment  { color: #475569; }

.tag-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

/* Tag tiles — kompakt, tekst-only (ingen ikoner) */
.tag-tile {
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  min-height: 32px;
  text-align: center;
  font-weight: 500;
  cursor: pointer;
  transition: transform var(--duration-fast), background var(--duration-fast), border-color var(--duration-fast);
}
.tag-tile:active { transform: scale(0.97); }
.tag-icon { display: none; }
.tag-label { font-size: var(--text-xs); line-height: 1.2; hyphens: auto; overflow-wrap: break-word; word-break: break-word; }

/* Valence default */
.tag-tile[data-valence="positive"] {
  background: oklch(96% 0.025 145); border-color: oklch(84% 0.07 145);
}
.tag-tile[data-valence="negative"] {
  background: oklch(97% 0.02 35); border-color: oklch(87% 0.07 35);
}
/* Valence hover */
.tag-tile[data-valence="positive"]:hover {
  background: oklch(93% 0.05 145); border-color: oklch(68% 0.13 145);
}
.tag-tile[data-valence="negative"]:hover {
  background: oklch(94% 0.05 35); border-color: oklch(70% 0.13 35);
}
/* Valence selected */
.tag-tile.selected[data-valence="positive"] {
  background: oklch(89% 0.10 145); border-color: oklch(50% 0.19 145); border-width: 2px;
}
.tag-tile.selected[data-valence="negative"] {
  background: oklch(91% 0.10 35); border-color: oklch(52% 0.19 35); border-width: 2px;
}

/* Note + voice */
.obs-note-wrap {
  padding: 0 var(--space-4) var(--space-2);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.obs-input-panel textarea {
  width: 100%; padding: var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: var(--text-sm);
  resize: none; min-height: 60px;
  transition: border-color var(--duration-fast);
}
.obs-input-panel textarea:focus { outline: none; border-color: var(--color-accent); }
.obs-note-actions { display: flex; gap: var(--space-2); align-items: center; }
.voice-btn {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-full);
  background: var(--color-surface); font-size: var(--text-sm);
  color: var(--color-text-muted); min-height: 36px;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
}
.voice-btn.active {
  background: var(--color-negative); color: #fff; border-color: var(--color-negative);
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
.voice-status { font-size: var(--text-xs); color: var(--color-text-muted); flex: 1; font-style: italic; }

/* Theory + footer */
.obs-footer {
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-elevated);
  display: flex; flex-direction: column; gap: var(--space-3);
  margin-top: auto;
}
.theory-row { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-height: 20px; }
.theory-row-label {
  font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--color-text-muted); white-space: nowrap;
}
.obs-theory-hint { font-size: var(--text-xs); color: var(--color-text-muted); }
.theory-chip {
  background: var(--color-accent-subtle); color: var(--color-accent);
  border-radius: var(--radius-full); padding: 2px 10px;
  font-size: var(--text-xs); font-weight: 600;
}
.btn-log {
  width: 100%; padding: var(--space-3);
  background: var(--color-accent); color: #fff;
  border-radius: var(--radius-md); font-weight: 600;
  font-size: var(--text-sm); min-height: var(--touch-min);
  transition: opacity var(--duration-fast);
}
.btn-log:disabled { opacity: 0.4; }

/* ── Logbog ─────────────────────────────────────── */
#logbook-view {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 0;
  background: var(--color-bg);
}

/* ── Classroom selector ── */
.lb-classroom-selector {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.lb-classroom-selector-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.lb-classroom-btn-group {
  display: flex;
  gap: var(--space-1);
  flex-wrap: nowrap;
}
.lb-classroom-btn {
  padding: 6px var(--space-3);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  min-height: 36px;
  cursor: pointer;
  transition: border-color .13s, background .13s, color .13s;
}
.lb-classroom-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.lb-classroom-btn--active {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: #fff;
}
.lb-classroom-btn--active:hover {
  filter: brightness(1.05);
}

/* ── KPI / Summary ── */
.lb-summary {
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-5) var(--space-5) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-4);
}
.lb-kpi-row {
  display: flex; align-items: center; gap: 0;
}
.lb-kpi {
  flex: 1; display: flex; flex-direction: column; gap: 2px; align-items: center;
}
.lb-kpi-divider {
  width: 1px; height: 32px; background: var(--color-border); flex-shrink: 0;
}
.lb-kpi-value {
  font-size: 1.6rem; font-weight: 700; line-height: 1;
  letter-spacing: -0.02em; color: var(--color-text);
}
.lb-kpi-value--pos { color: oklch(44% 0.16 145); }
.lb-kpi-value--neg { color: oklch(46% 0.16 35); }
.lb-kpi-label {
  font-size: 10px; font-weight: 500; letter-spacing: .06em;
  text-transform: uppercase; color: var(--color-text-muted);
}

/* Tag frequency chart */
.lb-tag-chart { display: flex; flex-direction: column; gap: var(--space-2); }
.lb-chart-label {
  font-size: 10px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--color-text-muted);
  margin-bottom: 2px;
}
.lb-chart-row { display: flex; align-items: center; gap: var(--space-3); }
.lb-chart-tag { flex-shrink: 0; min-width: 130px; }
.lb-chart-bar-track {
  flex: 1; height: 5px; background: var(--color-border);
  border-radius: var(--radius-full); overflow: hidden;
}
.lb-chart-bar {
  height: 100%; border-radius: var(--radius-full);
  transition: width .5s var(--ease-out);
}
.lb-chart-bar--positive { background: oklch(56% 0.16 145); }
.lb-chart-bar--negative { background: oklch(58% 0.16 35); }
.lb-chart-bar--neutral  { background: var(--color-accent); }
.lb-chart-count {
  font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted);
  min-width: 20px; text-align: right;
}

/* ── Timeline ── */
.lb-timeline {
  display: flex; flex-direction: column; gap: 0;
}

/* ── Session ── */
.lb-session {
  border-bottom: 1px solid var(--color-border);
}
.lb-session-hd {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-4);
  cursor: pointer; user-select: none;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--duration-fast);
}
.lb-session-hd:hover { background: var(--color-surface-elevated); }
.lb-session-date-col {
  display: flex; flex-direction: column;
}
.lb-date-day { font-size: var(--text-xs); font-weight: 700; color: var(--color-text); }
.lb-date-time { font-size: 11px; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.lb-session-info { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.lb-session-subject {
  font-size: var(--text-xs); font-weight: 700;
  color: var(--color-accent); letter-spacing: .01em;
}
.lb-session-chips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.lb-session-right { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.lb-obs-badge {
  font-size: 11px; font-weight: 600; color: var(--color-text-muted);
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius-full); padding: 2px 8px;
}
.lb-chevron {
  font-size: var(--text-xs); color: var(--color-text-muted);
  transition: none; width: 12px; text-align: center;
}

.lb-session-body--closed { display: none; }

/* ── Student group ── */
.lb-student-group {
  border-bottom: 1px solid var(--color-border);
}
.lb-student-group:last-child { border-bottom: none; }
.lb-student-hd {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-4);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.lb-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--color-accent-subtle); color: var(--color-accent);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lb-student-name { font-size: var(--text-xs); font-weight: 600; flex: 1; }
.lb-student-meta { display: flex; gap: var(--space-1); }
.lb-valence-pill {
  font-size: 10px; font-weight: 700; border-radius: var(--radius-full);
  padding: 1px 7px;
}
.lb-valence-pill--pos { background: oklch(92% 0.06 145); color: oklch(38% 0.14 145); }
.lb-valence-pill--neg { background: oklch(94% 0.05 35);  color: oklch(40% 0.14 35); }

/* ── Observation rows ── */
.lb-obs-rows { display: flex; flex-direction: column; }
.lb-obs-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  transition: opacity .25s;
  position: relative;
}
.lb-obs-row:last-child { border-bottom: none; }
.lb-obs-row--dimmed { opacity: 0.5; }

/* Ryd alt button */
.lb-clear-row {
  display: flex; justify-content: flex-end;
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-border);
  margin-top: var(--space-2);
}
.lb-clear-all {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid oklch(80% 0.10 35);
  background: transparent;
  color: oklch(45% 0.18 35);
  border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  min-height: 36px;
}
.lb-clear-all:hover:not(:disabled) {
  background: oklch(96% 0.05 35);
  border-color: oklch(60% 0.18 35);
  color: oklch(40% 0.18 35);
}
.lb-clear-all:disabled {
  opacity: 0.6; cursor: not-allowed;
}

/* Delete buttons */
.lb-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  padding: 0; border: none;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity .15s, background .15s, color .15s;
  flex-shrink: 0;
}
.lb-del:hover {
  opacity: 1;
  background: oklch(95% 0.05 35);
  color: oklch(50% 0.18 35);
}
.lb-del:focus-visible {
  opacity: 1;
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}
.lb-del--session {
  opacity: 0.55;
}
.lb-obs-row:hover .lb-del--obs { opacity: 0.85; }

/* Vertical timeline guide */
.lb-obs-row::after {
  content: '';
  position: absolute;
  left: 71px;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--color-border);
  pointer-events: none;
}

.lb-obs-time {
  display: flex; flex-direction: column; align-items: flex-end;
  padding-right: var(--space-3); padding-top: 3px;
  gap: 4px;
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: var(--color-text-muted); line-height: 1;
}
.lb-decay-note { font-size: 9px; color: var(--color-text-muted); opacity: .7; }

.lb-obs-content { display: flex; flex-direction: column; gap: var(--space-2); padding-left: var(--space-3); }
.lb-obs-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); }

.lb-note {
  margin: 0;
  font-size: var(--text-sm); font-style: italic; line-height: 1.55;
  color: var(--color-text);
  border-left: 2px solid var(--color-accent);
  padding: var(--space-1) var(--space-3);
  background: var(--color-accent-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.lb-theories {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.lb-theory-abbr {
  font-size: 10px; font-weight: 600; letter-spacing: .03em;
  color: var(--color-text-muted);
  text-decoration: none; cursor: help;
  border-bottom: 1px dotted var(--color-border);
}

/* ── Shared chip (tag pill) ── */
.lb-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: var(--text-xs); font-weight: 500;
  border-radius: var(--radius-full); padding: 3px 10px;
  white-space: nowrap; line-height: 1.2;
}
.lb-chip--sm { padding: 2px 8px; font-size: 11px; }
.lb-chip--positive { background: oklch(92% 0.06 145); color: oklch(38% 0.14 145); }
.lb-chip--negative { background: oklch(94% 0.05 35);  color: oklch(40% 0.14 35); }
.lb-chip--neutral  { background: var(--color-accent-subtle); color: var(--color-accent); }
.lb-chip b { font-weight: 700; opacity: .7; }

/* ── Empty / loading ── */
.lb-loading {
  display: flex; align-items: center; justify-content: center;
  gap: var(--space-3); padding: var(--space-8);
  color: var(--color-text-muted); font-size: var(--text-sm);
}
.lb-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.lb-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-2); padding: var(--space-8);
  color: var(--color-text-muted); text-align: center;
}
.lb-empty-icon { font-size: 2rem; }
.lb-empty-state p { font-size: var(--text-base); font-weight: 500; color: var(--color-text); }
.lb-empty-state small { font-size: var(--text-sm); line-height: 1.5; }

/* Utility */
.text-muted { color: var(--color-text-muted); font-size: var(--text-sm); }
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }

/* Sparring-historik */
.sparring-history-btn { margin-top: var(--space-2); width: 100%; }
.sparring-hist-item {
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-md, 0.5rem);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface, #fff);
}
.sparring-hist-summary {
  display: flex; align-items: center; gap: var(--space-2);
  flex-wrap: wrap; cursor: pointer; font-weight: 600;
}
.sparring-hist-type { flex: 1 1 auto; }
.sparring-hist-date { color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 400; }
.sparring-hist-body { margin-top: var(--space-3); }
.sparring-hist-decision { font-size: var(--text-sm); font-weight: 600; }
.sparring-hist-decision--accepted { color: var(--color-positive, #16a34a); }
.sparring-hist-decision--rejected { color: var(--color-negative, #dc2626); }
.sparring-hist-decision--modified { color: var(--color-warning, #d97706); }
.sparring-hist-decision--none { color: var(--color-text-muted); font-weight: 400; }
