/* =============================================================================
   components.css — gjenbrukbare komponenter med fulle tilstander
   hover / focus / active / disabled / loading er definert for alt klikkbart.
========================================================================== */

/* ---------------------------------------------------------------------------
   APP-SKALL: topbar + footer
--------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.1) blur(10px);
  border-bottom: var(--hairline) solid var(--line);
}
.topbar__inner {
  height: 100%;
  display: flex; align-items: center; gap: var(--space-6);
  max-width: var(--shell-max); margin-inline: auto;
  padding-inline: var(--space-6);
}
.topbar__brand {
  display: flex; align-items: center; gap: var(--space-3);
  color: var(--ink); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight); white-space: nowrap;
}
.topbar__brand:hover { text-decoration: none; }
.topbar__logo { height: 22px; width: auto; }
.topbar__nav { display: flex; gap: var(--space-2); margin-inline-start: var(--space-2); }
.topbar__link {
  color: var(--ink-muted); font-size: var(--text-sm); font-weight: var(--weight-medium);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.topbar__link:hover { color: var(--ink); background: var(--surface-hover); text-decoration: none; }
.topbar__link[aria-current="page"] { color: var(--ink); }
.topbar__spacer { flex: 1; }
.topbar__actions { display: flex; align-items: center; gap: var(--space-3); }

@media (max-width: 720px) {
  .topbar__nav, .topbar__search { display: none; }
  .topbar__inner { gap: var(--space-4); }
}

/* ---------------------------------------------------------------------------
   OFFCANVAS (skuff) + SCRIM — kurv og meny glir inn fra høyre
--------------------------------------------------------------------------- */
.scrim {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  background: color-mix(in srgb, var(--ink) 32%, transparent);
  opacity: 0; transition: opacity var(--dur) var(--ease);
}
.scrim[data-open="true"] { opacity: 1; }

.offcanvas {
  position: fixed; top: 0; bottom: 0; z-index: calc(var(--z-overlay) + 1);
  width: min(420px, 92vw);
  display: flex; flex-direction: column;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  transition: transform var(--dur) var(--ease-in-out);
  overscroll-behavior: contain;
}
.offcanvas--right { right: 0; transform: translateX(102%); border-inline-start: var(--hairline) solid var(--line); }
.offcanvas[data-open="true"] { transform: translateX(0); }

.offcanvas__head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  height: var(--topbar-h); padding-inline: var(--space-5);
  border-bottom: var(--hairline) solid var(--line);
}
.offcanvas__title {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight);
}
.offcanvas .icon { width: 18px; height: 18px; flex: none; }
.offcanvas__title .icon { color: var(--ink-muted); }
.offcanvas__count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px;
  padding-inline: 6px; border-radius: var(--radius-pill);
  background: var(--surface-hover); color: var(--ink-muted);
  font-size: var(--text-2xs); font-weight: var(--weight-semibold);
}
.offcanvas__close {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  border: none; background: transparent; color: var(--ink-muted);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.offcanvas__close:hover { background: var(--surface-hover); color: var(--ink); }

.offcanvas__body { flex: 1 1 auto; overflow-y: auto; padding: var(--space-4) var(--space-5); }
.offcanvas__empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-4); text-align: center; padding-block: var(--space-8);
}
.offcanvas__foot {
  flex: 0 0 auto; padding: var(--space-5);
  border-top: var(--hairline) solid var(--line);
  display: grid; gap: var(--space-3);
}

/* Mini-kurv-linje */
.minicart-line {
  display: grid; grid-template-columns: 48px 1fr auto; gap: var(--space-3);
  align-items: center; padding-block: var(--space-3);
}
.minicart-line + .minicart-line { border-top: var(--hairline) solid var(--line); }
.minicart-line__media {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  background: var(--surface-sunk); overflow: hidden;
  display: grid; place-items: center;
}
.minicart-line__media img { width: 100%; height: 100%; object-fit: cover; }
.minicart-line__name { font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: 1.25; }
.minicart-line__end { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-2); }
.minicart-sum {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: var(--space-1);
}

