/* Verkstedssystem: mørk premium (designsystemet «Verkstedsystem v2»). Kun systemfonter og lokale ressurser (CSP). */
:root {
  color-scheme: dark;
  --bg: #0a0c0b;
  --surface: #151a17;
  --surface-2: #1c221f;
  --glass: rgba(24, 30, 27, 0.62);
  --glass-border: rgba(255, 255, 255, 0.08);
  --border: #232a26;
  --border-strong: #66736c;
  --ink: #eef3ef;
  --ink-muted: #9aa59e;
  --brand: #b8f34a;
  --brand-bright: #b8f34a;
  --brand-soft: #1f2b12;
  --brand-ink: #c9f27f;
  --on-brand: #0a0c0b;
  --glow: rgba(184, 243, 74, 0.16);
  --steel: #8ec9ff;
  --steel-soft: #10233a;
  --graphite: #0e1210;
  --on-graphite: #eef3ef;
  --success: #5eead4;
  --success-soft: #0f2e2a;
  --warning: #fcd34d;
  --warning-soft: #3a2e10;
  --danger: #fca5a5;
  --danger-soft: #3b1a1a;
  --danger-solid: #b42323;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 32px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 8px 28px rgba(184, 243, 74, 0.28);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --focus: 3px solid #b8f34a;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f2; --surface: #ffffff; --surface-2: #eaeee9; --glass: rgba(255, 255, 255, 0.72); --glass-border: rgba(15, 20, 17, 0.08);
  --border: #dde3dc; --border-strong: #7b867f; --ink: #0f1411; --ink-muted: #5b665f; --brand: #3f6212; --brand-bright: #a3e635;
  --brand-soft: #ecfccb; --brand-ink: #365314; --glow: rgba(163, 230, 53, 0.22); --steel: #1e4f8a; --steel-soft: #dbe8f7;
  --success: #115e59; --success-soft: #ccfbf1; --warning: #854d0e; --warning-soft: #fef3c7; --danger: #b91c1c; --danger-soft: #fee2e2;
  --shadow-card: 0 1px 2px rgba(15, 20, 17, 0.05), 0 8px 24px rgba(15, 20, 17, 0.06); --shadow-glow: 0 8px 24px rgba(101, 163, 13, 0.28);
  --focus: 3px solid #3f6212;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: radial-gradient(900px 520px at 100% -10%, var(--glow), transparent 62%), radial-gradient(700px 460px at 10% 110%, var(--glow), transparent 60%), var(--bg);
  background-attachment: fixed;
  line-height: 1.5;
  font-size: 1rem;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

h1 { color: var(--ink); font-size: 1.6rem; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 0.75rem; }
h2 { color: var(--ink); font-size: 1.15rem; line-height: 1.3; font-weight: 700; margin: 0 0 0.6rem; }
h3 { color: var(--ink); }
p { margin: 0 0 0.9rem; }
a { color: var(--brand); text-underline-offset: 2px; font-weight: 600; }
a:hover { color: var(--brand-ink); }
code { background: var(--surface-2); padding: 0.1rem 0.35rem; border-radius: 6px; font-family: var(--font-mono); font-size: 0.9em; }

:focus-visible { outline: var(--focus); outline-offset: 2px; }

.muted { color: var(--ink-muted); font-size: 0.9rem; }
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.skip-link {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 100;
  background: var(--surface); color: var(--ink); padding: 0.6rem 1rem;
  border-radius: var(--radius-md); border: 2px solid var(--brand); font-weight: 700;
}
.skip-link:focus { top: 0.5rem; }

/* Merke (skiftenøkkel på lime) */
.mark { width: 36px; height: 36px; border-radius: 11px; background: var(--brand-bright); display: inline-grid; place-items: center; color: var(--on-brand); flex: none; box-shadow: var(--shadow-glow); }
.mark svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
svg.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Offentlige sider (innlogging, glemt passord): sentrert glass-kort over lime-glød */
body.public { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow-x: hidden; }
body.public::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--glass-border) 1px, transparent 1px), linear-gradient(90deg, var(--glass-border) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000, transparent 75%); mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000, transparent 75%);
}
body.public > * { position: relative; }
.public-brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-weight: 800; font-size: 1.3rem; letter-spacing: -0.02em; padding: 1.5rem 1rem 0; }
.container { width: 100%; max-width: 28rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; }
.container .card { padding: 1.75rem 1.5rem; background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%); }

.card {
  background: var(--glass); border: 1px solid var(--glass-border); -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%);
  border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-card);
}

/* Skjemaer */
.field { margin: 0 0 1rem; }
.field label, .field .legend { display: block; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.02em; margin-bottom: 0.3rem; }
.hint { color: var(--ink-muted); font-size: 0.85rem; margin: 0.3rem 0 0; }
.field-error { color: var(--danger); font-weight: 700; margin: 0.35rem 0 0; font-size: 0.95rem; }

input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=date], select {
  display: block; width: 100%; min-height: 3rem; padding: 0.6rem 1rem; font: inherit; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--radius-md);
}
input::placeholder { color: var(--ink-muted); }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); box-shadow: 0 0 0 4px var(--glow); }
input[aria-invalid=true]:focus { border-color: var(--danger); }
input[aria-invalid=true] { border-color: var(--danger); border-width: 2px; }
input:disabled { background: var(--surface-2); color: var(--ink-muted); cursor: not-allowed; }

fieldset { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 0.3rem; }
.radio { display: flex; align-items: flex-start; gap: 0.6rem; min-height: 2.75rem; padding: 0.4rem 0; }
.radio input { width: 1.25rem; height: 1.25rem; margin: 0.2rem 0 0; flex: none; accent-color: var(--brand-bright); }
.radio label { font-weight: 500; margin: 0; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 3rem; padding: 0.6rem 1.4rem; font: inherit; font-weight: 700; line-height: 1.2;
  color: var(--on-brand); background: var(--brand-bright); border: 1.5px solid transparent; border-radius: var(--radius-md);
  cursor: pointer; text-decoration: none; text-align: center; box-shadow: var(--shadow-glow);
}
button:hover, .btn:hover { filter: brightness(1.07); color: var(--on-brand); }
button:active, .btn:active { transform: scale(0.98); }
.btn-secondary { color: var(--ink); background: transparent; border-color: var(--border-strong); box-shadow: none; }
.btn-secondary:hover { color: var(--ink); background: var(--surface-2); filter: none; }
.btn-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; box-shadow: none; }
.btn-danger:hover { color: var(--danger); filter: brightness(1.2); }
.btn-small { min-height: 2.75rem; padding: 0.35rem 0.9rem; font-size: 0.9rem; border-radius: var(--radius-sm); }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

/* Meldinger */
.alert, .notice { padding: 0.75rem 1rem; border-radius: var(--radius-md); margin: 0 0 1rem; border: 1px solid; font-weight: 600; }
.alert, .notice-error { color: var(--danger); background: var(--danger-soft); border-color: rgba(252, 165, 165, 0.35); }
.notice-ok { color: var(--success); background: var(--success-soft); border-color: rgba(94, 234, 212, 0.35); }
.notice-warn { color: var(--warning); background: var(--warning-soft); border-color: rgba(252, 211, 77, 0.35); }
.notice-info { color: var(--steel); background: var(--steel-soft); border-color: rgba(142, 201, 255, 0.35); }
.error { color: var(--danger); font-weight: 700; }

/* Innlogget område */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 1rem; min-height: 3.5rem;
  background: var(--glass); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-bottom: 1px solid var(--glass-border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand .mark { width: 32px; height: 32px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--steel-soft); color: var(--steel); font-weight: 800; font-size: 0.8rem; flex: none; }
