/* IFS Træning – kølechauffører
   Udgangspunkt: kølekassen. Mørk stålblå som førerhuset, frostlys baggrund,
   og login-koden vist som displayet på et køleaggregat. */

:root {
  --cab:      #12304A;   /* førerhus / primær */
  --cab-2:    #1C4566;
  --frost:    #EEF4F7;   /* baggrund */
  --surface:  #FFFFFF;
  --ink:      #0F2233;
  --muted:    #5A6E7E;
  --line:     #D3DFE7;
  --ice:      #7FD0F0;   /* display-cifre */
  --ok:       #2F8F5B;
  --ok-bg:    #E2F3EA;
  --warn:     #B9741A;
  --warn-bg:  #FBF0DD;
  --err:      #B83C32;
  --err-bg:   #F9E4E2;
  --radius-s: 6px;
  --radius-l: 14px;
  --font: "Barlow", "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 17px/1.55 var(--font);
  color: var(--ink);
  background: var(--frost);
}
a { color: var(--cab-2); text-underline-offset: 2px; }
a:hover { color: var(--cab); }
:focus-visible { outline: 3px solid var(--ice); outline-offset: 2px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.2rem; margin-top: 1.4em; }

.muted { color: var(--muted); }
.small { font-size: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .8rem 1.25rem; background: var(--cab); color: #fff;
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand-mark { font-size: 1.4rem; color: var(--ice); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-display); font-size: 1.25rem; letter-spacing: .01em; }
.brand-co { font-size: .82rem; color: #A9C2D4; }
.topnav { display: flex; flex-wrap: wrap; gap: .25rem; }
.topnav a {
  color: #fff; text-decoration: none; padding: .45rem .75rem; border-radius: var(--radius-s);
}
.topnav a:hover { background: var(--cab-2); color: #fff; }

.wrap { max-width: 760px; margin: 0 auto; padding: 1.5rem 1.1rem 4rem; }
.area-admin .wrap { max-width: 1180px; }

/* ---------- Knapper og formularer ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .55rem 1.1rem;
  font: 600 1rem var(--font); text-decoration: none; cursor: pointer;
  color: var(--cab); background: var(--surface);
  border: 2px solid var(--cab); border-radius: var(--radius-s);
}
.btn:hover { background: var(--frost); }
.btn-primary { color: #fff; background: var(--cab); }
.btn-primary:hover { background: var(--cab-2); color: #fff; }
.btn-ghost { border-color: var(--line); color: var(--muted); }
.btn-small { min-height: 36px; padding: .3rem .7rem; font-size: .92rem; }
.btn-block { display: flex; width: 100%; min-height: 56px; font-size: 1.12rem; margin-top: .75rem; }

input, select {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 2px solid var(--line); border-radius: var(--radius-s);
  padding: .5rem .7rem; min-height: 44px; width: 100%;
}
input:focus, select:focus { border-color: var(--cab-2); outline: none; }
label { display: block; font-weight: 600; font-size: .95rem; }
label input, label select { margin-top: .3rem; font-weight: 400; }
.stack { display: grid; gap: 1rem; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
.inline-form label { flex: 1 1 200px; }
.inline-form .btn { flex: 0 0 auto; }

.flash { padding: .8rem 1rem; border-radius: var(--radius-s); margin-bottom: 1.2rem; border-left: 5px solid; }
.flash-ok  { background: var(--ok-bg);  border-color: var(--ok); }
.flash-err { background: var(--err-bg); border-color: var(--err); }

/* ---------- Login: koden vises som et aggregat-display ---------- */
.login { max-width: 380px; margin: 1rem auto 0; text-align: center; }
.login h1 { font-size: 2.3rem; margin-bottom: .2rem; }
.codeform { margin-top: 1.4rem; }
.code-input {
  display: block; width: 100%; height: 88px; margin: 0;
  font: 700 3.1rem/1 var(--font-display); letter-spacing: .32em; text-align: center;
  padding-left: .32em; /* opvejer letter-spacing efter sidste ciffer */
  color: var(--ice); caret-color: var(--ice);
  background: var(--cab); border: 0; border-radius: var(--radius-l) var(--radius-l) 0 0;
  box-shadow: inset 0 -3px 0 rgba(127, 208, 240, .35);
  font-variant-numeric: tabular-nums;
}
.code-input::placeholder { color: #3D6585; letter-spacing: .28em; }
.code-input:focus { outline: none; box-shadow: inset 0 -3px 0 var(--ice); }
.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px;
  background: var(--cab); padding: 2px; border-radius: 0 0 var(--radius-l) var(--radius-l);
}
.keypad button {
  height: 66px; border: 0; cursor: pointer;
  font: 600 1.7rem var(--font-display); color: var(--ink); background: var(--surface);
}
.keypad button:active { background: var(--frost); }
.keypad .key-alt { font: 600 1.05rem var(--font); color: var(--muted); background: #F6F9FB; }
.keypad button:nth-child(10) { border-bottom-left-radius: 12px; }
.keypad button:nth-child(12) { border-bottom-right-radius: 12px; }
.foot-link { margin-top: 2rem; font-size: .92rem; }

/* ---------- Chauffør: oversigt ---------- */
.hello { margin-bottom: 1.5rem; }
.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: .4rem 0 .6rem; }
.progress-bar { height: 100%; background: var(--ok); }

.modlist { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.mod a {
  display: flex; gap: 1rem; padding: 1rem 1.1rem; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line);
  border-radius: var(--radius-s);
}
.mod a:hover { border-color: var(--cab-2); }
.mod.state-ok a      { border-left-color: var(--ok); }
.mod.state-expired a { border-left-color: var(--warn); }
.mod.state-failed a  { border-left-color: var(--err); }
.mod-no { font: 700 1.9rem/1 var(--font-display); color: var(--cab-2); min-width: 1.4ch; }
.mod-body { display: flex; flex-direction: column; gap: .15rem; }
.mod-title { font: 700 1.25rem var(--font-display); }
.mod-sum { color: var(--muted); font-size: .95rem; }
.mod-meta { font-size: .9rem; color: var(--muted); margin-top: .35rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.badge {
  display: inline-block; padding: .1rem .55rem; border-radius: 99px;
  font-size: .82rem; font-weight: 600; white-space: nowrap;
}
.badge-ok      { background: var(--ok-bg);   color: var(--ok); }
.badge-expired { background: var(--warn-bg); color: var(--warn); }
.badge-failed  { background: var(--err-bg);  color: var(--err); }
.badge-none    { background: #E9EEF2;        color: var(--muted); }

/* ---------- Lektion og quiz ---------- */
.lesson, .quiz, .result, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 1.5rem 1.4rem;
}
.lead { font-size: 1.12rem; color: var(--muted); }
.lesson-body { max-width: 66ch; }
.lesson-body ul, .lesson-body ol { padding-left: 1.3rem; }
.lesson-body li { margin-bottom: .35rem; }
.lesson-end { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }

.q { border: 0; padding: 0; margin: 1.6rem 0 0; }
.q legend { font-weight: 600; font-size: 1.08rem; margin-bottom: .6rem; padding: 0; }
.q-no { font-family: var(--font-display); color: var(--cab-2); }
.opt {
  display: flex; gap: .75rem; align-items: flex-start; font-weight: 400; font-size: 1rem;
  padding: .85rem 1rem; margin-bottom: .45rem; cursor: pointer;
  border: 2px solid var(--line); border-radius: var(--radius-s);
}
.opt input { width: 22px; height: 22px; min-height: 0; margin: .1rem 0 0; flex: none; accent-color: var(--cab); }
.opt:has(input:checked) { border-color: var(--cab); background: #F2F7FA; }

.result { text-align: center; }
.result-score { font: 700 4.5rem/1 var(--font-display); margin: .2rem 0 .3rem; }
.result.is-pass .result-score { color: var(--ok); }
.result.is-fail .result-score { color: var(--err); }
.wrong { text-align: left; background: var(--err-bg); border-radius: var(--radius-s); padding: 1rem 1.2rem; margin: 1.2rem 0; }
.wrong h2 { font-size: 1.15rem; }
.wrong ul { margin: 0; padding-left: 1.2rem; }

/* ---------- Administration ---------- */
.narrow { max-width: 420px; margin: 1rem auto; }
.panel { margin-bottom: 1.25rem; }
.panel-head, .page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.panel-head .inline-form label { flex: 0 1 220px; }

.summary { display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; margin-bottom: 1.25rem; }
.summary > div { flex: 1 1 200px; background: var(--surface); padding: 1rem 1.2rem; color: var(--muted); }
.summary strong { display: block; font: 700 2.2rem/1.1 var(--font-display); color: var(--ink); }
.summary .s-ok strong { color: var(--ok); }
.summary .s-warn strong { color: var(--warn); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-weight: 600; color: var(--muted); font-size: .88rem; white-space: nowrap; }
tr.is-inactive td { color: var(--muted); }
td.actions { display: flex; gap: .4rem; justify-content: flex-end; }
td.actions form { margin: 0; }
.frac { font-weight: 600; }
.frac-ok { color: var(--ok); }

.matrix td.cell { text-align: center; font-size: .85rem; white-space: nowrap; }
.cell-ok      { background: var(--ok-bg);   color: var(--ok); }
.cell-expired { background: var(--warn-bg); color: var(--warn); }
.cell-failed  { background: var(--err-bg);  color: var(--err); }
.cell-none    { color: var(--muted); }
.legend { columns: 2 260px; margin: .5rem 0 0; padding-left: 1.6rem; color: var(--muted); }

.codecard {
  background: var(--cab); color: #fff; border-radius: var(--radius-l);
  padding: 1.3rem 1.5rem; margin-bottom: 1.25rem;
}
.codecard p { margin: 0; }
.codecard .muted { color: #A9C2D4; margin-top: .4rem; }
.codecard-code {
  font: 700 3.2rem/1.1 var(--font-display); letter-spacing: .14em; color: var(--ice);
  font-variant-numeric: tabular-nums; margin: .3rem 0 !important; user-select: all;
}

.print-only { display: none; }

@media (max-width: 560px) {
  h1 { font-size: 1.8rem; }
  .lesson, .quiz, .result, .panel { padding: 1.2rem 1rem; }
  td.actions { flex-direction: column; }
}

/* ---------- Redigering af moduler, spørgsmål og administratorer ---------- */
textarea {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  border: 2px solid var(--line); border-radius: var(--radius-s); padding: .6rem .7rem;
  margin-top: .3rem; resize: vertical;
}
textarea:focus { border-color: var(--cab-2); outline: none; }
#content { font: .92rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; border-top-left-radius: 0; border-top-right-radius: 0; margin-top: 0; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 1px; margin-top: .3rem;
  background: var(--line); border: 2px solid var(--line); border-bottom: 0;
  border-radius: var(--radius-s) var(--radius-s) 0 0; overflow: hidden;
}
.toolbar button {
  font: 500 .92rem var(--font); color: var(--ink); background: #F6F9FB;
  border: 0; padding: .45rem .8rem; cursor: pointer; min-height: 38px;
}
.toolbar button:hover { background: var(--surface); }

.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; align-items: end; }
label.check { display: flex; align-items: center; gap: .55rem; min-height: 44px; }
label.check input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--cab); }

.crumb { margin: 0 0 .4rem; font-size: .92rem; color: var(--muted); }
.btn-danger { color: var(--err); border-color: #E6B9B4; background: var(--surface); }
.btn-danger:hover { background: var(--err-bg); }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }

.qlist { list-style: none; padding: 0; margin: 0 0 1rem; }
.qitem { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.qitem:first-child { padding-top: .25rem; }
.qitem-head { display: flex; gap: .8rem; align-items: flex-start; }
.qpos input { width: 4.2rem; min-height: 38px; padding: .3rem .4rem; text-align: center; margin: 0; }
.qtext { flex: 1; margin: .35rem 0 0; font-weight: 600; }
.qitem .actions { display: flex; gap: .4rem; flex: none; }
.qitem .actions form { margin: 0; }
.alist { list-style: none; margin: .5rem 0 0 5rem; padding: 0; font-size: .95rem; color: var(--muted); }
.alist li { padding: .15rem 0; }
.alist li.is-correct { color: var(--ok); font-weight: 600; }
.qitem .flash { margin: .6rem 0 0 5rem; padding: .4rem .7rem; }

.answers-edit { border: 0; padding: 0; margin: 0; }
.answers-edit legend { font-weight: 600; font-size: .95rem; margin-bottom: .5rem; padding: 0; }
.answer-row { display: flex; gap: .6rem; align-items: center; margin-bottom: .5rem; }
.answer-correct {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 2px solid var(--line); border-radius: var(--radius-s); cursor: pointer;
}
.answer-correct input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--ok); }
.answer-correct:has(input:checked) { border-color: var(--ok); background: var(--ok-bg); }