/* Meny-skuff: navigasjon + brukerrad + tekst-utlogging */
.offcanvas-nav { display: flex; flex-direction: column; gap: 2px; }
.offcanvas-nav__link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-3); border-radius: var(--radius-md);
  color: var(--ink); font-weight: var(--weight-medium);
  transition: background var(--dur-fast) var(--ease);
}
.offcanvas-nav__link:hover { background: var(--surface-hover); text-decoration: none; }
.offcanvas-nav__link .icon { color: var(--ink-muted); }
.offcanvas-nav__link[aria-current="page"] { background: var(--surface-hover); }
.offcanvas-user {
  display: flex; align-items: center; gap: var(--space-2);
  color: var(--ink-subtle); font-size: var(--text-xs);
  padding-bottom: var(--space-1); min-width: 0;
}
.offcanvas-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.offcanvas-logout { justify-content: center; color: var(--critical); }
.offcanvas-logout:hover { background: var(--critical-weak); border-color: var(--critical); }

/* Lås bakgrunns-scroll når en skuff er åpen */
body.has-offcanvas { overflow: hidden; }

.footer {
  border-top: var(--hairline) solid var(--line);
  margin-top: var(--space-10);
  color: var(--ink-subtle); font-size: var(--text-xs);
}
.footer__inner {
  max-width: var(--shell-max); margin-inline: auto;
  padding: var(--space-6); display: flex; gap: var(--space-5);
  align-items: center; flex-wrap: wrap;
}

.footer {
  border-top: var(--hairline) solid var(--line);
  margin-top: var(--space-10);
  color: var(--ink-subtle); font-size: var(--text-xs);
}
.footer__inner {
  max-width: var(--shell-max); margin-inline: auto;
  padding: var(--space-6); display: flex; gap: var(--space-5);
  align-items: center; flex-wrap: wrap;
}

/* ---------------------------------------------------------------------------
   KNAPPER
--------------------------------------------------------------------------- */
.btn {
  --_bg: var(--surface);
  --_ink: var(--ink);
  --_line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3);
  height: var(--control-h); padding-inline: var(--space-5);
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  color: var(--_ink); background: var(--_bg);
  border: var(--hairline) solid var(--_line);
  border-radius: var(--radius-md);
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(0.5px) scale(0.992); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); border-color: var(--focus); }
.btn[disabled], .btn[aria-disabled="true"] {
  cursor: not-allowed; opacity: 0.5; transform: none;
}

/* Primær — fylt med --action */
.btn--primary {
  --_bg: var(--action); --_ink: var(--on-action); --_line: var(--action);
}
.btn--primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn--primary:active { background: var(--action-active); border-color: var(--action-active); }

/* Aksent — fylt med --accent (sjeldnere, f.eks. «legg i kurv»-CTA i tema) */
.btn--accent {
  --_bg: var(--accent); --_ink: var(--on-accent); --_line: var(--accent);
}
.btn--accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* Stille — kun tekst, til sekundære valg */
.btn--ghost { --_bg: transparent; --_line: transparent; }
.btn--ghost:hover { background: var(--surface-hover); }

/* Fare */
.btn--danger { --_ink: var(--critical); --_line: var(--line-strong); }
.btn--danger:hover { background: var(--critical-weak); border-color: var(--critical); }

.btn--sm  { height: var(--control-h-sm); padding-inline: var(--space-4); font-size: var(--text-xs); }
.btn--lg  { height: var(--control-h-lg); padding-inline: var(--space-6); font-size: var(--text-md); }
.btn--block { width: 100%; }
.btn--icon { padding-inline: 0; width: var(--control-h); }
.btn .icon { width: 17px; height: 17px; flex: none; }