.topbar .who { font-size: 0.9rem; text-align: right; color: var(--ink-muted); }
.topbar .who strong { color: var(--ink); }
.topbar form { margin: 0; }
.topbar .icon-btn { color: var(--ink); background: transparent; border-color: transparent; min-width: 2.75rem; min-height: 2.75rem; padding: 0.4rem 0.7rem; box-shadow: none; }
.topbar .icon-btn:hover { background: var(--surface-2); filter: none; color: var(--ink); }
.topbar .logout { white-space: nowrap; color: var(--ink); background: transparent; border-color: var(--border-strong); box-shadow: none; min-height: 2.75rem; padding: 0.4rem 1rem; }
.topbar .logout:hover { background: var(--surface-2); filter: none; color: var(--ink); }
.burger, .burger::before, .burger::after { display: block; width: 1.25rem; height: 2px; background: var(--ink); border-radius: 1px; }
.burger { position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }

html:not(.js) .icon-btn { display: none; }
#menu-toggle { display: none; }

.smtp-banner { margin: 0; padding: 0.7rem 1rem; background: var(--warning-soft); color: var(--warning); border-bottom: 1px solid rgba(252, 211, 77, 0.35); font-weight: 700; }
.smtp-banner a { color: var(--warning); }

.shell { display: flex; align-items: flex-start; min-height: calc(100vh - 3.5rem); }
#sidebar { width: 15.5rem; flex: none; align-self: stretch; background: var(--graphite); color: var(--on-graphite); border-right: 1px solid rgba(255, 255, 255, 0.06); padding: 1rem 0.75rem; }
#sidebar ul { list-style: none; margin: 0; padding: 0; }
#sidebar a {
  display: flex; align-items: center; gap: 12px; padding: 0.7rem 0.8rem; min-height: 2.75rem; margin-bottom: 0.2rem; border-radius: var(--radius-md);
  color: var(--on-graphite); opacity: 0.74; text-decoration: none; font-weight: 600;
}
#sidebar a:hover { opacity: 1; background: rgba(255, 255, 255, 0.06); color: var(--on-graphite); }
#sidebar a[aria-current=page] { opacity: 1; background: rgba(184, 243, 74, 0.12); color: #c9f27f; }
#sidebar a[aria-current=page]::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: #b8f34a; box-shadow: 0 0 10px #b8f34a; }

main#main { flex: 1; min-width: 0; padding: 1.25rem 1.25rem 2.5rem; max-width: 72rem; }
main#main:focus { outline: none; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }

/* Oversikt */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); margin-bottom: 1.25rem; padding: 1.5rem 1.25rem; color: var(--on-graphite);
  background: radial-gradient(520px 300px at 92% 0%, rgba(184, 243, 74, 0.28), transparent 65%), var(--graphite); border: 1px solid rgba(255, 255, 255, 0.08);
}
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 32px 32px; -webkit-mask-image: linear-gradient(90deg, transparent 35%, #000); mask-image: linear-gradient(90deg, transparent 35%, #000);
}
.hero > * { position: relative; }
.hero .date { display: inline-flex; align-items: center; gap: 8px; font-size: 0.75rem; font-weight: 700; color: #c9f27f; letter-spacing: 0.04em; text-transform: uppercase; }
.hero .date::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #b8f34a; box-shadow: 0 0 0 4px rgba(184, 243, 74, 0.18); }
.hero h1 { color: var(--on-graphite); font-size: 1.9rem; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; margin: 0.4rem 0 0.2rem; }
.hero p { margin: 0; opacity: 0.78; }
.search-big { margin-bottom: 1.5rem; }
.search-big input[type=search] { min-height: 3.5rem; font-size: 1.1rem; padding: 0.8rem 1.1rem; border-radius: var(--radius-md); }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 0.7rem 0; border-top: 1px solid var(--glass-border); }
.activity li:first-child { border-top: 0; }
.activity .when { color: var(--ink-muted); font-size: 0.85rem; }
.activity .what { font-weight: 700; }
.activity .detail { color: var(--ink-muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.empty { color: var(--ink-muted); font-style: italic; }
.shortcuts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 0.6rem; }
.shortcuts .btn { width: 100%; justify-content: flex-start; min-height: 3.25rem; background: var(--surface-2); border-color: var(--glass-border); }
.shortcuts .btn:hover { border-color: var(--brand); }

/* Tabeller */
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--glass-border); border-radius: var(--radius-md); background: var(--surface-2); }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 0.7rem 0.9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--glass-border); }
th { background: var(--surface); color: var(--ink-muted); font-size: 0.8rem; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.02); }
td.wrap { overflow-wrap: anywhere; word-break: break-word; }
.inline-forms { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.inline-forms input[type="password"] { width: 11rem; padding: 0.35rem 0.6rem; }
.inline-forms form { margin: 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 0.1rem 0.7rem; min-height: 1.65rem; border-radius: 999px; font-size: 0.82rem; font-weight: 700; border: 0; background: var(--surface-2); color: var(--ink); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--success); background: var(--success-soft); }
.badge-off { color: var(--ink-muted); background: var(--surface-2); }
.badge-info { color: var(--steel); background: var(--steel-soft); }
.badge-warn { color: var(--warning); background: var(--warning-soft); }

/* Midlertidig passord */
.secret-box { border: 1.5px solid var(--warning); background: var(--warning-soft); border-radius: var(--radius-md); padding: 1rem; margin: 1rem 0; }
.secret-box dt { font-size: 0.9rem; color: var(--warning); font-weight: 700; }
.secret-box dd { margin: 0 0 0.75rem; }
.secret-box .mono { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; user-select: all; }

.status-box { padding: 0.9rem 1rem; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--glass-border); margin-bottom: 1rem; }
.status-box.ok { border-color: var(--success); }
.status-box.pending { border-color: var(--steel); }
.status-box.failed { border-color: var(--danger); }
.status-box.none { border-color: var(--border-strong); }
.status-box h2 { margin-bottom: 0.25rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.25rem; margin: 0.5rem 0 0; }
.kv dt { color: var(--ink-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0 1rem; align-items: end; }

.pager { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 1rem; }
.pager a, .pager span { display: inline-block; min-width: 2.75rem; min-height: 2.75rem; padding: 0.55rem 0.7rem; text-align: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: transparent; color: var(--ink); text-decoration: none; }
.pager a:hover { background: var(--surface-2); }
.pager span[aria-current=page] { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; font-weight: 800; }
.pager span.gap { border: 0; background: transparent; min-width: 1rem; padding-left: 0; padding-right: 0; }

/* V2: kunder, biler og søk */
.pin {
  font-family: var(--font-mono); font-size: 2.5rem; font-weight: 700; letter-spacing: 0.4em; text-align: center; color: var(--ink);
  background: var(--surface-2); border: 2px solid var(--brand); border-radius: var(--radius-md); padding: 1rem 1rem 1rem 1.4rem; margin: 1rem 0; overflow-wrap: anywhere; user-select: all;
  box-shadow: 0 0 0 4px var(--glow);
}
.duplicate-box { color: var(--warning); background: var(--warning-soft); border: 1.5px solid rgba(252, 211, 77, 0.4); border-radius: var(--radius-md); padding: 1rem; margin: 0 0 1.25rem; }
.duplicate-box h2 { color: var(--warning); }
.duplicate-list { margin: 0; padding-left: 1.2rem; }
.duplicate-list li { margin-bottom: 0.5rem; overflow-wrap: anywhere; }
.summary { background: var(--steel-soft); border: 1px solid rgba(142, 201, 255, 0.3); border-radius: var(--radius-md); padding: 0.9rem 1rem; margin: 0 0 1.25rem; }
.summary p { margin: 0; }
.summary .kv { margin: 0; font-size: 1.1rem; }
.filter-links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }
.filter-links a {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0.4rem 1rem; border: 1.5px solid var(--border-strong); border-radius: 999px;
  background: transparent; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 0.9rem;
}
.filter-links a:hover { background: var(--surface-2); }
.filter-links a[aria-current] { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.search-form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: flex-end; }
.search-form .field { flex: 1 1 16rem; margin: 0; }
.search-form > label { flex: 1 1 100%; font-weight: 700; }
.search-form > input[type=search] { flex: 1 1 16rem; width: auto; }
.search-form > button { flex: none; }
.search-big .search-form { align-items: stretch; }
.search-big .search-form > button { min-height: 3.5rem; }
.owner-pick { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.pin-reset { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--glass-border); }
.pin-reset h3 { font-size: 1.05rem; margin: 0 0 0.5rem; }

