/* Librio 2 – designprøve "Indbygget køreplan". Se DESIGN.md for valgene og referencerne bag.
   Opbygning som Apples Mail/Påmindelser, listen som en køreplan (SBB/DSB), leveringsproblemer som GOV.UK's
   notification banner, og karakteren (flade farver, firkantede hjørner, Futura-etiketter) fra Peters Design Company. */
:root {
  --bg: #f2f2f4;
  --side: #ffffff;
  --tile: #ffffff;
  --soft: #ececef;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --line-strong: #c7c7cc;
  --st-new: #a15c00;
  --st-ordered: #0068d6;
  --st-done: #1f7a3a;
  --accent: #0068d6;
  --accent-ink: #ffffff;
  --info: #0068d6;
  --ok: #1f7a3a;
  --warn: #9a5800;
  --bad: #d70015;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: var(--body);
  --label: Futura, "Futura PT", "Century Gothic", "Avenir Next", var(--body);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 10px;     /* flader: bestillinger, grupperede felter, bokse */
  --r-sm: 8px;   /* knapper og inputfelter */
  --lift: 0 10px 30px rgba(0, 0, 0, .18);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161617; --side: #1e1e20; --tile: #232325; --soft: #2f2f32; --surface: #232325; --st-new: #ffb340; --st-ordered: #4da3ff; --st-done: #32d74b; --ink: #f5f5f7; --muted: #a1a1a6;
    --line: #38383a; --line-strong: #545458; --accent: #0a84ff; --info: #0a84ff; --ok: #32d74b; --warn: #ffb340; --bad: #ff453a;
    --lift: 0 10px 30px rgba(0, 0, 0, .55); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161617; --side: #1e1e20; --tile: #232325; --soft: #2f2f32; --surface: #232325; --st-new: #ffb340; --st-ordered: #4da3ff; --st-done: #32d74b; --ink: #f5f5f7; --muted: #a1a1a6;
  --line: #38383a; --line-strong: #545458; --accent: #0a84ff; --info: #0a84ff; --ok: #32d74b; --warn: #ffb340; --bad: #ff453a;
  --lift: 0 10px 30px rgba(0, 0, 0, .55); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 var(--body); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.label, .order-head, .split-h, nav.rail button > span:not(.badge), .notice-h, .btn, h2 {
  font-family: var(--label); font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
}

/* ---------- Ramme: værktøjslinje, sidebjælke, arbejdsflade ---------- */
.app { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.top {
  display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; min-height: 52px;
  padding-block: 8px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  background: var(--side); border-bottom: 1px solid var(--line); font-size: 14px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand .logo { width: 26px; height: 26px; flex: none; }
.brand small { font-weight: 400; font-size: 14px; color: var(--muted); letter-spacing: 0; }
.spacer { flex: 1; }
/* Beskeder i værktøjslinjen er almindelig tekst, ikke mærker */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 0; background: none; border: 0; font-size: 14px; color: var(--muted); white-space: nowrap; text-decoration: none; }
.chip b { font-weight: 600; color: var(--ink); }
.chip.warn { color: var(--warn); font-weight: 600; }
.chip.bad { color: var(--bad); font-weight: 600; }
.chip.ok { color: var(--ok); font-weight: 600; }
button.chip { cursor: pointer; }
button.chip:hover, a.chip:hover { text-decoration: underline; text-underline-offset: 3px; }
.top .btn, .top .btn.small { min-height: 30px; padding: 4px 6px; background: none; font: 500 14px var(--body); text-transform: none; letter-spacing: 0; }
.top a.toplink .ico { width: 16px; height: 16px; }

.body { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 0; }
nav.rail { background: var(--side); border-right: 1px solid var(--line); padding: 18px 0 0; display: flex; flex-direction: column; gap: 2px; }
nav.rail button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 11px 20px 11px 17px; border-left: 3px solid transparent; font-size: 13px; color: var(--muted);
}
nav.rail button:hover { color: var(--ink); }
nav.rail button[aria-current="page"] { color: var(--accent); border-left-color: var(--accent); }
nav.rail .ico { display: none; width: 22px; height: 22px; flex: none; }
nav.rail .badge { margin-left: auto; font: 600 14px var(--body); letter-spacing: 0; color: var(--bad); }
nav.rail .subnav { display: flex; flex-direction: column; margin: 0 0 6px 20px; }
nav.rail .subnav button { padding: 6px 12px; font: 400 14px var(--body); text-transform: none; letter-spacing: 0; border-left-width: 2px; }

.rail-foot { margin-top: auto; padding: 14px 20px 16px; border-top: 1px solid var(--line); font-size: 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.rail-foot b { font-weight: 600; }
.rail-foot .btn.ghost { padding: 2px 0; min-height: 26px; font: 500 14px var(--body); text-transform: none; letter-spacing: 0; }
@media (min-width: 861px) { .top [data-a="theme"], .top [data-a="logout"], .top span.chip:not(.warn):not(.bad) { display: none; } }
main { overflow: auto; padding-block: 24px 48px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); min-width: 0; }
.wrap { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.wrap.wide { max-width: none; }
h1 { font-weight: 700; font-size: 28px; line-height: 1.2; margin: 0; letter-spacing: -.015em; text-wrap: balance; }
h2 { font-size: 13px; margin: 0; color: var(--muted); }
.sub { color: var(--muted); margin: 0; }
.panel { background: transparent; border-top: 1px solid var(--line); padding: 16px 0 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.hint { color: var(--muted); font-size: 14px; }
.meta { color: var(--muted); font-size: 14px; }
.loading { color: var(--muted); padding: 24px; text-align: center; }
.empty { padding: 32px 0; color: var(--muted); }

/* ---------- Knapper: firkantede flader ---------- */
.btn { border: 0; background: var(--tile); box-shadow: inset 0 0 0 1px var(--line); color: var(--accent); border-radius: var(--r-sm); padding: 10px 18px; min-height: 44px; font-size: 13px; }
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); padding-inline: 8px; box-shadow: none; }
.btn.small { min-height: 32px; padding: 5px 12px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: default; filter: none; }

/* ---------- Leveringsproblem (GOV.UK-banner + Peters' flade farve) ---------- */
.notice { --sig: #c4001a; border: 2px solid var(--sig); background: var(--tile); }   /* fast mørk rød: hvid tekst 6:1 i lys og mørk */
.notice-h { background: var(--sig); color: #fff; font-size: 12px; padding: 4px 14px 5px; }
.notice-b { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; padding: 10px 14px; font-size: 16px; }
.notice-b .btn { background: var(--sig); color: #fff; box-shadow: none; }

/* ---------- Søgning og filtre ---------- */
.search { display: flex; gap: 10px; align-items: stretch; }
.search input { flex: 1; min-width: 0; font-size: 18px; padding: 13px 16px; border: 2px solid transparent; border-radius: var(--r); background: var(--tile); }
.search input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.search .btn { padding-inline: 22px; }
.filters { display: flex; gap: 4px 26px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.filters button { border: 0; background: none; padding: 8px 0 10px; font-size: 15px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }
.filters button.bad { color: var(--bad); font-weight: 600; }
.filters button.bad[aria-pressed="true"] { border-bottom-color: var(--bad); }

/* ---------- Bestillingslisten som køreplan ---------- */
.list { display: flex; flex-direction: column; gap: 3px; }
.order, .order-head {
  display: grid; grid-template-columns: 110px minmax(160px, 1fr) minmax(0, 1.4fr) minmax(220px, 1.3fr) 90px; gap: 18px; align-items: start;
}
.order-head { font-size: 12px; color: var(--muted); padding: 4px 16px 4px; }
.order { padding: 14px 16px; border: 0; background: var(--tile); text-align: left; width: 100%; box-shadow: inset 4px 0 transparent; }
.order:hover { box-shadow: inset 4px 0 var(--accent); }
.order > div { min-width: 0; }
.order > div:nth-child(2) > div:first-child { font-weight: 700; }
.bi { font-weight: 400; font-size: 16px; }
.items { overflow: hidden; }
.order .items { font-weight: 400 !important; white-space: nowrap; text-overflow: ellipsis; }
.order .meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order .items .meta { font-weight: 400; }
.st { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.st::before { content: ""; width: 10px; height: 10px; flex: none; background: currentColor; }
.st.st-oprettet { color: var(--st-new); }
.st.st-bestilt { color: var(--st-ordered); }
.st.st-klar, .st.st-afhentet { color: var(--st-done); }
.st.st-annulleret { color: var(--muted); }
.st + .pills { padding-left: 18px; }
.pills { display: block; color: var(--muted); font-size: 14px; }
.pill { font-size: 14px; }
.pills .pill + .pill::before { content: " · "; color: var(--muted); font-weight: 400; }
.pill.stock, .sms-bad { color: var(--bad); font-weight: 600; }
.sms-ok, .paid { color: var(--ok); }
.sms-wait { color: var(--muted); }
.order:has(.pill.stock) { box-shadow: inset 4px 0 var(--bad); }
.paidcol { font-size: 15px; }
.paidcol.unpaid { color: var(--muted); }
.paidcol.paid { color: var(--ok); font-weight: 600; }
/* Gamle mærke-klasser bruges stadig enkelte steder (fx SMS-status) – her som farvet tekst */
.unpaid { color: var(--bad); }
.gift { color: inherit; }
.st-koe, .st-sender { color: var(--accent); }
.st-sendt { color: var(--ok); }
.st-fejl, .st-ukendt { color: var(--bad); font-weight: 600; }
.ean-note { padding: 10px 14px; background: var(--soft); border-left: 4px solid var(--accent); font-weight: 600; }

/* ---------- Liste + åben bestilling (Mail på Mac) ---------- */
.split { display: block; }
.split-list { display: none; }
@media (min-width: 1100px) {
  .split { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 0 32px; align-items: start; }
  .split-list { display: block; background: var(--bg); position: sticky; top: -24px; max-height: calc(100vh - 80px); overflow: auto; border-right: 1px solid var(--line); margin-block: -24px; padding-top: 18px; }
  .split-h { font-size: 12px; color: var(--muted); padding: 0 14px 8px; }
  .split-list .order { margin-bottom: 3px; }
  .split-list .order { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 14px; }
  .split-list .order > div:nth-child(1) { grid-column: 2; grid-row: 1 / 3; text-align: right; }
  .split-list .order > div:nth-child(1) .bi { font-size: 13px; color: var(--muted); font-weight: 400; }
  .split-list .order > div:nth-child(2) { grid-column: 1; grid-row: 1; }
  .split-list .order > div:nth-child(2) .meta { display: none; }
  .split-list .order .items { grid-column: 1; }
  .split-list .order .state { grid-column: 1 / -1; }
  .split-list .order .items .meta, .split-list .paidcol { display: none; }
  .split-list .order .st { font-weight: 500; font-size: 14px; display: inline-flex; }
  .split-list .order .st + .pills { display: inline; padding-left: 0; }
  .split-list .order .st + .pills:not(:empty)::before { content: " · "; }
  .split-list .order.open { background: var(--accent); color: #fff; box-shadow: none; }
  .split-list .order.open * { color: #fff !important; }
  .split-main > .row:first-child { display: none; }   /* "← Bestillinger" er overflødig, når listen står ved siden af */
}
.split-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- Åben bestilling ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-bottom: 1px solid var(--line); }
.step { padding: 8px 0 10px; color: var(--muted); font-family: var(--label); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.step.done { color: var(--ink); border-bottom-color: var(--line-strong); }
.step.now { color: var(--accent); border-bottom-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.grid2 .panel, .split-main > .panel { background: transparent; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 0; margin: 0; background: var(--tile); }
.kv dt, .kv dd { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.kv dt { color: var(--muted); font-size: 15px; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.kv dt:nth-last-child(2), .kv dd:last-child { border-bottom: 0; }
.kv .pill { font-weight: 600; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; background: var(--tile); border-bottom: 1px solid var(--line); }
.line .t { font-weight: 600; }
.line.with-cover { grid-template-columns: 56px minmax(0, 1fr) auto; }
.line-cover { width: 56px; height: 80px; object-fit: contain; background: var(--soft); }
.toggle { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--line-strong); border-radius: 999px; padding: 8px 14px; background: var(--surface); font-weight: 600; min-height: 44px; }
.toggle[aria-pressed="true"] { border-color: var(--ok); background: var(--ok); color: #fff; }
.log { font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.log span { margin-right: 10px; color: var(--ink); }
.stock-bad { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; color: var(--bad); font-weight: 600; font-size: 14px; }

/* ---------- Formularer ---------- */
.form { display: grid; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 600; font-size: 14px; }
.field input, .field select, .field textarea { padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); font-size: 17px; min-height: 48px; width: 100%; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 1px var(--accent); }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; }
.suggest button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.suggest button[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); }
.seg button { border: 0; background: var(--surface); padding: 10px 18px; font-weight: 600; min-height: 46px; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.lineedit { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.1fr) 110px minmax(0, 1.3fr) auto; gap: 12px; align-items: end; padding: 14px; background: var(--tile); }
.stepper { display: flex; align-items: center; border: 1px solid var(--line-strong); height: 48px; background: var(--surface); }
.stepper button { border: 0; background: transparent; width: 36px; height: 100%; font-size: 20px; font-weight: 600; color: var(--accent); }
.stepper output { flex: 1; text-align: center; font-weight: 700; }
.customer-hit { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--soft); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

/* Titelforslag fra Bogportalen */
.bp-field { position: relative; }
.bp-results { position: absolute; top: 100%; left: 0; right: 0; min-width: min(820px, calc(100vw - 32px)); z-index: 30; margin-top: 2px; max-height: min(70vh, 680px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--lift); }
.bp-only { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--accent); border-bottom: 1px solid var(--line); }
.bp-only button { border: 1px solid var(--line-strong); background: var(--surface); padding: 4px 10px; font-size: 13px; }
.bp-hit { display: grid; grid-template-columns: 56px minmax(0, 1fr); column-gap: 14px; align-items: start; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 10px 12px; }
.bp-hit:hover, .bp-hit:focus { background: var(--side); }
.bp-hit .t { font-weight: 600; font-size: 17px; }
.bp-hit .bp-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bp-img { width: 56px; height: 80px; object-fit: contain; background: var(--soft); }
.bp-img.none { background: transparent; }
.bp-hit .m { font-size: 14px; color: var(--muted); }
.bp-msg { padding: 12px; color: var(--muted); font-size: 14px; }
.bp-msg.err { color: var(--bad); font-weight: 600; }
.ean-chip { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; color: var(--accent); font-weight: 600; }
.ean-chip button { border: 0; background: transparent; color: var(--muted); font-size: 14px; padding: 2px 6px; }

/* ---------- Beskedbokse (SMS) og gamle bannere ---------- */
.banner, .smsbox { display: flex; gap: 8px 12px; align-items: center; flex-wrap: wrap; padding: 12px 16px; background: var(--tile); border-left: 4px solid var(--warn); }
.banner strong { color: var(--warn); }
.smsbox.ok { border-left-color: var(--ok); } .smsbox.ok strong { color: var(--ok); }
.smsbox.info { border-left-color: var(--accent); } .smsbox.info strong { color: var(--accent); }
.smsbox.bad { border-left-color: var(--bad); } .smsbox.bad strong { color: var(--bad); }
.sms { background: var(--soft); border-radius: 14px 14px 14px 3px; padding: 12px 14px; white-space: pre-wrap; font-size: 15px; }
.sms-meta { font-size: 13px; color: var(--muted); }

/* ---------- Vinduer og bon ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; z-index: 50;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.modal { background: var(--surface); width: min(860px, 100%); max-height: 100%; overflow: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--lift); }
.receipt-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.receipt { width: max-content; max-width: 100%; background: #fff; color: #111; font-family: var(--mono); font-size: 12px; line-height: 1.45; padding: 18px 16px 22px; box-shadow: 0 2px 12px rgba(0,0,0,.18); }
.receipt .paper { width: 48ch; max-width: 100%; }
.receipt .ln { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.45em; }
.receipt .big { font-size: 2em; line-height: 1.2; }
.receipt .em { font-weight: 700; }
.receipt .ul { text-decoration: underline; }
.receipt .inv { background: #111; color: #fff; }
.receipt .bar { display: flex; justify-content: center; margin-top: 4px; }
.receipt .bar svg { width: 100%; height: 70px; }
.receipt .seddel-fejl { width: 48ch; max-width: 100%; margin-bottom: 10px; padding: 8px; border: 2px solid #c00; color: #c00; font-weight: 700; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: var(--bg); padding: 12px 20px; font-weight: 600; z-index: 70; max-width: calc(100% - 32px); box-shadow: var(--lift); }

/* ---------- Login og PIN ---------- */
.pin-bg, .center-bg { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.pin, .login { background: var(--surface); padding: 28px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: var(--lift); }
.login { width: min(420px, 100%); }
.pin .brand { justify-content: center; font-size: 20px; }
.pin-display { display: flex; gap: 10px; justify-content: center; }
.pin-display span { width: 44px; height: 54px; border-bottom: 3px solid var(--line-strong); display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.pin-display span.f { border-bottom-color: var(--ink); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keys button { height: 60px; border-radius: var(--r); border: 0; background: var(--soft); font-size: 24px; font-weight: 600; }
.keys button:active { background: var(--line-strong); }
.err { color: var(--bad); font-weight: 600; min-height: 22px; text-align: center; }

/* Scan */
.scanbox { border: 2px dashed var(--line-strong); padding: 30px 16px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.scanbox.on { border-color: var(--ok); }
.scanbox input { font-size: 22px; text-align: center; padding: 12px; border: 1px solid var(--line-strong); width: min(360px, 100%); background: var(--surface); }

/* Find printer */
.findprinter { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.fp-hit { justify-content: space-between; padding: 10px 14px; background: var(--tile); }

/* ---------- Telefon og smal iPad ---------- */
@media (max-width: 860px) {
  .top { padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); gap: 4px 14px; }
  .body { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  nav.rail { order: 2; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px)); overflow-x: auto; gap: 0; }
  .top [data-a="theme"], .top [data-a="testreset"], .top span.chip:not(.warn):not(:has(b)) { display: none; }
  .order > div:nth-child(2) .meta { display: none; }
  .rail-foot { display: none; }
  .st + .pills { padding-left: 18px; }
  nav.rail button > span:not(.badge) { font: 500 11px var(--body); text-transform: none; letter-spacing: 0; white-space: nowrap; }
  nav.rail button { flex: 1; flex-direction: column; gap: 3px; min-width: 0; padding: 6px 4px; text-align: center; border-left: 0; border-top: 3px solid transparent; position: relative; }
  nav.rail button[aria-current="page"] { border-top-color: var(--accent); }
  nav.rail .ico { display: block; }
  nav.rail .badge { position: absolute; top: 2px; right: calc(50% - 26px); font-size: 12px; }
  nav.rail .subnav { flex-direction: row; margin: 0; }
  main { padding-block: 16px 32px; padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
  h1 { font-size: 24px; }
  .order-head { display: none; }
  .order { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 4px 12px 10px; }
  .order > div:nth-child(1) { grid-column: 2; grid-row: 1 / 3; text-align: right; }
  .order > div:nth-child(1) .bi { font-size: 13px; color: var(--muted); font-weight: 400; }
  .order > div:nth-child(2) { grid-column: 1; grid-row: 1; }
  .order .items { grid-column: 1; }
  .order .state { grid-column: 1 / -1; }
  .order .paidcol { grid-column: 1 / -1; font-size: 14px; }
  .order .paidcol.unpaid { display: none; }
  .filters { gap: 2px 18px; }
  .filters button { font-size: 14px; }
  .search .btn { padding-inline: 14px; }
  .grid2, .receipt-wrap { grid-template-columns: 1fr; }
  .lineedit { grid-template-columns: 1fr 1fr; }
  .lineedit .bp-field { grid-column: 1 / -1; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}


/* ---------- Runde hjørner (ejerens ønske 2026-11-27: som i den originale Librio) ---------- */
.order { border-radius: var(--r); }
.split-list .order.open { border-radius: var(--r); }
.notice { border-radius: var(--r); overflow: hidden; }
.kv, .line, .lineedit, .banner, .smsbox, .fp-hit, .ean-note, .customer-hit, .scanbox { border-radius: var(--r); }
.kv { overflow: hidden; }
.line + .line { margin-top: 4px; }
.line-cover, .bp-img { border-radius: 3px; }
.st::before { border-radius: 3px; }
.seg { border-radius: var(--r-sm); overflow: hidden; }
.stepper { border-radius: var(--r-sm); overflow: hidden; }
.bp-results { border-radius: var(--r); }
.modal { border-radius: 14px; }
.pin, .login { border-radius: 16px; }
.toast { border-radius: 999px; }
.scanbox input { border-radius: var(--r-sm); }

/* ==========================================================================
   Runde 3 (2026-11-27): resten af skærmene i samme stil + interaktion.
   Princip: hver ting på sin egen hvide flade på grå (som bestillingerne), Futura-etiket over hvert afsnit,
   korte overgange (≤ 200 ms) kun når computeren ikke har bedt om mindre bevægelse.
   ========================================================================== */

/* ---------- Afsnit og grupperede flader ---------- */
.fsec { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fsec > h2 { padding-left: 2px; }
.sec-h { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; min-height: 32px; padding-left: 2px; }
.group { background: var(--tile); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.list-group { padding: 0; gap: 0; overflow: hidden; }
.list-group > .line { border-radius: 0; background: transparent; border-bottom: 0; }
.list-group > .line + .line { margin-top: 0; border-top: 1px solid var(--line); }

/* ---------- Tomme skærme: hvad er der sket, og hvad kan man gøre ---------- */
.empty { background: var(--tile); border-radius: var(--r); padding: 28px 24px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.empty-t { font-weight: 700; font-size: 17px; color: var(--ink); }
.empty p { margin: 0 0 8px; max-width: 56ch; }

/* ---------- Listen: tastatur ---------- */
.order:focus-visible { outline: none; box-shadow: inset 4px 0 var(--accent), 0 0 0 2px var(--accent); }
.split-list .order.open:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.kbd-hint { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
kbd { font: 600 12px/1.5 var(--body); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; margin: 0 2px; background: var(--tile); color: var(--ink); }
@media (max-width: 860px), (pointer: coarse) { .kbd-hint { display: none; } }

/* ---------- Åben bestilling ---------- */
.st-big { font-size: 16px; }
.st-big::before { width: 12px; height: 12px; }
.detail-head { border-radius: var(--r); padding: 6px 10px; margin: -6px -10px; }
.sms-st { font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.sms-st::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.sms-st.st-annulleret { color: var(--muted); }

/* ---------- Ny bestilling / Ret ---------- */
.form { gap: 24px; }
.form .grid2 { gap: 16px; }
.lineedit { grid-template-columns: minmax(0, 2fr) minmax(0, 1.1fr) 124px minmax(0, 1.3fr); gap: 14px; padding: 16px; }
.fsec > .lineedit + .lineedit { margin-top: 0; }
.lineedit-h { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; margin: -6px 0 -8px; }
.lineedit-h .label { font-size: 12px; color: var(--muted); }
.lineedit-h .btn { color: var(--bad); }
.suggest { grid-column: 1 / -1; align-items: center; }
.suggest-l { font-size: 13px; color: var(--muted); margin-right: 4px; }
.suggest button { border: 0; background: var(--soft); color: var(--ink); min-height: 30px; padding: 4px 12px; }
.suggest button:hover { background: var(--line); }
.suggest button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.stepper { height: 48px; }
.stepper button:hover { background: var(--soft); }
.form .toggle { border-width: 1px; font-weight: 500; }
.form .toggle[aria-pressed="true"] { font-weight: 600; }
/* Gem-knappen er altid inden for rækkevidde, også på en lang bestilling */
.form-actions { position: sticky; bottom: -48px; z-index: 5; display: flex; gap: 10px 12px; align-items: center; flex-wrap: wrap;
  margin: 0 -4px; padding: 12px 4px 48px; background: var(--bg); border-top: 1px solid var(--line); }
.form-actions .err { text-align: left; min-height: 0; }
.bp-results { border: 0; }
.bp-hit { box-shadow: inset 3px 0 transparent; }
.bp-hit:hover, .bp-hit:focus, .bp-hit.kb { background: var(--soft); box-shadow: inset 3px 0 var(--accent); outline: none; }
.bp-hit .m b { font-weight: 600; color: var(--ink); }
.bp-only { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.bp-only button { border-radius: 999px; }

/* ---------- Skal bestilles ---------- */
.qty { color: var(--bad); font-weight: 700; }
.warn-t { color: var(--warn); }
.olinks { display: flex; flex-wrap: wrap; gap: 2px 14px; justify-content: flex-end; }
.olink { border: 0; background: none; padding: 6px 0; color: var(--accent); font-size: 14px; font-weight: 600; }
.olink:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Indstillinger: hvert afsnit på sin egen flade ---------- */
.settings { display: contents; }
.settings .panel { background: var(--tile); border-top: 0; border-radius: var(--r); padding: 16px 18px; }
.settings .panel .panel { background: var(--soft); padding: 14px 16px; }
.settings .sec-h { padding-left: 0; min-height: 0; }
.page-h2 { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.page-h2 h2 { font: 700 20px/1.3 var(--body); text-transform: none; letter-spacing: -.01em; color: var(--ink); }
.rows { display: flex; flex-direction: column; }
.rowline { justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rows > .rowline:last-child { border-bottom: 0; }
.tag { font-family: var(--label); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; color: var(--accent); margin-left: 6px; }
.findprinter { border-top: 0; padding-top: 0; }

/* ---------- PIN og login: flad hvid flade på grå, som resten ---------- */
.pin, .login { box-shadow: none; }
.pin { text-align: center; gap: 12px; padding: 26px 24px 20px; }
.pin-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--label); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: 12px; color: var(--muted); }
.pin-brand .logo { width: 22px; height: 22px; }
.pin-title { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin-top: 8px; }
.pin .sub { margin-top: -8px; }
.pin-display { margin: 6px 0 2px; }
.pin-display span.f { border-bottom-color: var(--accent); }
.keys button { height: 64px; font-size: 26px; font-weight: 500; }
.keys button:hover { filter: brightness(.97); }
.keys .key-ok { background: var(--accent); color: var(--accent-ink); font: 700 15px var(--label); letter-spacing: .1em; }
.keys .key-ok:disabled { opacity: .4; }
.login { padding: 32px 28px 26px; gap: 16px; }
.login .brand { font-size: 20px; }
.login .err { text-align: left; min-height: 0; }
.login .err:empty { display: none; }

/* ---------- Vinduer og sedlen ---------- */
.modal { padding: 24px 24px 20px; }
.modal > h2 { font: 700 20px/1.3 var(--body); text-transform: none; letter-spacing: -.01em; color: var(--ink); }
.modal-bg { background: rgba(0, 0, 0, .4); }
.receipt-stage { background: var(--soft); border-radius: var(--r); padding: 20px; display: flex; justify-content: center; min-width: 0; }
.receipt { box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 8px 20px rgba(0, 0, 0, .12); border-radius: 2px; }
.sms { border-radius: 16px 16px 16px 4px; }

/* ---------- Telefon ---------- */
@media (max-width: 860px) {
  .group { padding: 14px; }
  .list-group > .line { grid-template-columns: minmax(0, 1fr); }
  .list-group > .line.with-cover { grid-template-columns: 56px minmax(0, 1fr); }
  .olinks { justify-content: flex-start; }
  .receipt-stage { padding: 12px; }
  .settings .panel { padding: 14px; }
  .form-actions .btn.primary { flex: 1; }
}

/* ---------- Bevægelse: kort, og kun når den ikke er fravalgt ---------- */
/* Markering efter scanning eller tryk: farven toner ud (ingen bevægelse, så den vises altid) */
.flash { animation: flash 1.4s ease-out; }
.split-list .order.open.flash { animation: ring 1.4s ease-out; }
.flash-ok { animation: flash-ok 1s ease-out; }
.flash-bad { animation: flash-bad 1.4s ease-out; }
@keyframes flash { 0%, 35% { background-color: color-mix(in srgb, var(--accent) 16%, var(--tile)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); } }
@keyframes ring { 0%, 35% { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px color-mix(in srgb, var(--accent) 60%, transparent); } }
@keyframes flash-ok { 0%, 30% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 40%, transparent); } }
@keyframes flash-bad { 0%, 35% { border-color: var(--bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 30%, transparent); } }
@media (prefers-reduced-motion: no-preference) {
  .btn, .order, .filters button, nav.rail button, .suggest button, .toggle, .keys button, .olink, .bp-hit, .seg button, .stepper button {
    transition: background-color .12s ease-out, color .12s ease-out, box-shadow .12s ease-out, filter .12s ease-out, transform .08s ease-out; }
  .btn:active:not(:disabled), .keys button:active, .toggle:active, .suggest button:active, .seg button:active { transform: scale(.97); }
  .wrap.enter { animation: fade-in .16s ease-out; }
  .modal-bg.enter { animation: fade-in .14s ease-out; }
  .modal-bg.enter .modal { animation: rise .18s cubic-bezier(.2, .8, .2, 1); }
  .pin-bg.enter .pin { animation: rise .2s cubic-bezier(.2, .8, .2, 1); }
  .toast.enter { animation: up .2s ease-out; }
  .search input.flash-bad { animation: flash-bad 1.4s ease-out, shake .3s ease-in-out; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes up { from { transform: translate(-50%, 12px); opacity: 0; } }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Handlinger på en åben bestilling: næste skridt først, "Ret" og "Annullér" ude til højre, forklaringen på egen linje */
.actions { gap: 10px; }
.actions > .btn.ghost:nth-child(1 of .ghost) { margin-left: auto; }
.actions-note { order: 99; flex-basis: 100%; }
.actions [data-a="cancel"] { color: var(--bad); }

/* Futura-versaler på knapper: lidt mindre bogstavafstand end på etiketter, så lange knaptekster ikke bliver tunge og brede */
.btn { letter-spacing: .06em; padding-inline: 16px; }
.btn.ghost { padding-inline: 8px; }
/* Ét udtryk for "valgt" i formularer: blå flade og hvid tekst (som valgt række og menupunkt). Grøn er kun tekst. */
.form .toggle, .modal .seg, .form .seg { border-radius: var(--r-sm); }
.form .toggle { border: 1px solid var(--line-strong); background: var(--surface); min-height: 46px; }
.form .toggle[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

@media (max-width: 860px) {
  .lineedit { grid-template-columns: minmax(0, 1fr) 124px; }
  .lineedit .bp-field, .lineedit .field:has(> [data-k="supplier"]) { grid-column: 1 / -1; }
}
/* Grøn er kun tekst: "Print og send SMS" er en almindelig hovedknap */
.btn.ok { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
/* Statusforløbet står altid på én linje, uanset antal trin */
.steps, .steps[class] { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.toast { width: max-content; text-align: center; }
@media (max-width: 860px) {
  /* Varer på en åben bestilling: "Kommet hjem?" under varen, så teksten får hele bredden */
  .split-main .line { grid-template-columns: minmax(0, 1fr); }
  .split-main .line.with-cover { grid-template-columns: 56px minmax(0, 1fr); }
  .split-main .line > .toggle { justify-self: start; grid-column: -2 / -1; }
}

/* ==========================================================================
   Bog & idé-rød som handlingsfarve (ejerens ønske 2026-11-27): knapper, links, valgt menupunkt og valgt række.
   Fokus forbliver blå (må ikke ligne en fejl). Statusfarverne (okker/blå/grøn) er uændrede.
   ========================================================================== */
:root { --accent: #c8102e; --focus: #0068d6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --accent: #e0303f; --focus: #0a84ff; } }
:root[data-theme="dark"] { --accent: #e0303f; --focus: #0a84ff; }
:focus-visible { outline-color: var(--focus); }
.order:focus-visible { box-shadow: inset 4px 0 var(--focus), 0 0 0 2px var(--focus); }
.split-list .order.open:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus); }
.search input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--focus); }
.field input:focus, .field select:focus, .field textarea:focus { box-shadow: 0 0 0 1px var(--focus); }
/* Markering efter scanning: blå, så den ikke ligner et problem */
@keyframes flash { 0%, 35% { background-color: color-mix(in srgb, var(--focus) 14%, var(--tile)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 45%, transparent); } }
@keyframes ring { 0%, 35% { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px color-mix(in srgb, var(--focus) 60%, transparent); } }
/* Annullér er en stille handling, ikke en advarsel */
.actions [data-a="cancel"] { color: var(--muted); }