/* Loading-tilstand: spinner inn, tekst dempet, klikk blokkert */
.btn[data-loading="true"] { pointer-events: none; color: transparent; position: relative; }
.btn[data-loading="true"]::after {
  content: ""; position: absolute; width: 16px; height: 16px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: var(--on-action);
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
.btn--primary[data-loading="true"]::after,
.btn--accent[data-loading="true"]::after { border-top-color: var(--on-action); }
.btn:not(.btn--primary):not(.btn--accent)[data-loading="true"]::after { border-top-color: var(--ink); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------------
   FELT
--------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--space-3); }
.field__label {
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink);
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4);
}
.field__hint { font-size: var(--text-xs); color: var(--ink-subtle); }

/* Bestiller til <person> — står i topbaren fordi valget gjelder til det byttes. */
.bestiller-for { display: flex; align-items: center; gap: var(--space-2); }
.bestiller-for__label { font-size: var(--text-xs); color: var(--ink-subtle); white-space: nowrap; }
.bestiller-for select { max-width: 200px; }
@media (max-width: 720px) { .bestiller-for__label { display: none; } }
.field__optional { font-size: var(--text-xs); color: var(--ink-faint); font-weight: var(--weight-regular); }

.input, .select, .textarea {
  height: var(--control-h);
  padding: 0 var(--space-4);
  background: var(--field-bg);
  color: var(--field-ink);
  border: var(--hairline) solid var(--field-line);
  border-radius: var(--field-radius);
  font-size: var(--text-md);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
  width: 100%;
}
.textarea { height: auto; padding: var(--space-3) var(--space-4); line-height: var(--leading-base); resize: vertical; min-height: 96px; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--focus); box-shadow: var(--focus-ring);
}
.input:disabled, .select:disabled, .textarea:disabled {
  background: var(--surface-sunk); color: var(--ink-faint); cursor: not-allowed;
}
/* Validering — aria-invalid driver stilen, ikke en egen klasse */
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] {
  border-color: var(--critical);
}
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--critical) 24%, transparent); }
.field__error {
  font-size: var(--text-xs); color: var(--critical-ink);
  display: flex; align-items: center; gap: var(--space-2);
}

/* Felt med prefiks/suffiks (f.eks. søk, valuta) */
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: calc(var(--space-4) + 22px); }
.input-group__icon {
  position: absolute; left: var(--space-4); color: var(--ink-faint);
  width: 16px; height: 16px; pointer-events: none;
}

/* ---------------------------------------------------------------------------
   OTP — signatur-interaksjonen (kode-på-epost)
--------------------------------------------------------------------------- */
/* Seks felt som deler bredden kortet faktisk har.
   Med `flex` + `width: 52px` krevde raden 6x52 + 5x8 = 352 px, mens kortet
   bare har 316 px innhold (412 minus 48 px luft på hver side). Raden stakk
   dermed 18 px ut på hver side og ble bredere enn `btn--block`-knappen under.
   1fr-kolonner krymper med kortet; max-width holder feltene på designbredden
   der det er romslig, så de aldri blir større enn de var ment å være. */
.otp {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--space-3);
  max-width: calc(6 * 52px + 5 * var(--space-3));
  margin-inline: auto;
}
.otp__digit {
  width: 100%; min-width: 0; height: 60px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--text-2xl); font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface);
  border: var(--hairline) solid var(--field-line);
  border-radius: var(--radius-md);
  caret-color: var(--accent);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.otp__digit:focus { outline: none; border-color: var(--focus); box-shadow: var(--focus-ring); }
.otp__digit[data-filled="true"] { border-color: var(--ink-faint); }
.otp[data-state="error"] .otp__digit { border-color: var(--critical); animation: shake 0.4s var(--ease); }
.otp[data-state="ok"] .otp__digit { border-color: var(--positive); }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-4px); } 40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); } 80% { transform: translateX(3px); }
}
@media (max-width: 420px) {
  .otp {
    gap: var(--space-2);
    max-width: calc(6 * 44px + 5 * var(--space-2));
  }
  .otp__digit { height: 54px; font-size: var(--text-xl); }
}

