:root {
  --berry: #7a1f3d;
  --berry-dark: #5a142c;
  --berry-soft: #f6e7ec;
  --gold: #c8932e;
  --gold-soft: #fbf1dc;
  --ink: #2a1d22;
  --muted: #7b6b71;
  --line: #eadfe2;
  --bg: #fbf8f5;
  --card: #ffffff;
  --green: #2f7a4f;
  --green-soft: #e4f3ea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 20, 35, .06), 0 6px 24px rgba(60, 20, 35, .06);
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--berry); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
.container { width: 100%; max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 2rem 0; }
.small { font-size: .875rem; }
[hidden] { display: none !important; }

/* Toppmeny */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .7rem 1.2rem; background: rgba(251, 248, 245, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--display); font-size: 1.3rem; font-weight: 700; text-decoration: none; color: var(--berry); white-space: nowrap; }
.brand-mark { font-size: 1.2rem; }
.mainnav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; }
.mainnav a { padding: .45rem .8rem; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: .95rem; white-space: nowrap; }
.mainnav a:hover { background: var(--berry-soft); }
.mainnav a.active { background: var(--berry); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: .5rem; }
.icon-btn { position: relative; border: 0; background: transparent; font-size: 1.25rem; cursor: pointer; padding: .3rem .4rem; border-radius: 10px; }
.icon-btn:hover { background: var(--berry-soft); }
.dot { position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; background: #d33; border-radius: 50%; border: 2px solid var(--bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--berry); color: #fff; display: grid; place-items: center; font-weight: 700; text-decoration: none; font-size: .95rem; }
.pill { display: inline-block; min-width: 1.3em; padding: 0 .4em; border-radius: 999px; background: var(--gold); color: #fff; font-size: .75rem; text-align: center; margin-left: .2rem; }
.notif-panel { position: absolute; right: 1rem; top: calc(100% + .4rem); width: min(380px, calc(100vw - 2rem)); max-height: 70vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .5rem; }
.notif { display: block; padding: .7rem .8rem; border-radius: 10px; text-decoration: none; color: var(--ink); }
.notif:hover { background: var(--berry-soft); }
.notif.unread { background: var(--gold-soft); }
.notif time { display: block; font-size: .78rem; color: var(--muted); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .mainnav { order: 3; flex-basis: 100%; }
  .topbar-right { margin-left: auto; }
}

/* Kort og skjema */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; }
.stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 520px) { .stat b { font-size: 1.5rem; } .stat { font-size: .85rem; padding: .9rem .5rem; } }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.field { margin-bottom: .9rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input, select, textarea { width: 100%; font: inherit; padding: .65rem .8rem; border: 1px solid #d9cbd0; border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--berry); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }
.check { display: flex; gap: .55rem; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: .3rem; }
.segmented { display: flex; gap: .4rem; flex-wrap: wrap; }
.segmented label { margin: 0; font-weight: 500; border: 1px solid #d9cbd0; border-radius: 999px; padding: .4rem .85rem; cursor: pointer; background: #fff; }
.segmented input { position: absolute; opacity: 0; width: 1px; }
.segmented input:checked + span { color: #fff; }
.segmented label:has(input:checked) { background: var(--berry); border-color: var(--berry); color: #fff; }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--berry); outline-offset: 2px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 600; padding: .62rem 1.1rem; border-radius: 10px; border: 1px solid transparent; cursor: pointer; text-decoration: none; background: var(--berry); color: #fff; white-space: nowrap; }
.btn:hover { background: var(--berry-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--berry); border-color: #d9cbd0; }
.btn.secondary:hover { background: var(--berry-soft); }
.btn.ghost { background: transparent; color: var(--muted); padding: .45rem .6rem; }
.btn.ghost:hover { background: var(--berry-soft); color: var(--berry); }
.btn.gold { background: var(--gold); }
.btn.gold:hover { background: #a9781f; }
.btn.green { background: var(--green); }
.btn.small { padding: .4rem .7rem; font-size: .88rem; }
.btn.block { width: 100%; }
.error { background: #fde8e8; color: #8a1c1c; padding: .6rem .8rem; border-radius: 10px; font-size: .92rem; }

/* Innlogging */
.auth-wrap { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: center; min-height: 70vh; }
.auth-hero h1 { font-size: clamp(2rem, 5vw, 3rem); color: var(--berry); }
.auth-hero ul { padding-left: 1.2rem; color: var(--muted); }
.auth-hero li { margin: .35rem 0; }
.auth-card { max-width: 440px; width: 100%; justify-self: center; }
.invite-banner { background: var(--gold-soft); border: 1px solid #ecd8ae; border-radius: var(--radius); padding: .9rem 1rem; margin-bottom: 1rem; }
@media (max-width: 760px) { .auth-wrap { grid-template-columns: 1fr; } }

/* Oversikt */
.hello { margin-bottom: 1.25rem; }
.stat { text-align: center; }
.stat b { display: block; font-family: var(--display); font-size: 2rem; color: var(--berry); }
.bday-list { list-style: none; padding: 0; margin: 0; }
.bday { display: flex; align-items: center; gap: .9rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.bday:last-child { border-bottom: 0; }
.bday-date { width: 54px; text-align: center; background: var(--berry-soft); border-radius: 10px; padding: .3rem 0; line-height: 1.1; flex-shrink: 0; }
.bday-date b { display: block; font-size: 1.3rem; color: var(--berry); }
.bday-date span { font-size: .72rem; text-transform: uppercase; color: var(--muted); }
.bday.soon .bday-date { background: var(--gold); }
.bday.soon .bday-date b, .bday.soon .bday-date span { color: #fff; }
.bday-main { flex: 1; min-width: 0; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .12rem .5rem; border-radius: 999px; background: var(--berry-soft); color: var(--berry); }
.badge.gold { background: var(--gold-soft); color: #8a6114; }
.badge.green { background: var(--green-soft); color: var(--green); }
.alert-soon { background: linear-gradient(120deg, var(--berry), #a0324f); color: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1rem; display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.alert-soon .btn { background: #fff; color: var(--berry); }

/* Ønsker */
.wish { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 1.1rem; }
.wish + .wish { border-top: 1px solid var(--line); }
.wish-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--gold-soft); display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.wish-main { flex: 1; min-width: 0; }
.wish-title { font-weight: 600; font-size: 1.02rem; }
.wish-meta { color: var(--muted); font-size: .88rem; margin-top: .15rem; word-break: break-word; }
.wish-actions { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.wish.received { opacity: .6; }
.wish.claimed-other .wish-title { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.35); }
.wish-list { padding: 0; overflow: hidden; }
.prio-1 .wish-icon { background: var(--berry); color: #fff; }
/* Annonser */
.ad-wrap { position: relative; background: #faf7f2; border: 1px solid #ece2d0; border-radius: var(--radius); padding: 1.4rem .8rem .8rem; min-height: 120px; overflow: hidden; }
.ad-wrap .ad-label { position: absolute; top: .35rem; left: .7rem; font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ad-wrap.placeholder { display: grid; place-items: center; text-align: center; color: #b3a48f; font-size: .85rem; border-style: dashed; }
.wish.ad-row { display: block; background: #fdfbf8; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 720px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ads { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .8rem; margin-top: .6rem; padding: .55rem .7rem; background: #faf7f2; border: 1px dashed #e2d3b5; border-radius: 10px; font-size: .85rem; }
.ads .ad-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ads a { white-space: nowrap; }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.empty .big { font-size: 2.4rem; }

/* Deling */
.share-box { background: var(--berry-soft); border: 1px solid #ecd3dc; }
.share-link { display: flex; gap: .4rem; }
.share-link input { font-size: .85rem; background: #fff; }

/* Toast */
.toast { visibility: hidden; opacity: 0; position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(150%); background: var(--ink); color: #fff; padding: .7rem 1.1rem; border-radius: 12px; transition: transform .25s ease, opacity .25s, visibility .25s; z-index: 50; max-width: calc(100vw - 2rem); }
.toast.show { visibility: visible; opacity: 1; transform: translateX(-50%) translateY(0); }

.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.2rem 1rem 2rem; }
dialog { border: 0; border-radius: var(--radius); padding: 1.4rem; width: min(520px, calc(100vw - 2rem)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(42, 29, 34, .45); }

@media (max-width: 600px) {
  .wish { flex-wrap: wrap; gap: .4rem .9rem; }
  .wish-actions { flex-basis: 100%; justify-content: flex-start; padding-left: calc(44px + .9rem); }
}

/* Juleliste */
.xmas-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.xmas-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; padding: .9rem 1.1rem; border-radius: var(--radius);
  background: linear-gradient(120deg, #1f5a3d, #2f7a4f); color: #fff; text-decoration: none; }
.xmas-banner .btn { background: #fff; color: #1f5a3d; }
.progress { height: 6px; background: var(--line); border-radius: 99px; margin: .5rem auto 0; max-width: 140px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font: inherit; font-size: .9rem; border: 1px solid #d9cbd0; background: #fff; border-radius: 999px; padding: .35rem .8rem; cursor: pointer; }
.chip:hover { background: var(--green-soft); border-color: var(--green); }
.budget { display: flex; align-items: center; gap: .35rem; margin: 0; font-size: .8rem; font-weight: 500; color: var(--muted); }
.budget input { width: 92px; padding: .35rem .5rem; font-size: .9rem; }
/* Utvidbar personliste i julelisten */
.jul-toolbar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); }
.jul-person + .jul-person { border-top: 1px solid var(--line); }
.jul-head { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .8rem; width: 100%; padding: .85rem 1.1rem; cursor: pointer; }
.jul-head:hover { background: #fcf8f9; }
.jul-head:focus-visible { outline: 2px solid var(--berry); outline-offset: -2px; }
.chev { font-size: 1.4rem; line-height: 1; color: var(--muted); transition: transform .15s; width: 1rem; text-align: center; }
.jul-person.open .chev { transform: rotate(90deg); color: var(--berry); }
.jul-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.jul-name b { font-size: 1.05rem; }
.jul-sum { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; justify-content: flex-end; text-align: right; }
.jul-sum .over { color: #a9781f; font-weight: 600; }
.jul-body { display: none; background: #fdfbfa; border-top: 1px dashed var(--line); padding-top: .6rem; }
.jul-person.open .jul-body { display: block; }
.jul-person.open { background: #fff; }
.jul-foot { padding: .6rem 1.1rem 1rem; }
.bday-date.mini.soon { background: var(--gold); } .bday-date.mini.soon b, .bday-date.mini.soon span { color: #fff; }
.bday-date.mini b, .bday-date.mini span { display: block; }
.bday-date.mini { display: block; width: 42px; padding: .2rem 0; border-radius: 8px; flex-shrink: 0; }
.bday-date.mini b { font-size: 1.05rem; }
.bday-date.mini span { font-size: .62rem; }
.bday-date.mini.nodate { display: grid; place-items: center; height: 38px; color: var(--muted); }
@media (max-width: 600px) {
  .jul-head { flex-wrap: wrap; }
  .jul-sum { flex-basis: 100%; justify-content: flex-start; padding-left: 1.8rem; text-align: left; gap: .5rem; }
}
.friend-hint { margin: 0 1.1rem .5rem; padding: .5rem .7rem; background: var(--berry-soft); border-radius: 10px; font-size: .88rem; }
@media print {
  .topbar, .footer, .no-print, .wish-actions, .ad-wrap, .toast { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; } #jul-grid { grid-template-columns: 1fr !important; }
  .jul-body { display: block !important; background: #fff; } .jul-person { break-inside: avoid; } .chev { display: none; }
}

.link-status { margin-top: .35rem; min-height: 1.2em; }
.link-status.ok { color: var(--green); }
.link-status.warn { color: #8a6114; }

/* Lister i gaveplanleggeren */
.list-cards { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.list-card { display: block; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
.list-card:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(60,20,35,.08), 0 10px 28px rgba(60,20,35,.10); }
.list-card .list-name { font-size: 1.05rem; }
.list-card.grace { border-color: #ecd8ae; background: #fffdf7; }
details.history summary { cursor: pointer; list-style: none; }
details.history summary::-webkit-details-marker { display: none; }
details.history summary::before { content: '›'; display: inline-block; margin-right: .5rem; color: var(--muted); transition: transform .15s; }
details.history[open] summary::before { transform: rotate(90deg); }
.hist-row { display: flex; align-items: center; gap: .4rem 1rem; flex-wrap: wrap; padding: .7rem 0; border-top: 1px solid var(--line); margin-top: .6rem; }
.hist-row a { text-decoration: none; color: var(--ink); }
.hist-row .btn { margin-left: auto; }
.sub-head { padding: .7rem 1.1rem .1rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

/* Bryllup */
.givers { margin-top: .5rem; padding: .5rem .7rem; background: var(--green-soft); border-radius: 10px; font-size: .88rem; }
.guest-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.wedding-hero { text-align: center; padding: 2.2rem 1rem 1.6rem; border-radius: var(--radius);
  background: radial-gradient(circle at 50% 0%, #fff 0%, #fbf3ea 60%, #f6e7ec 100%); border: 1px solid #efe2d6; }
.wedding-hero .rings { font-size: 2.2rem; }
.wedding-hero h1 { font-size: clamp(2rem, 5vw, 2.8rem); color: var(--berry); margin: .3rem 0; }
.wedding-hero .wdate { color: #8a6114; font-weight: 600; letter-spacing: .03em; margin: 0; }
.wedding-hero .wmsg { max-width: 560px; margin: 1rem auto 0; white-space: pre-line; color: var(--ink); }
.spleis { max-width: 360px; }

/* Tilbakemelding og kontakt */
.fb-btn { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: .9rem;
  background: var(--ink); color: #fff; padding: .6rem .95rem; border-radius: 999px; box-shadow: 0 4px 16px rgba(0,0,0,.18); }
.fb-btn:hover { background: var(--berry); }
@media (max-width: 600px) { .fb-btn span { display: none; } .fb-btn { padding: .65rem .8rem; font-size: 1.1rem; } }
@media print { .fb-btn { display: none; } }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fb-msg { white-space: pre-wrap; margin: .35rem 0; }
.footer a { color: var(--muted); }
.prose h2 { font-size: 1.15rem; margin-top: 1.4rem; }
.prose li { margin: .3rem 0; }
mark.todo { background: #fff1a8; padding: 0 .2rem; border-radius: 3px; }
.todo-box { background: #fff8d6; border: 1px solid #f0dc8a; padding: .6rem .8rem; border-radius: 10px; font-size: .9rem; }

.ev-card { border-left: 4px solid var(--gold); }

/* Testversjon */
body.is-beta .brand::after { content: 'Beta'; margin-left: .45rem; vertical-align: middle; font-family: var(--sans); font-size: .62rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: #8a6114; background: var(--gold-soft); border: 1px solid #ecd8ae; padding: .12rem .4rem; border-radius: 999px; }
.beta-bar { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; max-width: calc(980px - 2rem); margin: 1rem auto 0;
  padding: .6rem .6rem .6rem 1rem; background: var(--gold-soft); border: 1px solid #ecd8ae; border-radius: var(--radius); font-size: .9rem; width: calc(100% - 2rem); }
.beta-bar > span:first-child { flex: 1 1 420px; }
.beta-bar .btn { background: #8a6114; } .beta-bar .btn:hover { background: #6e4d10; }
@media print { .beta-bar { display: none; } body.is-beta .brand::after { display: none; } }
