/* =========================================================
   Tun – designsystem
   Nordisk, varm og rolig palett. Lyst og mørkt tema.
   ========================================================= */

:root {
    --bg: #f4f1ea;
    --bg-2: #ebe6db;
    --surface: #fffdf9;
    --surface-2: #f7f4ee;
    --surface-3: #efebe3;
    --text: #1c2523;
    --text-2: #3c4845;
    --muted: #6d7874;
    --border: rgba(28, 37, 35, .09);
    --border-strong: rgba(28, 37, 35, .16);
    --shadow-sm: 0 1px 2px rgba(40, 32, 20, .06), 0 1px 1px rgba(40, 32, 20, .04);
    --shadow: 0 1px 2px rgba(40, 32, 20, .05), 0 6px 20px -6px rgba(40, 32, 20, .12);
    --shadow-lg: 0 24px 60px -12px rgba(30, 24, 14, .28);
    --good: #2f9460;
    --good-bg: #e2f3e8;
    --warn: #c98a0b;
    --warn-bg: #fbf0d4;
    --bad: #d2452f;
    --bad-bg: #fbe4df;
    --info-bg: #e3ecf9;
    --accent: #1f7a6d;
    --accent-2: #2a9384;
    --accent-ink: #ffffff;
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --accent-softer: color-mix(in srgb, var(--accent) 7%, transparent);
    --gold: #f2b134;
    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --sidebar-w: 256px;
    --topbar-h: 58px;
    --bottom-h: 68px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: ui-rounded, "SF Pro Rounded", "Nunito", var(--font);
    --ease: cubic-bezier(.2, .8, .2, 1);
    color-scheme: light;
}

