.admin { max-width: 960px; margin: 0 auto; padding: 0 16px 64px; display: grid; gap: 16px; align-content: start; }
/* Grid-børn har min-width: auto og ville ellers lade tabeller og lange URL'er presse siden bredere end skærmen. */
.admin > * { min-width: 0; }
.admin h1 { font-size: 1.5rem; margin: 8px 0 0; }
.admin h2 { font-size: 1.125rem; margin: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.end { justify-content: flex-end; }
.grid-2 { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.empty { text-align: center; padding: 24px; }
.link { color: var(--accent); overflow-wrap: anywhere; margin-right: auto; }
.warning { margin: 0; padding: 12px 16px; border-radius: var(--radius-sm); background: color-mix(in srgb, #f5a524 18%, var(--surface)); }

.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; font-size: 1.125rem; color: var(--text); text-decoration: none; }
.topbar-extra { flex: 1; min-width: 0; }
.crumb { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.crumb::before { content: '/ '; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-color: var(--accent); }

.login { max-width: 380px; margin: 12vh auto 0; display: grid; gap: 16px; }

.new-quiz { display: flex; gap: 8px; }
.new-quiz input { flex: 1; }
.quiz-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.quiz-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.quiz-row-main { flex: 1; min-width: 0; display: grid; }
.quiz-title { font-weight: 700; font-size: 1.0625rem; color: var(--text); text-decoration: none; }
.quiz-title:hover { text-decoration: underline; }
.chip-open { background: var(--good-bg); color: var(--good); }
.chip-closed { background: var(--bad-bg); color: var(--bad); }

.settings { display: grid; gap: 14px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; min-height: 0; cursor: pointer; }
.segmented span { display: block; padding: 10px 16px; font-weight: 600; }
.segmented input:checked + span { background: var(--accent); color: var(--on-accent); }
.segmented input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: -3px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--accent); }

.question-list { display: grid; gap: 12px; }
.question-card { display: grid; gap: 14px; border-left: 4px solid transparent; }
.question-card.dirty, .question-card.unsaved { border-left-color: var(--accent); }
.question-card.dragging { opacity: .5; }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head .row { margin-left: auto; }
.icon { min-width: 40px; padding: 0 10px; }
.handle { cursor: grab; letter-spacing: -3px; }
.options-field { border: 0; padding: 0; margin: 0; }
.options-field legend { padding: 0; margin-bottom: 6px; font-size: .875rem; color: var(--muted); }
.options-edit { display: grid; gap: 8px; }
.options-edit > .btn { justify-self: start; }
.option-row { display: flex; align-items: center; gap: 8px; }
.option-row input[type=radio] { width: 22px; min-height: 22px; height: 22px; flex: none; accent-color: var(--good); }
.image-box { display: flex; }
.file { cursor: pointer; }
.thumb { display: flex; align-items: center; gap: 12px; }
.thumb img { width: 120px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); }

dialog { border: 0; border-radius: var(--radius); background: var(--bg); color: var(--text); padding: 20px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / .55); }
.preview { width: min(420px, calc(100vw - 32px)); }
.preview form { display: flex; justify-content: center; margin-top: 16px; }
.preview .question { animation: none; }
.preview .option, .preview .number-form .btn { pointer-events: none; }

.share { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.qr { width: 140px; height: 140px; image-rendering: pixelated; border-radius: var(--radius-sm); background: #fff; }
.share-main { flex: 1; min-width: 220px; display: grid; gap: 10px; }
.share-url { font-size: 1.125rem; font-weight: 700; overflow-wrap: anywhere; }
.qr-full { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; background: #fff; color: #000; display: none; place-items: center; align-content: center; gap: 24px; cursor: zoom-out; }
.qr-full[open] { display: grid; }
.qr-full img { width: min(80vw, 75dvh); height: auto; image-rendering: pixelated; }
.qr-url { font-size: clamp(1.25rem, 4vw, 2.5rem); font-weight: 800; margin: 0; }

.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.counter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; }
.counter strong { font-size: 1.75rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.counter span { color: var(--muted); font-size: .875rem; }

.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.board-table { width: 100%; border-collapse: collapse; }
.board-table th { text-align: left; font-size: .8125rem; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.board-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.board-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.board-table .strong { font-weight: 700; }
.board-table .name { min-width: 140px; }
.board-table .name input { min-height: 36px; padding: 4px 8px; }
.board-table .chip { margin-left: 6px; }
.board-table .actions { text-align: right; white-space: nowrap; }
.board-table .actions .btn { min-height: 34px; padding: 0 10px; font-size: .8125rem; }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--text); cursor: text; text-align: left; }
.link-button:hover { text-decoration: underline dotted; }

.stats { display: grid; gap: 20px; }
.stat h3 { font-size: 1rem; margin-bottom: 4px; }
.stat p { margin-bottom: 8px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 1fr) 2fr 3ch; align-items: center; gap: 10px; font-size: .875rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--muted); border-radius: inherit; transition: width .3s ease-out; }
.is-correct .bar-fill { background: var(--good); }
.is-correct .bar-label { font-weight: 700; color: var(--good); }
.bar-count { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .new-quiz { flex-direction: column; }
  .quiz-row { flex-wrap: wrap; }
  .board-table th:nth-child(5), .board-table td:nth-child(5) { display: none; }
}
.card > h2 { margin-bottom: 12px; }
.lock-hint { margin: 0; }
