/* Budgie — Design-system CSS (matcher Budgie-original.html 1:1) */

:root {
  --bg:  #07070e;
  --c1:  #0e0e1c;
  --c2:  #141428;
  --c3:  #1c1c38;
  --bd:  rgba(255,255,255,.07);
  --bd2: rgba(255,255,255,.13);
  --tx:  #eeeeff;
  --mu:  rgba(238,238,255,.42);
  --fa:  rgba(238,238,255,.07);
  --ac:  #7c5cfc;
  --ac2: #a78bfa;
  --ac3: rgba(124,92,252,.15);
  --gr:  #22d3a0;
  --rd:  #f43f5e;
  --am:  #fbbf24;
  --fn:  'DM Sans', sans-serif;
  --mo:  'DM Mono', monospace;
  color-scheme: dark;
}

/* Lys-tema override. Aktiveres via:
   - <html class="theme-light"> sat af theme-init-script før paint, eller
   - prefers-color-scheme: light som fallback hvis bruger ikke har valgt.
   Lilla (--ac/--ac2/--ac3) bevares — de virker på begge themes.
   --gr/--rd/--am justeres lidt for kontrast på lys baggrund. */
.theme-light {
  --bg:  #f7f7fb;
  --c1:  #ffffff;
  --c2:  #f0f0f7;
  --c3:  #e6e6ee;
  --bd:  rgba(0,0,0,.06);
  --bd2: rgba(0,0,0,.12);
  --tx:  #1a1a2e;
  --mu:  rgba(26,26,46,.55);
  --fa:  rgba(0,0,0,.04);
  --gr:  #0d9d70;
  --rd:  #d41a44;
  --am:  #b97500;
  color-scheme: light;
}

/* System-præference fallback når bruger ikke har valgt eksplicit
   (kun aktiv hvis html-tag ikke har theme-dark eller theme-light) */
@media (prefers-color-scheme: light) {
  html:not(.theme-light):not(.theme-dark) {
    --bg:  #f7f7fb;
    --c1:  #ffffff;
    --c2:  #f0f0f7;
    --c3:  #e6e6ee;
    --bd:  rgba(0,0,0,.06);
    --bd2: rgba(0,0,0,.12);
    --tx:  #1a1a2e;
    --mu:  rgba(26,26,46,.55);
    --fa:  rgba(0,0,0,.04);
    --gr:  #0d9d70;
    --rd:  #d41a44;
    --am:  #b97500;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html {
  background: var(--bg);
  color: var(--tx);
  font-family: var(--fn);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: var(--bg);
}

/* ── Shell (max 420px centreret) ─────────────────────────────────── */
.shell {
  width: 100%;
  max-width: 420px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* ── Topbar ───────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7,7,14,.93);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--bd);
}

.logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ac2);
}

.logo-bird {
  display: inline-block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.topbar-r {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* ── Sprog-toggle ─────────────────────────────────────────────────── */
.langbar {
  display: flex;
  background: var(--c2);
  border: 1px solid var(--bd2);
  border-radius: 999px;
  padding: 2px;
  gap: 1px;
}
.lb {
  padding: 4px 9px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--mu);
  font-size: 11px;
  font-family: var(--fn);
  cursor: pointer;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.lb.on {
  background: var(--ac);
  color: #fff;
}

/* ── Avatar ───────────────────────────────────────────────────────── */
.av {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ac), var(--ac2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
  cursor: pointer;
  border: none;
}

/* ── Bottom nav ───────────────────────────────────────────────────── */
.bnav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 420px;
  background: rgba(7,7,14,.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--bd);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 22px;
  z-index: 50;
}

.ni {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--mu);
  font-size: 10px;
  font-family: var(--fn);
  padding: 4px 12px;
  border-radius: 12px;
  transition: all .2s;
  text-decoration: none;
}

.ni svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.ni.on { color: var(--ac2); }
.nav-more { font-family: inherit; }

/* Mere-pop-over: bottom-sheet over .bnav */
.nav-more-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7,7,14,.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 49;
  opacity: 0;
  transition: opacity .2s ease;
}
.nav-more-backdrop.show { opacity: 1; }