/* Mobil */
@media (max-width: 800px) {
  .shell { flex-direction: column; align-items: stretch; min-height: 0; }
  #sidebar { width: 100%; border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, 0.06); align-self: auto; }
  html.js #menu-toggle { display: inline-flex; }
  html.js #sidebar-toggle { display: none; }
  html.js body:not(.menu-open) #sidebar { display: none; }
  main#main { padding: 1rem 1rem 2rem; }
  .topbar .who .role { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { margin-bottom: 0.4rem; }
  .pin { font-size: 2rem; letter-spacing: 0.3em; }
  .search-form > button { width: 100%; }

  /* Kortvisning for tabeller */
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  table.cards tr { border-bottom: 1px solid var(--border-strong); padding: 0.4rem 0; }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards td { border: 0; padding: 0.3rem 0.9rem; }
  table.cards td::before { content: attr(data-label); display: block; font-size: 0.75rem; color: var(--ink-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
}

@media (min-width: 720px) {
  .hero { padding: 2rem; }
  .hero h1 { font-size: 2.4rem; }
}

@media (min-width: 801px) {
  #menu-toggle { display: none !important; }
  body.sidebar-collapsed #sidebar { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  button, .btn, #sidebar a { transition: background-color 0.15s, border-color 0.15s, transform 0.08s; }
}

@media (max-width: 600px) {
  .topbar .who { display: none; }
  .topbar .brand { white-space: nowrap; font-size: 1rem; }
  .topbar .logout { padding: 0.45rem 0.7rem; white-space: nowrap; }
}

/* V5-UI1: felles forside med logo og to valg. Følger lyst og mørkt tema. */
body.start { margin: 0; color: var(--ink); background: radial-gradient(900px 520px at 100% -10%, var(--glow), transparent 62%), radial-gradient(700px 460px at 10% 110%, var(--glow), transparent 60%), var(--bg); background-attachment: fixed; }
.start-main { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.25rem; padding: 1.5rem 1rem; box-sizing: border-box; }
.start-card { width: 100%; max-width: 40rem; padding: 2rem 1.5rem; border-radius: var(--radius-lg); border: 1px solid var(--glass-border); background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(150%); backdrop-filter: blur(22px) saturate(150%); box-shadow: var(--shadow-card); }
.start-brand { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; text-align: center; margin-bottom: 1.25rem; }
.start-brand .mark { width: 56px; height: 56px; border-radius: 16px; }
.start-brand .mark svg { width: 30px; height: 30px; }
.start-brand .brand-logo { height: 64px; max-width: 240px; }
.start-brand h1 { margin: 0; font-size: clamp(1.6rem, 4vw + 1rem, 2.4rem); font-weight: 800; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.start-lead { text-align: center; color: var(--ink-muted); margin: 0 0 1.25rem; }
.start-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.choice-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 1.25rem; min-height: 9rem; border-radius: var(--radius-md); border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--ink); text-decoration: none; }
.choice-card:hover { border-color: var(--brand); color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .choice-card { transition: border-color 0.15s, transform 0.15s; }
  .choice-card:hover { transform: translateY(-2px); }
}
.choice-card .ico { width: 30px; height: 30px; color: var(--brand); }
.choice-title { font-size: 1.15rem; font-weight: 800; }
.choice-text { color: var(--ink-muted); font-size: 0.9rem; font-weight: 500; }
.start-vendor { margin: 0; text-align: center; font-size: 0.85rem; color: var(--ink-muted); }
@media (max-width: 600px) {
  .start-card { padding: 1.5rem 1rem; }
  .start-choices { grid-template-columns: 1fr; }
  .choice-card { min-height: 0; }
}

/* Logo, temabryter og filfelt */
.brand-logo { height: 40px; width: auto; max-width: 160px; object-fit: contain; display: block; padding: 4px 10px; border-radius: var(--radius-sm); background: #ffffff; }
.theme-form { margin: 0; }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.4rem 0.9rem; background: transparent; color: var(--ink);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-md); box-shadow: none;
}
.theme-toggle:hover { background: var(--surface-2); filter: none; color: var(--ink); }
.logo-preview { display: flex; align-items: center; gap: 1rem; min-height: 5rem; padding: 1rem; margin-bottom: 1rem; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--glass-border); }
.logo-preview-img { max-width: 240px; max-height: 80px; width: auto; height: auto; display: block; padding: 6px 12px; border-radius: var(--radius-sm); background: #ffffff; }
.logo-remove { margin: 1rem 0 0; }
input[type=file] {
  display: block; width: 100%; min-height: 3rem; padding: 0.55rem 0.8rem; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md);
}
input[type=file]::file-selector-button { margin-right: 1rem; padding: 0.5rem 1rem; border: 0; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
@media (max-width: 600px) {
  .theme-label { display: none; }
  .theme-toggle { padding: 0.4rem 0.7rem; }
  .brand-logo { max-width: 110px; height: 34px; }
  .brand-name { display: none; }
}

/* V3: besøk, oppgaver og merknader */
.mono { font-family: var(--font-mono); }
textarea {
  display: block; width: 100%; min-height: 6rem; padding: 0.7rem 1rem; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-md); resize: vertical;
}
textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); box-shadow: 0 0 0 4px var(--glow); }
textarea[aria-invalid=true], select[aria-invalid=true] { border-color: var(--danger); border-width: 2px; }
select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-muted); cursor: not-allowed; }

/* Skilt: lik i begge temaer */
.plate {
  display: inline-flex; align-items: stretch; max-width: 100%; overflow: hidden; background: #ffffff; color: #111111;
  border: 2px solid #111111; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); line-height: 1;
}
.plate-n { display: flex; align-items: center; justify-content: center; min-width: 1.7rem; padding: 0 0.3rem; background: #0b4fa8; color: #ffffff; font-size: 0.8rem; font-weight: 800; }
.plate-num { padding: 0.4rem 0.8rem; font-family: var(--font-mono); font-size: 1.6rem; font-weight: 800; letter-spacing: 0.06em; color: #111111; overflow-wrap: anywhere; }
.plate-sm .plate-num { padding: 0.2rem 0.5rem; font-size: 1rem; }
.plate-sm .plate-n { min-width: 1.2rem; font-size: 0.65rem; }

/* Statusmerke «Pågår» */
.badge-working { color: var(--brand); background: var(--brand-soft); }

/* Besøk: toppfelt og metadata */
.visit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: 0.75rem; }
.visit-head h1 { margin: 0; flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.visit-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; margin: 0 0 0.9rem; }
.visit-sub > * { min-width: 0; overflow-wrap: anywhere; }
.visit-meta { margin-top: 0.75rem; }
.visit-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 1rem; }
.visit-actions form { margin: 0; }
.final-box { border: 1.5px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius-md); padding: 0.9rem 1rem; margin: 0 0 1rem; }
.final-box p:last-child { margin-bottom: 0; }
.confirm-box { color: var(--warning); background: var(--warning-soft); border: 2px solid var(--warning); border-radius: var(--radius-md); padding: 1rem; margin: 1rem 0; }
.confirm-box p { color: var(--warning); font-weight: 700; }
.confirm-box .btn-secondary { color: var(--ink); }
.confirm-box .actions { margin-top: 0.5rem; }
.muted-row td { color: var(--ink-muted); }

