/* Økad – nøkternt, bankpreget design */
:root {
  --bg: #f4f4f7; --surface: #ffffff; --surface-2: #f6f5f9; --line: #e2e1ea; --line-strong: #cfcdda;
  --text: #1c1a29; --muted: #6a6880; --faint: #9a98ab;
  --primary: #3b2470; --primary-hover: #4d3290; --accent: #3b2470; --accent-2: #5b3fa0; --accent-soft: #efebf7; --accent-line: #d9cfee;
  --side-bg: #24173f; --side-text: rgba(255,255,255,.72); --side-hover: rgba(255,255,255,.07); --side-active: rgba(255,255,255,.12);
  --good: #1d7a4c; --good-soft: #eaf4ee; --bad: #b42318; --bad-soft: #fbeceb; --warn: #8a5a00; --warn-soft: #fbf3e2;
  --radius: 8px; --radius-sm: 6px; --shadow: 0 1px 2px rgba(28,26,41,.04);
  --shadow-lg: 0 16px 48px rgba(28,26,41,.18); --side: 252px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121019; --surface: #1a1724; --surface-2: #211d2d; --line: #2e2a3d; --line-strong: #3b364d;
    --text: #ecebf3; --muted: #a09db3; --faint: #77748a;
    --primary: #5b3fa0; --primary-hover: #6c4fb5; --accent: #b9a3ec; --accent-2: #b9a3ec; --accent-soft: #2a2340; --accent-line: #43386a;
    --side-bg: #0f0d17; --good: #5cc28d; --good-soft: #17291f; --bad: #f08a80; --bad-soft: #321b1a; --warn: #e3b55c; --warn-soft: #30271a;
    --shadow: none; --shadow-lg: 0 16px 48px rgba(0,0,0,.5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121019; --surface: #1a1724; --surface-2: #211d2d; --line: #2e2a3d; --line-strong: #3b364d;
  --text: #ecebf3; --muted: #a09db3; --faint: #77748a;
  --primary: #5b3fa0; --primary-hover: #6c4fb5; --accent: #b9a3ec; --accent-2: #b9a3ec; --accent-soft: #2a2340; --accent-line: #43386a;
  --side-bg: #0f0d17; --good: #5cc28d; --good-soft: #17291f; --bad: #f08a80; --bad-soft: #321b1a; --warn: #e3b55c; --warn-soft: #30271a;
  --shadow: none; --shadow-lg: 0 16px 48px rgba(0,0,0,.5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 8px; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 0 5px; border-radius: 4px; font-size: .88em; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.r { text-align: right; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 19px; letter-spacing: -.01em; color: var(--text); }
.logo .logo-mark { color: var(--accent); flex-shrink: 0; }
.logo.big { font-size: 30px; gap: 12px; }
.logo.sm { font-size: 17px; gap: 8px; }
.sidebar .logo { color: #fff; }
.sidebar .logo .logo-mark { color: #5b3fa0; }

/* Oppstart */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; }
.spinner { width: 24px; height: 24px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Innlogging */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); border-top: 4px solid var(--accent); }
.login-card { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 36px 32px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 21px; margin: 22px 0 8px; }
.login-card .btn.xl { width: 100%; margin: 22px 0 8px; }
.login-features { list-style: none; padding: 18px 0 0; margin: 22px 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.login-features li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.login-features .i { color: var(--accent-2); }
.dev { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.dev summary { cursor: pointer; font-weight: 500; font-size: 14px; }
.dev .form { margin-top: 10px; }

/* Knapper */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 500; font-size: 14px; cursor: pointer; transition: background .12s, border-color .12s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--bad); border-color: transparent; }
.btn.danger.ghost:hover { background: var(--bad-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.xl { padding: 12px 18px; font-size: 15px; }
.btn.ms { background: #2f2f2f; border-color: #2f2f2f; color: #fff; }
.btn.ms:hover { background: #1f1f1f; }
.icon-btn { border: 0; background: transparent; width: 34px; height: 34px; border-radius: var(--radius-sm); cursor: pointer; display: inline-grid; place-items: center; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; }

/* Skall */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--side); flex-shrink: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px; background: var(--side-bg); color: var(--side-text); overflow-y: auto; }
.sidebar > .logo { padding: 4px 10px 18px; }
.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--side-text); position: relative; }
.nav a .i { width: 18px; opacity: .85; }
.nav a:hover { background: var(--side-hover); color: #fff; }
.nav a.on { background: var(--side-active); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #a68bea; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.42); padding: 16px 12px 6px; font-weight: 600; }
.nav-sep { height: 12px; }
.side-foot { border-top: 1px solid rgba(255,255,255,.1); padding-top: 12px; margin-top: 12px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--radius-sm); color: #fff; }
.me:hover { background: var(--side-hover); }
.me div { display: flex; flex-direction: column; min-width: 0; }
.me b { font-weight: 500; font-size: 14px; }
.me small { color: rgba(255,255,255,.5); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .avatar { border-color: var(--side-bg); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 32px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .menu, .mobile-only { display: none; }
main { padding: 24px 32px 64px; max-width: 1240px; width: 100%; }
.chrome { display: flex; align-items: center; gap: 10px; }
.fam-pill { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 10px; border: 1px solid var(--line); border-radius: 999px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.on { background: #2e9e63; }
.dot.wait { background: #c98a12; }
.dot.off { background: var(--bad); }
.sync { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); }
.sync.error { color: #fff; background: var(--bad); border-color: var(--bad); }
.sync.pending { color: var(--warn); }
.sync .i { display: block; }
.sync.saving .i, .sync.loading .i { animation: spin 1.2s linear infinite; }
.avatars { display: flex; }
.avatars .avatar + .avatar { margin-left: -6px; }
.avatar { display: inline-grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: color-mix(in srgb, var(--c) 75%, var(--text));
  border: 2px solid var(--surface); position: relative; flex-shrink: 0; line-height: 1; font-weight: 600; letter-spacing: -.02em; }
.avatar.on::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 30%; height: 30%; min-width: 7px; min-height: 7px; background: #2e9e63; border: 2px solid var(--surface); border-radius: 50%; }
.scrim { display: none; }
.bottomnav { display: none; }

/* Sidetopp */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin: 0 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ph-title { display: flex; align-items: center; gap: 14px; }
.ph-ic { display: none; }

/* Nøkkeltall */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi span { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.kpi span .i { display: none; }
.kpi b { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.kpi em { font-style: normal; color: var(--muted); font-size: 12px; }
.kpi.hero { background: var(--primary); border-color: var(--primary); color: #fff; }
.kpi.hero span, .kpi.hero em { color: rgba(255,255,255,.72); }
.kpi.hero b { color: #fff !important; }
a.kpi:hover { border-color: var(--line-strong); }

/* Paneler og kort */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.panel > h2 { margin-bottom: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2 .i { color: var(--accent-2); }
.link-panel { display: block; transition: border-color .12s; }
.link-panel:hover { border-color: var(--line-strong); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .panel, .grid-3 > .panel { margin-bottom: 0; }
.grid-2, .grid-3 { margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; transition: border-color .12s; }
.click { cursor: pointer; }
.card.click:hover { border-color: var(--line-strong); }
.card-top { display: flex; align-items: flex-start; gap: 12px; }
.card-top h3 { overflow-wrap: anywhere; }
.card-top p { margin: 0; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.ic { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; flex-shrink: 0; color: var(--accent-2); }
.ic.sm { width: 28px; height: 28px; }
.big { font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.settled { opacity: .55; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 4px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.facts div { padding: 8px 10px; border-right: 1px solid var(--line); }
.facts div:last-child { border-right: 0; }
.facts dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.facts.big3 { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); border: 0; gap: 8px; }
.facts.big3 div { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.facts.col { grid-template-columns: 1fr; border: 0; gap: 8px; }
.facts.col div { border: 1px solid var(--line); border-radius: var(--radius-sm); }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 4px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.chip.shared { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-line); }
.chip.fam { color: var(--text); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.good { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-line); }

.bar { height: 6px; background: var(--surface-2); border: 0; border-radius: 3px; overflow: hidden; margin: 6px 0; box-shadow: inset 0 0 0 1px var(--line); }
.bar i { display: block; height: 100%; border-radius: 3px; transition: width .4s; }

.tip { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent-2); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.tip > .i { color: var(--accent-2); }
.tip.good { border-left-color: var(--accent-2); }
.tip.bad { border-left-color: var(--bad); background: var(--bad-soft); }
.tip.bad > .i { color: var(--bad); }
.tip > div { flex: 1; min-width: 200px; }
a.tip:hover { border-color: var(--line-strong); border-left-color: var(--accent-2); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-ic { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--accent-2); }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }

/* Grafer */
.donut { position: relative; flex-shrink: 0; }
.donut svg { width: 100%; height: 100%; }
.donut-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.donut-c b { font-size: 15px; font-weight: 600; }
.donut-c span { font-size: 12px; color: var(--muted); }
.donut-row { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.legend { list-style: none; padding: 0; margin: 0; flex: 1; min-width: 180px; display: flex; flex-direction: column; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.legend li:last-child { border-bottom: 0; }
.legend i { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.legend span { flex: 1; }
.legend b { font-weight: 500; }
.legend em { color: var(--muted); font-style: normal; width: 42px; text-align: right; }
.sparkbars { display: flex; align-items: flex-end; gap: 10px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.sparkbars div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.sparkbars i { width: 100%; max-width: 40px; border-radius: 2px 2px 0 0; min-height: 2px; }
.sparkbars span { position: absolute; bottom: -20px; font-size: 11px; color: var(--muted); text-transform: capitalize; }

/* Segmenter og brytere */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; flex-wrap: wrap; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font-weight: 500; font-size: 13px; color: var(--muted); border-right: 1px solid var(--line); display: inline-flex; align-items: center; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); }
.seg button.on { background: var(--accent-soft); color: var(--accent-2); }
.seg.sm button { padding: 4px 9px; font-size: 12px; }
.scopebar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--muted); user-select: none; }
.switch input { display: none; }
.switch i { width: 34px; height: 20px; background: var(--line-strong); border-radius: 99px; position: relative; transition: .2s; flex-shrink: 0; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: var(--accent-2); }
.switch input:checked + i::after { left: 17px; }

/* Tabell */
.table-wrap { overflow-x: auto; margin: -18px -20px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table th.r { text-align: right; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td.r { white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click:hover td { background: var(--surface-2); }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.mini { width: 54px; padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); text-align: right; }

.sortbar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; justify-content: flex-end; }
.sortbar select { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.table .group-row td { background: var(--surface-2); }
.conn-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.badge-n { margin-left: auto; background: #a68bea; color: #1c1530; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; }

.panel.attention { border-left: 3px solid var(--accent-2); }
.panel.attention h2 .i { color: var(--accent-2); }
.import-sum { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; }
.import-sum div { flex: 1 1 110px; padding: 8px 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.import-sum div:last-child { border-right: 0; }
.import-sum b { font-size: 17px; font-weight: 600; }
.import-sum span { font-size: 12px; color: var(--muted); }

/* Budsjett-tabell */
.cat-table .group-row td { background: var(--surface-2); border-bottom: 1px solid var(--line); padding-top: 10px; padding-bottom: 10px; }
.cat-table .group-row .i { color: var(--muted); }
.cat-table .group-row b { font-weight: 600; }
.cat-table .cat-row td { vertical-align: middle; }
.cat-table .cat-row td:first-child { padding-left: 34px; }
.cat-table .bar-cell { width: 28%; min-width: 120px; }
.cat-table .bar-cell .bar { margin: 0; }
.cat-table .add-row td { padding: 4px 12px 8px 30px; }
.cat-table tfoot td { border-top: 2px solid var(--line-strong); padding-top: 12px; padding-bottom: 12px; vertical-align: middle; }
.cat-table tfoot .bar { margin: 0; }
.over { color: var(--warn); font-weight: 600; }

/* Lister */
.month-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.month-nav h2 { font-size: 17px; min-width: 160px; text-align: center; }
.quick { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.quick input, .quick select { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; }
.quick input { flex: 1 1 140px; }
.quick input[name=amount] { flex: 0 1 120px; }
.quick select { flex: 0 1 auto; }
.panel .quick { padding: 0; border: 0; margin: 16px 0 0; }
.cat-list, .tx-list, .simple, .members, .share-list, .shop, .feed { list-style: none; padding: 0; margin: 0; }
.cat-list li { display: flex; gap: 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.cat-list li:last-child { border-bottom: 0; }
.cat-list li.click:hover, .tx-list li.click:hover { background: var(--surface-2); }
.cat-list .bar { margin: 6px 0 0; height: 5px; }
.tx-list li { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.tx-list li:last-child { border-bottom: 0; }
.tx-list b { font-weight: 500; }
.tx-list .grow b { font-weight: 500; }
.simple li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.simple li:last-child { border-bottom: 0; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters select { padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.bar-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search { flex: 1; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); min-width: 180px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* Vennelån */
.quick-buttons { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.qb { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 14px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; transition: border-color .12s; }
.qb:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.qb span { font-size: 12px; color: var(--muted); }
.qb b { font-weight: 600; font-size: 14px; }
.qb-ic { width: 30px; height: 30px; border-radius: var(--radius-sm); display: grid; place-items: center; margin-bottom: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--accent-2); }
.balances { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 16px; }
.balance { display: flex; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent-2); border-radius: var(--radius); padding: 14px 16px; }
.col-actions { display: flex; flex-direction: column; gap: 6px; }

/* Ønskeliste */
.stars { display: inline-flex; gap: 1px; color: var(--line-strong); }
.stars .on { color: var(--accent-2); }
.stars .on .i { fill: currentColor; }
.link { color: var(--accent-2); font-weight: 500; }
.link:hover { text-decoration: underline; }

/* Matplan */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--accent-2); border-bottom-color: var(--accent-2); }
.count { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; font-size: 11px; padding: 0 6px; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 150px; }
.day.today { border-color: var(--accent-2); box-shadow: inset 0 3px 0 var(--accent-2); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; flex-wrap: wrap; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.day-head b { font-weight: 600; font-size: 14px; }
.slot { display: flex; flex-direction: column; gap: 4px; }
.slot-l { font-size: 11px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; display: inline-flex; align-items: center; gap: 4px; }
.meal { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius-sm); padding: 7px 9px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; font-size: 13px; overflow-wrap: anywhere; }
.meal b { font-weight: 500; }
.meal:hover { border-color: var(--accent-line); }
.meal .chip { align-self: flex-start; font-size: 10px; }
.meal.add { background: transparent; border-style: dashed; color: var(--faint); align-items: center; padding: 3px; }
.meal.add:hover { color: var(--accent-2); }
.shop li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.shop li:last-child { border-bottom: 0; }
.shop .check { flex: 1; }

/* Familie */
.invite { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--accent-line); border-left: 3px solid var(--accent-2); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; flex-wrap: wrap; }
.members li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.members li:last-child { border-bottom: 0; }
.panel h3.muted { margin: 18px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.share-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.share-list li:last-child { border-bottom: 0; }
.danger-zone { border-color: var(--line); }
.danger-zone h2 { color: var(--bad); }
.feed li { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed li span:nth-child(2) { flex: 1; }
.mini-goal { margin-bottom: 10px; }
.features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.features li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.features li > .i { color: var(--accent-2); margin-top: 2px; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }

/* Skjema */
.form { display: flex; flex-wrap: wrap; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 100%; min-width: 0; }
.field.half { flex: 1 1 calc(50% - 7px); }
.field.third { flex: 1 1 calc(33.33% - 10px); min-width: 150px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text); }
.field small { color: var(--muted); font-size: 12px; }
.field input, .field select, .field textarea { width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); transition: border-color .12s, box-shadow .12s; }
.field input:focus, .field select:focus, .field textarea:focus, .quick input:focus, .quick select:focus, .search:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.field textarea { resize: vertical; }
.input-wrap { position: relative; }
.input-wrap em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 13px; pointer-events: none; }
.input-wrap input[type=text]:has(+ em) { padding-right: 34px; }
.person-new { margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check.half { flex: 1 1 calc(50% - 7px); }
.check.sm { font-size: 13px; color: var(--muted); }
.check input { width: 16px; height: 16px; accent-color: var(--accent-2); flex-shrink: 0; }
.share-toggle { flex: 1 1 100%; background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 10px 12px; border-radius: var(--radius-sm); font-weight: 500; color: var(--accent-2); }
.form > .btn { align-self: flex-start; }
.picker { display: flex; flex-wrap: wrap; gap: 6px; }
.picker label { cursor: pointer; }
.picker input { display: none; }
.picker b, .picker i { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 400; }
.picker b:hover { border-color: var(--line-strong); color: var(--text); }
.picker i { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; }
.picker input:checked + b { border-color: var(--accent-2); color: var(--accent-2); background: var(--accent-soft); }
.picker input:checked + i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-2); }

/* Ikoner og diverse */
.i { flex-shrink: 0; vertical-align: -0.18em; }
.btn .i { margin: 0 -2px; }
.btn:has(> .i:only-child) { padding-left: 8px; padding-right: 8px; }
.with-ic { display: inline-flex; align-items: center; gap: 6px; }
p.with-ic { display: flex; }
.spin { animation: spin 1s linear infinite; }

/* Import */
.choose { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.choice { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: border-color .12s; }
.choice:hover { border-color: var(--accent-2); }
.choice > span:not(.ic) { color: var(--muted); font-size: 13px; flex: 1; }
.choice em { align-self: flex-start; font-style: normal; }
.connections { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.conn { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; flex: 1 1 320px; }
.conn.err { border-left: 3px solid var(--bad); }
.steps { flex-basis: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 16px; font-size: 14px; }
.steps ol { margin: 6px 0 8px; padding-left: 20px; }
.steps li { margin: 3px 0; }
.mini-table { font-size: 12px; }
.mini-table th, .mini-table td { white-space: nowrap; padding: 6px 8px; }
.modal .table-wrap { margin: 8px 0 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }

/* Modal */
#modals { position: relative; z-index: 100; }
.modal-wrap { position: fixed; inset: 0; background: rgba(20,16,35,.5); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal-wrap.out { opacity: 0; transition: .15s; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .16s; }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); align-items: center; background: var(--surface-2); border-radius: 0 0 10px 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(6px); opacity: 0; } }

/* Toast */
#toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 460px; }
.toast { background: #24173f; color: #fff; padding: 11px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 14px; animation: pop .2s; transition: .4s; text-align: center; border-left: 3px solid #a68bea; }
.toast.good { border-left-color: #5cc28d; }
.toast.bad { border-left-color: #f08a80; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* Responsivt */
@media (max-width: 1180px) {
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  body.drawer .sidebar { transform: none; }
  body.drawer .scrim { display: block; position: fixed; inset: 0; background: rgba(20,16,35,.45); z-index: 55; }
  .topbar { padding: 0 16px; }
  .topbar .menu, .mobile-only { display: inline-flex; }
  main { padding: 18px 16px 96px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .quick-buttons { grid-template-columns: repeat(2, 1fr); }
  .choose { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface);
    border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 10px; border-radius: var(--radius-sm); color: var(--muted); min-width: 56px; }
  .bottomnav small { font-size: 11px; font-weight: 500; }
  .bottomnav a.on { color: var(--accent-2); }
  #toasts { bottom: 86px; }
}
@media (max-width: 560px) {
  h1 { font-size: 21px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi b { font-size: 18px; }
  .kpi.hero { grid-column: 1 / -1; }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .field.half, .check.half { flex-basis: 100%; }
  .cards, .balances { grid-template-columns: 1fr; }
  .balance { flex-wrap: wrap; }
  .col-actions { flex-direction: row; width: 100%; }
  .col-actions .btn { flex: 1; }
  .quick select, .quick input[name=amount] { flex: 1 1 40%; }
  .page-head { align-items: flex-start; }
  .login-card { padding: 28px 20px; }
  .login-features { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .cat-table .cat-row td:first-child { padding-left: 20px; }
  .modal-wrap { place-items: end center; padding: 0; }
  .modal { border-radius: 10px 10px 0 0; max-height: 92vh; }
}