/* ---------------------------------------------------------------------------
   ANTALL-STEPPER
--------------------------------------------------------------------------- */
.stepper {
  display: inline-flex; align-items: center;
  border: var(--hairline) solid var(--line-strong);
  border-radius: var(--radius-md); background: var(--surface);
  height: var(--control-h-sm); overflow: hidden;
}
.stepper__btn {
  width: 32px; height: 100%; border: 0; background: transparent;
  color: var(--ink-muted); cursor: pointer; font-size: var(--text-lg); line-height: 1;
  display: grid; place-items: center;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.stepper__btn:hover { background: var(--surface-hover); color: var(--ink); }
.stepper__btn:active { background: var(--accent-weak); }
.stepper__btn:disabled { color: var(--ink-faint); cursor: not-allowed; background: transparent; }
.stepper__input {
  width: 44px; height: 100%; border: 0; text-align: center;
  background: transparent; font-variant-numeric: tabular-nums;
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  border-inline: var(--hairline) solid var(--line);
  -moz-appearance: textfield;
}
.stepper__input::-webkit-outer-spin-button,
.stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper__input:focus { outline: none; box-shadow: inset var(--focus-ring); }

/* ---------------------------------------------------------------------------
   BADGE / STATUS-PILL
--------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-2);
  height: 22px; padding-inline: var(--space-3);
  font-size: var(--text-2xs); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  border-radius: var(--radius-pill);
  background: var(--surface-sunk); color: var(--ink-muted);
  border: var(--hairline) solid var(--line);
  white-space: nowrap;
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: 0.9; flex: none;
}
.badge--positive { background: var(--positive-weak); color: var(--positive-ink); border-color: transparent; }
.badge--warning  { background: var(--warning-weak);  color: var(--warning-ink);  border-color: transparent; }
.badge--critical { background: var(--critical-weak); color: var(--critical-ink); border-color: transparent; }
.badge--neutral::before { display: none; }

/* ---------------------------------------------------------------------------
   KORT / PANEL
--------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius-lg);
}
.card__pad { padding: var(--space-6); }
.panel {
  background: var(--surface);
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius-lg);
}
.panel__head {
  padding: var(--space-5) var(--space-6);
  border-bottom: var(--hairline) solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
}
.panel__title { font-size: var(--text-md); font-weight: var(--weight-semibold); }
.panel__body { padding: var(--space-6); }

/* ---------------------------------------------------------------------------
   TABELL — hårfine rader, høyrestilte tabular tall
--------------------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
/* Tom treffliste — sier fra i tabellen framfor å etterlate et bart hode. */
.table__empty { text-align: center; padding: var(--space-6); }
.table thead th {
  text-align: left; padding: var(--space-3) var(--space-4);
  font-size: var(--text-2xs); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--ink-subtle);
  border-bottom: var(--hairline) solid var(--line-strong);
  white-space: nowrap;
}
.table tbody td {
  padding: var(--space-4);
  border-bottom: var(--hairline) solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast) var(--ease); }
.table--rows tbody tr:hover { background: var(--surface-hover); }
.table tbody tr.row-link { cursor: pointer; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.num { text-align: right; }

/* ---------------------------------------------------------------------------
   PRIS — ledger-stilen (signatur)
--------------------------------------------------------------------------- */
.price {
  font-variant-numeric: tabular-nums; font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight); white-space: nowrap;
}
.price__unit { font-size: var(--text-xs); font-weight: var(--weight-regular); color: var(--ink-subtle); }
.price--lg { font-size: var(--text-xl); }
.price--strike { color: var(--ink-faint); font-weight: var(--weight-regular); text-decoration: line-through; }

/* Kontraktspris ved siden av listeprisen den erstatter. Merket bruker
   aksentfargen fordi det er det ene tallet på siden som er forhandlet fram —
   alt annet på kortet er katalogdata. */