:root[data-accent="falu"] { --accent: #b5523b; --accent-2: #c9664e; }
:root[data-accent="hav"] { --accent: #2f6fc4; --accent-2: #4a86d6; }
:root[data-accent="lyng"] { --accent: #7a55b8; --accent-2: #8d6bc9; }
:root[data-accent="mose"] { --accent: #4d8a2f; --accent-2: #5f9d3f; }
:root[data-accent="rav"] { --accent: #b97a08; --accent-2: #cf8e17; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0e1514;
        --bg-2: #121b1a;
        --surface: #172120;
        --surface-2: #1c2826;
        --surface-3: #22302d;
        --text: #e7eeeb;
        --text-2: #c5d0cc;
        --muted: #8b9894;
        --border: rgba(231, 238, 235, .08);
        --border-strong: rgba(231, 238, 235, .15);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
        --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px -8px rgba(0, 0, 0, .5);
        --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
        --good: #4cc182;
        --good-bg: rgba(76, 193, 130, .14);
        --warn: #f0b43c;
        --warn-bg: rgba(240, 180, 60, .14);
        --bad: #f06a53;
        --bad-bg: rgba(240, 106, 83, .15);
        --info-bg: rgba(90, 140, 220, .15);
        --accent-soft: color-mix(in srgb, var(--accent-2) 20%, transparent);
        --accent-softer: color-mix(in srgb, var(--accent-2) 11%, transparent);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0e1514;
    --bg-2: #121b1a;
    --surface: #172120;
    --surface-2: #1c2826;
    --surface-3: #22302d;
    --text: #e7eeeb;
    --text-2: #c5d0cc;
    --muted: #8b9894;
    --border: rgba(231, 238, 235, .08);
    --border-strong: rgba(231, 238, 235, .15);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
    --good: #4cc182;
    --good-bg: rgba(76, 193, 130, .14);
    --warn: #f0b43c;
    --warn-bg: rgba(240, 180, 60, .14);
    --bad: #f06a53;
    --bad-bg: rgba(240, 106, 83, .15);
    --info-bg: rgba(90, 140, 220, .15);
    --accent-soft: color-mix(in srgb, var(--accent-2) 20%, transparent);
    --accent-softer: color-mix(in srgb, var(--accent-2) 11%, transparent);
    color-scheme: dark;
}

/* ---------- Grunnlag ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.015em; font-family: var(--font-display); }
h1 { font-size: 1.75rem; font-weight: 750; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .6em; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
img { max-width: 100%; }
kbd {
    display: inline-block; font: 600 11px/1 var(--font); padding: 3px 6px; border-radius: 6px;
    background: var(--surface-3); border: 1px solid var(--border); color: var(--muted); margin: 0 2px;
}
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-soft); }

.icon { flex-shrink: 0; display: inline-block; vertical-align: middle; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }
.kicker { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.big { font-size: 1.35rem; font-weight: 750; font-family: var(--font-display); letter-spacing: -.02em; display: block; }
.h3 { font-size: 1.05rem; font-weight: 700; font-family: var(--font-display); }
.prewrap { white-space: pre-wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.center { text-align: center; }
.pad { padding: 18px; }
.text-bad { color: var(--bad); font-weight: 600; }
.text-good { color: var(--good); font-weight: 600; }
.accent-text { color: var(--accent); font-weight: 600; }
.money { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hint { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .8rem; margin: 10px 2px 0; }
.count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px;
    border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: .72rem; font-weight: 700;
}
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.hidden-input + *, label.btn { position: relative; }

/* ---------- Splash ---------- */
.splash {
    position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    background: var(--bg);
}
.splash-logo {
    width: 96px; height: 96px; border-radius: 28px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: var(--shadow-lg);
    animation: pop .6s var(--ease) both;
}
.splash-name { font: 800 1.6rem var(--font-display); letter-spacing: -.02em; }
.splash-bar { width: 120px; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.splash-bar span {
    display: block; height: 100%; width: var(--blazor-load-percentage, 10%); background: var(--accent);
    transition: width .2s ease; border-radius: 4px;
}

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; min-height: 100dvh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); padding: 20px 14px; display: none; flex-direction: column; gap: 14px;
    background: var(--surface); border-right: 1px solid var(--border); z-index: 30; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-logo {
    width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--accent) 60%, transparent);
}
.brand-logo.lg { width: 56px; height: 56px; border-radius: 16px; }
.brand.compact .brand-logo { width: 34px; height: 34px; border-radius: 11px; }
.brand-name { font: 800 1.3rem/1 var(--font-display); letter-spacing: -.02em; display: flex; flex-direction: column; }
.brand-name small { font: 600 .68rem var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

.sidebar-search {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface-2); color: var(--muted); text-align: left;
}
.sidebar-search span { flex: 1; }
.sidebar-search:hover { border-color: var(--border-strong); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a, .sidebar-foot a {
    display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-2);
    font-weight: 550; transition: background .15s, color .15s; position: relative;
}
.side-nav a:hover, .sidebar-foot a:hover { background: var(--surface-2); }
.side-nav a.active, .sidebar-foot a.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.nav-section { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 14px 12px 4px; }
.nav-badge {
    margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--bad); color: #fff;
    font-size: .7rem; font-weight: 750; display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: .76rem; color: var(--muted); padding: 4px 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.status-dot.off { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }

.main-col { min-width: 0; }

.topbar {
    position: sticky; top: 0; z-index: 25; height: calc(var(--topbar-h) + var(--safe-t)); padding: var(--safe-t) 14px 0;
    display: flex; align-items: center; justify-content: space-between;
    background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
    border-bottom: 1px solid transparent;
}
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.offline-pill {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 99px; font-size: .74rem; font-weight: 650;
    background: var(--warn-bg); color: var(--warn); margin-right: 4px;
}

.content {
    padding: 8px 16px calc(var(--bottom-h) + var(--safe-b) + 28px);
    max-width: 1180px; margin: 0 auto;
    /* Bare opacity her: en transform-animasjon ville gjort .content til referanseramme for position: fixed,
       og da havner ark/popuper (Sheet) utenfor skjermen på lange sider. */
    animation: fadeIn .3s ease both;
}

.banner {
    display: flex; align-items: center; gap: 10px; margin: 8px 16px 0; padding: 10px 14px; border-radius: var(--radius-sm);
    background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .9rem;
}
.banner span { flex: 1; }

.bottom-nav {
    position: fixed; inset: auto 0 0 0; z-index: 40; height: calc(var(--bottom-h) + var(--safe-b)); padding: 0 8px var(--safe-b);
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-top: 1px solid var(--border);
}
.bottom-nav > a:not(.fab) {
    display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: .68rem; font-weight: 600; color: var(--muted);
    padding: 6px 0; position: relative; transition: color .15s;
}
.bottom-nav > a.active { color: var(--accent); }
.bottom-nav > a.active .icon { transform: translateY(-1px); }
.bottom-nav .nav-badge { position: absolute; top: 0; left: calc(50% + 6px); margin: 0; min-width: 18px; height: 18px; font-size: .64rem; }

.fab {
    justify-self: center; width: 56px; height: 56px; border-radius: 20px; display: grid; place-items: center; color: var(--accent-ink);
    background: linear-gradient(135deg, var(--accent-2), var(--accent)); margin-top: -26px;
    box-shadow: 0 10px 24px -6px color-mix(in srgb, var(--accent) 70%, transparent), 0 0 0 5px var(--bg);
    transition: transform .2s var(--ease);
}
.fab:active { transform: scale(.92); }
.fab.desktop { display: none; }

@media (min-width: 960px) {
    .sidebar { display: flex; }
    .main-col { margin-left: var(--sidebar-w); }
    .topbar, .bottom-nav { display: none; }
    .content { padding: 28px 36px 80px; }
    .banner { margin: 16px 36px 0; }
    .fab.desktop {
        display: grid; position: fixed; right: 32px; bottom: 32px; margin: 0; z-index: 30;
        box-shadow: 0 12px 28px -8px color-mix(in srgb, var(--accent) 70%, transparent);
    }
    .fab.desktop:hover { transform: translateY(-2px) rotate(90deg); }
    .hide-desktop { display: none !important; }
}
@media (max-width: 959px) {
    .hide-mobile { display: none !important; }
}

/* ---------- Knapper ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
    border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 650; font-size: .92rem; white-space: nowrap;
    transition: transform .12s var(--ease), background .15s, box-shadow .15s, border-color .15s; user-select: none;
    background: var(--surface-3); color: var(--text);
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary {
    background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn.ghost { background: var(--surface); border-color: var(--border-strong); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger-text { color: var(--bad); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .84rem; border-radius: 10px; gap: 6px; }
.btn.lg { min-height: 48px; padding: 0 22px; font-size: 1rem; }
.btn.full { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.btn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 10px 0; }
.link { color: var(--accent); font-weight: 650; font-size: .88rem; }

.icon-btn {
    width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; border: 0; background: transparent;
    color: var(--text-2); position: relative; transition: background .15s; flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; color: var(--muted); }
.dot-count {
    position: absolute; top: 3px; right: 3px; min-width: 16px; height: 16px; border-radius: 99px; background: var(--accent);
    color: #fff; font-size: .62rem; font-weight: 800; display: grid; place-items: center; padding: 0 4px;
}

/* ---------- Skjema ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; flex: 1; }
.field > label, .field-label { font-size: .8rem; font-weight: 650; color: var(--text-2); display: block; margin-bottom: 2px; }
.field-label { margin: 14px 0 8px; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 160px; }
.field.narrow { flex: 0 0 90px !important; }

input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
    width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm); padding: 10px 12px; min-height: 44px; transition: border-color .15s, box-shadow .15s; appearance: none;
    -webkit-appearance: none;
}
textarea { resize: vertical; min-height: 72px; line-height: 1.45; }
select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input[type=date] { min-height: 44px; }
.input-lg { font-size: 1.15rem !important; font-weight: 600; padding: 12px 14px !important; }
.select-inline { width: auto !important; min-width: 140px; background-color: var(--surface) !important; }
.num-sm { width: 76px !important; text-align: center; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { flex: 1; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-dates button {
    border: 1px dashed var(--border-strong); background: transparent; border-radius: 99px; padding: 3px 10px; font-size: .76rem;
    font-weight: 600; color: var(--muted);
}
.quick-dates button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-softer); }
.recur-row { display: flex; align-items: center; gap: 8px; }
.recur-row select { flex: 1; }

.form { display: flex; flex-direction: column; gap: 14px; max-width: 820px; }
.form-section { padding: 18px; }
.form-section .card-title { margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; }
.form-actions.sticky {
    position: sticky; bottom: calc(var(--bottom-h) + var(--safe-b) + 10px); z-index: 5; padding: 10px; border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border); box-shadow: var(--shadow);
}
.form-actions.sticky .btn.primary { flex: 1; max-width: 320px; }
@media (min-width: 960px) { .form-actions.sticky { bottom: 20px; } }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 12px; }
.segmented.full { display: flex; width: 100%; }
.segmented button {
    flex: 1; border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-size: .85rem; font-weight: 600;
    color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
    transition: background .15s, color .15s, box-shadow .15s;
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented button.on.prio-high { color: var(--warn); }
.segmented button.on.prio-critical { color: var(--bad); }

.chip-row { display: flex; gap: 8px; align-items: center; margin: 4px 0 12px; }
.chip-row.scroll { overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; }
.chip-row.scroll::-webkit-scrollbar { display: none; }
.chip-row.wrap { flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px; border: 1px solid var(--border-strong);
    background: var(--surface); font-size: .85rem; font-weight: 600; white-space: nowrap; color: var(--text-2);
    transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: color-mix(in srgb, var(--c, var(--accent)) 50%, transparent); }
.chip.active {
    background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--surface)); border-color: color-mix(in srgb, var(--c, var(--accent)) 55%, transparent);
    color: color-mix(in srgb, var(--c, var(--accent)) 75%, var(--text));
}
.chip.removable { padding-right: 6px; }
.chip.removable button { border: 0; background: var(--surface-3); border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; color: var(--muted); }
.chip-mini {
    display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: .74rem; font-weight: 650;
    background: color-mix(in srgb, var(--c, var(--accent)) 13%, transparent); color: color-mix(in srgb, var(--c, var(--accent)) 70%, var(--text));
    white-space: nowrap;
}

.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 550; margin: 8px 0; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
    width: 46px; height: 28px; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-strong);
    position: relative; flex-shrink: 0; transition: background .2s;
}
.toggle-track::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--ease);
}
.toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }
.toggle input:focus-visible + .toggle-track { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.search-box {
    display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; border-radius: var(--radius-sm); background: var(--surface);
    border: 1px solid var(--border-strong); color: var(--muted); flex: 1; min-width: 0; transition: border-color .15s, box-shadow .15s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-box input { border: 0 !important; box-shadow: none !important; padding-left: 0 !important; background: transparent !important; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .search-box { flex: 1 1 240px; }

.filter-panel { padding: 16px; margin-bottom: 14px; animation: fadeUp .25s var(--ease) both; }
.filter-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.category-opt {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: var(--radius-sm);
    border: 1.5px solid var(--border); background: var(--surface); text-align: center; transition: all .15s;
}
.category-opt span { font-size: 1.4rem; line-height: 1; }
.category-opt small { font-size: .7rem; font-weight: 600; color: var(--muted); line-height: 1.2; }
.category-opt.active { border-color: var(--cat); background: color-mix(in srgb, var(--cat) 11%, var(--surface)); }
.category-opt.active small { color: color-mix(in srgb, var(--cat) 70%, var(--text)); }

.month-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.month-opt {
    padding: 8px 0; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font-size: .82rem;
    font-weight: 650; color: var(--muted); text-transform: capitalize;
}
.month-opt.on { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (min-width: 640px) { .month-grid { grid-template-columns: repeat(12, 1fr); } }

.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.radio-card {
    text-align: left; padding: 12px 14px; border-radius: var(--radius-sm); border: 1.5px solid var(--border-strong); background: var(--surface);
    display: flex; flex-direction: column; gap: 2px;
}
.radio-card small { color: var(--muted); font-size: .78rem; }
.radio-card.on { border-color: var(--accent); background: var(--accent-softer); box-shadow: 0 0 0 3px var(--accent-soft); }

.emoji-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.emoji-opt {
    width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); font-size: 1.35rem;
    display: grid; place-items: center; transition: transform .12s var(--ease);
}
.emoji-opt:hover { transform: scale(1.08); }
.emoji-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-opt {
    width: 32px; height: 32px; border-radius: 50%; border: 3px solid var(--surface); background: var(--c);
    box-shadow: 0 0 0 1.5px var(--border-strong);
}
.color-opt.active { box-shadow: 0 0 0 2.5px var(--c); }
.accent-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.accent-opt {
    display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 99px; border: 1.5px solid var(--border-strong);
    background: var(--surface); font-weight: 600; font-size: .85rem;
}
.accent-opt .swatch { width: 22px; height: 22px; border-radius: 50%; background: var(--c); }
.accent-opt.active { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 20%, transparent); }

.star-input { display: flex; gap: 4px; }
.star-input button { border: 0; background: none; font-size: 1.8rem; line-height: 1; color: var(--surface-3); padding: 0 2px; -webkit-text-stroke: 1px var(--border-strong); }
.star-input button.on { color: var(--gold); -webkit-text-stroke: 0; }
.stars { color: var(--gold); letter-spacing: 1px; font-size: .9rem; display: block; }
.stars .off { color: var(--surface-3); }

.step-editor { display: flex; flex-direction: column; gap: 6px; }
.step-edit-row { display: flex; align-items: center; gap: 6px; }
.step-edit-row input { flex: 1; min-height: 40px !important; padding: 8px 10px !important; }
.step-num {
    width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-size: .75rem;
    font-weight: 750; color: var(--muted); flex-shrink: 0;
}
.step-edit-row.add .step-num { background: var(--accent-soft); color: var(--accent); }

/* ---------- Kort og lister ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
}
a.card, button.card { display: block; transition: transform .18s var(--ease), box-shadow .18s, border-color .18s; text-align: left; width: 100%; }
a.card:hover, button.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card + .card { margin-top: 12px; }
.card-title { font-size: .95rem; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.list-card { padding: 4px; }
.card.list-card { padding: 6px; }
.list-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 12px; transition: background .15s; min-width: 0;
}
a.list-row:hover { background: var(--surface-2); }
.list-row + .list-row { border-top: 1px solid var(--border); }
.list-row strong, .list-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-emoji {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; background: var(--surface-3);
    flex-shrink: 0;
}
.row-emoji.lg { width: 52px; height: 52px; font-size: 1.6rem; border-radius: 15px; }

.tag {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: .72rem; font-weight: 650;
    background: var(--surface-3); color: var(--muted);
}
.tag.star { background: var(--warn-bg); color: var(--warn); }
.prio-pill { display: inline-flex; padding: 2px 9px; border-radius: 99px; font-size: .72rem; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.prio-pill.high { background: var(--warn-bg); color: var(--warn); }
.prio-pill.critical { background: var(--bad-bg); color: var(--bad); }
.prio-pill.low { background: var(--info-bg); color: #4a78c0; }
.prio-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.prio-dot.critical { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); animation: pulse 2s infinite; }

.due-badge {
    display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; white-space: nowrap;
    background: var(--surface-3); color: var(--text-2);
}
.due-badge.overdue { background: var(--bad-bg); color: var(--bad); }
.due-badge.today { background: var(--warn-bg); color: var(--warn); }
.due-badge.soon { background: var(--accent-soft); color: var(--accent); }
.due-badge.done, .due-badge.ok { background: var(--good-bg); color: var(--good); }
.due-badge.muted-badge { background: var(--surface-3); color: var(--muted); }

.avatar {
    width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 1rem; flex-shrink: 0;
    background: color-mix(in srgb, var(--c) 20%, var(--surface)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 45%, transparent);
}
.avatar.sm { width: 24px; height: 24px; font-size: .8rem; }

.bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 6px 0; }
.bar.lg { height: 10px; }
.bar span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .5s var(--ease); }
.bar.warn span { background: var(--warn); }
.bar.bad span { background: var(--bad); }

/* ---------- Sidetopp ---------- */
.page-header { display: flex; align-items: flex-start; gap: 10px; margin: 6px 0 18px; }
.page-header-text { flex: 1; min-width: 0; }
.page-header h1 { font-size: 1.6rem; }
.subtitle { color: var(--muted); margin: 4px 0 0; font-size: .92rem; }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.back-btn { margin-left: -8px; margin-top: -4px; }
@media (min-width: 960px) { .page-header h1 { font-size: 2rem; } }

.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.group-head {
    display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); margin: 22px 2px 10px; font-family: var(--font);
}
.group-head span:first-child { flex: 0 1 auto; }
.task-group.overdue .group-head { color: var(--bad); }
.task-group.today .group-head { color: var(--warn); }

.two-col { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 16px; }
.two-col > .section { margin-top: 10px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }

.tabs {
    display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 22px 0 16px; overflow-x: auto; scrollbar-width: none;
}
.tabs button {
    border: 0; background: none; padding: 10px 14px; font-weight: 650; color: var(--muted); border-bottom: 2.5px solid transparent;
    margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

.empty-state { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-state h3 { font-size: 1.2rem; }
.empty-state p { color: var(--muted); max-width: 420px; }
.empty-emoji {
    font-size: 2.6rem; width: 84px; height: 84px; border-radius: 28px; display: grid; place-items: center; background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 6px; animation: float 4s ease-in-out infinite;
}
.empty-state .btn { margin: 2px; }

/* ---------- Forside ---------- */
.hero {
    display: flex; align-items: center; gap: 16px; padding: 22px; border-radius: 24px; margin-top: 4px; position: relative; overflow: hidden;
    background:
        radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent-2) 30%, transparent), transparent 55%),
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface));
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.hero::after {
    content: ""; position: absolute; right: -40px; bottom: -60px; width: 220px; height: 160px; opacity: .07; pointer-events: none;
    background: var(--accent); clip-path: polygon(0 100%, 30% 35%, 45% 55%, 65% 10%, 100% 100%);
}
.hero-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.hero h1 { font-size: 1.55rem; margin: 4px 0 6px; }
.hero p { margin: 0; color: var(--text-2); }
.hero-score { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; }
.score-label { font-size: .72rem; font-weight: 750; padding: 2px 9px; border-radius: 99px; background: var(--good-bg); color: var(--good); }
.score-label.warn { background: var(--warn-bg); color: var(--warn); }
.score-label.bad { background: var(--bad-bg); color: var(--bad); }
@media (min-width: 960px) { .hero { padding: 30px 32px; } .hero h1 { font-size: 2rem; } }