/* Utfellbare skjema */
details.fold { border: 1px solid var(--glass-border); border-radius: var(--radius-md); background: var(--surface-2); padding: 0 0.9rem; margin: 0 0 1rem; }
details.fold > summary { display: flex; align-items: center; gap: 0.5rem; min-height: 3rem; cursor: pointer; font-weight: 700; color: var(--ink); list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 1.5px solid currentColor; font-weight: 800; line-height: 1; flex: none; }
details.fold[open] > summary::before { content: "\2013"; }
details.fold[open] > summary { border-bottom: 1px solid var(--glass-border); margin-bottom: 0.75rem; }
details.fold .fold-body { padding-bottom: 0.9rem; }
details.fold-danger > summary { color: var(--danger); }
.task-row details.fold { background: var(--surface); margin: 0.5rem 0 0; }

/* Fremdrift */
.progress-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; margin: 0 0 0.9rem; }
.progress-line .progress { flex: 1 1 10rem; }
progress.progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 0.7rem; border: 0; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
progress.progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
progress.progress::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
progress.progress::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
progress.progress-sm { height: 0.5rem; max-width: 9rem; margin-top: 0.3rem; }

/* Oppgaver */
.task-list { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: 0.6rem; }
.task-row { display: flex; align-items: flex-start; gap: 0.9rem; padding: 0.7rem 0.9rem; background: var(--surface-2); border: 1px solid var(--glass-border); border-radius: var(--radius-md); }
.task-row.is-done { border-color: var(--success); }
.task-check-form { margin: 0; flex: none; }
.task-check {
  width: 3rem; height: 3rem; min-height: 3rem; padding: 0; border-radius: 50%; background: transparent; color: var(--on-brand);
  border: 2.5px solid var(--border-strong); box-shadow: none;
}
.task-check:hover { background: var(--brand-soft); border-color: var(--brand); filter: none; color: var(--on-brand); }
.task-check.is-done { background: var(--brand-bright); border-color: var(--brand-bright); }
.task-check.is-done:hover { filter: brightness(1.07); background: var(--brand-bright); }
.task-check svg { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.task-check:disabled { cursor: default; opacity: 0.6; }
.task-body { flex: 1 1 auto; min-width: 0; }
.task-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; min-height: 3rem; font-weight: 700; overflow-wrap: anywhere; }
.task-row.is-done .task-name > .task-title { text-decoration: line-through; color: var(--ink-muted); }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.9rem; margin: -0.3rem 0 0.4rem; color: var(--ink-muted); font-size: 0.85rem; }
.task-meta a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.task-notes { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.add-task { padding-top: 1rem; border-top: 1px solid var(--glass-border); }
.add-task h3 { font-size: 1.05rem; margin: 0 0 0.6rem; }

/* Merknader */
.note-list { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: 0.6rem; }
.note { padding: 0.7rem 0.9rem; background: var(--surface); border: 1px solid var(--glass-border); border-left: 4px solid var(--warning); border-radius: var(--radius-sm); }
.task-row .note { background: var(--surface-2); }
.note.is-customer { border-left-color: var(--steel); }
.note-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; font-size: 0.85rem; color: var(--ink-muted); }
.note-body { margin: 0.4rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.radio-row { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }

/* Historikk */
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li { position: relative; padding: 0.6rem 0 0.8rem 1.25rem; border-left: 2px solid var(--border-strong); margin-left: 0.4rem; }
.history-list li::before { content: ""; position: absolute; left: -6px; top: 0.95rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.history-what { font-weight: 700; }
.history-when { color: var(--ink-muted); font-size: 0.85rem; }
.history-changes { list-style: none; margin: 0.3rem 0 0; padding: 0; font-size: 0.9rem; color: var(--ink-muted); overflow-wrap: anywhere; }
.history-changes strong { color: var(--ink); font-weight: 600; }

/* Besøk i lister og på oversikten */
.visit-rows { list-style: none; margin: 0 0 0.75rem; padding: 0; }
.visit-rows li { border-top: 1px solid var(--glass-border); }
.visit-rows li:first-child { border-top: 0; }
.visit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.9rem; min-height: 3rem; padding: 0.55rem 0; color: var(--ink); text-decoration: none; font-weight: 500; }
.visit-row:hover { color: var(--brand-ink); }
.visit-row .mono { font-weight: 800; }
.visit-row .grow { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.visit-row .progress-text { color: var(--ink-muted); font-size: 0.85rem; white-space: nowrap; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 0.6rem; }
.card-head h2 { margin: 0; }
.cancel-reason { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.2rem 0 0; }

@media (max-width: 800px) {
  .plate-num { font-size: 1.4rem; padding: 0.35rem 0.6rem; }
  .task-check { width: 3.25rem; height: 3.25rem; min-height: 3.25rem; }
  .task-row { gap: 0.7rem; padding: 0.65rem 0.7rem; }
  .visit-actions > *, .visit-actions form > button { width: 100%; }
  .confirm-box .actions > *, .confirm-box .actions form > button { width: 100%; }
  progress.progress-sm { max-width: none; }
}

/* V3 retting: ankerhopp, trykkflater, synlighetsvalg, merknadsknapp, kompakte besøkskort */
#visit-heading, #edit-heading, #tasks-heading, #notes-heading, #history-heading { scroll-margin-top: 6rem; }
.card .notice { margin: 0 0 0.9rem; }
.notice p { margin: 0 0 0.4rem; font-weight: 600; }
.notice p:last-child { margin-bottom: 0; }

/* Lenker med minst 44 px trykkflate (utseendet er omtrent uendret) */
.link-touch { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0.4rem 0.35rem; margin: -0.4rem -0.35rem; }
.visit-sub .link-touch { margin: 0; padding: 0.4rem 0.2rem; }

/* Radiovalg og avkrysning der hele raden er trykkflate */
.choice-row { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; }
.choice {
  display: flex; align-items: center; gap: 0.75rem; min-height: 3rem; margin: 0; padding: 0.5rem 0.9rem; box-sizing: border-box;
  font-size: 1rem; font-weight: 500; letter-spacing: 0; color: var(--ink); cursor: pointer;
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface);
}
.field label.choice { display: flex; margin: 0; font-size: 1rem; font-weight: 500; letter-spacing: 0; }
.choice input { width: 1.5rem; height: 1.5rem; margin: 0; flex: none; accent-color: var(--brand-bright); cursor: pointer; }
.choice:hover { background: var(--surface-2); }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice:focus-within { outline: 2px solid var(--brand); outline-offset: 1px; }
.field > .choice { display: flex; width: 100%; max-width: 24rem; }

/* Merker på oppgaver og knapp på merknader */
.task-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; margin: -0.2rem 0 0.5rem; }
.task-name { min-height: 2.25rem; }
.note-action { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; margin: 0.6rem 0 0; }
.note-action .hint { margin: 0; }
.note-action .btn-small { min-height: 2.75rem; }

