/* DAKFK Quran */

@font-face {
  font-family: 'Lexend';
  src: url('/fonts/lexend-latin-400.woff2') format('woff2');
  font-weight: 300 500;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Lexend';
  src: url('/fonts/lexend-latin-600.woff2') format('woff2');
  font-weight: 600 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Lexend';
  src: url('/fonts/lexend-latin-ext-400.woff2') format('woff2');
  font-weight: 300 500;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Lexend';
  src: url('/fonts/lexend-latin-ext-600.woff2') format('woff2');
  font-weight: 600 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Mushaf-skrift fra King Fahd Complex (via Quran Foundation). Amiri Quran er reserve. */
@font-face {
  font-family: 'UthmanicHafs';
  src: url('https://verses.quran.foundation/fonts/quran/hafs/uthmanic_hafs/UthmanicHafs1Ver18.ttf') format('truetype');
  font-display: swap;
}
@font-face {
  font-family: 'Amiri Quran';
  src: url('/fonts/amiri-quran-arabic.woff2') format('woff2');
  font-display: swap;
}

/* ── Farver ──────────────────────────────────────────────
   Mørk (standard): sort og mørkegrå. Lys: hvid baggrund.
   Guld bruges kun til Koranens pynt, hovedknapper og grafen. */
:root,
[data-theme='light'] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --surface-3: #ebebed;
  --line: #e4e4e7;
  --ink: #18181b;
  --ink-2: #5b5b63;
  --ink-3: #8a8a93;
  --gold: #9a7020;
  --gold-soft: #f6eedb;
  --on-gold: #ffffff;
  --chart: #9a7020;
  --ok: #1f7a4d;
  --ok-soft: #e3f3ea;
  --info: #1f5fa8;
  --info-soft: #e5eefa;
  --warn: #93600a;
  --warn-soft: #fbf0dc;
  --bad: #b4271b;
  --bad-soft: #fbe6e3;
  --mine: #f6eedb;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 12px 32px -16px rgb(0 0 0 / 0.18);
  --overlay: rgb(24 24 27 / 0.45);
  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #0f0f11;
  --surface: #17171a;
  --surface-2: #202024;
  --surface-3: #2a2a2f;
  --line: #2a2a2f;
  --ink: #f4f4f5;
  --ink-2: #a3a3ab;
  --ink-3: #74747c;
  --gold: #d4ad5f;
  --gold-soft: #2c2517;
  --on-gold: #17130a;
  --chart: #b98d32;
  --ok: #6fcf97;
  --ok-soft: #16281e;
  --info: #84b6ee;
  --info-soft: #172435;
  --warn: #e7b65a;
  --warn-soft: #2d2412;
  --bad: #f08c82;
  --bad-soft: #321b19;
  --mine: #2c2517;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px -18px rgb(0 0 0 / 0.8);
  --overlay: rgb(0 0 0 / 0.6);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  [data-theme='auto'] {
    --bg: #0f0f11;
    --surface: #17171a;
    --surface-2: #202024;
    --surface-3: #2a2a2f;
    --line: #2a2a2f;
    --ink: #f4f4f5;
    --ink-2: #a3a3ab;
    --ink-3: #74747c;
    --gold: #d4ad5f;
    --gold-soft: #2c2517;
    --on-gold: #17130a;
    --chart: #b98d32;
    --ok: #6fcf97;
    --ok-soft: #16281e;
    --info: #84b6ee;
    --info-soft: #172435;
    --warn: #e7b65a;
    --warn-soft: #2d2412;
    --bad: #f08c82;
    --bad-soft: #321b19;
    --mine: #2c2517;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 16px 40px -18px rgb(0 0 0 / 0.8);
    --overlay: rgb(0 0 0 / 0.6);
    color-scheme: dark;
  }
}

:root {
  --font-ui: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-quran: 'UthmanicHafs', 'Amiri Quran', 'Traditional Arabic', 'Geeza Pro', serif;
  --q-size: clamp(24px, 6.4vw, 32px);
  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0; font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: clamp(26px, 6.4vw, 34px); }