.nav-more-sheet {
  position: fixed;
  left: 50%;
  bottom: 70px;
  transform: translate(-50%, 16px);
  width: calc(100% - 24px);
  max-width: 396px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(124,92,252,.10) 0%, transparent 55%),
    var(--c1);
  border: 1px solid var(--bd2);
  border-radius: 18px;
  padding: 6px 8px 10px;
  z-index: 51;
  box-shadow: 0 -12px 40px rgba(0,0,0,.55);
  opacity: 0;
  transition: transform .22s cubic-bezier(.2,.8,.2,1), opacity .2s ease;
}
.nav-more-sheet.show {
  transform: translate(-50%, 0);
  opacity: 1;
}
.nav-more-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--bd2);
  margin: 6px auto 10px;
}
.nav-more-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--bd);
  margin: 0 4px 8px;
}
.nav-more-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--mu);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.nav-more-close {
  background: none;
  border: none;
  color: var(--mu);
  font-size: 22px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.nav-more-close:hover { background: var(--c3); color: var(--tx); }

.nav-more-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 12px;
  border-radius: 14px;
  color: var(--tx);
  text-decoration: none;
  font-family: var(--fn);
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.nav-more-item:hover {
  background: var(--c2);
  border-color: var(--bd);
  transform: translateX(2px);
}
.nav-more-item.on {
  background: var(--ac3);
  border-color: rgba(124,92,252,.3);
}
.nav-more-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--c3), rgba(124,92,252,.12));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ac2);
  flex-shrink: 0;
  border: 1px solid var(--bd);
}
.nav-more-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}
.nav-more-item.on .nav-more-icon {
  background: linear-gradient(135deg, var(--ac), var(--ac2));
  color: #fff;
  border-color: transparent;
}
.nav-more-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.nav-more-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx);
  line-height: 1.2;
}
.nav-more-sub {
  font-size: 11px;
  color: var(--mu);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-more-item.on .nav-more-label { color: var(--ac2); }
.nav-more-chev {
  width: 16px;
  height: 16px;
  color: var(--mu);
  flex-shrink: 0;
}
.nav-more-item.on .nav-more-chev { color: var(--ac2); }

/* ── Sideindhold ──────────────────────────────────────────────────── */
.page {
  flex: 1;
  padding: 16px 16px 90px;
  overflow-y: auto;
}

/* ── Kort ─────────────────────────────────────────────────────────── */
.card {
  background: var(--c2);
  border: 1px solid var(--bd);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
}

.card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--mu);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 12px;
}

/* ── Formularer ───────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 11px; font-weight: 500; color: var(--mu); letter-spacing: .4px; text-transform: uppercase; margin-bottom: 6px; }

.field input, .field select, .field textarea,
input.field, select.field, textarea.field {
  width: 100%;
  background: var(--c3);
  border: 1px solid var(--bd2);
  border-radius: 10px;
  color: var(--tx);
  font-size: 14px;
  font-family: var(--fn);
  padding: 11px 14px;
  transition: border-color .2s;
}

.field input:focus, .field select:focus, .field textarea:focus,
input.field:focus, select.field:focus, textarea.field:focus {
  outline: none;
  border-color: var(--ac);
}

.field input::placeholder,
input.field::placeholder, textarea.field::placeholder { color: var(--mu); }

/* ── Knapper ──────────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px;
  background: var(--ac);
  color: #fff;
  border: none;
  border-radius: 14px;
  font-family: var(--fn);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.btn:hover { background: #6b4edb; }
.btn:active { transform: scale(.98); }

.btn-sec {
  background: var(--c3);
  color: var(--tx);
  border: 1px solid var(--bd2);
}

.btn-sec:hover { background: rgba(255,255,255,.06); }

.btn-sm {
  width: auto;
  padding: 7px 14px;
  font-size: 12px;
  border-radius: 10px;
}

/* ── Flash-beskeder ───────────────────────────────────────────────── */
.alert-ok {
  background: rgba(34,211,160,.12);
  border: 1px solid rgba(34,211,160,.3);
  color: #22d3a0;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

.alert-err {
  background: rgba(244,63,94,.12);
  border: 1px solid rgba(244,63,94,.3);
  color: #f43f5e;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ── Notifikations-alerts (NotificationService) ───────────────────── */
.alerts-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.alert-card {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  background: var(--c1);
  border: 1px solid var(--bd);
  position: relative;
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease;
}
.alert-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .55;
  background:
    radial-gradient(120px 60px at 0% 50%, var(--alert-glow, transparent) 0%, transparent 70%);
}
.alert-card:hover { transform: translateY(-1px); }
.alert-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--alert-icon-bg, var(--c3));
  color: var(--alert-icon-fg, var(--ac2));
  border: 1px solid var(--alert-icon-bd, transparent);
  position: relative;
  z-index: 1;
}
.alert-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.alert-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.alert-msg {
  color: var(--tx);
  line-height: 1.4;
  font-weight: 500;
}
.alert-cta {
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  color: var(--alert-icon-fg, var(--ac2));
  letter-spacing: .02em;
  display: inline-block;
  margin-top: 2px;
}
.alert-cta:hover { text-decoration: underline; }
.alert-dismiss-form { margin: 0; padding: 0; line-height: 0; position: relative; z-index: 1; }
.alert-dismiss {
  background: none;
  border: none;
  color: var(--mu);
  font-size: 16px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background .15s, color .15s;
}
.alert-dismiss:hover { background: var(--c3); color: var(--tx); }