.ring { position: relative; display: inline-grid; place-items: center; flex-shrink: 0; }
.ring svg { position: absolute; inset: 0; }
.ring-track { stroke: var(--surface-3); }
.ring-value { stroke: var(--accent); transition: stroke-dashoffset .9s var(--ease); }
.ring.good .ring-value { stroke: var(--good); }
.ring.warn .ring-value { stroke: var(--warn); }
.ring.bad .ring-value { stroke: var(--bad); }
.ring-label { position: relative; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.ring-label strong { font: 800 1.05em var(--font-display); letter-spacing: -.02em; }
.ring-label small { font-size: .62rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.hero-score .ring-label strong { font-size: 1.6rem; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 14px; }
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-tile {
    display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: transform .18s var(--ease), box-shadow .18s;
}
a.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-tile strong { padding-right: 30px; font: 800 1.55rem/1.1 var(--font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-tile > span:last-child { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat-tile em { font-style: normal; margin-left: 4px; font-size: .75rem; }
.stat-icon {
    position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent);
}
.stat-icon .icon { width: 17px; height: 17px; }
.stat-tile.alert { background: linear-gradient(135deg, var(--bad-bg), var(--surface) 70%); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.stat-tile.alert strong { color: var(--bad); }
.stat-tile.alert .stat-icon { background: var(--bad-bg); color: var(--bad); }

.property-strip {
    display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin: 16px -16px 0; padding: 4px 16px 8px; scrollbar-width: none;
}
.property-strip::-webkit-scrollbar { display: none; }
.property-card {
    flex: 0 0 200px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
    transition: transform .18s var(--ease), box-shadow .18s;
}
.property-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.property-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.property-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.property-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.property-card.add { align-items: center; justify-content: center; color: var(--muted); border-style: dashed; background: transparent; box-shadow: none; font-weight: 600; font-size: .85rem; }
.property-card.add::before { display: none; }
.property-emoji {
    width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 1.5rem;
    background: color-mix(in srgb, var(--c, var(--accent)) 14%, var(--surface));
}
.property-emoji.lg { width: 56px; height: 56px; font-size: 1.9rem; border-radius: 17px; }
.property-emoji.xl { width: 76px; height: 76px; font-size: 2.6rem; border-radius: 22px; box-shadow: var(--shadow); background: var(--surface); }

.streak-card {
    display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 16px; border-radius: var(--radius);
    background: linear-gradient(90deg, color-mix(in srgb, var(--gold) 22%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
}
.streak-card div { display: flex; flex-direction: column; }
.streak-flame { font-size: 1.8rem; animation: flicker 1.6s ease-in-out infinite; }

.season-card { display: flex; flex-direction: column; gap: 6px; position: relative; }
.season-emoji { position: absolute; top: 12px; right: 14px; font-size: 2rem; opacity: .85; }
.tip-list { margin: 0 0 10px; padding: 0 40px 0 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.tip-list li { display: flex; gap: 10px; color: var(--text-2); }
.tip-list li::before { content: "✓"; color: var(--accent); font-weight: 800; }
.season-card .btn { align-self: flex-start; }

.checklist-mini-list { display: flex; flex-direction: column; gap: 8px; }
.checklist-mini { display: flex !important; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 !important; }
.checklist-mini .bar { margin: 6px 0 2px; }
.cl-emoji { font-size: 1.6rem; width: 44px; height: 44px; display: grid; place-items: center; background: var(--surface-3); border-radius: 13px; flex-shrink: 0; }
.cl-emoji.lg { width: 58px; height: 58px; font-size: 2rem; border-radius: 17px; }

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; align-items: center; gap: 14px; padding: 8px 6px; border-radius: 12px; position: relative; }
.timeline-item:hover { background: var(--surface); }
.timeline-date { width: 42px; text-align: center; display: flex; flex-direction: column; line-height: 1.05; flex-shrink: 0; }
.timeline-date strong { font: 800 1.25rem var(--font-display); }
.timeline-date span { font-size: .7rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.timeline-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--cat); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cat) 20%, transparent); flex-shrink: 0; }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; left: 67px; top: calc(50% + 10px); height: calc(100% - 20px); width: 2px; background: var(--border); }
.timeline-body { display: flex; flex-direction: column; min-width: 0; }
.timeline-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Oppgavekort ---------- */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-card { position: relative; border-radius: var(--radius); overflow: hidden; touch-action: pan-y; animation: fadeUp .3s var(--ease) both; }
.swipe-content {
    position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);
    transition: box-shadow .18s, border-color .18s; user-select: none; -webkit-user-select: none;
}
.swipe-content::before {
    content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3.5px; border-radius: 0 3px 3px 0; background: var(--cat); opacity: .9;
}
.swipe-content:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.task-card.inactive .swipe-content { opacity: .7; }
.swipe-bg {
    position: absolute; inset: 0; display: flex; align-items: center; padding: 0 22px; gap: 8px; font-weight: 750; color: #fff;
    border-radius: var(--radius); opacity: 0; transition: opacity .15s;
}
.swipe-bg-right { background: var(--good); justify-content: flex-start; }
.swipe-bg-left { background: var(--warn); justify-content: flex-end; }
.task-card.swipe-right .swipe-bg-right, .task-card.swipe-left .swipe-bg-left { opacity: .75; }
.task-card.swipe-armed .swipe-bg { opacity: 1; }
.task-card.swipe-armed .swipe-bg .icon { transform: scale(1.25); transition: transform .15s var(--ease); }

.task-cat {
    width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0;
    background: color-mix(in srgb, var(--cat) 15%, var(--surface));
}
.task-cat.sm { width: 34px; height: 34px; font-size: 1.05rem; border-radius: 10px; }
.task-cat.lg { width: 52px; height: 52px; font-size: 1.6rem; border-radius: 16px; }
.task-cat.xl { width: 72px; height: 72px; font-size: 2.3rem; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 650; display: flex; align-items: center; gap: 5px; line-height: 1.3; }
.task-title span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pin-icon { color: var(--accent); }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .76rem; color: var(--muted); margin-top: 3px; align-items: center; }
.task-meta > span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.task-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.task-side-row { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.meta-due { display: none !important; padding: 1px 7px; font-size: .7rem; }
@media (max-width: 520px) {
    .meta-due { display: inline-flex !important; }
    .task-side .due-badge:not(.done) { display: none; }
    .task-side:not(:has(*:not(.due-badge))) { display: none; }
}
.complete-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); color: transparent;
    display: grid; place-items: center; flex-shrink: 0; transition: all .2s var(--ease);
}
.complete-btn:hover { border-color: var(--good); color: var(--good); background: var(--good-bg); transform: scale(1.06); }
.complete-btn:active { transform: scale(.9); }
@media (max-width: 420px) {
    .task-side .avatar { display: none; }
    .swipe-content { gap: 10px; padding: 11px 10px 11px 12px; }
    .task-cat { width: 38px; height: 38px; font-size: 1.15rem; }
    .complete-btn { width: 36px; height: 36px; }
}