/* Besøksoversikt: «Åpne besøk» vises bare i kortvisningen (mobil) */
table.visit-cards th.col-open, table.visit-cards td.cell-open { display: none; }
.btn-open { min-height: 3rem; }

@media (max-width: 800px) {
  .choice-row { flex-direction: column; align-items: stretch; }
  .choice-row .choice { width: 100%; }
  .field > .choice { max-width: none; }
  .note-action .btn-small { width: 100%; }

  table.visit-cards tr { display: flex; flex-wrap: wrap; align-items: center; gap: 0.1rem 0.7rem; padding: 0.6rem 0.9rem; margin: 0; }
  table.visit-cards td { width: auto; min-width: 0; padding: 0; overflow-wrap: anywhere; }
  table.visit-cards td::before { display: none; }
  table.visit-cards .cell-reg { order: 1; font-size: 1.1rem; }
  table.visit-cards .cell-status { order: 2; margin-left: auto; }
  table.visit-cards .cell-car { order: 3; flex: 1 1 100%; font-weight: 600; }
  table.visit-cards .cell-title { order: 4; flex: 1 1 100%; }
  table.visit-cards .cell-resp { order: 5; font-size: 0.85rem; color: var(--ink-muted); }
  table.visit-cards .cell-resp::before { display: inline; content: "Ansvarlig: "; margin: 0; font-size: inherit; font-weight: 600; text-transform: none; letter-spacing: 0; color: inherit; }
  table.visit-cards .cell-created { order: 6; font-size: 0.85rem; color: var(--ink-muted); }
  table.visit-cards .cell-created::before { display: inline; content: "Opprettet: "; margin: 0; font-size: inherit; font-weight: 600; text-transform: none; letter-spacing: 0; color: inherit; }
  table.visit-cards .cell-progress { order: 7; flex: 1 1 100%; font-size: 0.9rem; margin-top: 0.2rem; }
  table.visit-cards td.cell-open { order: 8; display: block; flex: 1 1 100%; margin-top: 0.4rem; }
  table.visit-cards td.cell-open .btn { width: 100%; min-height: 3rem; }
  table.visit-cards progress.progress-sm { margin-top: 0.2rem; }
}

/* V4: bilder på besøk. Miniatyrer i rutenett, to kolonner på mobil. Ingen inline-stil (CSP). */
.image-grid { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.9rem; }
.image-card { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; padding: 0.6rem; border: 1px solid var(--glass-border); border-radius: var(--radius-md); background: var(--surface-2); }
.image-thumb { display: block; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.image-thumb img { display: block; width: 100%; height: auto; }
.image-thumb:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.image-meta .hint { overflow-wrap: anywhere; }
.image-caption { margin: 0.25rem 0; overflow-wrap: anywhere; }
.image-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.image-visibility { margin: 0.5rem 0; }
.image-card details.fold { background: var(--surface); margin: 0; }
.image-card .btn-danger { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.image-confirm { display: block; max-width: 100%; height: auto; border-radius: var(--radius-sm); }
@media (max-width: 480px) {
  .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .image-card { padding: 0.45rem; }
}
/* En åpen «Endre»-boks får hele bredden, så skjemaene får plass også i to-kolonners rutenett på mobil. */
.image-card:has(details[open]) { grid-column: 1 / -1; }
.image-card .fold-body input[type="text"] { width: 100%; min-width: 0; }
.image-card .fold-body button, .image-card .fold-body .btn { max-width: 100%; white-space: normal; }
.image-card .fold-body form + form, .image-card .fold-body form + a { margin-top: 0.6rem; }
.image-card .fold-body .btn-small { width: 100%; }

/* V5-UI2: kompakt oversikt for ansatte */
.hero-compact { padding: 1rem 1.25rem; margin-bottom: 1rem; }
.hero-compact h1 { font-size: 1.5rem; margin: 0.3rem 0 0; }
.dash-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: stretch; margin-bottom: 1.25rem; }
.dash-actions .search-big { flex: 1 1 20rem; margin: 0; }
.dash-actions .btn-new { flex: none; min-height: 3.5rem; padding: 0.6rem 1.5rem; font-size: 1.05rem; }
.visit-row .when { color: var(--ink-muted); font-size: 0.85rem; white-space: nowrap; }
.card-head > a { display: inline-flex; align-items: center; min-height: 2.75rem; }
@media (max-width: 600px) {
  .dash-actions .btn-new { flex: 1 1 100%; }
}

/* V5-UI3: historikk i modal (dialog-element: Escape, fokusfelle og bakgrunn følger nettleseren) */
.history-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.history-bar p { margin: 0; }
dialog.modal { padding: 0; border: 1px solid var(--glass-border); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); width: min(44rem, calc(100vw - 1.5rem)); max-height: min(85vh, 85dvh); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.62); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--glass-border); flex: none; }
.modal-head h2 { margin: 0; }
.modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1rem 1.25rem 1.25rem; }
.modal-body > .hint { margin-top: 0; }
html:has(dialog.modal[open]:not(.modal-static)) { overflow: hidden; }
html:not(.js) [data-modal-open] { display: none; }
html:not(.js) dialog.modal, dialog.modal.modal-static { display: block; position: static; width: auto; max-height: none; margin: 0 0 1.25rem; box-shadow: none; }
@media (max-width: 600px) {
  dialog.modal { width: calc(100vw - 1rem); max-height: 90vh; max-height: 90dvh; border-radius: var(--radius-md); }
  .modal-head, .modal-body { padding-left: 1rem; padding-right: 1rem; }
}