.alert-info-tone {
  --alert-icon-bg: rgba(56,189,248,.12);
  --alert-icon-fg: #38bdf8;
  --alert-icon-bd: rgba(56,189,248,.25);
  --alert-glow: rgba(56,189,248,.18);
  border-color: rgba(56,189,248,.18);
}
.alert-warn-tone {
  --alert-icon-bg: rgba(251,191,36,.13);
  --alert-icon-fg: #fbbf24;
  --alert-icon-bd: rgba(251,191,36,.28);
  --alert-glow: rgba(251,191,36,.18);
  border-color: rgba(251,191,36,.20);
}
.alert-err-tone {
  --alert-icon-bg: rgba(244,63,94,.13);
  --alert-icon-fg: #f43f5e;
  --alert-icon-bd: rgba(244,63,94,.28);
  --alert-glow: rgba(244,63,94,.18);
  border-color: rgba(244,63,94,.20);
}

/* ── Hero-sektion ─────────────────────────────────────────────────── */
.hero-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.hero-card {
  flex: 1;
  background: var(--c2);
  border: 1px solid var(--bd);
  border-radius: 16px;
  padding: 14px;
  text-align: center;
}

.hero-card.big {
  background: linear-gradient(135deg, rgba(124,92,252,.18), rgba(167,139,250,.08));
  border-color: rgba(124,92,252,.3);
}

.hero-label {
  font-size: 10px;
  color: var(--mu);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.hero-amount {
  font-size: 22px;
  font-weight: 700;
  color: var(--tx);
  font-family: var(--mo);
}

.hero-amount.big {
  font-size: 28px;
  color: var(--ac2);
}

.hero-amount.green { color: var(--gr); }
.hero-amount.red   { color: var(--rd); }

/* ── Transaktionsliste ────────────────────────────────────────────── */
.tx-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bd);
}

.tx-row:last-child { border-bottom: none; }

.tx-icon {
  width: 36px;
  height: 36px;
  background: var(--c3);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.tx-body { flex: 1; min-width: 0; }
.tx-desc { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 11px; color: var(--mu); margin-top: 2px; }
.tx-amt  { font-size: 14px; font-weight: 600; font-family: var(--mo); flex-shrink: 0; }
.tx-amt.pos { color: var(--gr); }
.tx-amt.neg { color: var(--rd); }

/* ── Budget-bar ───────────────────────────────────────────────────── */
.bud-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bd);
  cursor: pointer;
}

.bud-row:last-child { border-bottom: none; }

.bud-icon { font-size: 20px; flex-shrink: 0; width: 28px; text-align: center; }
.bud-body { flex: 1; min-width: 0; }
.bud-name { font-size: 13px; font-weight: 500; }
.bud-bar-track { height: 4px; background: var(--fa); border-radius: 999px; overflow: hidden; margin-top: 5px; }
.bud-bar-fill  { height: 100%; border-radius: 999px; background: var(--ac); transition: width .4s; }
.bud-bar-fill.over { background: var(--rd); }
.bud-bar-fill.near { background: var(--am); }
.bud-amounts { font-size: 11px; color: var(--mu); margin-top: 3px; }
.bud-right   { text-align: right; flex-shrink: 0; }
.bud-pct     { font-size: 12px; font-weight: 600; font-family: var(--mo); }

/* ── Modal ────────────────────────────────────────────────────────── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-bg.hidden { display: none; }

.modal {
  background: var(--c2);
  border: 1px solid var(--bd2);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 420px;
  padding: 20px 16px 36px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  background: var(--c3);
  border: none;
  color: var(--mu);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Upload-zone ──────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--bd2);
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--c3);
  position: relative;
}

.upload-zone:hover, .upload-zone.drag { border-color: var(--ac); background: var(--ac3); }
.upload-zone.ok { border-color: var(--gr); background: rgba(34,211,160,.06); }
.upload-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* ── Opsparing progress ───────────────────────────────────────────── */
.sav-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--bd);
  cursor: pointer;
}