.pris-avtale { display: inline-flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.pris-avtale__merke {
  font-size: var(--text-2xs); font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--accent);
}
.pris-avtale__tall { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.pris-avtale .price--strike { font-size: var(--text-xs); }

/* Trykkprofil som opplysning. Rolig med vilje: dette er en bekreftelse på noe
   bestilleren allerede regnet med, ikke et varsel. */
.trykkmerke {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); color: var(--ink-muted);
  margin-top: var(--space-2);
}
.trykkmerke__ikon { width: 14px; height: 14px; flex: none; color: var(--accent); }
.trykkmerke--kompakt { font-size: var(--text-2xs); margin-top: var(--space-1); }

/* ---------------------------------------------------------------------------
   TOAST
--------------------------------------------------------------------------- */
.toast-region {
  position: fixed; bottom: var(--space-6); right: var(--space-6);
  z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-3);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--space-4);
  min-width: 280px; max-width: 380px;
  padding: var(--space-4) var(--space-5);
  background: var(--paper-900); color: var(--paper-50);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  font-size: var(--text-sm); pointer-events: auto;
  animation: toast-in var(--dur-slow) var(--ease);
}
.toast[data-leaving="true"] { animation: toast-out var(--dur) var(--ease) forwards; }
.toast__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--positive); flex: none; }
.toast--critical .toast__dot { background: var(--critical); }
@keyframes toast-in  { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ---------------------------------------------------------------------------
   SKJELETT / LOADING
--------------------------------------------------------------------------- */
.skeleton {
  background: linear-gradient(100deg,
    var(--surface-sunk) 30%, var(--paper-200) 50%, var(--surface-sunk) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton--text { height: 0.7em; margin: 0.25em 0; }
.skeleton--line { height: 12px; }
.skeleton--block { height: 100%; width: 100%; }

/* ---------------------------------------------------------------------------
   TOM TILSTAND
--------------------------------------------------------------------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: var(--space-4); padding: var(--space-9) var(--space-6);
  color: var(--ink-muted);
}
.empty__mark {
  width: 48px; height: 48px; border-radius: var(--radius-lg);
  display: grid; place-items: center;
  background: var(--surface-sunk); color: var(--ink-subtle);
  border: var(--hairline) solid var(--line);
}
.empty__mark .icon { width: 24px; height: 24px; }
.empty__title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--ink); }
.empty__body { max-width: 38ch; font-size: var(--text-sm); }

/* ---------------------------------------------------------------------------
   FEILTILSTAND (inline, ikke modal)
--------------------------------------------------------------------------- */
.alert {
  display: flex; gap: var(--space-4); align-items: flex-start;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  border: var(--hairline) solid var(--line);
  background: var(--surface);
  font-size: var(--text-sm);
}
.alert__icon { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.alert--critical { background: var(--critical-weak); border-color: transparent; color: var(--critical-ink); }
.alert--warning  { background: var(--warning-weak);  border-color: transparent; color: var(--warning-ink); }
.alert--info     { background: var(--accent-weak);   border-color: transparent; color: var(--ink); }
/* Beskjed som gjelder hele siden, ikke ett felt: står alene i flyten og
   trenger luft over og under, enten den ligger over pagehead eller under
   et rutenett. */
.alert--blokk    { margin-block: var(--space-5); }
.alert--blokk:first-child { margin-top: 0; }
.alert--blokk a  { color: inherit; }
.alert__title { font-weight: var(--weight-semibold); }

/* ---------------------------------------------------------------------------
   SEGMENT-KONTROLL (f.eks. visningsbytte rutenett/liste)
--------------------------------------------------------------------------- */
.segment {
  display: inline-flex; padding: 2px; gap: 2px;
  background: var(--surface-sunk); border-radius: var(--radius-md);
  border: var(--hairline) solid var(--line);
}
.segment__btn {
  height: 28px; padding-inline: var(--space-3); border: 0; background: transparent;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--ink-subtle);
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-xs); font-weight: var(--weight-medium);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.segment__btn:hover { color: var(--ink); }
.segment__btn[aria-pressed="true"] {
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs);
}

/* ---------------------------------------------------------------------------
   AVATAR / KONTOMENY-TRIGGER
--------------------------------------------------------------------------- */
.avatar {
  width: 30px; height: 30px; border-radius: var(--radius-pill);
  background: var(--accent-weak); color: var(--accent-hover);
  display: grid; place-items: center;
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  border: var(--hairline) solid var(--line);
}

/* Liten lagervisning */
.stock { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--ink-muted); }
.stock__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--positive); }
.stock--low  .stock__dot { background: var(--warning); }
.stock--out  .stock__dot { background: var(--critical); }
/* Filopplasting — gjør den native «Velg filer»-knappen til en ordentlig knapp */
.input[type="file"] { padding: 0; line-height: var(--control-h); cursor: pointer; }
.input[type="file"]::file-selector-button {
  height: calc(var(--control-h) - 2px);
  margin: 0 var(--space-3) 0 0;
  padding: 0 var(--space-4);
  border: 0; border-right: var(--hairline) solid var(--field-line);
  background: var(--surface-sunk); color: var(--ink);
  font: inherit; font-weight: var(--weight-medium); cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.input[type="file"]::file-selector-button:hover { background: var(--accent-weak); color: var(--accent); }

/* ---------------------------------------------------------------------------
   MODAL (<dialog>) — brukes til personvernerklæringen fra login/søknadsskjema

   Native <dialog> framfor en div-konstruksjon: fokusfelle, Esc-lukking, inert
   bakgrunn og riktig rolle for skjermlesere følger med fra nettleseren. Vi
   styler bare kortet og bakteppet.

   MERK `margin: auto` under. Nettleseren sentrerer en <dialog> med
   `inset: 0; margin: auto` i sitt eget stilark, men reset-regelen
   `* { margin: 0 }` i base.css slår den ut — og da havner modalen i øvre
   venstre hjørne. Sentreringen må derfor settes eksplisitt her.
--------------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(680px, calc(100vw - 2 * var(--space-5)));
  max-height: min(80vh, 900px);
  padding: 0;
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius-lg, 14px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg, 0 24px 60px rgba(0,0,0,.22));
  overflow: hidden;
}
.modal::backdrop { background: color-mix(in srgb, #000 46%, transparent); }
/* Kortet er en kolonne så bare brødteksten scroller — hode og fot står stille. */
.modal[open] {
  display: flex;
  flex-direction: column;
  animation: modal-inn var(--dur-slow, 220ms) var(--ease, cubic-bezier(.2,.7,.3,1));
}
.modal[open]::backdrop { animation: modal-teppe var(--dur-slow, 220ms) var(--ease, ease); }

/* Glir opp og toner inn. Kort vei — en modal som reiser langt føles treg. */
@keyframes modal-inn {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@keyframes modal-teppe { from { opacity: 0; } to { opacity: 1; } }

/* Respekter systemvalget: bevegelse kan utløse ubehag og svimmelhet. */
@media (prefers-reduced-motion: reduce) {
  .modal[open], .modal[open]::backdrop { animation: none; }
}

/* På små skjermer legger den seg som et ark nederst — nærmere tommelen, og
   den bruker høyden som faktisk finnes. */
@media (max-width: 560px) {
  .modal {
    inset: auto 0 0 0;
    width: 100%;
    max-height: 88dvh;
    border-radius: var(--radius-lg, 14px) var(--radius-lg, 14px) 0 0;
    border-bottom: 0;
  }
  @keyframes modal-inn {
    from { opacity: 0; transform: translateY(100%); }
    to   { opacity: 1; transform: none; }
  }
}

.modal__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--hairline) solid var(--line);
  flex: none;
}
.modal__title { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; }
.modal__title .icon { color: var(--ink-muted); }
.modal__close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 0; border-radius: var(--radius-sm, 8px);
  background: transparent; color: var(--ink-muted); cursor: pointer;
}
.modal__close:hover { background: var(--surface-hover); color: var(--ink); }

