:root {
  --ground: #F6F4EF;
  --surface: #FFFFFF;
  --ink: #1F2420;
  --muted: #5B635D;
  --line: #DAD6CC;
  --green: #1D5E48;
  --green-ink: #FFFFFF;
  --green-soft: #E3EFE9;
  --amber: #FBEBD9;
  --amber-ink: #6E3A0A;
  --bad: #A3271B;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #151917; --surface: #1E2421; --ink: #ECEFEC; --muted: #A9B2AC; --line: #34403A;
    --green: #5FB894; --green-ink: #0D1F18; --green-soft: #1F3A30; --amber: #3A2A18; --amber-ink: #F4CFA6; --bad: #F08A7E;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 18px; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5; }
a { color: var(--green); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 8px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.4rem; text-decoration: none; color: var(--green); }
.saldo { display: flex; align-items: baseline; gap: 8px; background: var(--green-soft); padding: 8px 14px; border-radius: 999px; }
.saldo strong { font-size: 1.15rem; }
.saldo span { white-space: nowrap; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; padding-bottom: 8px; align-items: center; }
.nav a, .linkbtn { min-height: 44px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { background: var(--green-soft); font-weight: 600; }
.linkbtn { background: none; border: 0; font: inherit; cursor: pointer; color: var(--green); text-decoration: underline; }
.inline { display: inline; }
.badge { background: var(--green); color: var(--green-ink); border-radius: 999px; padding: 0 8px; margin-left: 6px; font-size: .8rem; }
h1 { font-size: 1.8rem; margin: 0 0 16px; }
h2 { font-size: 1.2rem; margin: 0 0 8px; }
h3 { font-size: 1.05rem; margin: 0 0 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.btn.big { min-height: 52px; padding: 0 24px; }
.btn.small { min-height: 44px; padding: 0 12px; font-size: .9rem; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.center { text-align: center; }
.hero p { font-size: 1.1rem; }
#bankid-start { display: flex; flex-direction: column; gap: 12px; max-width: 360px; margin: 0 auto; }
#qr { width: 220px; height: 220px; margin: 8px auto; }
#qr svg { width: 100%; height: 100%; }
.radio { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.radio input { width: 22px; height: 22px; }
fieldset { border: 1px solid var(--line); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { min-height: 44px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); }
.chip[aria-current="true"] { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.product { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.product img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; }
.product .ph { width: 100%; height: 88px; }
.product .ph { display: flex; align-items: center; justify-content: center; background: var(--green-soft); color: var(--green); font-size: 2.4rem; font-weight: 700; }
.pbody { padding: 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pbody p { margin: 0; }
.price { font-weight: 700; font-size: 1.15rem; margin-top: auto !important; padding-top: 6px; }
.addform, .qtyform { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.addform { margin-top: 8px; }
input[type="number"] { width: 72px; }
input, select, textarea { min-height: 44px; font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
textarea { width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; }
.w6 { width: 6em; }
.form { display: flex; flex-direction: column; gap: 12px; max-width: 520px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field span { font-weight: 600; }
.check { display: inline-flex; gap: 6px; align-items: center; min-height: 44px; }
.check input { width: 22px; height: 22px; min-height: 0; }
.lines { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lines th, .lines td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lines th { font-size: .85rem; color: var(--muted); }
.num { text-align: right !important; white-space: nowrap; }
.sum { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; max-width: 420px; margin: 16px 0 16px auto; }
.sum dt { color: var(--muted); }
.sum dd { margin: 0; text-align: right; font-weight: 700; }
.bad { color: var(--bad); }
.flash { padding: 12px 16px; border-radius: 10px; background: var(--green-soft); }
.flash.warn { background: var(--amber); color: var(--amber-ink); }
.foot { padding: 32px 16px; font-size: .85rem; }
.thumbcell { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.thumb { width: 56px; height: 56px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; display: inline-block; }
.thumb.ph { background: var(--green-soft); }
.filebtn { position: relative; cursor: pointer; }
.filebtn:focus-within { outline: 3px solid var(--green); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 640px) {
  .saldo { flex-wrap: wrap; font-size: .9rem; row-gap: 0; border-radius: 14px; }
  .lines thead { display: none; }
  .lines tr { display: grid; grid-template-columns: 1fr auto; border-bottom: 1px solid var(--line); }
  .lines td { border: 0; }
  .sum { margin-left: 0; max-width: none; }
}

/* Medlemskap */
.steps { list-style: none; display: flex; gap: 8px; flex-wrap: wrap; padding: 0; margin: 0 0 20px; }
.steps li { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.steps li span { display: inline-flex; width: 26px; height: 26px; border-radius: 999px; align-items: center; justify-content: center; background: var(--line); color: var(--ink); font-size: .85rem; }
.steps li.now { border-color: var(--green); color: var(--ink); }
.steps li.now span, .steps li.done span { background: var(--green); color: var(--green-ink); }
.doctext p { margin: 0 0 12px; }
.doctext { max-width: 720px; }
details.card summary { cursor: pointer; min-height: 44px; padding: 8px 0; line-height: 1.5; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; margin-right: 8px; }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.wait { background: var(--amber); color: var(--amber-ink); }

/* Familj */
.people { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-direction: column; gap: 8px; }
.person { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--ground); }
.person.waiting { background: var(--amber); color: var(--amber-ink); }
.person.rejected { background: var(--ground); color: var(--muted); }
.avatar { width: 44px; height: 44px; flex: none; border-radius: 999px; background: var(--green); color: var(--green-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.addfamily > summary { list-style: none; display: inline-flex; }
.addfamily > summary::-webkit-details-marker { display: none; }
.addfamily[open] > summary { margin-bottom: 12px; }
.famreq { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.famreq > div { flex: 1 1 260px; }
.person.rejected .avatar { background: var(--line); color: var(--muted); }
.person.waiting .avatar { background: var(--amber-ink); color: var(--amber); }
