/* HejBonni – lys, luftig og nordisk. Alle tekstfarver overholder WCAG AA. */
@import url("fonts/fonts.css");

:root {
  --paper: #FBF8F1;          /* varm off-white, som kvitteringspapir */
  --card: #FFFFFF;
  --line: #ECE6D8;
  --ink: #17332B;            /* dyb skovgrøn til tekst – 12.8:1 */
  --muted: #5B6E67;          /* 5.1:1 */
  --mint: #1B7A63;           /* primær, knapper og links – 5.2:1 på hvid */
  --mint-dark: #145C4A;
  --mint-bright: #2FA884;    /* kun dekorativ */
  --mint-tint: #DDF3EA;
  --coral: #F08A6C;          /* kun dekorativ */
  --coral-tint: #FDE6DE;
  --warn-bg: #FFF1D6; --warn-ink: #8A5A00;
  --bad-bg: #FBE3DD;  --bad-ink: #A23A22;
  --ok-bg: #DDF3EA;   --ok-ink: #14634F;
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(23, 51, 43, .05), 0 8px 24px rgba(23, 51, 43, .06);
  --font-head: "Nunito", ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 72px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0F1E1A; --card: #172A25; --line: #26403A;
    --ink: #EEF4F1; --muted: #A9BDB6; --mint: #5FD3AE; --mint-dark: #7FE0C1; --mint-bright: #5FD3AE;
    --mint-tint: #1D3B33; --coral-tint: #3A2620;
    --warn-bg: #3A2E14; --warn-ink: #F4CF85; --bad-bg: #3D2019; --bad-ink: #F5A792; --ok-bg: #1D3B33; --ok-ink: #8BE3C6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
  .btn-primary { color: #0F1E1A !important; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, .brand { font-family: var(--font-head); line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 800; margin: 0 0 .25rem; }
h2 { font-size: 1.2rem; font-weight: 800; margin: 0 0 .75rem; }
h3 { font-size: 1.05rem; font-weight: 700; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }
a { color: var(--mint); text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
.ico { width: 22px; height: 22px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--mint-bright); outline-offset: 2px; border-radius: 8px; }

/* ---------- Ramme ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 1.35rem; font-weight: 800; color: var(--ink); text-decoration: none; }
.brand .hej { color: var(--mint); }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); background: var(--card); box-shadow: var(--shadow); border: 0; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; background: var(--coral); border-radius: 50%; border: 2px solid var(--card); }
.wrap { max-width: 760px; margin: 0 auto; padding: 8px 16px calc(var(--nav-h) + 40px); }
.wrap-narrow { max-width: 460px; margin: 0 auto; padding: 24px 16px 48px; }

.bottomnav {
  position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--card); border-top: 1px solid var(--line);
}
.bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; font-weight: 600; color: var(--muted); text-decoration: none; padding: 6px 0; }
.bottomnav a[aria-current="page"] { color: var(--mint); }
.bottomnav .fab { justify-self: center; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; background: var(--mint); color: #fff; margin-top: -26px; box-shadow: 0 6px 18px rgba(27, 122, 99, .35); }
.bottomnav .fab .ico { width: 28px; height: 28px; }
.bottomnav .fab span { display: none; }

@media (min-width: 900px) {
  .bottomnav { inset: 0 auto 0 0; width: 220px; height: 100vh; grid-template-columns: 1fr; grid-auto-rows: min-content; align-content: start; padding: 96px 16px 0; border-top: 0; border-right: 1px solid var(--line); gap: 4px; }
  .bottomnav a { flex-direction: row; gap: 12px; font-size: .95rem; padding: 10px 14px; border-radius: 12px; }
  .bottomnav a[aria-current="page"] { background: var(--mint-tint); }
  .bottomnav .fab { order: -1; width: auto; height: auto; margin: 0 0 12px; border-radius: 999px; padding: 12px 16px; justify-self: stretch; display: flex; justify-content: center; }
  .bottomnav .fab span { display: inline; color: #fff; }
  .topbar, .wrap { margin-left: 220px; }
  .topbar { padding-left: 32px; padding-right: 32px; }
  .wrap { padding-bottom: 64px; }
}

/* ---------- Kort og kvitteringskant ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card-tight { padding: 8px; }
.receipt-edge { position: relative; border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 28px; }
.receipt-edge::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px;
  background:
    linear-gradient(135deg, var(--card) 50%, transparent 50%) 0 0 / 20px 10px repeat-x,
    linear-gradient(-135deg, var(--card) 50%, transparent 50%) 0 0 / 20px 10px repeat-x;
}
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 0 10px; }
.section-head h2 { margin: 0; }

.hello { padding: 8px 0 16px; }
.hello p { font-size: 1.05rem; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat b { display: block; font: 800 1.8rem/1.1 var(--font-head); }

/* ---------- Lister ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; color: inherit; text-decoration: none; }
.row:hover { background: color-mix(in srgb, var(--mint-tint) 50%, transparent); }
.list li + li .row { border-top: 1px solid var(--line); border-radius: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: .875rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amount { font-weight: 650; text-align: right; white-space: nowrap; }
.thumb { width: 48px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--mint-tint); display: grid; place-items: center; color: var(--mint); flex: none; }
.due { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; flex: none; font: 800 1.1rem/1 var(--font-head); text-align: center; }
.due small { display: block; font: 600 .62rem/1.2 var(--font-body); text-transform: uppercase; letter-spacing: .04em; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok-ink); }
.b-warn { background: var(--warn-bg); color: var(--warn-ink); }
.b-bad { background: var(--bad-bg); color: var(--bad-ink); }
.b-neutral { background: var(--line); color: var(--ink); }

.empty { text-align: center; padding: 36px 16px; }

/* ---------- Formularer ---------- */
label { display: block; font-weight: 600; font-size: .92rem; margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.error-text { font-size: .85rem; color: var(--bad-ink); margin-top: 4px; font-weight: 600; }
input[type=text], input[type=email], input[type=date], input[type=search], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; min-height: 48px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--mint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 18%, transparent); }
textarea { min-height: 96px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .grid2.stack-sm { grid-template-columns: 1fr; } }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; margin: 0 0 10px; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--mint); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; }
.chip span { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--card); font-weight: 600; font-size: .88rem; cursor: pointer; }
.chip input:checked + span { background: var(--mint-tint); border-color: var(--mint); color: var(--ok-ink); }
.chip input:focus-visible + span { outline: 3px solid var(--mint-bright); outline-offset: 2px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--line); border-radius: 999px; padding: 4px; }
.segmented label { margin: 0; position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; text-align: center; padding: 10px; border-radius: 999px; cursor: pointer; font-weight: 650; }
.segmented input:checked + span { background: var(--card); box-shadow: var(--shadow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px; border: 0; cursor: pointer;
  font: 700 1rem/1 var(--font-body); text-decoration: none; transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--mint); color: #fff; }
.btn-primary:hover { background: var(--mint-dark); }
.btn-soft { background: var(--mint-tint); color: var(--ok-ink); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-danger { background: var(--bad-bg); color: var(--bad-ink); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--mint); text-decoration: underline; cursor: pointer; }

.upload-zone { display: block; text-align: center; border: 2px dashed color-mix(in srgb, var(--mint) 45%, var(--line)); border-radius: var(--radius); padding: 28px 16px; background: color-mix(in srgb, var(--mint-tint) 35%, var(--card)); cursor: pointer; }
.upload-zone .ico { width: 44px; height: 44px; color: var(--mint); margin: 0 auto 8px; }
.upload-zone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.upload-zone strong { display: block; font: 800 1.1rem var(--font-head); }
.upload-list { font-size: .9rem; margin-top: 10px; color: var(--muted); }

.item-card { border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.item-card .item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

/* ---------- Detaljevisning ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.files a { display: block; border-radius: 14px; overflow: hidden; background: var(--mint-tint); color: var(--ok-ink); text-decoration: none; aspect-ratio: 3/4; position: relative; }
.files img { width: 100%; height: 100%; object-fit: cover; }
.files .fname { position: absolute; inset: auto 0 0 0; padding: 6px 8px; font-size: .72rem; background: color-mix(in srgb, var(--card) 88%, transparent); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.files .noimg { display: grid; place-items: center; height: 100%; }
.amount-big { font: 800 2rem/1.1 var(--font-head); }
.pre { white-space: pre-wrap; font: .85rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--paper); padding: 12px; border-radius: 12px; max-height: 320px; overflow: auto; }
details summary { cursor: pointer; font-weight: 650; }

/* ---------- Beskeder ---------- */
.flash { border-radius: 14px; padding: 12px 16px; margin: 0 0 16px; font-weight: 600; }
.flash-ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash-error { background: var(--bad-bg); color: var(--bad-ink); }
.flash-info { background: var(--mint-tint); color: var(--ok-ink); }
.ocr-banner { display: flex; align-items: center; gap: 12px; background: var(--mint-tint); color: var(--ok-ink); border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.spinner { width: 20px; height: 20px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } * { transition: none !important; } }
[hidden] { display: none !important; }

/* ---------- Offentlige sider (login) ---------- */
.public-hero { text-align: center; margin: 24px 0 24px; }
.public-hero .mascot { width: 104px; height: 104px; margin: 0 auto 16px; }
.public-hero p { color: var(--muted); }
.trust { display: flex; justify-content: center; gap: 6px; align-items: center; color: var(--muted); font-size: .85rem; margin-top: 18px; }
.trust .ico { width: 18px; height: 18px; }

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px 12px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.filters a { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .88rem; }
.filters a[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.searchbar { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar input { flex: 1; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }

.member { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.member + .member { border-top: 1px solid var(--line); }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font: 800 1rem var(--font-head); background: var(--coral-tint); color: var(--ink); flex: none; }
.member .grow { flex: 1; min-width: 0; }
.letter { white-space: pre-wrap; background: var(--paper); border-radius: 14px; padding: 16px; font-size: .95rem; border: 1px solid var(--line); }
.suggested { border-color: var(--mint-bright) !important; background: color-mix(in srgb, var(--mint-tint) 45%, var(--card)) !important; }
.center { text-align: center; }
.ico-inline { width: 14px; height: 14px; vertical-align: -1px; color: var(--muted); }
.row .title, .row .sub { display: block; }
.row .badge { margin-top: 4px; }
ol { padding-left: 20px; margin: 0 0 12px; }
ol li { margin-bottom: 6px; }
.mt { margin-top: 20px; }
.due.badge { display: grid; padding: 0; gap: 0; }
/* Logo */
.brand .logo { width: 40px; height: 40px; border-radius: 10px; }
.public-hero .brand { flex-direction: column; gap: 10px; font-size: 1.6rem; }
.public-hero .brand .logo-lg { width: 88px; height: 88px; border-radius: 22px; box-shadow: var(--shadow); }
.empty .empty-logo { width: 120px; height: 120px; margin: 0 auto 12px; border-radius: 28px; }