.modal__body { flex: 1 1 auto; overflow-y: auto; padding: var(--space-5); }
.modal__body > :first-child { margin-top: 0; }

.modal__foot {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-top: var(--hairline) solid var(--line);
  background: var(--surface-subtle, transparent);
  flex: none;
}

/* Løpende tekst i modal og på /personvern — overskriftene skal puste. */
.prose h2 { font-size: var(--text-md, 1.05rem); margin: var(--space-6) 0 var(--space-2); }
.prose h3 { font-size: var(--text-sm); margin: var(--space-5) 0 var(--space-1); color: var(--ink-muted); }
.prose p, .prose ul { margin: 0 0 var(--space-3); }
.prose ul { padding-inline-start: var(--space-5); }
.prose li { margin-bottom: var(--space-2); }

/* Kurv gruppert per mottaker — samlebestilling til flere ansatte. */
.kurvgruppe__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-3) 0 var(--space-2); margin-top: var(--space-3);
  border-block-start: 1px solid var(--line); font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.kurvgruppe__head:first-child { border-block-start: 0; margin-top: 0; }
.kurvgruppe__navn { display: inline-flex; align-items: center; gap: var(--space-2); }
.kurvgruppe__navn svg { inline-size: 15px; block-size: 15px; color: var(--ink-subtle); }

