/* ============================================================================
   J-Gass kunde-PWA — designsystem v2
   Mobil-først, tenant-brandbar (--brand settes i runtime av app.js).
   Alle klassenavn fra v1 er bevart; app.js er uendret.
   Lys + mørk modus (prefers-color-scheme), redusert bevegelse respekteres.
   ========================================================================== */

:root {
  /* Merkevare — J-Gass oransje som standard, kan overstyres per tenant.
     app.js setter --brand, --brand-rgb, --brand-dark, --brand-soft i runtime. */
  --brand: #e05a2b;               /* J-Gass — litt dempet, mindre neon */
  --brand-dark: #bd471e;
  --brand-soft: #f6ede9;
  --brand-rgb: 224, 90, 43;
  --on-brand: #ffffff;            /* tekstfarge oppå merkefarge */
  --vipps: #ff5b24;

  /* Nøytral, kjølig flate-palett (lys modus) — profesjonelt, ikke skrikende.
     --tint brukes til flater som før var fylt med merkefarge (miniatyrer, ikoner),
     så designet er nøytralt og merkefargen kun er en aksent på CTA/pris/aktiv. */
  --bg: #eef1f5;
  --bg-grad-1: #f2f4f8;
  --bg-grad-2: #e7ebf1;
  --card: #ffffff;
  --card-2: #f8fafc;
  --tint: #eef1f6;
  --tint-2: #e6eaf1;
  --fg: #1b2430;
  --fg-soft: #3d4757;
  --muted: #6b7482;
  --faint: #98a1b0;
  --border: #e3e7ee;
  --border-strong: #cfd6e0;

  --ok: #15a34a;
  --ok-soft: #e7f8ee;
  --warn: #c0392b;
  --warn-soft: #fdecea;
  --amber: #d97706;
  --amber-soft: #fff5e6;

  /* Layered shadows — mykere, mer premium */
  --shadow-xs: 0 1px 2px rgba(19, 26, 36, 0.05);
  --shadow: 0 2px 6px rgba(19, 26, 36, 0.06), 0 8px 20px rgba(19, 26, 36, 0.05);
  --shadow-md: 0 4px 12px rgba(19, 26, 36, 0.08), 0 16px 36px rgba(19, 26, 36, 0.07);
  --shadow-brand: 0 8px 24px rgba(var(--brand-rgb), 0.28);

  --radius: 18px;
  --radius-sm: 12px;
  --radius-xs: 9px;
  --radius-pill: 999px;

  /* Type-skala */
  --fs-hero: clamp(26px, 6.5vw, 32px);
  --fs-h1: clamp(22px, 5.5vw, 26px);
  --fs-h2: 18px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);   /* soft ease-out */
  --tap: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-soft: rgba(var(--brand-rgb), 0.16);
    --on-brand: #ffffff;
    --bg: #0d1017;
    --bg-grad-1: #10141d;
    --bg-grad-2: #0b0e15;
    --card: #161b25;
    --card-2: #1b212d;
    --tint: #1c2330;
    --tint-2: #232c3b;
    --fg: #eef1f6;
    --fg-soft: #c4cbd6;
    --muted: #93a0b1;
    --faint: #6a7686;
    --border: #262d3a;
    --border-strong: #333c4c;

    --ok: #34d399;      --ok-soft: rgba(52, 211, 153, 0.14);
    --warn: #f87171;    --warn-soft: rgba(248, 113, 113, 0.14);
    --amber: #fbbf24;   --amber-soft: rgba(251, 191, 36, 0.14);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 12px 28px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5), 0 22px 48px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
        Roboto, "Helvetica Neue", sans-serif;
  overscroll-behavior-y: contain;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(env(safe-area-inset-top), 14px) 16px 12px;
  background: var(--card);   /* fallback for nettlesere uten color-mix */
  background: color-mix(in srgb, var(--card) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand img { height: 28px; display: block; }
.ghost-btn {
  background: none; border: 0; color: var(--muted);
  font-size: 14px; padding: 8px 12px; cursor: pointer;
  border-radius: var(--radius-xs); font-weight: 500;
  transition: background .15s var(--tap), color .15s;
}
.ghost-btn:active { background: var(--bg); color: var(--fg); }

/* ---------- main ---------- */
main {
  flex: 1; padding: 20px 16px;
  display: flex; flex-direction: column;
}

h1 { font-size: var(--fs-h1); font-weight: 750; letter-spacing: -0.02em; margin: 4px 0 6px; }
h2 { font-size: var(--fs-h2); font-weight: 650; letter-spacing: -0.01em; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 18px; font-size: 15px; }

/* ---------- buttons ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px;
  font-size: 17px; font-weight: 650; letter-spacing: -0.01em;
  border: 0; border-radius: var(--radius-sm);
  background: var(--brand);   /* fallback for nettlesere uten color-mix */
  background: linear-gradient(180deg,
      color-mix(in srgb, var(--brand) 92%, #fff 8%), var(--brand));
  color: var(--on-brand);
  cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-brand);
  transition: transform .12s var(--tap), box-shadow .18s var(--ease), filter .15s;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(1px) scale(0.985); box-shadow: 0 4px 12px rgba(var(--brand-rgb), 0.24); }
.btn:disabled { background: var(--border-strong); color: var(--card); box-shadow: none; cursor: default; }
.btn.secondary {
  background: var(--card); color: var(--brand);
  border: 1.5px solid color-mix(in srgb, var(--brand) 40%, var(--border));
  box-shadow: var(--shadow-xs);
}
.btn.danger { background: linear-gradient(180deg, #e05545, var(--warn)); box-shadow: 0 8px 22px rgba(192, 57, 43, 0.28); }
.btn.large  { padding: 20px; font-size: 18px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.btn.vipps { background: linear-gradient(180deg, color-mix(in srgb, var(--vipps) 92%, #fff 8%), var(--vipps)); color: #fff; }
.btn.vipps::before {
  content: ""; width: 28px; height: 28px;
  background: url("/app/img/vipps-mark.svg") center/contain no-repeat;
}

/* Demo-betaling — kun synlig på test-automater (simulerte enheter) */
.btn.demo {
  background: linear-gradient(180deg, #7c80f2, #6366f1); color: #fff;
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.28);
}
.pay-trust.demo-hint { color: #6366f1; }

/* ---------- Avbryt/fortsett-modal (navigasjonslås under handel) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 20, 28, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; backdrop-filter: blur(2px);
}
.modal-card {
  background: var(--card); border-radius: var(--radius);
  padding: 22px 20px; width: 100%; max-width: 420px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.25);
  animation: modal-up 0.22s ease-out;
}
@keyframes modal-up { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .modal-card { animation: none; } }
.modal-card h2 { margin: 0 0 8px; font-size: 20px; }
.modal-card p  { margin: 0 0 18px; color: var(--muted); }
.modal-actions { display: flex; flex-direction: column; gap: 10px; }

/* Rød avbryt-lenke (payment/detected — handel med innsatt flaske) */
.link-btn.danger-link { color: var(--warn); }

/* ---------- «Bytt til annen type flaske»-skuff (detected-skjermen) ---------- */
.same-type-offer {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; margin: 14px 0; box-shadow: var(--shadow-xs);
}
.same-type-offer .label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}
.same-type-offer .row { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.same-type-offer .price { font-weight: 700; }
.alt-drawer { margin-top: 6px; }
.drawer-toggle {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  font-size: 15px; font-weight: 600; color: var(--fg); cursor: pointer;
}
.drawer-toggle .chev { transition: transform 0.2s; }
.drawer-toggle.open .chev { transform: rotate(180deg); }
.drawer-body { padding-top: 12px; }
.bottle .alt-price { font-weight: 700; margin-top: 4px; }
.bottle .alt-price-note { font-size: 11px; color: var(--muted); }

/* ---------- choice cards (welcome) ---------- */
.choice {
  position: relative; display: block; width: 100%;
  background:
    linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 14px;
  text-align: left; cursor: pointer;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: border-color .18s, transform .12s var(--tap), box-shadow .2s var(--ease);
}
.choice::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 4px;
  background: var(--brand); opacity: 0; transition: opacity .2s;
}
.choice:active { transform: scale(0.99); }
.choice:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--border)); box-shadow: var(--shadow); transform: translateY(-1px); }
.choice:hover::after { opacity: 1; }
.choice .icon {
  width: 54px; height: 54px;
  background: var(--tint);
  border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 13px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.choice .icon svg { width: 28px; height: 28px; color: var(--brand); }
.choice .title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 3px; }
.choice .desc  { color: var(--muted); font-size: 14px; }

/* ---------- buy: category tabs (sticky) ---------- */
.tabs {
  display: flex; gap: 5px; margin: 0 0 16px;
  background: var(--card); padding: 5px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-xs); border: 1px solid var(--border);
  position: sticky; top: 58px; z-index: 5;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: 1 0 auto; padding: 9px 16px; border: 0; background: transparent;
  font-weight: 600; font-size: 14px; color: var(--muted);
  border-radius: var(--radius-pill); cursor: pointer; white-space: nowrap;
  transition: background .18s var(--ease), color .18s, box-shadow .18s;
}
.tabs button.active { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-brand); }
.tabs button:not(.active):active { background: var(--brand-soft); color: var(--brand); }

/* ---------- buy: bottle grid ---------- */
.bottle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bottle {
  position: relative;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 10px 13px;
  display: flex; flex-direction: column;
  text-align: left; cursor: pointer; font: inherit; color: inherit;
  box-shadow: var(--shadow-xs);
  transition: border-color .16s, transform .14s var(--tap), box-shadow .18s var(--ease);
  animation: bottleIn .34s var(--ease) both;
}
@keyframes bottleIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.bottle:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--border)); box-shadow: var(--shadow); transform: translateY(-3px); }
.bottle:active { transform: scale(0.98); }
.bottle.selected { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.16), var(--shadow); }
.bottle .thumb {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  background: linear-gradient(165deg, var(--tint), var(--card));
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px; overflow: hidden;
}
.bottle .thumb img {
  height: 86%; width: auto; max-width: 78%; object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(19, 26, 36, 0.16));
}
.bottle .name {
  font-size: 13.5px; font-weight: 600; line-height: 1.28; min-height: 34px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bottle .price-row { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin-top: 6px; }
.bottle .price { color: var(--fg); font-weight: 800; font-size: 17px; white-space: nowrap; letter-spacing: -0.02em; }
.bottle .price .cur { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 1px; }
.bottle .pick { font-size: 12px; font-weight: 700; color: var(--brand);
  opacity: 0; transform: translateX(-3px); transition: opacity .16s, transform .16s; }
.bottle:hover .pick { opacity: 1; transform: none; }

.bottle.unavailable { cursor: default; }
.bottle.unavailable:hover { border-color: var(--border); box-shadow: var(--shadow-xs); transform: none; }
.bottle.unavailable .thumb img { filter: grayscale(1); opacity: 0.4; }
.bottle.unavailable .name, .bottle.unavailable .price { opacity: 0.5; }
.bottle .soldout {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(19, 26, 36, 0.82); color: #fff; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; padding: 5px 12px; border-radius: var(--radius-pill);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.bottle.selecting { pointer-events: none; }
.bottle.selecting .thumb img { opacity: 0.25; }
.bottle.selecting .thumb::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border: 3px solid var(--brand-soft); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}

/* ---------- summary card (exchange offer / payment) ---------- */
.summary-card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.summary-card .row { display: flex; align-items: center; gap: 14px; padding: 10px 0; }
.summary-card .row + .row { border-top: 1px solid var(--border); }
.summary-card .row img { width: 64px; height: 80px; object-fit: contain; }
.summary-card .row .thumb-sm {
  width: 64px; height: 72px; flex-shrink: 0;
  background: linear-gradient(160deg, var(--tint), var(--card));
  border-radius: var(--radius-xs); display: flex; align-items: center; justify-content: center;
}
.summary-card .row .thumb-sm img {
  width: auto; height: 84%; max-width: 80%; object-fit: contain;
  filter: drop-shadow(0 4px 7px rgba(19, 26, 36, 0.14));
}
.summary-card .row .meta { flex: 1; }
.summary-card .row .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.summary-card .row .name { font-weight: 650; font-size: 15px; }
.summary-card .total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 14px; padding-top: 14px; border-top: 1.5px solid var(--border);
  font-size: 16px; font-weight: 650;
}
.summary-card .total .price { font-size: 28px; font-weight: 850; color: var(--fg); letter-spacing: -0.03em; }
.summary-card .mva { color: var(--muted); font-size: 12px; text-align: right; margin-top: 2px; }