/* ---------- Detaljside ---------- */
.detail-hero, .property-hero {
    margin: 0 -16px; padding: 4px 16px 22px; position: relative;
    background: linear-gradient(180deg, color-mix(in srgb, var(--cat, var(--c)) 15%, var(--bg)), var(--bg));
}
.property-hero { --cat: var(--c); }
.detail-hero-top { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.detail-hero-body, .property-hero-body { display: flex; gap: 16px; align-items: flex-start; }
.property-hero-body { align-items: center; flex-wrap: wrap; }
.detail-hero h1, .property-hero h1 { font-size: 1.6rem; margin: 4px 0 10px; }
.address { display: inline-flex; align-items: center; gap: 4px; font-size: .88rem; }
.address:hover { color: var(--accent); }
@media (min-width: 960px) {
    .detail-hero, .property-hero { margin: -28px -36px 0; padding: 18px 36px 28px; }
    .detail-hero h1, .property-hero h1 { font-size: 2.1rem; }
}

.menu-wrap { position: relative; }
.menu-backdrop { position: fixed; inset: 0; z-index: 50; }
.menu {
    position: absolute; right: 0; top: 44px; z-index: 51; min-width: 220px; padding: 6px; border-radius: 14px; background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pop .18s var(--ease) both; transform-origin: top right;
}
.menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; background: none; border-radius: 9px;
    font-weight: 550; text-align: left;
}
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--bad); }