/* Leveringsvalg — et adressevalg, så adressen står i selve valget. */
.levering { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-3);
  align-items: start; padding: var(--space-4); border: 1px solid var(--line);
  border-radius: var(--radius-md); cursor: pointer; }
.levering:hover { border-color: var(--ink-faint); }
.levering:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.levering--eneste { cursor: default; }
.levering input { accent-color: var(--accent); margin-block-start: 2px; }
.levering__tekst { display: grid; gap: var(--space-1); }
.levering__navn { font-weight: var(--weight-semibold); }
.levering__hjelp, .levering__adresse { font-size: var(--text-xs); }
.levering__pris { font-size: var(--text-sm); white-space: nowrap; }

/* ---------------------------------------------------------------------------
   KUPONGKORT
   Kupongstatus i pagehead på katalogsiden. Sto tidligere bare i kurven og
   utsjekk — synlig først når den ansatte allerede handlet.
--------------------------------------------------------------------------- */
.kupongkort {
  flex: none;
  min-width: 230px; max-width: 300px;
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius-lg);
}
.kupongkort__topp { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-2); }
.kupongkort__merkelapp {
  flex: 1 0 100%;
  font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: var(--tracking-caps); color: var(--ink-subtle);
}
.kupongkort__belop {
  font-size: var(--text-2xl); font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums; color: var(--ink);
}
.kupongkort__enhet { font-size: var(--text-sm); color: var(--ink-muted); }

/* Måleren viser brukt av totalt. Bredden settes i malen, der tallene finnes. */
.kupongkort__maler {
  height: 6px; margin: var(--space-3) 0 var(--space-2);
  background: var(--surface-sunk); border-radius: 999px; overflow: hidden;
}
.kupongkort__maler > span {
  display: block; height: 100%;
  background: var(--accent); border-radius: 999px;
}
.kupongkort__under {
  margin: 0; font-size: var(--text-xs); color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.kupongkort__note {
  margin: var(--space-2) 0 0; font-size: var(--text-xs); color: var(--ink-subtle);
}

/* Under 720 px står pagehead i én kolonne, og kortet skal fylle bredden i
   stedet for å stå som en smal stripe ved siden av overskriften. */
@media (max-width: 720px) {
  .kupongkort { max-width: none; width: 100%; }
}

/* Kupongbrikke i topbaren — beløpet igjen der blikket allerede er.
   Tabulære siffer så brikka ikke hopper i bredden når beløpet endrer seg. */
.topbar__kupong { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Kortet i menyskuffen står mot skuffens egen flate, ikke som et kort oppå
   et kort — derfor uten ramme og bakgrunn der. */
.offcanvas__kupong { padding-bottom: 0; }
.offcanvas__kupong .kupongkort {
  max-width: none; width: 100%;
  border: 0; background: transparent; padding: 0;
}

/* På profilsiden står det som et vanlig kort, med luft under. */
.profil-kupong { max-width: 620px; margin-bottom: var(--space-5); }
