/* Mobile-first PWA styles. Single column, large touch targets, no horizontal scroll. */
:root {
  --brand: #1a4a7a;
  --brand-dark: #143a60;
  --bg: #f3f5f8;
  --card: #ffffff;
  --line: #d7dee8;
  --text: #1c2733;
  --muted: #6b7785;
  --grey-prev: #9aa6b2;
  --red: #d32f2f;
  --green: #2a7a3b;
  --radius: 12px;
  --tap: 48px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', Roboto, system-ui, Arial, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 16px; line-height: 1.4;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top));
}
.topbar .title { font-size: 27px; font-weight: 600; flex: 1; min-width: 0; }
.topbar .sub { font-size: 20px; opacity: .85; }
.topbar .sub2 { font-size: 13px; opacity: .7; font-weight: 400; margin-top: 1px; }
.topbar-right { font-size: 26px; font-weight: 600; text-align: right; max-width: 52%; line-height: 1.2;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.user-badge { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.18); color: #fff; font-size: 19px; font-weight: 700; }
.user-badge:active { background: rgba(255,255,255,.34); }
.help-btn { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255,255,255,.18); color: #fff; font-size: 20px; font-weight: 700; }
.help-btn:active { background: rgba(255,255,255,.34); }
.help-article h3 { font-size: 16px; margin: 20px 0 6px; color: var(--brand); }
.help-article h3:first-of-type { margin-top: 4px; }
.help-article p { margin: 0 0 10px; line-height: 1.45; }
.help-lead { font-size: 15px; color: var(--muted); margin-bottom: 16px; }
/* User popover */
.user-card { text-align: center; }
.user-avatar { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center; background: var(--brand); color: #fff;
  font-size: 30px; font-weight: 800; }
.user-name { font-size: 20px; font-weight: 700; color: var(--text); }
.user-email { font-size: 15px; color: var(--muted); margin-top: 2px; }
.user-store { font-size: 16px; color: var(--brand); font-weight: 600; margin-top: 10px; }
/* Language switch, moved here off the topbar. On the dark header the active flag is marked with a
   white outline; on this white card that would be invisible, so it gets a grey chip instead. */
.user-lang { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; }
.user-lang span { font-size: 15px; color: var(--muted); }
.user-lang .flag.on { outline: 0; }
.topbar button.back {
  background: rgba(255,255,255,.18); color: #fff; border: 0;
  width: 40px; height: 40px; border-radius: 10px; font-size: 20px;
}
/* Language switch (Norwegian / English flags) */
.lang-sw { display: inline-flex; gap: 4px; flex: 0 0 auto; align-items: center; }
.lang-sw .flag { padding: 2px; background: transparent; border: 0; border-radius: 5px;
  line-height: 0; opacity: .45; cursor: pointer; filter: grayscale(.4); }
.lang-sw .flag.on { opacity: 1; filter: none; outline: 2px solid rgba(255,255,255,.9); }
.lang-sw .flag svg { display: block; border-radius: 2px; }
.content { padding: 12px; }

/* Buttons */
button { font-family: inherit; cursor: pointer; }
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: var(--tap); border: 0; border-radius: var(--radius);
  background: var(--brand); color: #fff; font-size: 17px; font-weight: 600;
  padding: 0 16px;
}
.btn:active { background: var(--brand-dark); }
.btn.secondary { background: #e7ecf3; color: var(--brand); }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
.btn[disabled] { opacity: .5; }

/* Sticky bottom action */
.sticky-action {
  position: sticky; bottom: 0;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
}
.sticky-action.two-btn { display: flex; gap: 10px; }
.sticky-action.two-btn .btn { flex: 1; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.card h2 { font-size: 21px; margin: 0 0 8px; color: var(--brand); text-transform: uppercase; letter-spacing: .03em; }
.works-link { display: inline-block; color: var(--brand); font-weight: 700; text-decoration: none; padding: 8px 0; font-size: 22px; }

/* Forms */
label.field { display: block; margin-bottom: 12px; }
label.field .lbl { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font-size: 26px; font-family: inherit; color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 12px; background: #fff;
  min-height: var(--tap);
}
textarea { min-height: 96px; resize: vertical; }
#note { min-height: 40px; margin-top: 8px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
/* Light green = unsaved change, committed on Bekreft. */
textarea.changed, select.changed, input.changed { background: #edfaf0; border-color: #9fd9ad; }
/* Invalid value (e.g. DOT out of range) */
input.invalid { border-color: var(--red); color: var(--red); background: #fdecea; }

/* Password field with show/hide eye toggle */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 4px; top: 0; height: 100%; width: 46px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--muted); }
.pw-toggle:active { color: var(--brand); }

/* Brand combobox dropdown (custom — native <datalist> can render white-on-white) */
.combo-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 2px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; max-height: 220px; overflow-y: auto;
  box-shadow: 0 8px 20px rgba(0,0,0,.14); }
.combo-opt { padding: 9px 12px; color: var(--text); font-size: 17px; border-bottom: 1px solid var(--line); }
.combo-opt:last-child { border-bottom: 0; }
.combo-opt:active { background: #eef3f9; }
/* Compact tire-info form (Merke/Dimensjon/DOT) — not part of the enlarged måling fields */
#tireForm input { font-size: 18px; min-height: 42px; padding: 8px 10px; }
#tireForm .lbl { font-size: 12px; margin-bottom: 4px; }
#tireForm .card { padding: 10px; margin-bottom: 8px; }
/* Notat textarea back to normal size */
#comment { font-size: 17px; }

/* Tread-depth colour by value (StoreSettings thresholds): worn / warning / good — both the
   entered value and the previous (grey) value get a soft background so wear is visible at a glance. */
/* Card header with a control on the right (Mønsterdybde + antall hjul). */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-head h2 { margin: 0; }
.items-pick { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.items-pick span { font-size: 13px; color: var(--muted); }
.items-pick select { font-size: 17px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--text); }
.axle-row input.d-red,    .axle-row .prev.d-red    { background: #f6c7cb; }
.axle-row input.d-orange, .axle-row .prev.d-orange { background: #ffe3b0; }
.axle-row input.d-green,  .axle-row .prev.d-green  { background: #c6ebcf; }
.axle-row .prev.d-red, .axle-row .prev.d-orange, .axle-row .prev.d-green { border-radius: 6px; padding: 2px 0; color: var(--text); }

/* Warning: scanned wheelset is registered out (no storage location) */
.warn-out { display: flex; gap: 10px; align-items: center; background: #fdf6e3; border: 1px solid #e8a000;
  border-left: 4px solid #e8a000; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px;
  color: #6a4b00; font-size: 16px; }
.warn-out svg { flex: 0 0 auto; }
.warn-out b { color: #6a4b00; }
/* Stronger (red) variant — e.g. the car is deleted */
.warn-out.warn-strong { border-color: var(--red); border-left-color: var(--red); background: #fdecea; color: var(--red); }
.warn-out.warn-strong b { color: var(--red); }
/* Informational note (e.g. measured recently) */
.warn-info { background: #edf3fb; border: 1px solid #1a4a7a; border-left: 4px solid #1a4a7a; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 12px; color: #1a4a7a; font-size: 15px; }

/* Deleted wheelset — big red warning + Av-slett */
.deleted-banner { background: #fdecea; border: 2px solid var(--red); border-radius: 12px; padding: 14px; margin-bottom: 12px; text-align: center; }
.deleted-banner .del-title { color: var(--red); font-weight: 800; font-size: 34px; letter-spacing: .08em; }
.deleted-banner .del-sub { color: var(--red); font-size: 16px; margin: 4px 0 12px; }
.deleted-banner .btn { background: var(--red); }
.deleted-banner .btn:active { background: #a31515; }

/* "Which wheelset?" chooser + yes/no confirm overlay */
.choose-overlay { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center;
  background: rgba(20,40,70,.5); padding: 22px; }
.choose-card { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 360px;
  box-shadow: 0 14px 36px rgba(0,0,0,.28);
  /* Never taller than the screen — scroll inside so Lukk/Avbryt stay reachable
     even when the card grows (e.g. the reservations block on a small phone). */
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  overflow-y: auto; -webkit-overflow-scrolling: touch; }
.choose-title { font-size: 20px; font-weight: 700; color: var(--text); text-align: center; }
.choose-sub { font-size: 16px; color: var(--muted); text-align: center; margin: 4px 0 14px; }
.choose-btn { justify-content: space-between; margin-bottom: 10px; text-align: left; }
.choose-loc { font-size: 13px; font-weight: 600; opacity: .9; }

/* Save confirmation splash (after Bekreft) */
.saved-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(20,40,70,.45); padding: 24px; }
.saved-card { background: #fff; border-radius: 18px; padding: 28px 34px; text-align: center;
  box-shadow: 0 14px 36px rgba(0,0,0,.28); animation: saved-pop .18s ease-out; }
.saved-card svg { display: block; margin: 0 auto 10px; }
.saved-title { font-size: 23px; font-weight: 700; color: var(--text); }
.saved-sub { font-size: 18px; color: var(--green); font-weight: 600; margin-top: 4px; }
@keyframes saved-pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Menu hub */
.menu-grid { display: flex; flex-direction: column; gap: 14px; }
.menu-btn {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px; text-align: left; min-height: 84px;
}
.menu-btn .ic { font-size: 30px; width: 44px; text-align: center; }
.menu-btn .mlbl { font-size: 19px; font-weight: 600; color: var(--text); }
.menu-btn .mdesc { font-size: 13px; color: var(--muted); }
.menu-btn:active { border-color: var(--brand); }
.menu-btn[disabled] { opacity: .55; }
.menu-btn[disabled] .mlbl { color: var(--muted); }
.badge-soon { font-size: 11px; background: #e7ecf3; color: var(--muted); border-radius: 999px; padding: 3px 8px; margin-left: auto; }
/* An inline on/off toggle riding on a .menu-btn row (Ekstra > Etikettskriver) —
   pushed to the right like .badge-soon, but interactive: its own click handler
   stops the row's own navigate-on-click from also firing (see ekstraScreen). */
.menu-toggle { margin-left: auto; display: flex; align-items: center; }
.menu-toggle input { width: 26px; height: 26px; min-height: 26px; accent-color: var(--brand); }

/* Header (compact car info) */
.wheel-type { text-align: center; font-weight: 800; font-size: 26px; letter-spacing: .25em;
  color: var(--brand); text-transform: uppercase; margin: 2px 0 12px; }
.car-head .headline { font-size: 24px; font-weight: 700; color: var(--text); }
/* Dekktype is now a link inline in the headline (was duplicated further down) */
.tiretype-link { color: var(--brand); text-decoration: none; }
.car-head .reg { font-size: 44px; font-weight: 700; letter-spacing: .04em; }
.car-head .loc { font-size: 28px; color: var(--brand); font-weight: 600; }
.car-head .specs { font-size: 20px; color: var(--muted); margin-top: 6px; }
.car-head .specs b { color: var(--text); font-weight: 600; }
/* Tire info is a tappable link to its edit page. */
.tireinfo-edit { display: block; position: relative; text-decoration: none; color: inherit; margin-top: 4px; padding-right: 22px; }
.tireinfo-edit .edit-ic { position: absolute; right: 0; top: 0; color: var(--brand); font-size: 21px; }
.tireinfo-edit.add { color: var(--brand); font-weight: 600; padding-right: 0; }
.car-head .specs.unverified, .car-head .specs.unverified b { color: var(--grey-prev); font-weight: 400; }
.unverified-note { color: var(--grey-prev); font-size: 18px; font-style: italic; margin-top: 2px; }
/* Hotel category (tappable, left) + last-swapped date/time (right), one row. */
.cat-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 10px; }
.cat-link { font-size: 20px; font-weight: 600; color: var(--brand); text-decoration: none; }
.swap-date { font-size: 15px; color: var(--muted); white-space: nowrap; }

/* Wheel diagram */
/* Compact one-row-per-axle layout: label · prev · input | input · prev · label */
.axle-row { display: grid; grid-template-columns: 30px 56px 1fr 1fr 56px 30px; gap: 4px; align-items: center; margin-bottom: 10px; }
.axle-row .wlbl { font-size: 18px; color: var(--muted); font-weight: 600; }
.axle-row > .wlbl:first-child { text-align: right; }
.axle-row > .wlbl:last-child { text-align: left; }
.axle-row .prev { font-size: 26px; color: var(--grey-prev); text-align: center; }
.axle-row input { min-height: 58px; text-align: center; font-size: 34px; font-weight: 600; padding: 6px 4px; }
.topbar-right a, .loc-link { color: #fff; text-decoration: underline; }
.axle { display: grid; grid-template-columns: 1fr 56px 1fr; gap: 8px; align-items: center; margin-bottom: 14px; }
.car-spine { background: #e7ecf3; border-radius: 8px; align-self: stretch; min-height: 64px; }
.wheel { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wheel .wlbl { font-size: 11px; color: var(--muted); }
.wheel .prev { font-size: 12px; color: var(--grey-prev); min-height: 15px; }
.wheel input { text-align: center; font-size: 18px; font-weight: 600; }
.wheel input.rise { color: var(--red); border-color: var(--red); }
/* Red font when the entered depth is HIGHER than the previous reading (tread only wears down → likely a typo). */
.axle-row input.rise { color: var(--red); border-color: var(--red); font-weight: 700; }
.wheel.right { order: 3; }
.spine-wrap { order: 2; align-self: stretch; display: flex; align-items: center; }
.spine-wrap .label { writing-mode: vertical-rl; text-align: center; font-size: 10px; color: var(--muted); width: 100%; }

/* Works list — kept at original size on the måling page (excluded from the +50% bump). */
.works h2 { font-size: 14px; }
.works table { width: 100%; border-collapse: collapse; font-size: 13px; }
.works th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.works td { padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.works .empty { color: var(--muted); padding: 10px 0; }
.works .work-row { cursor: pointer; }
.works .work-row:active { background: #f0f4f9; }

.note { font-size: 13px; color: var(--muted); margin: 8px 0; }
.error { background: #fdecea; color: var(--red); border: 1px solid #f5c6c2; border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; }
.scan-view { position: relative; width: 100%; aspect-ratio: 3/4; background: #000; border-radius: var(--radius); overflow: hidden; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Dekkmåling label scan: a shorter camera view (viewport-height based, not
   aspect-ratio-to-width) so the whole screen — camera, hint, OCR button and
   the "or type Regnr" fallback — fits without scrolling on a phone. */
.scan-view.compact-cam { aspect-ratio: auto; height: 42.5vh; }
.card.compact-card { padding: 10px 12px; margin-bottom: 0; }
.scan-start { position: absolute; inset: 0; margin: auto; width: 78%; height: 52px; border: 0; border-radius: 12px;
  background: rgba(255,255,255,.94); color: var(--brand); font-weight: 700; font-size: 16px; }
.zoom-ctl { position: absolute; z-index: 2; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 24px; background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.zoom-ctl .zoom-ic { font-size: 16px; line-height: 1; }
/* touch-action: none is the real fix — without it some mobile browsers treat
   a slow single-finger drag over an element sitting on a live camera <video>
   as ambiguous (could be a page gesture) and never hand the touch to the
   range input at all, so the thumb never moves. -webkit-appearance: none +
   explicit thumb/track sizing makes the actual hit-area match what's drawn,
   instead of relying on each browser's own (sometimes tiny) default. */
.zoom-ctl input[type=range] { flex: 1; accent-color: #fff; height: 28px; touch-action: none;
  -webkit-appearance: none; appearance: none; background: rgba(255,255,255,.35); border-radius: 4px; }
.zoom-ctl input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.zoom-ctl input[type=range]::-moz-range-thumb { width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
/* Narrow scan strip for barcodes (PO scanners) — matches the STRIP_FRAC (20%)
   decode crop; only what is inside is read. */
.scan-strip { position: absolute; left: 0; right: 0; top: 40%; height: 20%;
  border-top: 2px solid rgba(255,255,255,.92); border-bottom: 2px solid rgba(255,255,255,.92);
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); pointer-events: none; }
.scan-strip-line { position: absolute; left: 4%; right: 4%; top: 50%; height: 2px;
  background: rgba(227,52,47,.85); transform: translateY(-50%); }
.scan-strip::after { content: 'Hold én strekkode her'; position: absolute; left: 0; right: 0; top: -20px;
  text-align: center; font-size: 11px; color: #fff; letter-spacing: .08em; text-transform: uppercase; opacity: .9; }

.ocr-guide { position: absolute; left: 8%; right: 8%; top: 42%; height: 16%;
  border: 2px dashed rgba(255,255,255,.9); border-radius: 8px; pointer-events: none;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.28); }
.ocr-guide::after { content: 'Regnr'; position: absolute; top: -18px; left: 0;
  font-size: 11px; color: #fff; letter-spacing: .1em; text-transform: uppercase; opacity: .9; }
.ocr-btn { margin: 10px auto 0; display: block; width: 100%; }
.ocr-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  gap: 10px; background: rgba(0,0,0,.55); color: #fff; font-weight: 600; font-size: 15px; }
.ocr-busy .spin { width: 22px; height: 22px; border: 3px solid rgba(255,255,255,.35);
  border-top-color: #fff; border-radius: 50%; animation: ocrspin .8s linear infinite; }
@keyframes ocrspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ocr-busy .spin { animation: none; } }
.center { text-align: center; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* Lokasjon dropdown-with-search */
.loc-wrap { position: relative; }
.loc-wrap input { padding-right: 52px; }
.loc-caret { position: absolute; right: 4px; top: 0; height: 100%; width: 46px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--brand); font-size: 20px; }
.combo-list.loc-list { max-height: 45vh; }
.combo-opt.sel { background: #edf3fb; font-weight: 600; color: var(--brand); }
.combo-opt.muted { color: var(--muted); }

/* Hjulsett-opsjoner — checkbox grid on the måling screen */
.ho-card h2 { font-size: 14px; }
.ho-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.ho-opt { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 17px; }
.ho-opt input[type=checkbox] { width: 24px; height: 24px; min-height: 24px; accent-color: var(--brand); flex: 0 0 auto; }
.ho-opt input[disabled] + span { color: var(--muted); }

/* Bestillingsmottak — Varelager group heading in the PO picker */
.po-wh-head { font-size: 13px; font-weight: 700; color: var(--brand); text-transform: uppercase;
  letter-spacing: .04em; margin: 14px 2px 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.po-wh-grid { margin-bottom: 4px; }

/* Bestillingsmottak — location row in product card + location picker */
.pc-loc { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap;
  color: var(--text); margin-bottom: 14px; }
.pc-locname { font-weight: 700; font-size: 20px; color: var(--brand); }
.pc-locbtn { width: auto; min-height: 34px; padding: 0 12px; font-size: 13px; }
.po-locpick .po-loclist { max-height: 46vh; position: static; box-shadow: none; margin-top: 6px; }
.po-locpick input { font-size: 18px; }
/* Location picker's two quantity columns: how much of this product, and
   how much total, already sits in each bin (server-sorted, most first). */
.loc-opt-head, .loc-opt { display: grid; grid-template-columns: 1fr 64px 64px; gap: 6px; align-items: center; }
.loc-opt-head { padding: 6px 12px 2px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.loc-opt-head span:not(:first-child) { text-align: right; }
.loc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-qty { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Bestillingsmottak — reservations block in product card */
.pc-res { border-top: 1px solid var(--line); margin: 4px 0 14px; padding-top: 10px; text-align: left; }
.pc-res-head { display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pc-res-head .pc-res-edit { width: auto; min-height: 30px; padding: 0 12px; font-size: 13px; }
.pc-res-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--line); }
.pc-res-row:last-of-type { border-bottom: none; }
.pc-res-cust { font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Salgsordre — compact cart line (DP2-25681): name+qty, meta, price/discount/subtotal */
.salg-lines-card { padding-top: 8px; }
.salg-total-row { display: flex; align-items: center; gap: 8px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.salg-total-lbl { flex: 1; font-size: 14px; font-weight: 600; color: var(--muted); text-align: right; }
.salg-total-val { font-size: 18px; font-weight: 700; color: var(--text); white-space: nowrap; }
.salg-line { padding: 6px 0; border-bottom: 1px solid var(--line); }
.salg-line:last-of-type { border-bottom: none; }
.salg-line-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.salg-line-name { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.salg-line-meta { font-size: 12px; color: var(--muted); margin: 1px 0 4px; }
.salg-line-price { display: flex; align-items: center; gap: 6px; }
.salg-line-price .unit { font-size: 12px; color: var(--muted); }
.salg-line-sub { flex: 1; text-align: right; font-size: 15px; font-weight: 700; color: var(--text); white-space: nowrap; }
.vat-toggle { flex: 0 0 auto; min-height: 28px; padding: 0 8px; font-size: 12px; font-weight: 600;
  color: var(--brand); background: #e7ecf3; border: 0; border-radius: 8px; }
.price-input { flex: 0 0 64px; min-height: 28px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 6px; font-size: 14px; font-weight: 600; text-align: right; }
.discount-input { flex: 0 0 42px; min-height: 28px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 4px; font-size: 14px; font-weight: 600; text-align: right; }
.warn-text { color: var(--red); }
.pc-res-alloc { font-weight: 700; font-size: 15px; white-space: nowrap; }
.pc-res-step { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.pc-res-step b { min-width: 20px; text-align: center; font-size: 16px; }
.step-btn.sm { width: 34px; height: 34px; font-size: 20px; border-radius: 8px; }
.pc-res-note { font-size: 12px; margin-top: 8px; }

/* Bestillingsmottak — AutoSkann split screen */
.auto-toggle { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 15px;
  font-weight: 600; color: var(--brand); margin: 8px 0 4px; }
.auto-toggle input { width: 22px; height: 22px; min-height: 22px; accent-color: var(--brand); }
.po-scan-content.auto { display: flex; flex-direction: column; }
.po-scan-content.auto .scan-view { aspect-ratio: auto; height: 42vh; }
.po-scan-bottom { padding: 10px 4px; }
.auto-prod { text-align: center; }
.auto-prod .pc-cat { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.auto-prod .pc-brand { font-size: 19px; font-weight: 800; color: var(--brand); }
.auto-prod .pc-nums { display: flex; justify-content: space-around; margin-top: 8px; }
.auto-prod .pc-num { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.auto-prod .pc-val { font-size: 30px; font-weight: 800; }
.auto-prod .pc-now .pc-val { color: var(--green); }
.auto-prod .pc-now .pc-val.over { color: var(--red); }
.auto-warn { margin-top: 10px; background: #fdf6e3; border: 1px solid #e8a000; border-radius: 8px;
  padding: 8px 10px; color: #6a4b00; font-size: 14px; text-align: center; }

/* Bestillingsmottak — focused product card (per-scan) */
.po-prodcard { max-width: 380px; }
.po-prodcard .pc-cat { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.pc-brand { font-size: 20px; font-weight: 800; color: var(--brand); text-align: center; }
.pc-name { font-size: 15px; text-align: center; color: var(--text); margin-top: 2px; }
.pc-sku { font-size: 12px; color: var(--muted); text-align: center; margin-bottom: 14px; }
.pc-nums { display: flex; justify-content: space-around; gap: 8px; margin-bottom: 14px; }
.pc-num { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pc-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pc-val { font-size: 26px; font-weight: 700; color: var(--text); }
.pc-num.pc-now .pc-val { color: var(--green); }

/* Salgsordre — product search result card: brand/product/SKU line, then two
   grid rows (category+headers, dimension+values) so the three stock numbers
   line up as right-aligned columns under their Lok/Tra/Res labels. */
.salg-pc-row1 { display: block; font-size: 15px; font-weight: 600; color: var(--text); text-align: left; }
.salg-pc-grid { display: grid; grid-template-columns: 1fr repeat(3, 2.8em); column-gap: 6px; align-items: baseline; margin-top: 4px; }
.salg-pc-label { text-align: left; }
.salg-pc-col { text-align: right; }
.salg-pc-head { margin-top: 8px; }
.salg-pc-head .salg-pc-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.salg-pc-head .salg-pc-col { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.salg-pc-vals .salg-pc-label { font-size: 14px; color: var(--text); }
.salg-pc-vals .salg-pc-col { font-size: 17px; font-weight: 700; color: var(--text); }

.pc-step { display: flex; align-items: center; justify-content: center; gap: 20px; margin-bottom: 16px; }
.pc-step .step-btn { width: 54px; height: 54px; font-size: 28px; border-radius: 12px; }
.pc-stepval { font-size: 30px; font-weight: 800; min-width: 44px; text-align: center; }
.pc-actions { display: flex; gap: 10px; }
.pc-actions .btn { flex: 1; }

/* Bestillingsmottak (PO receiving) — compact line table, small text to fit phone width */
.po-card { padding: 8px; }
.po-lines { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.po-lines th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .02em; }
.po-lines td { padding: 9px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.po-lines tr.po-row { cursor: pointer; }
.po-lines tr.po-row:active { background: #eef3f9; }
.po-lines tr.po-row td:first-child { position: relative; }
.po-lines th:nth-child(1), .po-lines td:nth-child(1) { width: 20%; }
.po-lines th:nth-child(2), .po-lines td:nth-child(2) { width: 18%; }
.po-lines th:nth-child(3), .po-lines td:nth-child(3) { width: 16%; }
.po-lines th:nth-child(4), .po-lines td:nth-child(4) { width: 24%; }
.po-lines th.num, .po-lines td.num { text-align: right; width: 11%; }
.po-lines .pend { color: var(--green); font-weight: 700; margin-left: 3px; }
.po-lines tr.has-pending td { background: #edfaf0; }
.step-btn { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--brand); font-size: 16px; font-weight: 700; line-height: 1; padding: 0; }
.step-btn:active { background: #eef3f9; }
.step-btn[disabled] { opacity: .35; }
.po-product { font-size: 17px; font-weight: 600; }
.po-qty { margin-left: auto; font-size: 15px; font-weight: 700; color: var(--brand); white-space: nowrap; }
.warn-info a { color: inherit; font-weight: 600; }

/* Salgsordre — order-type segmented control */
.seg-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.seg-btn { flex: 1 1 auto; min-width: 70px; min-height: 40px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; color: var(--muted); font-size: 14px; font-weight: 600; padding: 0 10px; }
.seg-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.seg-btn[disabled] { opacity: .55; }

/* Wheelset pictures ("Bilder") */
.btn.danger { background: var(--red); color: #fff; border: 0; }
.btn.danger:active { background: #a31515; }
.pic-actions { display: flex; gap: 10px; margin-top: 12px; }
.pic-actions .pic-add { flex: 1; margin-top: 0; }
.pic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pic-tile { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #f1f4f8; aspect-ratio: 1/1; }
.pic-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pic-tile.uploading { opacity: .7; }
.pic-tile.failed { border-color: var(--red); }
.pic-status { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px; font-size: 12px; font-weight: 700;
  text-align: center; background: rgba(20,40,70,.62); color: #fff; }
.pic-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(8,16,28,.94);
  display: flex; flex-direction: column; }
.pic-overlay-bar { display: flex; gap: 10px; padding: 14px; }
.pic-overlay-bar .btn { flex: 1; }
.pic-overlay-bar .btn.ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.pic-full { flex: 1; min-height: 0; width: 100%; object-fit: contain; }

/* Mønstersjekk (advisory camera texture check) */
.pic-tread-btn { width: 100%; margin-top: 8px; }
.tread-legend { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.35; }
.tread-badge { position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.tread-badge-green { background: var(--green); }
.tread-badge-yellow { background: #e8a000; }
.tread-badge-red { background: var(--red); }
.tread-overlay { justify-content: flex-start; }
.tread-scan { margin: 0 14px; aspect-ratio: 1/1; }
.tread-guide { position: absolute; inset: 14%; border: 3px dashed rgba(255,255,255,.9); border-radius: 12px;
  pointer-events: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
.tread-hint { position: absolute; left: 0; right: 0; bottom: 10px; text-align: center;
  font-size: 14px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); pointer-events: none; }
.tread-result { padding: 0 14px; }
.tread-note { color: #fff; font-size: 14px; text-align: center; padding: 14px; }

/* Schedule (Timeplan) */
.schedule-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.schedule-port-btn { flex: 1 1 auto; min-height: var(--tap); font-size: 16px; }
.schedule-datenav { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; }
.schedule-datenav .btn { width: 44px; min-width: 44px; min-height: 44px; padding: 0; font-size: 22px; line-height: 1; flex: 0 0 auto; }
.schedule-date { flex: 1; text-align: center; font-weight: 600; color: var(--brand); white-space: nowrap; }
.port-pick .combo-list, .store-pick .combo-list { max-height: 46vh; position: static; box-shadow: none; margin-top: 6px; }
.schedule-list { display: flex; flex-direction: column; gap: 8px; }
.slot-row { display: flex; gap: 12px; align-items: flex-start; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.slot-row[data-regno] { cursor: pointer; }
.slot-row[data-regno]:active { border-color: var(--brand); background: #edf3fb; }
.slot-row.current { border-color: var(--brand); border-width: 2px; background: #edf3fb; }
.slot-row.blocked { background: #e9edf2; border-style: dashed; }
.slot-row.blocked .slot-time { color: var(--muted); }
.slot-time { flex: 0 0 auto; width: 92px; font-weight: 700; color: var(--brand); font-size: 15px; }
.slot-main { flex: 1; min-width: 0; }
.slot-regno { font-size: 18px; font-weight: 700; }
.slot-suffix { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.slot-loc { font-size: 14px; color: var(--muted); margin-top: 2px; }
.slot-comment { font-size: 14px; color: var(--muted); margin-top: 2px; }

/* ---------- Varetelling ---------- */
.tell-h { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 8px; }
.tell-actions { display: flex; gap: 10px; }
/* nowrap: three buttons share 390px — an emoji label must shrink, not stack
   onto a second line and make one button taller than its siblings. */
.tell-actions .btn { flex: 1; white-space: nowrap; padding-left: 8px; padding-right: 8px; }

.tell-sess { display: flex; align-items: center; gap: 10px; }
.tell-sess-main { flex: 1; background: none; border: 0; padding: 0; text-align: left; font: inherit; color: inherit; }
.tell-sess-t { font-weight: 600; font-size: 16px; }
.tell-sess-s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tell-sess.done { opacity: .72; }
.tell-warn { font-size: 13px; color: var(--red); margin-top: 4px; font-weight: 600; }
.tell-issues { border-left: 4px solid var(--red); background: #fdeceb; padding: 10px 14px; margin: 12px 0; font-size: 14px; }

/* Stock strip: available / reserved / in transit. */
.tell-strip { display: flex; gap: 18px; margin-top: 10px; }
.tell-strip span { display: flex; flex-direction: column; line-height: 1.15; }
.tell-strip b { font-size: 18px; font-variant-numeric: tabular-nums; }
.tell-strip i { font-style: normal; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.tell-prod-h { font-weight: 700; font-size: 17px; }
.tell-prod-s { font-size: 13px; color: var(--muted); margin-top: 1px; }
.tell-prod-s.dim { opacity: .8; }

.tell-cand { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.tell-cand-loc { font-size: 13px; color: var(--muted); margin-top: 8px; }
/* Already counted in this session — the shelf list doubles as a checklist. */
.tell-cand.counted { opacity: .62; }
.tell-counted-chip {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 9px;
  font-size: 12px; font-weight: 700; color: #2a7a3b; background: rgba(42,122,59,.12);
}

/* One shelf row on the product card. */
.tell-row-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.tell-row-n { font-weight: 600; font-size: 16px; }
.tell-row-s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tell-row-diff { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tell-row-diff.up { color: #2a7a3b; }
.tell-row-diff.down { color: var(--red); }
.tell-row-diff.ok { color: #2a7a3b; font-size: 15px; }
.tell-row-hint { font-size: 13px; color: var(--red); margin-top: 8px; }

/* "Counted, this number is right" — the save action for the everyday case
   where the count matches the system and nothing else would trigger a save. */
/* .btn's base is solid brand-blue — green-on-blue is unreadable, so the
   confirm button gets its own light ground with a green border instead. */
.tell-confirm { width: 100%; margin-top: 10px; background: var(--card); border: 1px solid #2a7a3b; color: #2a7a3b; font-weight: 700; }
.tell-confirm:active { background: rgba(42,122,59,.12); }
.tell-confirm.done { background: rgba(42,122,59,.12); border-color: transparent; font-weight: 600; }
/* "Flytt hit" — one unit per tap from this row to the location the user is at. */
.tell-move { width: 100%; margin-top: 8px; }
.tell-row-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.tell-row-move { font-size: 13px; font-weight: 700; color: var(--brand); white-space: nowrap; }

.tell-step { display: flex; align-items: stretch; gap: 10px; margin-top: 12px; }
.tell-step-b {
  flex: 0 0 60px; font-size: 26px; line-height: 1; border: 1px solid var(--line);
  background: var(--card); border-radius: 10px; color: inherit; cursor: pointer;
}
.tell-step-b:active { background: var(--line); }
.tell-step-i {
  flex: 1; min-width: 0; text-align: center; font-size: 24px; font-weight: 700;
  font-variant-numeric: tabular-nums; padding: 12px 8px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: inherit;
}

/* Change list. */
.tell-line { display: flex; align-items: center; gap: 12px; }
.tell-line-b { flex: 1; min-width: 0; }
.tell-line-t { font-weight: 600; font-size: 15px; }
.tell-line-s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tell-line-d { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tell-line-d.up { color: #2a7a3b; }
.tell-line-d.down { color: var(--red); }
.tell-line-d.ok { color: #2a7a3b; font-size: 15px; white-space: nowrap; }
.tell-line-x {
  flex: 0 0 34px; height: 34px; border-radius: 17px; border: 1px solid var(--line);
  background: none; color: var(--muted); font-size: 15px; cursor: pointer;
}

/* Location picker overlay. */
.tell-locq { width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: inherit; margin: 10px 0; }
.tell-loclist { max-height: 46vh; overflow-y: auto; margin-bottom: 10px; }
.tell-locrow {
  display: flex; justify-content: space-between; align-items: baseline; width: 100%;
  padding: 12px 10px; border: 0; border-bottom: 1px solid var(--line);
  background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.tell-locrow i { font-style: normal; font-size: 12px; color: var(--muted); }

/* Search result card reuses the Salg layout; only the shelf line is extra.
   Vendor (when present, e.g. a barcode with several candidate matches) sits
   on the SAME row, right-aligned — it used to be its own line floating below
   the card, disconnected and oddly indented. */
.tell-pc-loc-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 6px; }
.tell-pc-loc { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.tell-pc-loc.none { font-style: italic; opacity: .8; }
.tell-pc-vendor { font-size: 12px; color: var(--muted); font-style: italic; white-space: nowrap; flex: 0 0 auto; }

/* Compact discard on a session row. The row's real action is "continue", so
   Slett must stay reachable without competing with it — .btn is width:100%
   and a full tap height, which is wrong here. */
.tell-sess-x {
  flex: 0 0 auto; align-self: center;
  padding: 8px 14px; min-height: 38px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: transparent; color: var(--muted);
  font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tell-sess-x:active { background: var(--line); color: var(--red); }

/* NIIMBOT printer settings (Ekstra). */
.nb-head { font-weight: 600; font-size: 16px; margin-bottom: 10px; }
.nb-ok { color: #2a7a3b; font-size: 14px; margin-bottom: 10px; }
.nb-warn { color: var(--muted); font-size: 14px; line-height: 1.45; }
.nb-size { display: flex; gap: 12px; margin-top: 12px; }
.nb-size .field { flex: 1; min-width: 0; }

.print-status { text-align: center; padding: 26px 22px; }
.print-status-t { margin-top: 14px; font-size: 16px; font-weight: 600; }
.spin-big {
  width: 38px; height: 38px; margin: 0 auto; border-radius: 50%;
  border: 4px solid var(--line); border-top-color: var(--brand);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin-big { animation-duration: 3s; } }

.print-fail-i { font-size: 34px; }
.print-detail {
  text-align: left; font-size: 12px; line-height: 1.45; white-space: pre-wrap;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; margin: 12px 0; max-height: 34vh; overflow: auto;
}

/* Batch shelf-label picker. */
.lbl-tools { display: flex; gap: 8px; margin-top: 10px; }
.lbl-tools .tell-sess-x { flex: 1; text-align: center; }
.lbl-list { margin-top: 12px; }
.lbl-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  background: var(--card);
}
.lbl-row input { width: 22px; height: 22px; flex: 0 0 22px; }
.lbl-row-n { flex: 1; font-weight: 600; font-size: 16px; }
.lbl-row-s { font-size: 12px; color: var(--muted); }

.nb-kind { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.nb-kind label { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.nb-kind input { width: 20px; height: 20px; }
