
/* Layout: kasse-app med fast topbjælke, navigationsskinne til venstre (bundbjælke på telefon) og ét arbejdsområde */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --ink: #1b2330;
  --muted: #5d6778;
  --line: #dde1e8;
  --soft: #eceff4;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --ok: #1d7a46;
  --warn: #9a5b00;
  --bad: #b3261e;
  --info: #1f5fae;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161d; --surface: #1b212b; --ink: #e8ecf2; --muted: #9aa4b4; --line: #2e3643; --soft: #242b37;
    --accent: #ef4a5f; --ok: #5cc98a; --warn: #e3a54d; --bad: #ff7d73; --info: #7fb2ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161d; --surface: #1b212b; --ink: #e8ecf2; --muted: #9aa4b4; --line: #2e3643; --soft: #242b37;
  --accent: #ef4a5f; --ok: #5cc98a; --warn: #e3a54d; --bad: #ff7d73; --info: #7fb2ff; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--body); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--info); outline-offset: 2px; }

.app { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--display); font-weight: 800; font-size: 20px; letter-spacing: -.01em; }
.brand small { font-family: var(--body); font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 6px; }
.spacer { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--soft); font-size: 14px; white-space: nowrap; }
.chip b { font-weight: 700; }
.example { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }

.body { display: grid; grid-template-columns: 220px 1fr; min-height: 0; }
nav.rail { background: var(--surface); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 6px; }
nav.rail button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 14px 14px; border-radius: 10px; font-size: 16px; font-weight: 700; color: var(--muted);
}
nav.rail button[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
nav.rail .badge { margin-left: auto; background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 12px; padding: 1px 8px; }
nav.rail .ico { width: 22px; height: 22px; flex: none; }
main { overflow: auto; padding-block: 20px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-width: 0; }
.wrap { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
h1 { font-family: var(--display); font-weight: 800; font-size: 28px; margin: 0; letter-spacing: -.015em; text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 600; font-size: 19px; margin: 0; }
.sub { color: var(--muted); margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 12px 18px; font-weight: 700; min-height: 48px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.search { display: flex; gap: 10px; align-items: stretch; }
.search input { flex: 1; min-width: 0; font-size: 18px; padding: 14px 16px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); }
.search input:focus { border-color: var(--info); outline: none; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; color: var(--muted); }
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.banner { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--r);
  background: color-mix(in srgb, var(--warn) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.banner strong { color: var(--warn); }

.list { display: flex; flex-direction: column; }
.order {
  display: grid; grid-template-columns: 120px minmax(0, 1.2fr) minmax(0, 2fr) auto; gap: 14px; align-items: center;
  padding: 14px 10px; border-bottom: 1px solid var(--line); background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%;
}
.order:hover { background: var(--soft); }
.bi { font-family: var(--mono); font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.meta { color: var(--muted); font-size: 13px; }
.items { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; letter-spacing: .02em; }
.st-oprettet { background: var(--soft); color: var(--muted); }
.st-bestilt { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.st-klar { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.st-afhentet { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.st-annulleret { background: transparent; color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.paid { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.unpaid { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.gift { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* Detalje */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.step { padding: 10px; border-radius: 10px; background: var(--soft); color: var(--muted); font-weight: 700; font-size: 14px; text-align: center; }
.step.done { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.step.now { background: var(--ink); color: var(--bg); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.line .t { font-weight: 700; }
.toggle { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 999px; padding: 8px 14px; background: var(--surface); font-weight: 700; min-height: 44px; }
.toggle[aria-pressed="true"] { border-color: var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.log { font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.log span { font-family: var(--mono); font-size: 12px; margin-right: 8px; }

/* Formular */
.form { display: grid; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-weight: 700; font-size: 14px; }
.field input, .field select { padding: 12px 14px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 17px; min-height: 50px; width: 100%; }
.field input:focus { border-color: var(--info); outline: none; }
.hint { color: var(--muted); font-size: 13px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; }
.suggest button { border: 1px dashed var(--line); background: var(--soft); border-radius: 999px; padding: 6px 12px; font-size: 14px; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 12px 18px; font-weight: 700; min-height: 48px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.lineedit { display: grid; grid-template-columns: minmax(0, 2fr) 110px minmax(0, 1.3fr) auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.stepper { display: flex; align-items: center; border: 2px solid var(--line); border-radius: 10px; height: 50px; }
.stepper button { border: 0; background: transparent; width: 36px; height: 100%; font-size: 20px; font-weight: 700; }
.stepper output { flex: 1; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.customer-hit { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--info) 10%, transparent); color: var(--info); font-weight: 700; }

/* Modal + bon */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 14, 20, .5); 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); border-radius: 16px; width: min(860px, 100%); max-height: 100%; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.receipt-wrap { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.receipt { width: 300px; 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); border-radius: 2px; }
.receipt .c { text-align: center; }
.receipt .big { font-size: 18px; font-weight: 700; }
.receipt hr { border: 0; border-top: 1px dashed #777; margin: 8px 0; }
.receipt .bar { display: flex; justify-content: center; margin-top: 8px; }
.receipt .bar svg { width: 100%; height: 70px; }
.sms { background: var(--soft); border-radius: 14px 14px 14px 4px; padding: 12px 14px; white-space: pre-wrap; font-size: 15px; }
.sms-meta { font-size: 13px; color: var(--muted); }

/* PIN */
.pin-bg { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 16px; }
.pin { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.pin-display { display: flex; gap: 10px; justify-content: center; }
.pin-display span { width: 44px; height: 54px; border-radius: 10px; border: 2px solid var(--line); display: grid; place-items: center; font-family: var(--mono); font-size: 22px; font-weight: 700; }
.pin-display span.f { border-color: var(--ink); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keys button { height: 62px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); font-size: 24px; font-weight: 700; }
.err { color: var(--bad); font-weight: 700; min-height: 22px; text-align: center; }

/* Scan */
.scanbox { border: 3px dashed var(--line); border-radius: 16px; 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-family: var(--mono); font-size: 22px; text-align: center; padding: 12px; border-radius: 10px; border: 2px solid var(--line); width: min(360px, 100%); background: var(--surface); }
.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; border-radius: 999px; font-weight: 700; z-index: 70; max-width: calc(100% - 32px); }

@media (max-width: 860px) {
  .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: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); overflow-x: auto; }
  nav.rail button { flex-direction: column; gap: 4px; font-size: 12px; padding: 8px 10px; text-align: center; min-width: 76px; }
  nav.rail .badge { margin: 0; position: relative; }
  .order { grid-template-columns: 1fr auto; }
  .order .items { grid-column: 1 / -1; white-space: normal; }
  .grid2, .receipt-wrap { grid-template-columns: 1fr; }
  .lineedit { grid-template-columns: 1fr 1fr; }
  .lineedit .field:first-child { grid-column: 1 / -1; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: no-preference) { .toast { animation: up .2s ease-out; } @keyframes up { from { transform: translate(-50%, 12px); opacity: 0; } } }

/* ---------- Tilføjelser i det rigtige program ---------- */
.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)); }
.login { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; }
.chip.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); font-weight: 700; }
.chip.bad { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); font-weight: 700; }
.chip.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); font-weight: 700; }
button.chip { border: 0; cursor: pointer; }
.loading { color: var(--muted); padding: 20px; text-align: center; }
.st-koe, .st-sender { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.st-sendt { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.st-fejl, .st-ukendt { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; }
.check input { width: 22px; height: 22px; }
.ean-note { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--info) 10%, transparent); color: var(--info); font-weight: 700; }
.st-annulleret { background: transparent; color: var(--muted); border: 1px solid var(--line); }