h2 { font-size: 19px; }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -60px; background: var(--surface); padding: 8px 12px; z-index: 50; border-radius: 8px; }
.skip:focus { top: 8px; }
.icon { display: inline-flex; width: 1.2em; height: 1.2em; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ── Skal: sidemenu på computer, bundmenu på telefon ────── */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.main { outline: none; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); }
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.nav-item {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); text-decoration: none; font-size: 12px; font-weight: 600;
}
.nav-item .icon { width: 24px; height: 24px; }
.nav-item[aria-current='page'] { color: var(--ink); }
.nav-item[aria-current='page'] .icon { color: var(--gold); }
.badge {
  position: absolute; top: 8px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--gold); color: var(--on-gold); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
  .tabbar { display: none; }
  .main { padding-bottom: 48px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
    padding: 22px 14px; border-right: 1px solid var(--line); background: var(--bg);
  }
  .sidebar .brand { padding: 4px 10px 22px; }
  .sidebar .nav-item {
    flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px;
    font-size: 15px; color: var(--ink-2);
  }
  .sidebar .nav-item:hover { background: var(--surface-2); color: var(--ink); }
  .sidebar .nav-item[aria-current='page'] { background: var(--surface-2); color: var(--ink); }
  .sidebar .nav-item .icon { width: 20px; height: 20px; }
  .sidebar .badge { position: static; margin-left: auto; }
  .side-user { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); display: grid; font-size: 14px; }
  .side-user span { color: var(--ink-3); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
}

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.brand-mark { display: inline-flex; width: 28px; height: 28px; color: var(--ink); }
.brand-mark svg { width: 100%; height: 100%; }