/* ---------- payment: kort-knapp + trygghets-linje ---------- */
.btn.card { background: var(--card); color: var(--fg); border: 1.5px solid var(--border); box-shadow: var(--shadow-xs); }
.btn.card::before {
  content: ""; width: 22px; height: 16px; border-radius: 3px;
  background: var(--brand-soft); border: 1.5px solid var(--brand);
  box-shadow: inset 0 4px 0 -2px var(--brand);
}
.btn.card:active { background: var(--brand-soft); }
.pay-trust {
  text-align: center; color: var(--muted); font-size: 12px;
  margin-top: 14px; line-height: 1.5;
  display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}

/* ---------- door instruction ---------- */
.door-card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 20px;
  margin-bottom: 16px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.door-card .door-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100px; height: 100px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 88%, #fff 12%), var(--brand-dark));
  color: var(--on-brand);
  border-radius: 30px;
  font-size: 50px; font-weight: 850;
  margin-bottom: 16px;
  box-shadow: var(--shadow-brand);
  animation: doorPulse 1.7s ease-in-out infinite;
}
.door-card .door-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.door-card h2 { margin-top: 8px; }

@keyframes doorPulse {
  0%,100% { box-shadow: 0 8px 22px rgba(var(--brand-rgb), 0.32); }
  50%     { box-shadow: 0 10px 34px rgba(var(--brand-rgb), 0.6); }
}