.sav-row:last-child { border-bottom: none; }

.sav-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sav-icon   { font-size: 20px; }
.sav-name   { font-size: 14px; font-weight: 600; flex: 1; }
.sav-pct    { font-size: 12px; color: var(--mu); font-family: var(--mo); }
.sav-bar-track { height: 6px; background: var(--fa); border-radius: 999px; overflow: hidden; }
.sav-bar-fill  { height: 100%; border-radius: 999px; background: var(--gr); transition: width .6s; }
.sav-amounts   { font-size: 11px; color: var(--mu); margin-top: 5px; }

/* ── Utility ──────────────────────────────────────────────────────── */
.sep    { height: 1px; background: var(--bd); margin: 12px 0; }
.muted  { color: var(--mu); }
.mono   { font-family: var(--mo); }
.green  { color: var(--gr); }
.red    { color: var(--rd); }
.amber  { color: var(--am); }
.accent2{ color: var(--ac2); }
.bg-app { background: var(--bg); }

/* Margins (gentagne inline-styles flyttet hertil) */
.mb-0  { margin-bottom: 0 !important; }
.mb-2  { margin-bottom: 2px; }
.mb-4  { margin-bottom: 4px; }
.mb-6  { margin-bottom: 6px; }
.mb-8  { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-2  { margin-top: 2px; }
.mt-4  { margin-top: 4px; }
.mt-6  { margin-top: 6px; }
.mt-8  { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.ml-auto { margin-left: auto; }
.ml-4    { margin-left: 4px; }
.ml-6    { margin-left: 6px; }
.ml-8    { margin-left: 8px; }
.m-0   { margin: 0; }

/* Font-størrelser */
.fs-10 { font-size: 10px; }
.fs-11 { font-size: 11px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-14 { font-size: 14px; }
.fs-15 { font-size: 15px; }
.fs-16 { font-size: 16px; }
.fs-18 { font-size: 18px; }
.fs-20 { font-size: 20px; }
.fs-22 { font-size: 22px; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* Display & flex helpers */
.hidden        { display: none !important; }
.flex          { display: flex; }
.flex-center   { display: flex; align-items: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.flex-col      { display: flex; flex-direction: column; }
.gap-4         { gap: 4px; }
.gap-6         { gap: 6px; }
.gap-8         { gap: 8px; }
.gap-10        { gap: 10px; }
.gap-12        { gap: 12px; }
.text-center   { text-align: center; }
.w-full        { width: 100%; }
.contents      { display: contents; }
.inline-block  { display: inline-block; }

/* Field-label gentaget i mange formularer */
.field-label-mu { font-size: 11px; color: var(--mu); display: block; margin-bottom: 4px; }

/* Dynamisk progress-bar via data-pct (sat af JS pga. CSP) */
[data-pct]     { width: 0%; transition: width .6s ease; }
[data-color]   { /* JS sætter color-property baseret på data-color */ }

/* ════════════════════════════════════════════════════════════════════
   Desktop-layout (>= 1024px)
   Mobile-first preserved. Desktop udvider shell til wider grid med
   sidebar-nav i stedet for bottom-nav. PWA-shell forbliver mobil-stil.
   ════════════════════════════════════════════════════════════════════ */

@media (min-width: 1024px) {
  /* Udvid shell til full-width grid: sidebar + content.
     Eksplicit named-areas så children IKKE auto-flow forkert ind i
     sidebar-column. Tidligere bug: chat-page og .page-content endte
     i samme cell som sidebar fordi de stod efter topbar i HTML. */
  .shell {
    max-width: 1180px;
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "topbar topbar"
      "sidebar content";
    gap: 0;
    padding: 0;
    align-items: start;
  }

  /* Topbar spans full width */
  .topbar {
    grid-area: topbar;
    padding: 14px 28px;
  }

  /* Bottom-nav transformeres til sidebar — eksplicit grid-area */
  .bnav {
    grid-area: sidebar;
    position: sticky;
    top: 73px;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    max-width: none;
    height: calc(100vh - 73px);
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 18px 12px;
    gap: 4px;
    border-top: none;
    border-right: 1px solid var(--bd);
    backdrop-filter: none;
    background: var(--bg);
    z-index: 10;
  }
  .bnav .ni {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    width: 100%;
    color: var(--mu);
    transition: background .15s ease, color .15s ease;
  }
  .bnav .ni:hover { background: var(--c2); color: var(--tx); }
  .bnav .ni.on {
    background: var(--ac3);
    color: var(--ac2);
  }
  .bnav .ni svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }
  .bnav .nav-more {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--bd);
    border-radius: 0;
  }

  /* Mere-popover bliver dropdown ved siden af sidebar i stedet for bottom-sheet */
  .nav-more-sheet {
    position: fixed;
    left: 240px;
    bottom: auto;
    top: 90px;
    transform: translate(0, 12px);
    width: 320px;
    max-width: 320px;
    max-height: calc(100vh - 110px);
  }
  .nav-more-sheet.show {
    transform: translate(0, 0);
  }

  /* Page-content vokser til hele right-column.
     Eksplicit grid-area "content" så IKKE-page-children (chat-page,
     spiir-onboard, etc.) også får korrekt placering. */
  .page,
  .chat-page,
  .spiir-onboard {
    grid-area: content;
    padding: 28px 32px;
    max-width: none;
  }
  .chat-page { padding: 0; }  /* chat-page har egen padding */
  .spiir-onboard { padding: 32px 28px; }
  /* Flash-besked + andre direkte shell-children skal også placeres */
  .shell > .alert-success,
  .shell > .alert-error,
  .shell > .flash-row {
    grid-area: content;
    margin: 0 32px;
  }

  /* Cards bliver større med mere åndedrag */
  .card {
    padding: 22px;
  }

  /* Dashboard-grid: 2-kolonne på desktop */
  .hero-row {
    flex-wrap: wrap;
    gap: 16px;
  }
  .hero-row > * {
    flex: 1 1 calc(50% - 8px);
    min-width: 240px;
  }

  /* Transaction-rows er tighter på desktop */
  .tx-row { padding: 12px 4px; }
  .tx-desc { font-size: 14px; }
  .tx-amt  { font-size: 14px; }

  /* Budget/savings-cards i 2-kolonne */
  .recur-list,
  .acc-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .recur-row,
  .acc-row {
    padding: 16px 18px;
  }

  /* Welcome-page bliver bredere på desktop */
  .w-hero {
    max-width: 1200px;
    margin: 0 auto;
  }

  /* Alerts bliver maks 720px */
  .alerts-stack {
    max-width: 720px;
  }

  /* Chat udnytter desktop-bredde */
  .chat-shell {
    max-width: 760px;
    margin: 0 auto;
    padding: 18px;
    height: calc(100vh - 110px);
  }

  /* Modal centreres pænere på desktop */
  .modal {
    max-width: 520px;
  }
}

/* Større desktops: max-width 1280px og flere columns på lister */
@media (min-width: 1440px) {
  .shell { max-width: 1320px; }
  .recur-list,
  .acc-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Premium-badges (genbrugbar pre-flight gate UX) ──────────────────── */
.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ac), var(--ac2));
  color: #fff;
  border: 1px solid rgba(167,139,250,0.4);
  vertical-align: middle;
}
.premium-badge.gold {
  background: linear-gradient(90deg, var(--am), #f59e0b);
  border-color: rgba(251,191,36,0.5);
  color: var(--bg);
}
.premium-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, var(--ac3), rgba(124,92,252,0.04) 60%);
  border: 1px solid rgba(124,92,252,0.3);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.premium-banner-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ac), var(--ac2));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
.premium-banner-text { flex: 1; min-width: 0; }
.premium-banner-title {
  font-size: 13px; font-weight: 600;
  color: var(--tx);
  margin-bottom: 2px;
}
.premium-banner-desc {
  font-size: 11px; color: var(--mu);
  line-height: 1.5;
}
.premium-banner-cta {
  background: var(--ac);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 36px;
  display: inline-flex; align-items: center;
}
.premium-banner-cta:hover { opacity: 0.92; }

/* Free-tier counter (fx "2 / 3 gratis posteringer brugt") */
.tier-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--mu);
  font-family: var(--mo);
  padding: 3px 10px;
  background: var(--c3);
  border: 1px solid var(--bd);
  border-radius: 999px;
  margin-left: 8px;
}
.tier-counter.warn { color: var(--am); border-color: rgba(251,191,36,0.3); }
.tier-counter.full { color: var(--rd); border-color: rgba(244,63,94,0.3); }