/* ── Sider ──────────────────────────────────────────────── */
.page { max-width: 760px; margin: 0 auto; padding: 28px 18px 32px; display: grid; gap: 22px; align-content: start; grid-template-columns: minmax(0, 1fr); }
.page-narrow { max-width: 620px; }
.page-wide { max-width: 1160px; }
.page-reading { max-width: 780px; }
@media (min-width: 900px) { .page { padding: 40px 32px; } }
.lead { font-size: 16px; color: var(--ink-2); margin-top: -12px; }
.muted { color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: 14px; }
.error { color: var(--bad); min-height: 1.5em; }
.block { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.block > .btn { justify-self: start; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.block-head h2 { font-size: 17px; }
.block-head .hint { white-space: nowrap; }
details.block > summary { cursor: pointer; font-weight: 600; padding: 4px 0; color: var(--ink-2); }
details.block > summary:hover { color: var(--ink); }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--ink-2); font-size: 15px; }
.back:hover { color: var(--ink); }
.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 480px) { .three { grid-template-columns: 1fr 1fr; } .three > :last-child { grid-column: 1 / -1; } }
.stack-tight { gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chips span { display: inline-grid; place-items: center; min-width: 48px; min-height: 40px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; font-size: 14px; color: var(--ink-2); }
.chips input:checked + span { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.chips input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.plan-preview { background: var(--surface-2); border-radius: var(--r-m); padding: 14px 16px; display: grid; gap: 4px; min-height: 72px; }
.plan-preview-error { background: var(--bad-soft); color: var(--bad); }
.plan-count { font-weight: 600; font-size: 18px; }
.plan-row { cursor: default; }
.plan-row:hover { background: transparent; }
@media (max-width: 420px) { .two { grid-template-columns: 1fr; } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--ink-3); padding: 18px 0; font-size: 15px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--gold); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot { min-height: 70vh; display: grid; place-items: center; }
.error-box { background: var(--bad-soft); border-radius: var(--r-m); padding: 14px 16px; display: grid; gap: 10px; justify-items: start; }
.ok-box { background: var(--ok-soft); border-radius: var(--r-m); padding: 14px 16px; display: grid; gap: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
[data-theme='dark'] .card, [data-theme='dark'] .rows, [data-theme='dark'] .people { border-color: transparent; }
@media (prefers-color-scheme: dark) { [data-theme='auto'] .card, [data-theme='auto'] .rows, [data-theme='auto'] .people { border-color: transparent; } }

/* ── Knapper og felter ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn-primary:hover { background: var(--gold); filter: brightness(1.08); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn-wide { width: 100%; }
.btn-icon {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 999px;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex: none;
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); }
.row-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.row-start { justify-content: flex-start; }

.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-weight: 600; font-size: 14px; color: var(--ink-2); }
input:not([type='radio']):not([type='checkbox']), select, textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); color: var(--ink);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
select { max-width: 100%; text-overflow: ellipsis; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--ink-3); }
.inline-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 220px; }
.form { background: var(--surface); padding: 20px; border-radius: var(--r-l); border: 1px solid var(--line); }
.preview { margin-top: -8px; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 999px; justify-self: start; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / 0.18); }
[data-theme='dark'] .segmented input:checked + span { background: var(--surface-3); }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ── Overblik ────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px 14px 14px; display: grid; gap: 2px; align-content: start; }
[data-theme='dark'] .stat { border-color: transparent; }
.stat-value { font-size: clamp(26px, 7.5vw, 40px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 0.45em; font-weight: 600; color: var(--ink-2); letter-spacing: 0; margin-left: 3px; }
.stat-label { color: var(--ink-2); font-size: 13.5px; line-height: 1.3; }
@media (max-width: 380px) { .stats { gap: 8px; } .stat { padding: 14px 10px 12px; } .stat-label { font-size: 12.5px; } }

.chart-card { padding-bottom: 12px; }
.chart { position: relative; height: 150px; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; align-items: end; padding-top: 22px; }
.chart::after { content: ''; position: absolute; left: 0; right: 0; bottom: 26px; border-top: 1px solid var(--line); }
.bar-col { position: relative; display: grid; grid-template-rows: 1fr auto; height: 100%; justify-items: center; cursor: default; }
.bar-track { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%; }
.bar { width: min(26px, 62%); min-height: 0; background: var(--chart); border-radius: 4px 4px 0 0; }
.bar-zero { height: 2px; width: 10px; background: var(--surface-3); border-radius: 2px; }
.bar-day { font-size: 12px; color: var(--ink-3); padding-top: 8px; height: 26px; }
.bar-col.today .bar-day { color: var(--ink); font-weight: 600; }
.bar-tip {
  position: absolute; bottom: calc(100% - 12px); left: 50%; transform: translateX(-50%); z-index: 2;
  background: var(--ink); color: var(--bg); font-size: 12.5px; font-weight: 600; padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 0.12s;
}
.bar-col:hover .bar-tip, .bar-col:focus-visible .bar-tip { opacity: 1; }
.bar-col:hover .bar { filter: brightness(1.12); }

.stat-table { width: 100%; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.stat-table th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 13px; padding: 0 8px 8px; }
.stat-table td { padding: 10px 8px; border-top: 1px solid var(--line); }
.stat-table th:not(:first-child), .stat-table td:not(:first-child) { text-align: right; }
.table-wrap { overflow-x: auto; margin: 0 -4px; }

/* ── Lister ─────────────────────────────────────────── */
.rows { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; text-decoration: none; color: inherit; position: relative;
  border: 0; border-top: 1px solid var(--line); background: transparent; width: 100%; text-align: left; cursor: pointer;
}
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row::before { content: ''; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); order: -1; }
.row-late::before { background: var(--bad); }
.row-submitted::before { background: var(--info); }
.row-redo::before { background: var(--warn); }
.row-approved::before { background: var(--ok); }
.row-plain::before { display: none; }
.row-main { display: grid; gap: 1px; min-width: 0; flex: 1; }
.row-title { font-size: 16px; font-weight: 600; }
.row-sub { color: var(--ink-2); font-size: 14px; display: block; }
.row-end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.row-note { font-size: 13px; color: var(--gold); font-weight: 600; }
.row-stack { flex-wrap: wrap; }
.row-stack .row-progress { flex-basis: 100%; padding-left: 22px; }
.row-progress { display: grid; gap: 6px; }

.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill-late { background: var(--bad-soft); color: var(--bad); }
.pill-submitted { background: var(--info-soft); color: var(--info); }
.pill-redo { background: var(--warn-soft); color: var(--warn); }
.pill-approved { background: var(--ok-soft); color: var(--ok); }

.progress { display: flex; height: 6px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.seg { display: block; min-width: 6px; }
.seg-approved { background: var(--ok); }
.seg-submitted { background: var(--info); }
.seg-redo { background: var(--warn); }
.seg-late { background: var(--bad); opacity: 0.6; }
.seg-missing { background: var(--surface-3); }

.people { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.people li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 16px; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; }
.people li > span { display: grid; min-width: 0; }
.people select { width: auto; min-width: 150px; min-height: 40px; }

/* ── Holdkode ─────────────────────────────────────── */
.code-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; display: grid; gap: 10px; }
[data-theme='dark'] .code-panel { border-color: transparent; }
.code-label { color: var(--ink-2); font-size: 14px; }
.join-code { font-size: clamp(32px, 9vw, 44px); font-weight: 600; letter-spacing: 0.16em; color: var(--gold); font-variant-numeric: tabular-nums; }

/* ── Login ───────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-content: center; gap: 18px; padding: 24px 18px; }
.login-card { width: min(400px, 100%); display: grid; gap: 18px; }
.login-brand { display: grid; justify-items: start; gap: 14px; }
.login-brand .brand-mark { width: 44px; height: 44px; }
.login-brand h1 { font-size: 30px; }
.login-form { display: grid; gap: 14px; }
.login-foot { color: var(--ink-3); font-size: 14px; }

/* ── Lektie ───────────────────────────────────────── */
.assign-head { display: grid; gap: 8px; }
.assign-sub { color: var(--ink-2); }
.teacher-note { background: var(--gold-soft); border-radius: var(--r-m); padding: 12px 14px; max-width: 70ch; }
.teacher-note-label { font-weight: 600; font-size: 13.5px; color: var(--gold); }
.assign-layout { display: grid; gap: 22px; align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) {
  .assign-layout { grid-template-columns: minmax(0, 1fr) 360px; }
  .assign-side { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow: auto; }
}
.assign-side { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.record-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
[data-theme='dark'] .record-panel, [data-theme='dark'] .submission { border-color: transparent; }

/* ── Læser og mushaf ────────────────────────────────── */
.reader { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.reader-top select { max-width: 440px; }
.player {
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  position: sticky; top: 10px; z-index: 5; box-shadow: var(--shadow);
}
[data-theme='dark'] .player { border-color: var(--surface-2); }
.btn-play { width: 44px; height: 44px; border-radius: 50%; border: 0; flex: none; cursor: pointer; display: grid; place-items: center; background: var(--gold); color: var(--on-gold); }
.btn-play:disabled { opacity: 0.6; }
.now { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.now-label { font-weight: 600; font-size: 15px; }
.now-reciter { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player [aria-pressed='true'] { color: var(--gold); }

.mushaf-frame { background: var(--surface); border-radius: var(--r-l); padding: clamp(18px, 4.5vw, 36px) clamp(14px, 4.5vw, 40px) 18px; }
[data-theme='light'] .mushaf-frame { border: 1px solid var(--line); }
@media (prefers-color-scheme: light) { [data-theme='auto'] .mushaf-frame { border: 1px solid var(--line); } }
.mushaf-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.mushaf-pageno { text-align: center; font-family: 'Amiri Quran', var(--font-quran); color: var(--gold); font-size: 17px; margin-top: 14px; }
.mushaf { font-family: var(--font-quran); font-size: var(--q-size); direction: rtl; color: var(--ink); min-height: 40vh; overflow: hidden; }
.mushaf .loading, .mushaf .error-box { direction: ltr; font-family: var(--font-ui); font-size: 15px; }
.mushaf-lines { display: grid; }
.line { display: flex; justify-content: space-between; align-items: baseline; line-height: 2.05; white-space: nowrap; }
.line-short { justify-content: center; gap: 0.3em; }
.measuring .line { justify-content: flex-start; gap: 0.22em; width: max-content; }
.mushaf-flow .mushaf-lines { display: block; text-align: justify; text-align-last: center; line-height: 2.2; }
.mushaf-flow .line { display: inline; white-space: normal; }
.mushaf-flow .line::after { content: ' '; }
.mushaf-flow { font-size: 30px; }
:root[data-size='xl'] .mushaf-flow { font-size: 38px; }
.mushaf-flow .surah-head, .mushaf-flow .bismillah { display: block; }
.w { cursor: pointer; border-radius: 4px; transition: background-color 0.15s, color 0.15s; }
.w:hover { color: var(--gold); }
.w.is-active { background: var(--gold-soft); color: var(--gold); }
.ayah {
  display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; padding: 0 0.12em;
  border-radius: 50%; border: 1px solid var(--gold); background: transparent; color: var(--gold);
  font-family: 'Amiri Quran', serif; font-size: 0.6em; line-height: 1; cursor: pointer; vertical-align: middle;
}
.ayah.is-active { background: var(--gold); color: var(--on-gold); }
.ayah-static { cursor: default; }
.surah-head { display: grid; justify-items: center; margin: 6px 0 2px; padding: 8px 12px; border-radius: var(--r-m); background: var(--surface-2); }
.surah-name { font-size: 0.95em; line-height: 1.7; }
.surah-latin { font-family: var(--font-ui); font-size: 12.5px; color: var(--ink-3); line-height: 1.2; }
.bismillah { text-align: center; line-height: 2.1; }
:root[data-size='l'] { --q-size: clamp(28px, 7.6vw, 36px); }
:root[data-size='xl'] { --q-size: clamp(32px, 9vw, 44px); }

.verse-list { display: grid; }
.verse { padding: 14px 0 16px; border-bottom: 1px solid var(--line); }
.verse:last-of-type { border-bottom: 0; }
.verse-ar { line-height: 2.1; }
.verse-tr { direction: ltr; text-align: left; font-family: var(--font-ui); font-size: 15.5px; color: var(--ink-2); margin-top: 6px; max-width: 70ch; }
.verse-no { font-weight: 600; color: var(--gold); font-size: 13px; }
.source { direction: ltr; text-align: left; font-family: var(--font-ui); margin-top: 8px; }
.credit { text-align: center; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pager-label { color: var(--ink-3); font-size: 14px; text-align: center; }

/* Vers-dialog */
.verse-big { font-family: var(--font-quran); font-size: calc(var(--q-size) * 1.05); line-height: 2.1; text-align: right; }
.tr-text { font-size: 16px; max-width: 70ch; }
.tafsir { border-top: 1px solid var(--line); padding-top: 16px; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.tafsir-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tafsir-head select { width: auto; max-width: 100%; flex: 1 1 220px; min-height: 40px; }
.tafsir-text { max-width: 72ch; display: grid; gap: 10px; color: var(--ink-2); }
.tafsir-text[dir='rtl'] { font-family: 'Amiri Quran', var(--font-quran); font-size: 20px; line-height: 1.9; }
.tafsir-text p, .tafsir-text h2, .tafsir-text h3, .tafsir-text h4, .tafsir-text ul, .tafsir-text blockquote { margin: 0; }
.tafsir-text h2, .tafsir-text h3, .tafsir-text h4 { font-size: 16px; color: var(--ink); }

/* ── Optager ──────────────────────────────────────── */
.recorder { display: grid; gap: 12px; --level: 0; grid-template-columns: minmax(0, 1fr); }
.rec-after { justify-content: flex-start; }
.rec-controls { display: flex; align-items: center; gap: 16px; }
.rec-main {
  width: 72px; height: 72px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  display: grid; place-items: center; align-content: center; gap: 1px;
  background: var(--bad); color: #fff; font-weight: 600; font-size: 12.5px;
  box-shadow: 0 0 0 calc(var(--level) * 14px) color-mix(in srgb, var(--bad) 22%, transparent);
  transition: box-shadow 0.08s linear;
}
.rec-main .icon { width: 26px; height: 26px; }
.recorder-compact .rec-main { width: 54px; height: 54px; }
.recorder-compact .rec-main .icon { width: 22px; height: 22px; }
.recorder-compact .rec-main-label { display: none; }
.recorder[data-state='recording'] .rec-main, .recorder[data-state='paused'] .rec-main { background: var(--ink); color: var(--bg); }
.rec-readout { display: grid; gap: 4px; }
.rec-time { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.rec-meter { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.rec-meter span { width: 4px; border-radius: 2px; background: var(--bad); height: calc(3px + var(--level) * 15px); }
.rec-meter span:nth-child(2) { height: calc(3px + var(--level) * 11px); }
.rec-meter span:nth-child(3) { height: calc(3px + var(--level) * 17px); }
.rec-meter span:nth-child(4) { height: calc(3px + var(--level) * 9px); }
.rec-meter span:nth-child(5) { height: calc(3px + var(--level) * 13px); }
.recorder[data-state='paused'] .rec-meter span { opacity: 0.3; }
.rec-pause { margin-left: auto; }
.rec-status { color: var(--ink-2); font-size: 14.5px; }
.recorder[data-state='error'] .rec-status { color: var(--bad); }
.rec-preview, .audio { width: 100%; height: 42px; }
.rec-progress, .review-form progress { width: 100%; height: 6px; accent-color: var(--gold); }

/* ── Afleveringer og feedback ──────────────────────────── */
.submissions { display: grid; gap: 12px; }
.submission { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 16px; display: grid; gap: 10px; justify-items: stretch; }
.submission > .btn { justify-self: start; }
.submission-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.submission-head > span { display: grid; }
.note { background: var(--surface-2); border-radius: var(--r-s); padding: 8px 12px; font-size: 15px; }
.feedback { border-left: 2px solid var(--gold); padding: 2px 0 2px 12px; display: grid; gap: 6px; }
.feedback-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.grade { font-weight: 600; color: var(--gold); }
.feedback-text { white-space: pre-wrap; }
.feedback-audio { display: grid; gap: 4px; }
.review { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.review-subs { display: grid; gap: 12px; }
.review-form { border-top: 1px solid var(--line); padding-top: 16px; }
.sheet .submission { background: var(--surface-2); border-color: transparent; }
@media (min-width: 900px) {
  .sheet-wide .review { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .sheet-wide .review-form { border-top: 0; padding-top: 0; }
}
.danger-zone { border-top: 1px solid var(--line); padding-top: 16px; }

/* ── Chat ─────────────────────────────────────────── */
.chat-page { max-width: 1160px; margin: 0 auto; padding: 0; }
.main:has(.chat-page) { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .main:has(.chat-page) { padding-bottom: 0; } }
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr); min-height: calc(100vh - var(--nav-h)); }
.thread-list-wrap { padding: 28px 18px; display: grid; gap: 18px; align-content: start; }
.thread-list { display: grid; gap: 2px; }
.thread-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 10px; border-radius: var(--r-m); text-decoration: none; color: inherit;
}
.thread-item:hover { background: var(--surface-2); }
.thread-item[aria-current='true'] { background: var(--surface-2); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); font-weight: 600; font-size: 16px; }
.avatar-group { background: var(--gold-soft); color: var(--gold); }
.thread-text { display: grid; min-width: 0; }
.thread-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-sub { color: var(--ink-3); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-meta { display: grid; justify-items: end; gap: 4px; font-size: 12px; color: var(--ink-3); }
.thread-item.unread .thread-title, .thread-item.unread .thread-sub { color: var(--ink); }
.unread-dot { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: var(--on-gold); font-size: 11.5px; font-weight: 600; line-height: 20px; text-align: center; }
.thread-empty { display: none; }

.thread { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: calc(100vh - var(--nav-h) - env(safe-area-inset-bottom)); height: calc(100dvh - var(--nav-h) - env(safe-area-inset-bottom)); }
.thread-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.thread-head .thread-text { flex: 1; }
.msgs { overflow-y: auto; padding: 18px 14px 12px; display: flex; flex-direction: column; gap: 3px; overscroll-behavior: contain; }
.msg { display: grid; justify-items: start; max-width: min(78%, 560px); }
.msg-mine { align-self: flex-end; justify-items: end; }
.msg-name { font-size: 12.5px; color: var(--ink-3); margin: 10px 12px 3px; display: flex; gap: 6px; align-items: center; }
.tag { font-size: 11px; font-weight: 600; color: var(--gold); }
.bubble {
  background: var(--surface-2); padding: 9px 13px; border-radius: 18px; font-size: 15.5px; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere; cursor: default;
}
.msg-mine .bubble { background: var(--mine); }
.msg-deleted .bubble { background: transparent; border: 1px dashed var(--line); color: var(--ink-3); font-style: italic; }
.msg-time { font-size: 11.5px; color: var(--ink-3); margin: 2px 12px 0; }
.msg-actions { margin: 2px 6px 0; }
.msg-system { align-self: center; max-width: 92%; justify-items: center; margin: 10px 0; }
.msg-system .bubble { background: transparent; color: var(--ink-2); font-size: 13.5px; padding: 4px 8px; text-align: center; }
.msg-system a { color: var(--gold); font-weight: 600; text-decoration: none; }
.day-sep { align-self: center; font-size: 12px; color: var(--ink-3); margin: 14px 0 4px; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px); border-top: 1px solid var(--line); background: var(--bg); }
.composer textarea { min-height: 44px; max-height: 140px; resize: none; border-radius: 22px; padding: 11px 16px; }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--gold); color: var(--on-gold); display: grid; place-items: center; cursor: pointer; flex: none; }
.send:disabled { opacity: 0.4; cursor: default; }
.chat-placeholder { display: none; }
.load-older { align-self: center; margin-bottom: 8px; }

@media (min-width: 900px) {
  .chat-layout { grid-template-columns: 340px minmax(0, 1fr); min-height: 100vh; border-right: 1px solid var(--line); }
  .thread-list-wrap { border-right: 1px solid var(--line); padding: 40px 14px; height: 100vh; overflow-y: auto; position: sticky; top: 0; }
  .thread { height: 100vh; }
  .chat-placeholder { display: grid; place-content: center; text-align: center; color: var(--ink-3); gap: 6px; }
  .thread-back { display: none; }
  .chat-layout.has-thread .thread-list-wrap { display: grid; }
  .msgs { padding: 24px 28px 16px; }
}
@media (max-width: 899px) {
  .chat-layout.has-thread .thread-list-wrap { display: none; }
  .chat-layout.has-thread ~ * { display: none; }
}

/* ── Profil ───────────────────────────────────────── */
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head .avatar { width: 56px; height: 56px; font-size: 20px; }
.profile-head p { color: var(--ink-3); font-size: 14px; }

/* ── Dialoger ─────────────────────────────────────── */
.sheet { border: 0; padding: 0; background: var(--surface); color: var(--ink); width: min(560px, 100vw); max-height: min(92vh, 900px); border-radius: var(--r-l); box-shadow: var(--shadow); }
[data-theme='dark'] .sheet { background: var(--surface); outline: 1px solid var(--surface-2); }
.sheet-wide { width: min(920px, 100vw); }
.sheet::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 10px 10px 20px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sheet-title { font-size: 18px; }
.sheet-body { padding: 6px 20px 24px; overflow: auto; display: grid; grid-template-columns: minmax(0, 1fr); }
@media (max-width: 640px) {
  .sheet { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
}

/* ── Beskeder ─────────────────────────────────────── */
.toasts { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; width: min(420px, calc(100vw - 32px)); }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 600; font-size: 15px; transition: opacity 0.3s, transform 0.3s; }
.toast-error { background: var(--bad); color: #fff; }
.toast-out { opacity: 0; transform: translateY(8px); }

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

.people li.is-disabled { opacity: 0.55; }
.pick-list:empty { display: none; }
.pick-list li { padding-right: 12px; }
.people li > .user-actions { display: flex; align-items: center; gap: 4px; flex: none; }
@media (max-width: 480px) { .people li > .user-actions select { min-width: 0; width: 128px; } }