.detail-grid { display: grid; gap: 14px; margin-top: 6px; }
.detail-main, .detail-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.detail-main .card + .card, .detail-side .card + .card { margin-top: 0; }
@media (min-width: 1000px) { .detail-grid { grid-template-columns: 1fr 330px; align-items: start; } .detail-side { position: sticky; top: 20px; } }

.due-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; border-width: 1.5px; }
.due-card.overdue { border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: linear-gradient(135deg, var(--bad-bg), var(--surface) 60%); }
.due-card.overdue .big { color: var(--bad); }
.due-card.today { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: linear-gradient(135deg, var(--warn-bg), var(--surface) 60%); }
.due-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 520px) { .due-actions { width: 100%; } .due-actions .btn { flex: 1; } }

.steps { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.step {
    display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 12px; cursor: pointer; transition: background .15s;
}
.step:hover { background: var(--surface-2); }
.step input, .checklist-item input, .pick-row input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark {
    width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0;
    color: transparent; transition: all .2s var(--ease); background: var(--surface);
}
.checkmark.lg { width: 30px; height: 30px; border-radius: 10px; }
.step.done .checkmark, .checklist-item.done .checkmark, .pick-row.on .checkmark {
    background: var(--good); border-color: var(--good); color: #fff; animation: pop .3s var(--ease);
}
.step.done > span:last-child { text-decoration: line-through; color: var(--muted); }
.steps.compact .step { padding: 7px 8px; }

.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; color: var(--muted); font-size: .88rem; }
.info-row + .info-row { border-top: 1px solid var(--border); }
.info-row span { flex: 1; }
.info-row strong { color: var(--text); font-weight: 650; text-align: right; }

.contact-mini, .equipment-mini { display: flex; flex-direction: column; gap: 4px; }
.equipment-mini { display: flex !important; flex-direction: row; align-items: center; gap: 12px; }
.equipment-mini .grow { display: flex; flex-direction: column; }
.contact-mini .btn-row { margin-bottom: 0; }
.task-actions { display: flex; flex-direction: column; gap: 8px; }
.icon-btn.danger-text { color: var(--bad); margin-right: auto; }
.icon-btn.danger-text:hover { background: var(--bad-bg); }

.history-list { display: flex; flex-direction: column; }
.history-item { display: flex; gap: 12px; padding: 12px 4px; }
.history-item + .history-item { border-top: 1px solid var(--border); }
.history-item.skipped { opacity: .65; }
.history-item.link-row { padding: 12px 10px; border-radius: 12px; transition: background .15s; }
.history-item.link-row:hover { background: var(--surface-2); }
.card.history-list { padding: 6px; }
.history-dot { font-size: 1.1rem; }
.history-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.history-note { margin: 6px 0 0; padding: 8px 12px; background: var(--surface-2); border-radius: 10px; font-size: .88rem; color: var(--text-2); }
.history-date { width: 38px; display: flex; flex-direction: column; align-items: center; line-height: 1.1; flex-shrink: 0; }
.history-date strong { font: 800 1.2rem var(--font-display); }
.history-date small { font-size: .68rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }

.photo-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photo-thumb {
    width: 76px; height: 76px; border-radius: 12px; background: var(--surface-3) center/cover no-repeat; border: 1px solid var(--border);
    position: relative; display: block; padding: 0; cursor: zoom-in; flex-shrink: 0;
}
.photo-thumb.skeleton { animation: shimmer 1.4s infinite linear; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; }
.photo-thumb.hero-photo { width: 100%; height: 200px; border-radius: var(--radius); margin-bottom: 12px; }
.photo-thumb.eq-photo { width: 52px; height: 52px; border-radius: 15px; }
.photo-remove {
    position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--text);
    color: var(--surface); display: grid; place-items: center;
}
.photo-picker {
    width: 76px; height: 76px; border-radius: 12px; border: 1.5px dashed var(--border-strong); display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .66rem; font-weight: 650; cursor: pointer;
    position: relative; text-align: center; transition: all .15s;
}
.photo-picker:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-softer); }
.photo-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--border-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.lightbox {
    position: fixed; inset: 0; z-index: 200; background: rgba(0, 0, 0, .88); display: grid; place-items: center; padding: 20px;
    animation: fadeIn .2s both; cursor: zoom-out;
}
.lightbox img { max-height: 90vh; border-radius: 12px; box-shadow: var(--shadow-lg); }
.lightbox-close { position: absolute; top: calc(14px + var(--safe-t)); right: 14px; color: #fff; background: rgba(255, 255, 255, .15); }

/* ---------- Ark (bottom sheet / dialog) ---------- */
.sheet-backdrop {
    position: fixed; inset: 0; z-index: 90; background: rgba(12, 18, 17, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    animation: fadeIn .2s both;
}
.sheet {
    position: fixed; z-index: 91; left: 0; right: 0; bottom: 0; max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column;
    background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg); animation: sheetUp .32s var(--ease) both;
    padding-bottom: var(--safe-b);
}
.sheet-handle { width: 40px; height: 5px; border-radius: 5px; background: var(--border-strong); margin: 8px auto 0; flex-shrink: 0; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px 6px 20px; gap: 10px; }
.sheet-header h2 { font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { padding: 8px 20px 16px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.sheet-footer {
    display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap;
}
.sheet-footer .btn.primary { flex: 1; max-width: 260px; }
.sheet-footer .danger-text { margin-right: auto; }
@media (min-width: 720px) {
    .sheet {
        left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, calc(100vw - 40px)); max-height: 86vh; border-radius: 24px;
        transform: translate(-50%, -50%); animation: dialogIn .28s var(--ease) both; padding-bottom: 0;
    }
    .sheet.wide { width: min(760px, calc(100vw - 40px)); }
    .sheet-handle { display: none; }
    .sheet-header { padding-top: 16px; }
}
.sheet.confirm { text-align: center; }
.sheet.confirm .sheet-body { padding-top: 22px; }
.sheet.confirm h2 { margin-bottom: 8px; }
.sheet.confirm p { color: var(--muted); }
.sheet.confirm .sheet-footer .btn { flex: 1; max-width: none; }
@media (min-width: 720px) { .sheet.confirm { width: 420px; } }
.confirm-icon {
    width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--accent-soft);
    color: var(--accent);
}
.confirm-icon.danger { background: var(--bad-bg); color: var(--bad); }

.complete-hero {
    display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; margin-bottom: 16px;
    background: color-mix(in srgb, var(--cat) 10%, var(--surface-2));
}
.next-hint {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--accent-softer);
    color: var(--text-2); font-size: .88rem; margin-top: 8px;
}
.next-hint .icon { color: var(--accent); }
.next-hint.warn { background: var(--warn-bg); }
.next-hint.warn .icon { color: var(--warn); }

.snooze-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.snooze-opt {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: 14px;
    border: 1.5px solid var(--border-strong); background: var(--surface); text-align: left; transition: all .15s;
}
.snooze-opt span { font-size: .76rem; color: var(--muted); }
.snooze-opt:hover { border-color: var(--accent); background: var(--accent-softer); }

/* ---------- Toast ---------- */
.toast-host {
    position: fixed; z-index: 150; left: 12px; right: 12px; bottom: calc(var(--bottom-h) + var(--safe-b) + 12px);
    display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 8px 8px 8px 16px; border-radius: 16px;
    background: #1d2826; color: #eef4f2; box-shadow: var(--shadow-lg); max-width: 520px; width: 100%; animation: toastIn .35s var(--ease) both;
    font-weight: 550; font-size: .9rem;
}
:root[data-theme="dark"] .toast { background: #2a3936; }
.toast-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); flex-shrink: 0; }
.toast.success .toast-icon { background: var(--good); color: #fff; }
.toast.error { background: #7b2418; }
.toast.warning .toast-icon { background: var(--warn); color: #fff; }
.toast-msg { flex: 1; }
.toast-action { border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-weight: 750; padding: 8px 14px; border-radius: 10px; }
.toast-action:hover { background: rgba(255, 255, 255, .22); }
.toast-close { border: 0; background: none; color: rgba(255, 255, 255, .55); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; }
@media (min-width: 960px) { .toast-host { left: auto; right: 28px; bottom: 104px; align-items: flex-end; } .toast { width: 400px; } }

/* ---------- Søk ---------- */
.search-panel {
    position: fixed; z-index: 95; top: calc(12px + var(--safe-t)); left: 12px; right: 12px; max-width: 620px; margin: 0 auto;
    background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); overflow: hidden;
    animation: dialogDrop .25s var(--ease) both; display: flex; flex-direction: column; max-height: 78vh;
}
@media (min-width: 960px) { .search-panel { top: 12vh; } }
.search-input { display: flex; align-items: center; gap: 10px; padding: 6px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.search-input input { border: 0 !important; box-shadow: none !important; font-size: 1.05rem !important; padding: 12px 0 !important; background: transparent !important; }
.search-results { overflow-y: auto; padding: 6px; }
.search-hit {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 12px; text-align: left;
}
.search-hit.selected { background: var(--accent-soft); }
.hit-emoji { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); font-size: 1.1rem; flex-shrink: 0; }
.hit-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hit-text strong, .hit-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hit-text small { color: var(--muted); }
.hit-kind { font-size: .7rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.search-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); }
@media (max-width: 600px) { .search-foot { display: none; } }

/* ---------- Onboarding ---------- */
.onboarding {
    min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: calc(20px + var(--safe-t)) 16px calc(20px + var(--safe-b));
    background:
        radial-gradient(80% 60% at 0% 0%, color-mix(in srgb, var(--accent-2) 25%, transparent), transparent 60%),
        radial-gradient(60% 50% at 100% 100%, color-mix(in srgb, var(--gold) 18%, transparent), transparent 60%),
        var(--bg);
}
.onboarding-card {
    width: 100%; max-width: 520px; background: var(--surface); border-radius: 28px; padding: 26px 22px; box-shadow: var(--shadow-lg);
    border: 1px solid var(--border); animation: dialogIn .4s var(--ease) both;
}
.onboarding-card h2 { font-size: 1.45rem; margin-bottom: 6px; }
.onboarding-progress { display: flex; gap: 6px; margin-bottom: 22px; }
.onboarding-progress span { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-3); transition: background .3s; }
.onboarding-progress span.on { background: var(--accent); }
.onboarding-hero { text-align: center; }
.onboarding-hero h1 { font-size: 1.9rem; margin: 14px 0 8px; }
.onboarding-hero p { color: var(--text-2); }
.logo-big {
    width: 88px; height: 88px; margin: 0 auto; border-radius: 26px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--accent-2), var(--accent)); box-shadow: 0 16px 36px -10px color-mix(in srgb, var(--accent) 70%, transparent);
    animation: float 4s ease-in-out infinite;
}
.feature-list { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; }
.feature-list li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.feature-list li > span { font-size: 1.4rem; }
.feature-list li div { display: flex; flex-direction: column; }
.feature-list small { color: var(--muted); }
.onboarding-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.onboarding-actions.row { flex-direction: row; justify-content: space-between; }
.onboarding-actions.row .btn.primary { flex: 1; max-width: 280px; }
.type-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 14px 0; }
.type-opt {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: 14px; border: 1.5px solid var(--border-strong);
    background: var(--surface); font-size: .78rem; font-weight: 650;
}
.type-opt span { font-size: 1.6rem; }
.type-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
@media (max-width: 420px) { .type-grid { grid-template-columns: repeat(3, 1fr); } }
.template-pick { max-height: 48vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin: 12px -6px; padding: 0 6px; }
.pick-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--border); cursor: pointer;
    transition: all .15s;
}
.pick-row.on { border-color: color-mix(in srgb, var(--good) 45%, transparent); background: var(--good-bg); }
.pick-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pick-text small { color: var(--muted); }