/* ---------- progress / status timeline ---------- */
.timeline { margin: 10px 0 16px; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.step .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--border-strong); flex-shrink: 0;
  transition: background .25s, box-shadow .25s;
}
.step.done .dot { background: var(--ok); }
.step.active .dot { background: var(--brand); box-shadow: 0 0 0 6px rgba(var(--brand-rgb), 0.18); }
.step .text { font-size: 14px; color: var(--muted); }
.step.active .text, .step.done .text { color: var(--fg); font-weight: 550; }

/* ---------- spinner ---------- */
.spinner {
  width: 44px; height: 44px;
  border: 3.5px solid var(--border); border-top-color: var(--brand);
  border-radius: 50%; margin: 32px auto;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- detection result ---------- */
.detected-bottle {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 18px; text-align: center; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.detected-bottle img { height: 160px; margin-bottom: 12px; filter: drop-shadow(0 10px 16px rgba(19,26,36,0.16)); }
.detected-bottle .badge {
  display: inline-block; padding: 4px 11px;
  background: var(--brand-soft); color: var(--brand);
  border-radius: var(--radius-pill); font-size: 12px; font-weight: 650;
  margin-bottom: 8px;
}
.detected-bottle .name { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; }

/* ---------- error / receipt ---------- */
.error-box {
  background: var(--warn-soft); color: var(--warn);
  border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
  border-left: 4px solid var(--warn);
}
.success-box {
  background: var(--ok-soft); color: var(--ok);
  border-radius: var(--radius); padding: 24px; text-align: center; margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--ok) 22%, transparent);
}
.success-box .check {
  width: 66px; height: 66px; background: var(--ok);
  border-radius: 50%; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 33px;
  box-shadow: 0 8px 22px rgba(21, 163, 74, 0.34);
  animation: popIn .4s var(--ease) both;
}
@keyframes popIn { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

/* ---------- footer ---------- */
.footer {
  text-align: center; padding: 14px 16px;
  padding-bottom: max(env(safe-area-inset-bottom), 14px);
  color: var(--muted); font-size: 12px;
  background: color-mix(in srgb, var(--card) 70%, transparent);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.footer .powered-by {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 650; color: var(--fg-soft);
}
.footer .jgass-mark { height: 14px; width: auto; display: block; }

.brand img#brand-logo { max-height: 30px; max-width: 150px; object-fit: contain; }

/* ---------- mobile input ---------- */
.input-group { margin: 14px 0; }
.input-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 550; }
.input-group input {
  width: 100%; padding: 14px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 17px; font-family: inherit;
  background: var(--card); color: var(--fg);
  transition: border-color .15s, box-shadow .15s;
}
.input-group input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), 0.14); }