/* V5: kundeportal */
body.portal { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
.portal-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 1rem; border-bottom: 1px solid var(--glass-border); background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%); }
.portal-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; font-weight: 800; color: var(--ink); text-decoration: none; }
.portal-brand:hover { color: var(--ink); }
.portal-brand { min-height: 2.75rem; }
.portal-brand .mark { width: 32px; height: 32px; }
.portal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-tools { display: flex; align-items: center; gap: 0.5rem; }
.portal-tools form { margin: 0; }
.portal-tools .logout { white-space: nowrap; color: var(--ink); background: transparent; border-color: var(--border-strong); box-shadow: none; min-height: 2.75rem; padding: 0.4rem 1rem; }
.portal-tools .logout:hover { background: var(--surface-2); filter: none; color: var(--ink); }
.portal-main { flex: 1 0 auto; width: 100%; max-width: 46rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; box-sizing: border-box; }
.portal-main:focus { outline: none; }
.portal-card { max-width: 28rem; margin: 1rem auto; padding: 1.5rem; }
.portal-foot { padding: 1rem; text-align: center; color: var(--ink-muted); font-size: 0.85rem; }
.portal-foot p { margin: 0; }
.portal-cars, .portal-visits { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.portal-cars .card, .portal-visits .card { margin: 0; }
.portal-car-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }
.portal-car-head h2 { margin: 0; }
.portal-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; }
.portal-facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.35rem 1rem; margin: 0; }
.portal-facts dt { color: var(--ink-muted); font-weight: 600; }
.portal-facts dd { margin: 0; font-weight: 600; }
.portal-tasks, .portal-notes { list-style: none; margin: 0; padding: 0; }
.portal-tasks li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; padding: 0.6rem 0; border-top: 1px solid var(--glass-border); }
.portal-tasks li:first-child, .portal-notes li:first-child { border-top: 0; }
.portal-task-state { width: 1.4rem; text-align: center; font-weight: 800; }
.portal-task-state.is-done { color: var(--success); }
.portal-task-state.is-open { color: var(--ink-muted); }
.portal-task-name { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.portal-notes li { padding: 0.7rem 0; border-top: 1px solid var(--glass-border); }
.portal-tasks .portal-task-notes { flex: 1 1 100%; list-style: none; margin: 0.2rem 0 0 2rem; padding: 0; }
.portal-tasks .portal-task-notes li { display: block; padding: 0.35rem 0 0.35rem 0.75rem; border-top: 0; border-left: 3px solid var(--glass-border); margin-top: 0.3rem; }
.portal-tasks .portal-task-notes .portal-note-body { margin: 0 0 0.15rem; }
.portal-note-body { margin: 0 0 0.25rem; overflow-wrap: anywhere; }
.portal-brand .brand-logo { height: 34px; max-width: 120px; }
@media (max-width: 600px) {
  .portal-tools .theme-label { display: none; }
  .portal-top { padding-left: 0.75rem; padding-right: 0.75rem; }
  .portal-tools .logout { padding: 0.4rem 0.75rem; }
}

/* ==========================================================================
   V6-UI: nettbrett og mobil først (desktop sjelden).
   - Under 1025 px: menyen er en skuff (overlay) i stedet for fast sidemeny, så nettbrett får hele bredden.
   - Under 1025 px: alle tabeller med class="cards" vises som kompakte kort (2 kolonner fra 600 px).
   - Registreringsnummer vises som skilt i lister. Hele kortet er trykkflate når første celle har en lenke.
   - Oversikten: søkefelt og Søk-knapp på én linje, besøksrader som små kort.
   Kun CSS (ingen inline-stil, CSP uendret).
   ========================================================================== */

/* Skilt-stil på registreringsnummer i lister */
.table-wrap a.mono, .visit-row .mono, .visit-sub a.mono {
  display: inline-flex; align-items: center; min-height: 2rem; padding: 0.15rem 0.55rem 0.15rem 1.55rem; position: relative;
  background: #ffffff; color: #111111; border: 2px solid #111111; border-radius: 7px; text-decoration: none;
  font-family: var(--font-mono); font-weight: 800; letter-spacing: 0.06em; line-height: 1; white-space: nowrap; overflow: hidden;
}
.table-wrap a.mono::before, .visit-row .mono::before, .visit-sub a.mono::before {
  content: "N"; position: absolute; left: 0; top: 0; bottom: 0; width: 1.1rem; display: grid; place-items: end center; padding-bottom: 0.2rem;
  background: #0b4fa8; color: #ffffff; font-family: var(--font-sans); font-size: 0.6rem; font-weight: 800; letter-spacing: 0;
}
.table-wrap a.mono:hover, .visit-row:hover .mono { color: #111111; }
.table-wrap a.mono strong { font-weight: 800; }

/* Oversikt: besøksrader som små kort */
.visit-rows { display: grid; gap: 0.5rem; }
.visit-rows li, .visit-rows li:first-child { border-top: 0; }
.visit-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.25rem 0.8rem;
  min-height: 3.5rem; padding: 0.65rem 0.9rem; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--glass-border);
}
.visit-row:hover { border-color: var(--brand); color: var(--ink); }
.visit-row .grow { font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.visit-row::after { content: ""; width: 0.55rem; height: 0.55rem; border-right: 2px solid var(--ink-muted); border-top: 2px solid var(--ink-muted); transform: rotate(45deg); margin-right: 0.2rem; }
.visit-row .progress-text, .visit-row .when { grid-column: 2; }
.visit-row::after { grid-column: 3; grid-row: 1 / span 2; }
.dash-actions .search-form { flex-wrap: nowrap; }
.dash-actions .search-big { min-width: 0; }
.dash-actions .search-form > input[type=search] { flex: 1 1 auto; width: 0; min-width: 0; }
.dash-actions .search-form > button { width: auto; flex: none; padding-left: 1.2rem; padding-right: 1.2rem; }

/* Meny som skuff og kortlister på nettbrett og mobil */
@media (max-width: 1024px) {
  html.js #menu-toggle { display: inline-flex !important; }
  html.js #sidebar-toggle { display: none; }
  .shell { display: block; min-height: 0; }
  html.js #sidebar {
    display: block; position: fixed; z-index: 30; top: 3.5rem; left: 0; bottom: 0; width: min(18rem, 85vw); overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.08); border-bottom: 0; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    transform: translateX(-105%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s;
  }
  html.js body.menu-open #sidebar { transform: none; visibility: visible; }
  html.js body.menu-open::after { content: ""; position: fixed; inset: 3.5rem 0 0 0; z-index: 25; background: rgba(0, 0, 0, 0.55); }
  html.js body.sidebar-collapsed #sidebar { display: block; }
  main#main { max-width: none; padding: 1rem 1.25rem 2.5rem; }

  /* Kortvisning for alle tabeller med class="cards" */
  .table-wrap:has(table.cards) { overflow: visible; border: 0; background: transparent; border-radius: 0; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  table.cards tbody { display: grid; grid-template-columns: 1fr; gap: 0.6rem; }
  table.cards tr, table.cards tr:last-child {
    position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.7rem; margin: 0;
    padding: 0.8rem 0.95rem; background: var(--surface-2); border: 1px solid var(--glass-border); border-radius: var(--radius-md);
  }
  table.cards tr:hover td { background: transparent; }
  table.cards tr:has(td:first-child a):hover { border-color: var(--brand); }
  table.cards td { width: auto; min-width: 0; padding: 0; border: 0; flex: 1 1 100%; order: 4; overflow-wrap: anywhere; }
  table.cards tr:last-child td { border: 0; padding: 0; }
  table.cards td::before { display: none; }
  /* Første celle: tittel. Status: øverst til høyre. Knapper: nederst. */
  table.cards td:first-child { order: 1; flex: 0 1 auto; font-size: 1.05rem; font-weight: 700; }
  table.cards td:has(> .badge) { order: 2; flex: none; margin-left: auto; }
  table.cards td:nth-child(2):not(:has(> .badge)) { order: 3; font-weight: 600; }
  table.cards td:nth-child(n+3):not(:has(> .badge)):not(:has(.btn)) { font-size: 0.88rem; color: var(--ink-muted); }
  table.cards td:nth-child(n+3):not(:has(> .badge)):not(:has(.btn))::before {
    display: inline; content: attr(data-label) ": "; font-size: inherit; font-weight: 600; text-transform: none; letter-spacing: 0; color: inherit;
  }
  table.cards td:has(.btn) { order: 9; margin-top: 0.35rem; }
  table.cards td:has(.btn) .actions { flex-wrap: nowrap; }
  table.cards td:has(.btn) .btn { flex: 1 1 0; width: 100%; min-height: 2.9rem; }
  /* Hele kortet er trykkflate når første celle har en lenke; andre lenker og knapper ligger over */
  table.cards td:first-child a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-md); }
  table.cards td:not(:first-child) a, table.cards td:not(:first-child) button { position: relative; z-index: 1; }

  /* Besøkslisten: samme kort, med «Åpne besøk» som rolig knapp (hele kortet er lenke) */
  table.visit-cards tr { padding: 0.8rem 0.95rem; }
  table.visit-cards td.cell-open { display: none; }
  table.visit-cards .cell-reg { order: 1; font-size: 1rem; flex: 0 1 auto; }
  table.visit-cards .cell-status { order: 2; margin-left: auto; flex: none; }
  table.visit-cards .cell-car { order: 3; flex: 1 1 100%; font-weight: 700; font-size: 1rem; color: var(--ink); }
  table.visit-cards .cell-title { order: 4; flex: 1 1 100%; font-size: 0.95rem; color: var(--ink); }
  table.visit-cards .cell-title::before, table.visit-cards .cell-car::before, table.visit-cards .cell-progress::before { display: none !important; }
  table.visit-cards .cell-resp { order: 5; flex: 1 1 100%; }
  table.visit-cards .cell-resp::before { content: "Ansvarlig: " !important; }
  table.visit-cards .cell-created { order: 6; flex: 1 1 100%; }
  table.visit-cards .cell-created::before { content: "Opprettet: " !important; }
  table.visit-cards .cell-progress { order: 7; flex: 1 1 100%; margin-top: 0.3rem; font-size: 0.88rem; color: var(--ink-muted); }
  table.visit-cards progress.progress-sm { max-width: none; }
}