/* ---------- Kalender ---------- */
.calendar-layout { display: grid; gap: 16px; }
@media (min-width: 1000px) { .calendar-layout { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; } }
.calendar { padding: 14px; }
.cal-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.cal-head h2 { flex: 1; text-align: center; font-size: 1.15rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: .7rem; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 6px 0; }
.cal-day {
    aspect-ratio: 1 / 1; min-height: 44px; border: 0; background: transparent; border-radius: 12px; display: flex; flex-direction: column;
    align-items: center; justify-content: flex-start; padding: 6px 2px 4px; gap: 3px; position: relative; transition: background .15s;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.other { opacity: .35; }
.cal-num { font-weight: 650; font-size: .9rem; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--accent); color: #fff; }
.cal-day.selected { background: var(--accent-soft); }
.cal-day.has-overdue .cal-num { color: var(--bad); }
.cal-day.today.has-overdue .cal-num { color: #fff; }
.cal-dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; max-width: 36px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cat); display: inline-block; }
.cal-dot.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px var(--cat); }
.cal-more { font-size: .58rem; font-weight: 700; color: var(--muted); line-height: 6px; }
.cal-done { position: absolute; top: 3px; right: 5px; font-size: .62rem; color: var(--good); font-weight: 900; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; padding: 0 4px; }
.cal-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .cal-done { position: static; }
@media (min-width: 700px) { .cal-day { aspect-ratio: 1.15 / 1; } .cal-dot { width: 7px; height: 7px; } }

/* ---------- Eiendommer ---------- */
.property-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.property-big { position: relative; overflow: hidden; padding: 18px !important; }
.property-big::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--c); }
.property-big + .property-big { margin-top: 0 !important; }
.property-big-top { display: flex; align-items: center; gap: 14px; }
.property-big-top .grow { display: flex; flex-direction: column; min-width: 0; }
.property-big-top .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 16px 0 12px; }
.mini-stats div { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 12px; background: var(--surface-2); }
.mini-stats strong { font: 800 1.1rem var(--font-display); }
.mini-stats span { font-size: .7rem; color: var(--muted); font-weight: 600; }

/* ---------- Maler ---------- */
.target-card { display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 4px; }
.target-card .chip-row { margin: 0; flex: 1; }
.select-bar { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 10px; }
.template-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); padding-bottom: 80px; }
.template-card {
    background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer;
    transition: all .18s var(--ease); display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm);
}
.template-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.template-card.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); box-shadow: 0 0 0 3px var(--accent-soft); }
.template-card.added { cursor: default; opacity: .7; }
.template-top { display: flex; align-items: center; gap: 12px; }
.template-top .task-cat { --cat: var(--cat, var(--accent)); }
.template-desc { font-size: .86rem; color: var(--text-2); margin: 0; }
.template-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.template-meta .muted { display: inline-flex; align-items: center; gap: 3px; }
.select-check {
    width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent;
    flex-shrink: 0; transition: all .2s var(--ease);
}
.select-check.on { background: var(--accent); border-color: var(--accent); color: #fff; animation: pop .25s var(--ease); }
.added-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; color: var(--good); background: var(--good-bg); padding: 3px 9px; border-radius: 99px; white-space: nowrap; }
.floating-action {
    position: fixed; z-index: 45; left: 12px; right: 12px; bottom: calc(var(--bottom-h) + var(--safe-b) + 12px); display: flex; gap: 8px;
    justify-content: center; padding: 10px; border-radius: 20px; max-width: 520px; margin: 0 auto;
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: toastIn .3s var(--ease) both;
}
.floating-action .btn.primary { flex: 1; }
@media (min-width: 960px) { .floating-action { left: calc(var(--sidebar-w) + 20px); bottom: 24px; } }
.mini-items { margin: 0; padding-left: 18px; font-size: .84rem; color: var(--text-2); }
.template-card .btn { align-self: flex-start; }
.template-list { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.template-row { display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; background: none; border-radius: 12px; text-align: left; width: 100%; }
.template-row:hover { background: var(--surface-2); }
.template-row .grow { display: flex; flex-direction: column; }

/* ---------- Sjekklister ---------- */
.checklist-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.checklist-card { display: flex !important; flex-direction: column; gap: 6px; margin: 0 !important; }
.checklist-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.checklist-card .tag { align-self: flex-start; }
.checklist-progress { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; transition: background .4s; }
.checklist-progress.complete { background: linear-gradient(135deg, var(--good-bg), var(--surface)); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.checklist-progress.complete .bar span { background: var(--good); }
.checklist-items { display: flex; flex-direction: column; gap: 8px; }
.checklist-item {
    display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 4px 8px 4px 4px;
    box-shadow: var(--shadow-sm); transition: all .2s;
}
.checklist-item > label { display: flex; align-items: center; gap: 12px; padding: 10px 10px; cursor: pointer; min-width: 0; }
.checklist-item.done { background: var(--surface-2); box-shadow: none; }
.checklist-item.done .item-text { text-decoration: line-through; color: var(--muted); }
.item-text { font-weight: 550; }
.inline-edit { min-height: 38px !important; padding: 6px 10px !important; }
.add-item { margin-top: 12px; }

/* ---------- Utstyr ---------- */
.equipment-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.equipment-card { display: flex !important; flex-direction: column; gap: 10px; margin: 0 !important; align-items: stretch; }
.equipment-top { display: flex; align-items: center; gap: 12px; }
.equipment-top .grow { display: flex; flex-direction: column; min-width: 0; }
.equipment-card .due-badge { align-self: flex-start; }
.lifespan .bar { margin: 2px 0 4px; }

/* ---------- Kontakter ---------- */
.contact-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.contact-grid .card { margin: 0; }
.contact-card.highlight { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.contact-top { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 8px; }
.contact-top .grow { display: flex; flex-direction: column; }
.contact-avatar {
    width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; font-weight: 800; font-family: var(--font-display);
    background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; flex-shrink: 0;
}

/* ---------- Målere ---------- */
.meter-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.meter-grid .card { margin: 0; }
.meter-card.expanded { grid-column: 1 / -1; }
.meter-top { display: flex; align-items: center; gap: 12px; }
.meter-top .grow { display: flex; flex-direction: column; }
.meter-values { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 8px; }
.meter-values > div { display: flex; flex-direction: column; }
.sparkline { width: 100%; height: 44px; display: block; margin: 6px 0; }
.spark-line { stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-area { fill: var(--accent-soft); }

/* ---------- Grafer ---------- */
.bar-chart { display: flex; flex-direction: column; margin-top: 10px; }
.bar-chart svg { width: 100%; display: block; overflow: visible; }
.bar-rect { fill: color-mix(in srgb, var(--accent) 55%, var(--surface-3)); transition: fill .15s; }
.bar-rect:hover { fill: var(--accent); }
.bar-rect.hl { fill: var(--accent); }
.bar-labels { display: flex; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font-size: .66rem; color: var(--muted); font-weight: 650; }
.bar-labels span.hl { color: var(--accent); }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex-shrink: 0; }
.donut circle { transition: stroke-dasharray .6s var(--ease); }
.donut-total { font: 800 15px var(--font-display); fill: var(--text); }
.donut-sub { font-size: 7px; fill: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 6px; font-size: .84rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.swatch { width: 11px; height: 11px; border-radius: 4px; flex-shrink: 0; }

.leaderboard { display: flex; flex-direction: column; gap: 12px; }
.leader-row { display: flex; align-items: center; gap: 12px; }
.leader-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.medal { width: 28px; text-align: center; font-size: 1.3rem; font-weight: 700; color: var(--muted); }

/* ---------- Innstillinger ---------- */
.settings { display: grid; gap: 14px; max-width: 820px; }
.settings .card + .card { margin-top: 0; }
.member-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.member-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; border-radius: 14px; border: 1.5px solid var(--border); }
.member-row.me { border-color: var(--accent); background: var(--accent-softer); }
.member-pick { flex: 1; display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 8px; text-align: left; }
.member-pick .grow { display: flex; flex-direction: column; }
.danger-zone { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border-strong); }
.about { display: flex; gap: 16px; align-items: center; }

/* ---------- Mer ---------- */
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 640px) { .more-grid { grid-template-columns: repeat(3, 1fr); } }
.more-tile {
    display: flex; flex-direction: column; gap: 2px; padding: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); transition: transform .18s var(--ease);
}
.more-tile:active { transform: scale(.97); }
.more-tile small { color: var(--muted); font-size: .76rem; }
.more-icon {
    width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 10px;
    background: color-mix(in srgb, var(--c) 15%, var(--surface)); color: var(--c);
}
.install-card { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.install-card .grow { display: flex; flex-direction: column; }

/* ---------- Effekter ---------- */
.confetti-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 300; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes dialogIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes dialogDrop { from { opacity: 0; transform: translateY(-12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-3deg); } 50% { transform: scale(1.1) rotate(3deg); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--bad-bg); } 50% { box-shadow: 0 0 0 6px transparent; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Onboarding-kortet bruker samme dialog-animasjon uten sentrering */
.onboarding-card { animation-name: fadeUp; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Blazor feilhåndtering ---------- */
#blazor-error-ui {
    background: var(--bad); color: #fff; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0;
    padding: .8rem 1.25rem calc(.8rem + var(--safe-b)); position: fixed; width: 100%; z-index: 1000; font-weight: 600;
}
#blazor-error-ui .reload { color: #fff; text-decoration: underline; margin-left: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 1rem; top: .7rem; }
.blazor-error-boundary { background: var(--bad-bg); color: var(--bad); padding: 1rem; border-radius: 12px; }
.blazor-error-boundary::after { content: "Det oppstod en feil."; }

/* ---------- Synkronisering ---------- */
.sync-indicator {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 650; text-align: left; position: relative;
}
.sync-indicator:hover { border-color: var(--border-strong); }
.sync-indicator.compact { padding: 0; width: 40px; height: 40px; justify-content: center; border: 0; background: transparent; border-radius: 12px; }
.sync-indicator.compact:hover { background: var(--surface-3); }
.sync-icon { display: grid; place-items: center; }
.sync-indicator.ok .sync-icon { color: var(--good); }
.sync-indicator.pending .sync-icon { color: var(--accent); }
.sync-indicator.offline .sync-icon { color: var(--warn); }
.sync-indicator.error .sync-icon { color: var(--bad); }
.sync-indicator.syncing .sync-icon .icon { animation: spin 1s linear infinite; color: var(--accent); }
.sync-count {
    position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--accent);
    color: #fff; font-size: .6rem; font-weight: 800; display: grid; place-items: center;
}
.sync-indicator.offline .sync-count { background: var(--warn); }

.sync-status-card {
    display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; margin-bottom: 16px; background: var(--good-bg);
}
.sync-status-card.offline { background: var(--warn-bg); }
.sync-status-card.error { background: var(--bad-bg); }
.sync-status-card.disabled, .sync-status-card.syncing { background: var(--surface-2); }
.sync-status-icon {
    width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); color: var(--good); flex-shrink: 0;
}
.sync-status-card.offline .sync-status-icon { color: var(--warn); }
.sync-status-card.error .sync-status-icon { color: var(--bad); }
.sync-status-card.syncing .sync-status-icon { color: var(--accent); }
.sync-status-card.syncing .sync-status-icon .icon { animation: spin 1s linear infinite; }