/* ---------- utility ---------- */
.center-text { text-align: center; }
.muted { color: var(--muted); }
.mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.fade-in { animation: fadeIn .34s var(--ease); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- welcome — locate / map / nearest-automat ---------- */
.locate-card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 18px; text-align: center;
  box-shadow: var(--shadow); margin: 14px 0;
}
.locate-icon { font-size: 42px; margin-bottom: 12px; }
.locate-card .btn { margin-top: 8px; }
.locate-card .small { font-size: 12px; margin-top: 10px; color: var(--muted); }
.locate-fallback { margin-top: 16px; color: var(--muted); font-size: 14px; }
.locate-fallback summary { cursor: pointer; padding: 10px 0; font-weight: 550; color: var(--fg-soft); }

.loading-page {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 60px 0; gap: 16px; color: var(--muted);
}

.automat-banner {
  border-radius: var(--radius); padding: 13px 15px; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.automat-banner.ok      { border-left: 4px solid var(--ok); }
.automat-banner.warn    { border-left: 4px solid var(--amber); background: var(--amber-soft); }
.automat-banner.danger  { border-left: 4px solid var(--warn); background: var(--warn-soft); }
.automat-banner .label  { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.automat-banner .name   { font-size: 18px; font-weight: 750; letter-spacing: -0.01em; margin: 2px 0 6px; }
.automat-banner.loading { display: flex; justify-content: center; padding: 16px; }
.automat-banner-alt     { margin-top: 8px; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 650; line-height: 1.4;
}
.badge.ok      { background: var(--ok-soft); color: var(--ok); }
.badge.warn    { background: var(--amber-soft); color: var(--amber); }
.badge.danger  { background: var(--warn-soft); color: var(--warn); }
/* Test-automat (simulert enhet — demo uten ekte betaling) */
.badge.test    { background: rgba(99, 102, 241, .14); color: #6366f1;
                 margin-left: 6px; letter-spacing: .04em; }

.automat-card {
  display: block; width: 100%; text-align: left;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px;
  margin-bottom: 10px; cursor: pointer; font: inherit; color: inherit;
  box-shadow: var(--shadow-xs);
  transition: background .15s, transform .1s var(--tap), box-shadow .18s, border-color .15s;
}
.automat-card:not(.disabled):hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); box-shadow: var(--shadow); }
.automat-card:not(.disabled):active { transform: scale(0.99); background: var(--brand-soft); }
.automat-card.disabled { opacity: 0.65; cursor: default; }
.automat-card.primary  { border-color: var(--brand); }
.automat-card.alt      { border-left: 4px solid var(--ok); }
.automat-card .head    { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.automat-card .head strong { font-size: 16px; font-weight: 700; }
.automat-card .small   { font-size: 13px; color: var(--muted); }
.automat-card .row.between { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.btn.small { padding: 7px 12px; font-size: 13px; width: auto; box-shadow: var(--shadow-xs); }
.btn.ghost-btn { background: var(--brand-soft); color: var(--brand); box-shadow: none; }

.link-btn {
  background: none; border: 0; padding: 12px;
  color: var(--brand); font-size: 14px; font-weight: 600;
  cursor: pointer; display: block; width: 100%; text-align: center;
  margin-top: 8px; border-radius: var(--radius-xs);
}
.link-btn:active { background: var(--brand-soft); }

.map-canvas {
  height: 320px; border-radius: var(--radius);
  margin: 12px 0 16px; overflow: hidden;
  border: 1px solid var(--border); box-shadow: var(--shadow-xs);
}

.spinner.small { width: 18px; height: 18px; border-width: 2px; margin: 0 auto; }

/* ---------- topbar: persistent automat-indikator ---------- */
.current-automat {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 11px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--card);
  margin: 0 8px; min-height: 32px; box-shadow: var(--shadow-xs);
}
.current-automat[hidden] { display: none; }
.current-automat .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--ok); }
.current-automat.warn .dot   { background: var(--amber); }
.current-automat.danger .dot { background: var(--warn); animation: pulseDot 1.6s ease infinite; }
.current-automat .meta { display: flex; flex-direction: column; min-width: 0; }
.current-automat .label { font-size: 10px; color: var(--muted); line-height: 1; letter-spacing: .03em; text-transform: uppercase; }
.current-automat .name {
  font-size: 13px; font-weight: 650; color: var(--fg);
  line-height: 1.2; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Egen keyframe for indikator-prikken (unngår navnekollisjon med doorPulse) */
@keyframes pulseDot { 50% { opacity: 0.35; } }

/* ---------- view-tabs (Kart / Liste) ---------- */
.view-tabs {
  display: flex; gap: 4px; padding: 4px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin: 12px 0; box-shadow: var(--shadow-xs);
}
.view-tabs button {
  flex: 1; padding: 10px 14px;
  background: transparent; border: 0; border-radius: var(--radius-xs);
  font: inherit; font-size: 14px; font-weight: 550;
  color: var(--muted); cursor: pointer;
  transition: background .15s var(--ease), color .15s;
}
.view-tabs button.active { background: var(--brand); color: var(--on-brand); }
.view-tabs button:not(.active):active { background: var(--brand-soft); color: var(--brand); }

/* ---------- kart-først landing ----------
   Blokk-layout (IKKE absolutt-posisjonert) så kartet får høyde selv om en gammel
   cachet CSS-versjon mangler disse reglene — app.js setter også høyde inline. */
.map-landing {
  position: relative;
  margin: -20px -16px 0;           /* bryt ut av main-padding → edge-to-edge kart */
}
.map-hero { position: relative; width: 100%; height: 54vh; min-height: 320px; display: block; background: var(--tint); }
.map-hero.leaflet-container, .map-hero .leaflet-container { width: 100%; height: 100%; font: inherit; background: var(--tint); }
.map-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px; color: var(--muted); font-size: 14px;
}

