[hidden] { display: none !important; }

:root {
  --bg: #fff6ea; --card: #ffffff; --ink: #2b2118; --muted: #8a7b6c; --line: #f1e6d6;
  --accent: #ff6b4a; --accent-ink: #fff; --ok: #22a06b;
  --meny: #e0102a; --kiwi: #2fa84f;
  --radius: 20px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --shadow: 0 2px 0 rgba(120, 80, 40, .06), 0 6px 18px rgba(120, 80, 40, .07);
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1c1712; --card: #2a231c; --ink: #fbf1e4; --muted: #b3a291; --line: #3a3027; --shadow: none; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 18px; line-height: 1.3; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.muted { color: var(--muted); } .center { text-align: center; } .pad { padding: 24px 16px; }
.small { font-size: 15px; }

#app { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- topp ---------- */
#top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: calc(var(--safe-t) + 10px) 12px 8px; }
#top .bar { display: flex; align-items: center; gap: 10px; }
#top h1 { font-size: 28px; margin: 0; flex: 1; font-weight: 800; letter-spacing: -.01em; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.off { background: #f0b429; }
.seg { display: flex; background: var(--card); border-radius: 999px; padding: 4px; gap: 4px; box-shadow: var(--shadow); flex: 1; }
.seg button { flex: 1; border: 0; background: transparent; padding: 11px 6px; border-radius: 999px; font-weight: 800; font-size: 17px; cursor: pointer; transition: background .2s, color .2s, transform .1s; }
.seg button:active { transform: scale(.96); }
.seg button.on { background: var(--ink); color: var(--bg); }
.seg button.meny.on { background: var(--meny); color: #fff; }
.seg button.kiwi.on { background: var(--kiwi); color: #fff; }
.count { font-weight: 800; font-size: 17px; min-width: 40px; text-align: center; background: var(--card); border-radius: 999px; padding: 8px 6px; box-shadow: var(--shadow); }
.progress { height: 8px; background: var(--line); border-radius: 99px; margin-top: 10px; overflow: hidden; }
.progress > div { height: 100%; border-radius: 99px; background: var(--ok); transition: width .4s cubic-bezier(.3, 1.4, .5, 1); }
.progress.meny > div { background: var(--meny); }
.progress.kiwi > div { background: var(--kiwi); }

/* ---------- liste ---------- */
#main { flex: 1; padding: 4px 12px calc(170px + var(--safe-b)); }
.card { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.item { --dep: #ffb86b; position: relative; display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 6px 4px 6px 18px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; -webkit-user-select: none; }
.item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--dep); }
.item:last-child { border-bottom: 0; }
.item.newcat { border-top: 4px solid var(--bg); }
.item:active { background: var(--line); }
.box { width: 32px; height: 32px; border-radius: 50%; border: 3px solid #d8c8b4; flex: none; display: grid; place-items: center; font-size: 18px; font-weight: 900; color: #fff; transition: all .15s; }
.item.done .box { background: var(--ok); border-color: var(--ok); }
.item.pop .box { animation: pop .35s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }
.item .name { flex: 1; min-width: 0; font-size: 19px; font-weight: 600; overflow-wrap: anywhere; }
.item.done { background: transparent; }
.item.done::before { background: var(--line); }
.item.done .name { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); font-weight: 500; }
.qty { display: inline-block; background: var(--dep, var(--accent)); color: var(--ink); font-weight: 800; font-size: 15px; padding: 2px 9px; border-radius: 999px; margin-right: 4px; vertical-align: 2px; }
.item.done .qty { background: var(--line); color: var(--muted); }
.item .note { color: var(--muted); font-size: 15px; font-weight: 500; }
.more { border: 0; background: transparent; font-size: 22px; width: 44px; height: 44px; color: var(--muted); border-radius: 50%; flex: none; }
.label { font-size: 15px; font-weight: 800; color: var(--muted); margin: 20px 8px 8px; }
.label.row2 { display: flex; justify-content: space-between; align-items: center; }
.link { border: 0; background: var(--card); color: var(--accent); font-weight: 800; font-size: 15px; padding: 10px 14px; border-radius: 999px; box-shadow: var(--shadow); }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); font-size: 19px; font-weight: 600; }
.empty big { font-size: 56px; display: block; margin-bottom: 8px; }
details.fold > summary { list-style: none; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }

/* ---------- legg til ---------- */
#addbar { position: fixed; left: 0; right: 0; bottom: calc(66px + var(--safe-b)); z-index: 6; padding: 10px 12px; background: linear-gradient(to top, var(--bg) 65%, transparent); }
.addrow { display: flex; gap: 8px; background: var(--card); border-radius: 999px; padding: 6px; box-shadow: 0 8px 24px rgba(120, 80, 40, .16); }
#addinput { flex: 1; border: 0; background: transparent; padding: 10px 14px; font-size: 19px; font-weight: 600; outline: none; min-width: 0; }
#addinput::placeholder { color: var(--muted); font-weight: 500; }
.iconbtn { border: 0; width: 50px; height: 50px; border-radius: 50%; background: var(--line); font-size: 22px; flex: none; cursor: pointer; transition: transform .1s; }
.iconbtn:active { transform: scale(.9); }
.iconbtn.primary { background: var(--accent); color: #fff; font-size: 30px; font-weight: 700; }
.iconbtn.live { background: var(--meny); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
#suggest { display: flex; gap: 8px; overflow-x: auto; padding: 0 2px 10px; scrollbar-width: none; }
#suggest:empty { display: none; }
.chip { border: 0; background: var(--card); box-shadow: var(--shadow); border-radius: 999px; padding: 10px 16px; white-space: nowrap; font-size: 17px; font-weight: 700; cursor: pointer; }

/* ---------- faner ---------- */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: flex; background: var(--card); padding-bottom: var(--safe-b); box-shadow: 0 -4px 16px rgba(120, 80, 40, .07); }
#tabs button { flex: 1; border: 0; background: transparent; padding: 8px 0 9px; font-size: 12px; font-weight: 700; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; }
#tabs button span { font-size: 24px; transition: transform .15s; }
#tabs button.on { color: var(--ink); }
#tabs button.on span { transform: scale(1.15) translateY(-1px); }

/* ---------- ark ---------- */
#sheet { position: fixed; inset: 0; z-index: 20; background: rgba(43, 33, 24, .45); display: flex; align-items: flex-end; }
#sheet .panel { background: var(--bg); width: 100%; max-height: 90dvh; overflow: auto; border-radius: 28px 28px 0 0; padding: 22px 16px calc(18px + var(--safe-b)); }
#sheet h3 { margin: 0 0 12px; font-size: 24px; font-weight: 800; }
label.f { display: block; font-size: 15px; color: var(--muted); margin: 12px 4px 6px; font-weight: 700; }
.in { width: 100%; padding: 14px 16px; border: 2px solid var(--line); border-radius: 16px; background: var(--card); font-size: 18px; font-weight: 600; outline: none; }
.in:focus { border-color: var(--accent); }
textarea.in { min-height: 100px; resize: vertical; }
.check { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); font-size: 18px; }
.check input { width: 26px; height: 26px; accent-color: var(--ok); }
.btn { border: 0; background: var(--card); padding: 15px 18px; border-radius: 999px; font-weight: 800; font-size: 17px; cursor: pointer; box-shadow: var(--shadow); transition: transform .1s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { color: var(--meny); }
.btn.block { width: 100%; margin-top: 12px; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(150px + var(--safe-b)); z-index: 30; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-size: 16px; font-weight: 700; max-width: 92vw; text-align: center; }

/* ---------- ukemeny, statistikk, mer ---------- */
.section { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.section h3 { margin: 0 0 10px; font-size: 19px; font-weight: 800; }
.bars .b { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; align-items: center; font-size: 15px; margin: 7px 0; font-weight: 600; }
.bars .b .bar { height: 12px; background: var(--accent); border-radius: 99px; min-width: 4px; }
.bars .b .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: var(--card); border-radius: 16px; padding: 12px 8px; text-align: center; box-shadow: var(--shadow); }
.kpi b { font-size: 24px; display: block; font-weight: 800; }
.kpi span { font-size: 13px; color: var(--muted); font-weight: 600; }
.weeks { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.weeks div { flex: 1; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.day { background: var(--card); border-radius: var(--radius); padding: 12px 16px; margin: 10px 0; box-shadow: var(--shadow); }
.day.today { outline: 3px solid var(--accent); }
.day .dl { font-size: 14px; color: var(--muted); font-weight: 800; text-transform: capitalize; display: flex; justify-content: space-between; }
.day input.title { border: 0; width: 100%; font-size: 20px; font-weight: 700; background: transparent; padding: 6px 0; outline: none; }
.day summary { padding: 8px 0; font-weight: 600; }
.order { list-style: none; padding: 0; margin: 0; }
.order li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.order li span { flex: 1; }
.order li button { border: 0; background: var(--line); border-radius: 50%; width: 44px; height: 44px; font-size: 18px; font-weight: 800; }
table.lines { width: 100%; border-collapse: collapse; font-size: 15px; }
table.lines td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.lines td.n { text-align: right; white-space: nowrap; font-weight: 700; }

/* ---- A, litt tettere ---- */
.item { min-height: 50px; padding: 3px 2px 3px 16px; gap: 12px; }
.item.newcat { border-top: 3px solid var(--bg); }
.box { width: 30px; height: 30px; }

/* ---- antall og vekt ---- */
.qty { cursor: pointer; }
.stepper { display: flex; gap: 8px; align-items: center; }
.stepper button { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--card); box-shadow: var(--shadow); font-size: 30px; font-weight: 800; flex: none; }
.stepper button:active { transform: scale(.92); }
.stepper .in { text-align: center; font-size: 22px; font-weight: 800; }
.qchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.qchips .chip { padding: 10px 14px; }
.item .note { display: inline-block; white-space: nowrap; }

/* ---- dempet bakgrunn, varme striper, roligere flater ---- */
:root { --bg: #f7f6f3; --line: #ebe8e3; --muted: #8a847b; --accent: #e07a5f;
  --shadow: 0 1px 2px rgba(60, 40, 20, .05); }
@media (prefers-color-scheme: dark) {
  :root { --bg: #161514; --card: #222120; --line: #33312e; --muted: #a39d94; --shadow: none; }
}
.card { box-shadow: none; border: 1px solid var(--line); }
.seg, .count, .link, .chip, .kpi, .section, .day { box-shadow: none; border: 1px solid var(--line); }
.box { border-width: 2.5px; border-color: #d4cfc7; }
.more { opacity: .45; }
.item .qty { color: #3b2a1a; }
.addrow { box-shadow: 0 4px 16px rgba(60, 40, 20, .10); border: 1px solid var(--line); }
#tabs { box-shadow: none; border-top: 1px solid var(--line); }
#tabs button span { opacity: .55; }
#tabs button.on span { opacity: 1; }
#addbar { background: linear-gradient(to top, var(--bg) 65%, transparent); }

/* ---- overskrift som scroller bort ---- */
#title:empty { display: none; }
#title { padding: calc(var(--safe-t) + 18px) 18px 4px; }
#title h1 { font-size: 30px; font-weight: 800; margin: 0; letter-spacing: -.02em; }
#title .sub { color: var(--muted); font-size: 15px; font-weight: 600; margin-top: 2px; }
#title:not(:empty) + #top { padding-top: 8px; }
.item .qty { color: #2b2118; }

/* ---- gaver ---- */
.occ { display: flex; gap: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.occ button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 9px 14px; font-weight: 800; font-size: 15px; white-space: nowrap; }
.occ button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.bud { display: block; width: 100%; height: 10px; padding: 0; border: 0; background: var(--line); border-radius: 9px; margin-top: 10px; overflow: hidden; position: relative; cursor: pointer; }
.bud > div { height: 100%; background: #93d9a3; border-radius: 9px; transition: width .4s; }
.bud.over > div { background: #ff9f8f; }
.bud span { position: absolute; inset: 0; display: none; }
.bud:has(span) { height: auto; background: none; text-align: left; color: var(--accent); font-weight: 800; font-size: 14px; padding: 4px 4px 0; }
.bud:has(span) span { position: static; display: inline; }
.person { margin: 18px 0 6px; display: flex; justify-content: space-between; align-items: baseline; padding: 0 6px; }
.person b { font-size: 19px; font-weight: 800; }
.person span { color: var(--muted); font-weight: 700; font-size: 15px; }
.item.gift .name { line-height: 1.25; }
.gsub { display: block; color: var(--muted); font-size: 14px; font-weight: 500; }
.item.gift.done .name { text-decoration: none; color: var(--ink); font-weight: 600; }
.item.gift.done::before { background: var(--dep); }
.st { font-size: 13px; font-weight: 800; padding: 3px 9px; border-radius: 99px; white-space: nowrap; flex: none; }
.st-ide { background: #eceae6; color: #6b655d; }
.st-kjopt { background: #dff3e4; color: #23774a; }
.st-pakket { background: #fde7cf; color: #9a5a12; }
.st-gitt { background: #e3ecfb; color: #2f5a9e; }
.price { color: var(--muted); font-weight: 700; font-size: 16px; white-space: nowrap; flex: none; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
#tabs button { font-size: 11px; }
.gt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-size: 14px; font-weight: 600; min-width: 52px; text-align: right; }