.sync-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: .82rem; max-height: 260px; overflow-y: auto; }
.sync-log li { display: flex; gap: 10px; padding: 6px 10px; border-radius: 8px; color: var(--text-2); border-left: 3px solid var(--border-strong); }
.sync-log li.success { border-left-color: var(--good); }
.sync-log li.warning { border-left-color: var(--warn); }
.sync-log li.error { border-left-color: var(--bad); }
.sync-log-time { font-variant-numeric: tabular-nums; color: var(--muted); flex-shrink: 0; }

/* ---------- Endringer fra andre enheter ---------- */
.banner.remote {
    background: var(--surface); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    box-shadow: var(--shadow); flex-wrap: wrap; animation: fadeIn .3s ease both;
}
.banner.remote .remote-icon { flex: 0 0 auto;
   
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex-shrink: 0;
}
.remote-text { flex: 1; min-width: 180px; display: flex; flex-direction: column; }
.remote-text strong { font-size: .9rem; }
.remote-text small { color: var(--muted); font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.remote-actions { display: flex; gap: 6px; margin-left: auto; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; border-top-color: currentColor; }
.sync-indicator.remote .sync-icon { color: var(--accent); }
.sync-count.remote { background: var(--accent); }
.remote-card {
    display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; margin-bottom: 16px;
    background: var(--accent-softer); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.remote-card ul { margin: 6px 0 0; padding-left: 18px; font-size: .84rem; color: var(--text-2); }

/* ---------- Konto og innlogging ---------- */
.login-form { display: flex; flex-direction: column; }
.login-modes { margin: 4px 0 14px; }
.code-input { text-transform: uppercase; letter-spacing: .15em; font-size: 1.1rem !important; }
.account-grid { display: grid; gap: 14px; max-width: 980px; align-items: start; }
.account-grid .card + .card { margin-top: 0; }
@media (min-width: 900px) { .account-grid { grid-template-columns: 1fr 1fr; } .account-grid .profile-card { grid-column: 1 / -1; } }
.profile-card { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.contact-avatar.lg { width: 60px; height: 60px; border-radius: 18px; font-size: 1.4rem; }
.contact-avatar.sm { width: 36px; height: 36px; border-radius: 11px; font-size: .85rem; }
.account-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border-strong);
    margin: 4px 0 10px; transition: background .15s;
}
.account-row:hover { background: var(--surface-2); }
.account-row .grow { display: flex; flex-direction: column; min-width: 0; }
.account-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.invite-code {
    display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px; margin-bottom: 12px; border-radius: 16px;
    background: var(--accent-softer); border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent);
}
.invite-code .mono { font-size: 1.8rem; font-weight: 800; letter-spacing: .2em; color: var(--accent); }
.invite-code .btn-row { margin: 6px 0 0; }
.remote-card.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