/* Nettbrett: to kort i bredden */
@media (min-width: 600px) and (max-width: 1024px) {
  table.cards tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table.cards tr { align-content: flex-start; height: 100%; }
}

/* Mobil: litt strammere */
@media (max-width: 600px) {
  main#main { padding: 0.9rem 0.9rem 2rem; }
  .card { padding: 1rem; border-radius: 20px; }
  .card-head h2 { font-size: 1.05rem; }
  .page-head h1 { font-size: 1.5rem; }
  .visit-row { padding: 0.6rem 0.75rem; gap: 0.2rem 0.6rem; }
  .visit-row .grow { font-size: 0.95rem; }
  .dash-actions { gap: 0.6rem; }
  .filter-links { flex-wrap: nowrap; overflow-x: auto; margin-left: -0.9rem; margin-right: -0.9rem; padding: 0 0.9rem 0.2rem; scrollbar-width: none; }
  .filter-links::-webkit-scrollbar { display: none; }
  .filter-links a { flex: none; }
}

/* Bilhistorikk (P2 steg 2): ett kort per besøk, med oppgavene under. Fungerer likt på PC og mobil (ingen tabell). */
.visit-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.visit-entry { border: 1px solid var(--glass-border); border-radius: var(--radius-md); background: var(--surface-2); padding: 0.9rem 1rem; }
.visit-entry.is-cancelled { opacity: 0.8; }
.visit-entry-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.5rem 0.9rem; }
.visit-entry-main { flex: 1 1 14rem; min-width: 0; }
.visit-entry-main p { margin: 0; }
.visit-entry-date { font-size: 0.85rem; color: var(--ink-muted); font-weight: 600; }
.visit-entry-title { margin: 0.1rem 0 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.visit-entry-status { flex: none; }
.visit-entry-meta { margin: 0.5rem 0 0; font-size: 0.88rem; color: var(--ink-muted); overflow-wrap: anywhere; }
.history-tasks { list-style: none; margin: 0.65rem 0 0; padding: 0.55rem 0 0; border-top: 1px solid var(--glass-border); display: grid; gap: 0.4rem; }
.history-task { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.6rem; }
.task-state { display: inline-flex; align-items: center; gap: 0.3rem; flex: none; min-width: 8.4rem; font-size: 0.85rem; font-weight: 700; }
.task-state.is-done { color: var(--success); }
.task-state.is-open { color: var(--danger); }
.task-icon { width: 1.1rem; height: 1.1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; align-self: center; }
.history-task-name { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.history-more { margin-top: 0.3rem; }
.history-more > summary { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; cursor: pointer; font-weight: 700; color: var(--ink); list-style: none; }
.history-more > summary::-webkit-details-marker { display: none; }
.history-more > summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 1.5px solid currentColor; font-weight: 800; line-height: 1; flex: none; }
.history-more[open] > summary::before { content: "\2013"; }
.history-more .when-open { display: none; }
.history-more[open] .when-open { display: inline; }
.history-more[open] .when-closed { display: none; }
.history-more .history-tasks { margin-top: 0.1rem; padding-top: 0; border-top: 0; }
@media (max-width: 600px) {
  .visit-entry { padding: 0.8rem 0.85rem; }
  .visit-entry-head .btn { width: 100%; min-height: 2.9rem; }
  .task-state { min-width: 0; }
  .history-task-name { flex-basis: 100%; }
}

/* P2 steg 3c: faner under Innstillinger. Vanlige lenker (ingen skript). Rulles sidelengs på smale skjermer, og hvert mål er minst 44 px høyt. */
.settings-tabs { margin: 0 0 1.25rem; border-bottom: 1px solid var(--border); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.settings-tabs ul { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; min-width: max-content; }
.settings-tabs a { display: flex; align-items: center; min-height: 2.75rem; padding: 0.5rem 1rem; color: var(--ink-muted); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent; border-radius: var(--radius-md) var(--radius-md) 0 0; white-space: nowrap; }
.settings-tabs a:hover { color: var(--ink); background: var(--surface-2); }
.settings-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brand); }
@media (max-width: 600px) {
  .settings-tabs { margin-left: -1rem; margin-right: -1rem; padding: 0 1rem; }
}

/* ==========================================================================
   V7-UI: eget lyst tema, tettere layout, faner og besøkskort.
   ========================================================================== */