.row-form { display: flex; gap: .4rem; min-width: 240px; }
.row-form input { min-height: 36px; padding: .3rem .6rem; }

.preview { border-left: 4px solid var(--line); padding-left: 1rem; }

@media (max-width: 560px) {
  .qitem-head { flex-wrap: wrap; }
  .alist, .qitem .flash { margin-left: 0; }
}

/* ---------- Auditrapport og versioner ---------- */
.callout { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; border-left: 6px solid var(--cab); }
.callout h2 { margin-bottom: .2rem; }
.callout p { margin: 0; }
tr.is-selected td { background: #F2F7FA; }
.ver { font-size: .8em; font-weight: 600; color: var(--cab-2); }

.snap-content { border-left: 4px solid var(--line); padding-left: 1rem; margin-bottom: 1rem; }
.snap-questions { padding-left: 1.4rem; }
.snap-questions > li { margin-bottom: .8rem; }
.snap-questions p { margin: 0 0 .2rem; font-weight: 600; }
.snap-questions ul { list-style: none; padding-left: 0; margin: 0; color: var(--muted); }
.snap-questions li.is-correct { color: var(--ok); font-weight: 600; }

.report {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 2rem 2.2rem; font-size: .95rem;
}
.report-head { border-bottom: 3px solid var(--cab); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.report-co { margin: 0; font-weight: 600; color: var(--muted); }
.report-head h1 { font-size: 2rem; margin: .2rem 0; }
.report-head > p { margin: 0 0 1rem; }
.meta { width: auto; }
.meta th, .meta td { border: 0; padding: .15rem 1.2rem .15rem 0; font-size: .92rem; }
.meta th { color: var(--muted); font-weight: 500; }
.report-section { margin-bottom: 2rem; }
.report-section h2 { border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.report .table-wrap table { font-size: .88rem; }
.report th, .report td { padding: .4rem .5rem; }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.kpis > div { background: var(--surface); padding: .8rem 1rem; color: var(--muted); font-size: .9rem; }
.kpis strong { display: block; font: 700 1.9rem/1.1 var(--font-display); color: var(--ink); }

.w-action { width: 35%; }
.writein { margin-top: 1.5rem; }
.lines { height: 5.5rem; background: repeating-linear-gradient(to bottom, transparent 0 1.75rem, var(--line) 1.75rem calc(1.75rem + 1px)); }
.sigs { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-top: 2.5rem; font-size: .88rem; color: var(--muted); }
.sigline { border-bottom: 1px solid var(--ink); height: 2.5rem; margin-bottom: .3rem; }
.appendix-module { margin-bottom: 1.6rem; }
.report-foot { margin-top: 2rem; padding-top: .6rem; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }

@media (max-width: 700px) {
  .report { padding: 1.2rem 1rem; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .sigs { grid-template-columns: 1fr; }
}

/* ---------- Firmaer ---------- */
.company-line { margin: -.3rem 0 .5rem; font-weight: 600; }
.company-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; align-items: end; }
.company-form .btn-row { grid-column: 1 / -1; }

/* ---------- Sprog ---------- */
.langs { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin: 0 0 1.4rem; }
.langs a {
  display: inline-flex; align-items: center; min-height: 40px; padding: .3rem .75rem;
  font-size: .95rem; font-weight: 500; color: var(--cab); text-decoration: none;
  background: var(--surface); border: 2px solid var(--line); border-radius: 99px;
}
.langs a:hover { border-color: var(--cab-2); }
.langs a.is-current { color: #fff; background: var(--cab); border-color: var(--cab); }
.area-driver .wrap > .langs { justify-content: flex-start; }
.flash-warn { background: var(--warn-bg); border-color: var(--warn); }

.langcodes { white-space: nowrap; }
.lc { display: inline-block; font-size: .72rem; font-weight: 600; padding: .05rem .3rem; border-radius: 4px; margin-right: 1px; }
.lc-ok { background: var(--ok-bg); color: var(--ok); }
.lc-missing { background: #E9EEF2; color: #9AA8B3; }

.tr-field { margin-bottom: .9rem; }
.tr-src { margin: 0 0 .25rem; font-size: .9rem; color: var(--muted); }
.tr-src::before { content: "DA: "; font-weight: 600; font-size: .78rem; }
.tr-answer { margin-left: 1.5rem; }
.tr-answer.is-correct .tr-src { color: var(--ok); }
.tr-questions { padding-left: 1.4rem; }
.tr-questions > li { padding: .6rem 0 .4rem; border-bottom: 1px solid var(--line); }
.tr-src-block { margin-bottom: .6rem; }
.tr-src-block summary { cursor: pointer; color: var(--cab-2); font-size: .92rem; }

.lc-unreviewed { background: var(--warn-bg); color: var(--warn); }
input.is-auto, textarea.is-auto { background: #FFF8E6; border-color: #E8C77A; }
.gt-panel .inline-form { margin-top: .4rem; }
.review label.check { margin-bottom: .6rem; }
.review label:not(.check) { max-width: 360px; }
code { font-size: .9em; background: #EEF2F5; padding: .05rem .3rem; border-radius: 4px; }

@media print {
  body { background: #fff; font-size: 12pt; }
  .topbar, .no-print, .topnav, .flash { display: none !important; }
  .print-only { display: block; }
  .panel { border: 0; padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .cell-ok, .cell-expired, .cell-failed, .badge { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sign { margin-top: 2.5rem; }

  /* Auditrapport */
  .report { border: 0; padding: 0; font-size: 10pt; }
  .report .table-wrap { overflow: visible; }
  .report table { font-size: 9pt; }
  .report thead { display: table-header-group; }
  .report tr, .snap-questions > li, .kpis, .sigs { break-inside: avoid; }
  .report-section h2, .report-section h3 { break-after: avoid; }
  .appendix { break-before: page; }
  .sign-block { break-inside: avoid; }
  .cell-ok, .cell-expired, .cell-failed, .kpis, .lines { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@page {
  size: A4;
  margin: 14mm 12mm 16mm;
  @bottom-right { content: "Side " counter(page) " af " counter(pages); font-size: 8pt; color: #5A6E7E; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