.map-locate {
  position: absolute; right: 14px; top: calc(54vh - 56px); z-index: 500;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--card); color: var(--brand);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.map-sheet {
  position: relative; background: var(--card);
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 34px rgba(19, 26, 36, 0.16);
  margin-top: -20px;               /* trekk panelet litt opp over kartet */
  display: flex; flex-direction: column;
  padding: 8px 16px max(env(safe-area-inset-bottom), 14px);
}
.map-sheet-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: 4px auto 10px; }
.map-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.map-sheet-title { font-size: 17px; font-weight: 750; letter-spacing: -0.01em; }
.map-sheet-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.map-list { overflow-y: auto; -webkit-overflow-scrolling: touch; display: grid; gap: 8px; padding-bottom: 4px; }
.map-list .automat-card { margin-bottom: 0; }

/* kart-popup (pin) */
.map-popup { min-width: 156px; font-family: inherit; }
.map-popup strong { font-size: 15px; color: var(--fg); }
.map-popup .small { color: var(--muted); margin: 3px 0 9px; font-size: 12.5px; }
.map-popup-btns { display: flex; gap: 6px; }
.map-popup-btns .btn.small { padding: 8px 10px; font-size: 13px; width: auto; flex: 1; box-shadow: none; }

/* kart-pin (divIcon) */
.automat-pin { background: none; border: 0; }
.automat-pin .pin {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 2px;
  transform: rotate(45deg);
  background: var(--pin, #e05a2b);
  border: 2px solid #fff; box-shadow: 0 3px 8px rgba(19, 26, 36, 0.3);
  display: flex; align-items: center; justify-content: center;
}
.automat-pin .pin > span {
  transform: rotate(-45deg);
  color: #fff; font-size: 12px; font-weight: 800;
}

/* ---------- redusert bevegelse ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ===== TESTMILJØ-banner (kun test.grillgass.no / test-tenant) ===== */
#test-banner {
  position: sticky; top: 0; z-index: 2000;
  background: repeating-linear-gradient(45deg, #b8860b, #b8860b 14px, #8a6508 14px, #8a6508 28px);
  color: #fff; text-align: center; font-size: 12.5px; font-weight: 700;
  padding: 7px 12px; line-height: 1.35; letter-spacing: .01em;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
body.is-test-env .topbar { border-top: 2px solid #b8860b; }