/* 1. Lyst tema med egne farger: mørk grønn i stedet for neon-lime, lys sidemeny og lys hilsen */
html[data-theme="light"] {
  --bg: #f4f5f2; --surface: #ffffff; --surface-2: #f0f2ee; --glass: #ffffff; --glass-border: #e3e7e0; --border: #e3e7e0;
  --brand: #3f6212; --brand-bright: #3f6212; --brand-ink: #365314; --brand-soft: #eef6dc; --on-brand: #ffffff;
  --glow: rgba(63, 98, 18, 0.05); --graphite: #ffffff; --on-graphite: #0f1411;
  --shadow-card: 0 1px 2px rgba(15, 20, 17, 0.06); --shadow-glow: 0 1px 2px rgba(15, 20, 17, 0.12);
  --focus: 3px solid #3f6212;
}
html[data-theme="light"] .card, html[data-theme="light"] .topbar { -webkit-backdrop-filter: none; backdrop-filter: none; }
html[data-theme="light"] #sidebar { border-right-color: var(--border); }
html[data-theme="light"] #sidebar a { color: var(--ink); opacity: 0.8; }
html[data-theme="light"] #sidebar a:hover { background: var(--surface-2); color: var(--ink); }
html[data-theme="light"] #sidebar a[aria-current=page] { opacity: 1; background: var(--brand-soft); color: var(--brand); }
html[data-theme="light"] #sidebar a[aria-current=page]::after { background: var(--brand); box-shadow: none; }
html[data-theme="light"] .hero { background: linear-gradient(135deg, #eef6dc, #ffffff 70%); border-color: var(--border); }
html[data-theme="light"] .hero::before { background-image: linear-gradient(rgba(15, 20, 17, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(15, 20, 17, 0.05) 1px, transparent 1px); }
html[data-theme="light"] .hero .date { color: var(--brand); }
html[data-theme="light"] .hero .date::before { background: var(--brand); box-shadow: 0 0 0 4px rgba(63, 98, 18, 0.15); }
html[data-theme="light"] .mark { color: #ffffff; }
html[data-theme="light"] body.menu-open::after { background: rgba(15, 20, 17, 0.35); }

/* 2. Tettere: mindre luft i kort, overskrifter og lister */
h1 { font-size: 1.4rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.05rem; margin-bottom: 0.4rem; }
p { margin-bottom: 0.6rem; }
.card { padding: 1rem 1.1rem; margin-bottom: 0.85rem; border-radius: 18px; }
.card-head { margin-bottom: 0.45rem; }
.page-head { margin-bottom: 0.7rem; }
main#main { padding-top: 0.9rem; }
.hero-compact { padding: 0.8rem 1.1rem; margin-bottom: 0.75rem; }
.hero-compact h1 { font-size: 1.3rem; margin-top: 0.15rem; }
.dash-actions { margin-bottom: 0.85rem; gap: 0.6rem; }
.search-big input[type=search], .dash-actions .btn-new, .search-big .search-form > button { min-height: 3rem; }
.field { margin-bottom: 0.75rem; }
.filter-links { margin-bottom: 0.7rem; }
.filter-links a { min-height: 2.5rem; padding: 0.3rem 0.9rem; }
.visit-row { min-height: 3.1rem; padding: 0.5rem 0.8rem; }
.visit-rows { gap: 0.4rem; }
/* Nøkkel/verdi side ved side også på mobil (halverer høyden på «Om besøket», «Bildata» osv.) */
.kv { grid-template-columns: minmax(6.5rem, 38%) 1fr; gap: 0.25rem 0.9rem; }
@media (max-width: 800px) { .kv { grid-template-columns: minmax(6.5rem, 38%) 1fr; } .kv dd { margin-bottom: 0; } }
.kv dt { font-size: 0.9rem; -webkit-hyphens: auto; hyphens: auto; overflow-wrap: anywhere; }
/* Knappene på besøket ved siden av hverandre */
@media (max-width: 800px) {
  .visit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .visit-actions > *, .visit-actions form > button { width: 100%; }
}

/* 3. Oppgaver: kompakt rad, merknadsknappen som liten lenke-knapp */
.task-list { gap: 0.45rem; margin-bottom: 0.9rem; }
.task-row { padding: 0.55rem 0.7rem; gap: 0.7rem; align-items: flex-start; }
.task-check { width: 2.75rem; height: 2.75rem; min-height: 2.75rem; }
.task-check svg { width: 1.35rem; height: 1.35rem; }
.task-name { min-height: 0; padding-top: 0.15rem; }
.task-badges { margin: 0.15rem 0 0.2rem; }
.task-badges .badge { min-height: 1.4rem; font-size: 0.75rem; padding: 0 0.55rem; }
.task-meta { margin: 0; gap: 0 0.8rem; }
.task-meta a { min-height: 2.4rem; }
.task-row details.fold { background: transparent; border: 0; padding: 0; margin: 0; }
.task-row details.fold > summary { min-height: 2.4rem; font-size: 0.88rem; color: var(--brand); gap: 0.4rem; }
.task-row details.fold > summary::before { width: 1.1rem; height: 1.1rem; font-size: 0.8rem; }
.task-row details.fold[open] { background: var(--surface); border: 1px solid var(--glass-border); padding: 0 0.7rem; margin-top: 0.3rem; }
.task-notes { margin-top: 0.3rem; gap: 0.35rem; }
.note { padding: 0.5rem 0.75rem; }
.note-body { margin-top: 0.2rem; }
@media (max-width: 800px) { .task-check { width: 2.75rem; height: 2.75rem; min-height: 2.75rem; } .task-row { padding: 0.55rem 0.6rem; } }

/* 4. Besøkskort i bilhistorikken: status tydelig, «Ikke fullført» gult (ikke rødt), knapp til høyre */
.visit-history { gap: 0.5rem; }
.visit-entry { padding: 0.7rem 0.85rem; }
.visit-entry-head { gap: 0.3rem 0.7rem; align-items: center; }
.visit-entry-title { font-size: 1rem; }
.visit-entry-meta { margin-top: 0.3rem; font-size: 0.83rem; }
.history-tasks { margin-top: 0.45rem; padding-top: 0.4rem; gap: 0.15rem; }
.history-task { align-items: center; min-height: 1.9rem; }
.task-state { min-width: 0; padding: 0.1rem 0.55rem 0.1rem 0.4rem; border-radius: 999px; font-size: 0.75rem; }
.task-state.is-done { color: var(--success); background: var(--success-soft); }
.task-state.is-open { color: var(--warning); background: var(--warning-soft); }
.task-icon { width: 0.9rem; height: 0.9rem; }
.history-task-name { flex: 1 1 auto; font-size: 0.95rem; }
@media (max-width: 600px) {
  .visit-entry-head .btn { width: auto; min-height: 2.6rem; margin-left: auto; }
  .history-task-name { flex-basis: auto; }
}
/* Fullført/annullert i besøkslistene: fullført turkis, annullert dempet */
.visit-entry .badge-info, table.visit-cards .badge-info { color: var(--success); background: var(--success-soft); }

/* 5. Innstillinger: faner som segmentkontroll som kan sveipes */
.settings-tabs { border-bottom: 0; margin-bottom: 0.9rem; padding: 0; }
.settings-tabs ul { gap: 0.25rem; padding: 0.25rem; background: var(--surface-2); border: 1px solid var(--glass-border); border-radius: 14px; width: max-content; max-width: 100%; }
.settings-tabs a { min-height: 2.6rem; padding: 0.4rem 0.95rem; border: 0; border-radius: 10px; font-size: 0.92rem; color: var(--ink-muted); }
.settings-tabs a:hover { background: transparent; color: var(--ink); }
.settings-tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); font-weight: 700; }
html:not([data-theme="light"]) .settings-tabs a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); box-shadow: none; }
@media (max-width: 600px) {
  .settings-tabs { margin-left: -0.9rem; margin-right: -0.9rem; padding: 0 0.9rem; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .settings-tabs ul { max-width: none; }
}

/* 6. Mobil: enda strammere */
@media (max-width: 600px) {
  main#main { padding: 0.75rem 0.75rem 1.75rem; }
  .card { padding: 0.85rem 0.9rem; border-radius: 16px; }
  .topbar { min-height: 3.25rem; padding: 0.35rem 0.75rem; }
  .page-head h1 { font-size: 1.3rem; }
  .hint { font-size: 0.82rem; }
}

/* V8-UI: fire nøkkeltall på oversikten. 2×2 på mobil, 4 i bredden fra 720 px. */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; margin: 0 0 0.85rem; }
.stat { display: grid; gap: 0.15rem; align-content: start; min-height: 6.5rem; padding: 0.8rem 0.9rem; border-radius: 16px; text-decoration: none; color: var(--ink); background: var(--glass); border: 1px solid var(--glass-border); box-shadow: var(--shadow-card); }
.stat:hover { color: var(--ink); border-color: var(--brand); }
.stat-label { display: flex; align-items: center; gap: 0.4rem; font-size: 0.82rem; font-weight: 700; color: var(--ink-muted); }
.stat-label .ico { width: 16px; height: 16px; }
.stat-value { font-size: 2rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-meta { font-size: 0.8rem; font-weight: 600; color: var(--ink-muted); overflow-wrap: anywhere; }
.stat-meta .mono { font-weight: 800; color: var(--ink); }
.stat-meta.is-warn { color: var(--warning); }
.stat-primary { background: var(--brand-bright); border-color: transparent; color: var(--on-brand); box-shadow: var(--shadow-glow); }
.stat-primary:hover { color: var(--on-brand); filter: brightness(1.05); }
.stat-primary .stat-label, .stat-primary .stat-meta { color: var(--on-brand); opacity: 0.8; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; } .stat-value { font-size: 2.2rem; } }
