:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe2e7;
  --text: #1a1d23;
  --muted: #5d6573;
  --accent: #1f4fd1;
  --accent-text: #ffffff;
  --accent-soft: #e6ecfb;
  --ok: #17803d;
  --ok-soft: #e3f4e8;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --svv: #2b6cb0;
  --bt: #c2410c;
  --plate-bg: #ffffff;
  --plate-text: #111;
  --plate-eu: #003399;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1e222b;
    --border: #2b303b;
    --text: #e7e9ee;
    --muted: #9aa3b2;
    --accent: #6d95ff;
    --accent-text: #0b1020;
    --accent-soft: #1c2742;
    --ok: #4ade80;
    --ok-soft: #14301f;
    --warn: #fbbf24;
    --warn-soft: #3a2c0c;
    --bad: #f87171;
    --bad-soft: #3b1514;
    --svv: #7fb2ec;
    --bt: #fb923c;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a21; --surface-2: #1e222b; --border: #2b303b; --text: #e7e9ee; --muted: #9aa3b2;
  --accent: #6d95ff; --accent-text: #0b1020; --accent-soft: #1c2742; --ok: #4ade80; --ok-soft: #14301f;
  --warn: #fbbf24; --warn-soft: #3a2c0c; --bad: #f87171; --bad-soft: #3b1514; --svv: #7fb2ec; --bt: #fb923c;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
[hidden] { display: none !important; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Top bar + plate search */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar__inner { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.search { display: flex; gap: 8px; margin-left: auto; flex: 1 1 320px; max-width: 460px; }
.plate-input {
  display: flex; align-items: stretch; flex: 1; min-width: 0;
  border: 2px solid #222; border-radius: 6px; overflow: hidden; background: var(--plate-bg);
}
.plate-input:focus-within { outline: 3px solid var(--accent); outline-offset: 1px; }
.plate-input__eu {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  background: var(--plate-eu); color: #fff; font-weight: 700; font-size: 12px; padding: 4px 7px 3px; gap: 2px;
}
.plate-input__flag {
  width: 16px; height: 11px; border-radius: 1px;
  background:
    linear-gradient(90deg, transparent 4px, #fff 4px, #fff 5px, #00205b 5px, #00205b 7px, #fff 7px, #fff 8px, transparent 8px),
    linear-gradient(0deg, transparent 4px, #fff 4px, #fff 5px, #00205b 5px, #00205b 6px, #fff 6px, #fff 7px, transparent 7px),
    #ba0c2f;
}
.plate-input input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--plate-text);
  font: 700 22px/1 "DIN Alternate", "Arial Narrow", system-ui, sans-serif; letter-spacing: 2px;
  text-transform: uppercase; padding: 8px 10px;
}
.plate-input input::placeholder { color: #9aa0a8; }
.btn {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 8px; padding: 0 14px; min-height: 40px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { filter: brightness(.97); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); padding: 0 20px; flex: none; }
.btn--small { min-height: 32px; padding: 0 10px; font-size: 13px; }

/* Welcome + history */
.welcome { padding: 48px 0 24px; max-width: 760px; }
.welcome h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.2; margin: 0 0 12px; }
.history { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.history h2 { width: 100%; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 4px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 14px;
}
.chip:hover { border-color: var(--accent); }
.chip b { font-family: "DIN Alternate", "Arial Narrow", system-ui, sans-serif; letter-spacing: 1px; }

.loading { display: flex; align-items: center; gap: 14px; padding: 48px 0; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { margin: 32px 0; padding: 20px; border-color: var(--bad); background: var(--bad-soft); }
.error h2 { margin: 0 0 6px; font-size: 18px; color: var(--bad); }

/* Hero */
#result { padding: 24px 0 8px; }
.hero { padding: 20px; display: grid; gap: 18px; }
.hero__top { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.plate {
  display: inline-flex; align-items: stretch; border: 2px solid #222; border-radius: 6px; overflow: hidden;
  background: var(--plate-bg); color: var(--plate-text); flex: none;
}
.plate .plate-input__eu { font-size: 13px; padding: 5px 8px 4px; }
.plate__num { font: 700 30px/1 "DIN Alternate", "Arial Narrow", system-ui, sans-serif; letter-spacing: 3px; padding: 10px 14px; white-space: nowrap; }
.hero__title { flex: 1 1 300px; min-width: 0; }
.hero__title h1 { margin: 0; font-size: clamp(22px, 3vw, 30px); line-height: 1.15; overflow-wrap: anywhere; }
.hero__title p { margin: 6px 0 0; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--bad { background: var(--bad-soft); color: var(--bad); }
.hero__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.stat__label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat__value { font-size: 18px; font-weight: 650; overflow-wrap: anywhere; }
.stat__sub { font-size: 12px; color: var(--muted); }
.stat--ok .stat__value { color: var(--ok); }
.stat--warn .stat__value { color: var(--warn); }
.stat--bad .stat__value { color: var(--bad); }
.vin { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 14px; }

.sources { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin: 12px 4px; }
.src-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.src-dot--ok { background: var(--ok); }
.src-dot--stale { background: var(--warn); }
.src-dot--bad { background: var(--bad); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 16px; overflow-x: auto; scrollbar-width: thin; }
.tab {
  border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 14px;
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab__count { font-size: 12px; background: var(--surface-2); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }

/* Overview sections */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 420px) { .grid { grid-template-columns: 1fr; } }
.section { padding: 16px 18px; }
.section h2 { margin: 0 0 8px; font-size: 16px; }
.kv { display: grid; grid-template-columns: minmax(120px, 42%) 1fr; gap: 0; margin: 0; }
.kv dt, .kv dd { padding: 7px 0; border-top: 1px solid var(--border); margin: 0; }
.kv dt { color: var(--muted); padding-right: 12px; font-size: 14px; }
.kv dd { overflow-wrap: anywhere; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.kv dt:first-of-type, .kv dt:first-of-type + dd { border-top: 0; }
.src { font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; flex: none; }
.src--vegvesen { color: var(--svv); }
.src--biltema { color: var(--bt); }
.list { margin: 0; padding-left: 18px; }
.list li { margin: 4px 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-top: 0; }
td.path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
td.val { overflow-wrap: anywhere; }

/* Parts */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.input {
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px;
  min-height: 38px; padding: 0 12px; font: inherit; flex: 1 1 220px; min-width: 0;
}
select.input { flex: 0 1 220px; }
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.part { display: flex; flex-direction: column; padding: 12px; gap: 8px; color: var(--text); text-decoration: none; min-width: 0; }
.part:hover { border-color: var(--accent); }
.part__img { aspect-ratio: 4 / 3; background: #fff; border-radius: 8px; display: grid; place-items: center; overflow: hidden; }
.part__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.part__name { font-weight: 600; line-height: 1.3; }
.part__meta { font-size: 12.5px; color: var(--muted); }
.part__row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: auto; }
.part__price { font-size: 18px; font-weight: 700; }
.part__old { font-size: 12px; color: var(--muted); text-decoration: line-through; margin-left: 4px; }
.crit { font-size: 12.5px; background: var(--surface-2); border-radius: 6px; padding: 5px 8px; }
.crit b { font-weight: 600; }
.group-title { font-size: 15px; margin: 22px 0 10px; display: flex; gap: 8px; align-items: baseline; }
.group-title:first-child { margin-top: 0; }

pre.json {
  margin: 0; padding: 16px; overflow: auto; max-height: 70vh; font-size: 12.5px; line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre;
}
.empty { padding: 24px; text-align: center; color: var(--muted); }

.footer { margin-top: 40px; border-top: 1px solid var(--border); background: var(--surface); font-size: 14px; }
.footer__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 32px; padding-top: 22px; padding-bottom: 22px; align-items: start; }
.footer__brand { display: grid; gap: 2px; }
.footer__brand span, .footer__small { color: var(--muted); }
.footer__links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: flex-end; }
.footer__links a { color: var(--text); text-decoration: none; font-weight: 600; }
.footer__links a:hover { color: var(--accent); text-decoration: underline; }
.footer__small { grid-column: 1 / -1; margin: 6px 0 0; font-size: 12.5px; }
@media (max-width: 640px) {
  .footer__inner { grid-template-columns: 1fr; }
  .footer__links { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .search { max-width: none; flex-basis: 100%; }
  .plate__num { font-size: 24px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kv { grid-template-columns: 1fr 1.2fr; }
}

/* Top navigation + misc */
.topnav { display: flex; gap: 14px; font-size: 14px; font-weight: 600; }
.topnav a { color: var(--muted); text-decoration: none; }
.topnav a:hover { color: var(--accent); }
.small { font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.guide { padding: 24px 0 8px; }
.guide h1 { margin: 0 0 6px; font-size: clamp(24px, 3.5vw, 32px); }
.ws-section { margin-bottom: 16px; scroll-margin-top: 80px; }
.ws-section h2 { margin: 0 0 8px; font-size: 16px; }
.ws-section td { min-width: 90px; }
.ws-section td a { font-weight: 600; text-decoration: none; }

@media print {
  .topbar, .tabs, .sources, .hero__actions, .footer, .no-print, .chips, .workshop__head .btn, .toolbar .btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .card { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  [role="tabpanel"][hidden] { display: none !important; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  a { color: #000; }
}
.li-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px; }
.li-cell { display: flex; justify-content: space-between; gap: 6px; padding: 4px 8px; background: var(--surface-2); border-radius: 6px; font-size: 13.5px; }

/* Used parts */
.used-src { font-size: 14px; margin: 4px 0; overflow-wrap: anywhere; }
.used-group { padding: 12px 16px; margin-bottom: 8px; }
.used-group summary { cursor: pointer; font-weight: 650; display: flex; gap: 8px; align-items: baseline; }
.used-group .chip { cursor: pointer; font: inherit; font-size: 13.5px; }
.used-group .chip .muted { font-size: 12px; }
.used-card .part__img { display: grid; }
.src--finndel { color: #0f766e; }
.src-badge { text-decoration: none; }
.src-badge--bruktdel { background: var(--accent-soft); color: var(--accent); }
.src-badge--finndel { background: #e0f2f1; color: #0f766e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .src-badge--finndel { background: #12302d; color: #5eead4; } }

/* Recalls / known issues */
.recall, .known { border-top: 1px solid var(--border); padding: 12px 0; }
.recall:first-of-type { border-top: 0; }
.recall__head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; margin-bottom: 6px; }
.known__issue { padding: 8px 0 8px 12px; border-left: 3px solid var(--border); margin: 8px 0; }
.notice { background: var(--warn-soft); border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-bottom: 8px; }

/* Tuning */
.legal { border-color: var(--warn); background: var(--warn-soft); }
.legal h2 { color: var(--warn); }
.tbar { height: 6px; border-radius: 3px; margin-top: 4px; max-width: 160px; }
.tbar--hp { background: var(--accent); }
.tbar--nm { background: var(--bt); }
.tuning .chip { cursor: pointer; font: inherit; flex-direction: column; align-items: flex-start; }

/* Login + account */
body.locked .search, body.locked .topnav, body.locked .account { display: none; }
body.blocked .search, body.blocked .topnav { display: none; }
.login { display: flex; justify-content: center; padding: 48px 0; }
.login__card { width: 100%; max-width: 380px; padding: 28px; }
.login__card h1 { margin: 0 0 18px; font-size: 24px; }
.field { display: grid; gap: 4px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.field input, .field select {
  min-height: 40px; padding: 0 12px; font: inherit; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.field input:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.login__submit, .login__guest, .login__sso { width: 100%; }
.login__sso { margin-top: 10px; justify-content: center; color: inherit; text-decoration: none; }
.login__error { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 14px; }
.login__or { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--muted); font-size: 13px; }
.login__or::before, .login__or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.login__note { margin: 14px 0 0; font-size: 13px; }
.account { position: relative; flex: none; }
.account__menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.account__menu > summary::-webkit-details-marker { display: none; }
.account__role { padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; background: var(--surface-2); color: var(--muted); }
.account__role--admin { background: var(--bad-soft); color: var(--bad); }
.account__role--user { background: var(--accent-soft); color: var(--accent); }
.account__pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; display: grid; gap: 6px; padding: 8px; min-width: 170px; }
.dialog { padding: 24px; width: min(400px, calc(100vw - 32px)); color: var(--text); }
.dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog h2 { margin-top: 0; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }
@media print { .account { display: none !important; } }
@media (max-width: 560px) {
  .account { order: 3; margin-left: auto; }
  .search { order: 4; }
  .topbar__inner { gap: 8px 10px; }
  .topnav { gap: 10px; font-size: 13px; }
  .account .btn--small { padding: 0 6px; min-height: 28px; }
  .account__menu > summary .account__role--admin { display: none; }  /* the admin bar already says it */
}

/* Admin bar + panel */
.adminbar { background: #161b26; color: #e7e9ee; font-size: 13.5px; }
.adminbar__inner { display: flex; align-items: center; gap: 14px; min-height: 38px; flex-wrap: wrap; }
.adminbar__label { font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 4px; background: #b42318; color: #fff; }
.adminbar__nav { display: flex; gap: 4px; flex-wrap: wrap; }
.adminbar__nav a { color: #c3c9d4; text-decoration: none; font-weight: 600; padding: 6px 10px; border-radius: 6px; }
.adminbar__nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.adminbar__nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .14); }
.admin { padding: 24px 0 8px; }
.admin h1 { margin: 0 0 4px; font-size: 24px; }
.admin__head { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; margin-bottom: 16px; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 4px 0 2px; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.meter--warn > span { background: var(--warn); }
.meter--bad > span { background: var(--bad); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dbtable td { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; max-width: 420px; overflow-wrap: anywhere; }
.dbtable tbody tr { cursor: pointer; }
.dbtable tbody tr:hover td { background: var(--surface-2); }
.dbtable th button { all: unset; cursor: pointer; }
.dbtable th button:hover { color: var(--accent); }
.dbtable td.null { color: var(--muted); font-style: italic; }
.db-tables { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.db-tables .chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 12px; font-size: 14px; }
.row-dialog { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 64px); }
.row-dialog pre { max-height: 50vh; overflow: auto; margin: 4px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 4px; }
.users-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.users-form .field { margin: 0; flex: 1 1 160px; }
.users-form .btn { flex: none; }
.form-msg { margin: 10px 0 0; font-size: 14px; }
.form-msg--bad { color: var(--bad); }
.form-msg--ok { color: var(--ok); }
@media print { .adminbar { display: none !important; } }
.login__hint { margin: -6px 0 12px; font-size: 13px; }
.login__switch { margin: 12px 0 0; text-align: center; font-size: 14px; color: var(--muted); }
.linkbtn { all: unset; cursor: pointer; color: var(--accent); font-weight: 600; }
.linkbtn:hover, .linkbtn:focus-visible { text-decoration: underline; }

/* Announcement / maintenance banner (admin settings) */
.announce__item { border-bottom: 1px solid var(--border); font-size: 14px; }
.announce__inner { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding-top: 9px; padding-bottom: 9px; }
.announce__inner > span { white-space: pre-line; }
.announce__item--info { background: var(--accent-soft); color: var(--text); }
.announce__item--warn { background: var(--warn-soft); color: var(--text); }
.announce__item--bad { background: var(--bad-soft); color: var(--text); }
.announce__item--bad b { color: var(--bad); }
.announce__close { all: unset; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 4px; color: var(--muted); }
.announce__close:hover { color: var(--text); }
@media print { .announce { display: none !important; } }

/* Admin settings */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings__nav { position: sticky; top: 84px; display: grid; gap: 2px; }
.settings__nav a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.settings__nav a:hover { background: var(--surface-2); }
.settings__navcount { align-self: center; line-height: 20px; min-width: 20px; text-align: center; font-size: 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.settings__navcount:empty { display: none; }
.settings__main { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-bottom: 80px; }
.settings__section { scroll-margin-top: 84px; }
.settings__sechead { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 6px; }
.setting { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 20px; align-items: start; padding: 14px 0; border-top: 1px solid var(--border); }
.setting__label { font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.setting__dirty { display: none; color: var(--accent); font-size: 12px; }
.setting--dirty .setting__dirty { display: inline; }
.setting--dirty { box-shadow: inset 3px 0 0 var(--accent); padding-left: 12px; margin-left: -12px; }
.setting__help { margin: 2px 0 0; font-size: 13.5px; }
.setting__meta { margin-top: 4px; }
.setting__control { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.setting--preview { grid-template-columns: 1fr; }
.preview { border: 1px solid var(--border); border-radius: 8px; margin-top: 6px; }
.preview .announce__inner { padding: 9px 12px; }
.unit-input { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.input--num { flex: none; width: 96px; }
.input--unit { flex: none; width: auto; }
.text-input { display: grid; gap: 2px; justify-items: end; width: min(420px, 100%); }
.textarea { width: 100%; min-height: 64px; padding: 8px 12px; resize: vertical; font: inherit; }
.switch { position: relative; display: inline-flex; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch__track { width: 44px; height: 24px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.savebar { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 30; display: flex; gap: 10px; align-items: center; padding: 10px 12px 10px 18px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.savebar__msg { flex: 1; font-weight: 600; font-size: 14px; }
.ops__h { font-size: 14px; margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.ops__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.ops__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.opcard { border: 1px solid var(--border); border-radius: 10px; padding: 12px; display: grid; gap: 4px; align-content: start; }
.opcard p { margin: 0 0 6px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.toast { position: fixed; right: 16px; bottom: 84px; z-index: 40; max-width: min(420px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 10px; background: #161b26; color: #fff; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); transition: opacity .4s; }
.toast--bad { background: var(--bad); }
.toast--out { opacity: 0; }
@media (max-width: 800px) {
  .settings { grid-template-columns: minmax(0, 1fr); }
  .settings__sechead { flex-wrap: wrap; }
  .settings__nav { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
  .settings__nav a { border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 13px; }
  .setting { grid-template-columns: minmax(0, 1fr); }
  .setting__control { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .adminbar__inner { gap: 6px; }
  .adminbar__nav { gap: 0; }
  .adminbar__nav a { padding: 6px 7px; font-size: 13px; }
  .adminbar__label { display: none; }
}
body.blocked .account { margin-left: auto; }

/* Pages: Min garasje, Min konto, Personvern */
.page { padding: 24px 0 8px; }
.page__head h1 { margin: 0 0 4px; font-size: 26px; }
.page__head { margin-bottom: 16px; }
.page__head p { margin: 0; }
.page__narrow { max-width: 560px; margin: 24px auto; }
.page__narrow h1 { margin-top: 0; font-size: 24px; }
.garage { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.garage__car { padding: 14px 16px; display: grid; gap: 10px; align-content: start; }
.garage__main { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; min-width: 0; }
.garage__main:hover .garage__name b { color: var(--accent); }
.garage__name { display: grid; min-width: 0; }
.garage__name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.garage__eu { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.garage__eu .muted:first-child { flex-basis: 100%; }
.garage__add .input { flex: 1 1 200px; }
.plate--small { padding: 0; border-width: 1.5px; flex: none; }
.plate--small .plate-input__eu { font-size: 9px; padding: 3px 4px 2px; }
.plate--small .plate__num { font-size: 16px; padding: 2px 8px; letter-spacing: 1.5px; }
.btn--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.btn--danger { color: var(--bad); }
.btn--danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--danger-solid:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }
.danger-zone { margin-top: 16px; border-color: var(--bad); }
.danger-zone h2 { color: var(--bad); }
.prose { max-width: 760px; margin: 0 auto; padding: 24px 28px; line-height: 1.6; }
.prose h1 { margin-top: 0; }
.prose h2 { font-size: 18px; margin: 24px 0 6px; }
.prose code { font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
@media (max-width: 560px) { .prose { padding: 18px 16px; } }

/* AI jobs */
.job { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.job .spinner { flex: none; width: 26px; height: 26px; margin: 0; }
.job__text { flex: 1; min-width: 0; }
.job__label { margin: 0; font-weight: 600; }
.job__sub { margin: 2px 0 0; }
.job__error h3 { margin: 0 0 4px; font-size: 16px; }
.ai-test__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.ai-test__out { margin-top: 14px; }
.ai-test__result { padding: 14px 16px; }
.ai-test__result pre { margin: 0 0 6px; padding: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; }

/* Delelager */
.crumbs { margin: 0 0 10px; font-size: 14px; }
.nowrap { white-space: nowrap; }
.car-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding: 14px 18px; margin-bottom: 16px; }
.car-head__name { flex: 1 1 200px; min-width: 0; }
.car-head__name h1 { margin: 0; font-size: 22px; }
.car-head__name p { margin: 0; }
.car-head__eu { display: grid; gap: 2px; }
.section__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.section__head h2 { margin: 0; }
.parts-table td { vertical-align: top; }
.parts-table tfoot td { border-top: 2px solid var(--border); }
.parts-note { white-space: pre-line; margin-top: 2px; color: var(--muted); }
.part-form { padding: 14px 16px; margin: 10px 0; }
.part-form h3, .review h3 { margin: 0 0 10px; }
.part-form__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 0 12px; }
.imports { display: grid; gap: 10px; margin-top: 10px; }
.imports:empty { display: none; }
.import__title { margin: 0 0 6px; font-weight: 600; }
.import__ready, .import__failed { padding: 12px 16px; }
.import__ready { border-color: var(--accent); }
.import__failed { border-color: var(--warn); }
.import__ready p, .import__failed p { margin: 0 0 8px; }
.review { padding: 16px; }
.review__note { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); font-size: 14px; }
.review__warnings { margin: 0 0 10px; padding-left: 20px; color: var(--warn); font-size: 14px; }
.review__layout { display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr); gap: 16px; align-items: start; }
.review__layout > :only-child { grid-column: 1 / -1; }
.review__file { display: grid; gap: 8px; position: sticky; top: 84px; }
.review__file img { width: 100%; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
.review__head { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.review__head .field { margin-bottom: 10px; }
.review__table th, .review__table td { padding: 4px; }
.review__table .input { min-height: 34px; padding: 0 8px; width: 100%; min-width: 80px; font-size: 14px; }
.review__table td:nth-child(2) .input { min-width: 180px; }
.review__table .input--qty { min-width: 56px; max-width: 70px; }
.review__table .input--price { min-width: 84px; max-width: 110px; }
.review__row--off .input { opacity: .45; text-decoration: line-through; }
.review__table tfoot td { border-top: 2px solid var(--border); padding-top: 8px; }
@media (max-width: 720px) {
  .review__layout { grid-template-columns: 1fr; }
  .review__file { position: static; }
  .review__file img { max-height: 280px; object-fit: contain; }
}
.parts-table .pt-actions .actions { flex-wrap: nowrap; justify-content: flex-end; }
@media (max-width: 640px) {
  .parts-table thead { display: none; }
  .parts-table, .parts-table tbody, .parts-table tfoot { display: block; }
  .parts-table tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--border); }
  .parts-table tbody td { border: 0; padding: 0; }
  .parts-table .pt-name { grid-column: 1 / -1; order: -1; }
  .parts-table .pt-date, .parts-table .pt-shop { color: var(--muted); font-size: 13px; }
  .parts-table .pt-shop { grid-column: 1 / -1; text-align: left; }
  .parts-table .pt-qty, .parts-table .pt-price, .parts-table .pt-sum { text-align: left; font-size: 14px; }
  .parts-table .pt-qty::before, .parts-table .pt-price::before, .parts-table .pt-sum::before { content: attr(data-label) ": "; color: var(--muted); }
  .parts-table .pt-actions { grid-column: 1 / -1; margin-top: 4px; }
  .parts-table .pt-actions .actions { justify-content: flex-start; }
  .parts-table tfoot tr { display: flex; justify-content: space-between; border-top: 2px solid var(--border); padding-top: 8px; }
  .parts-table tfoot td { border: 0; padding: 0; }
  .parts-table tfoot td:empty, .parts-table tfoot td:last-child { display: none; }
}

/* EU-kontroll */
.eu-summary { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.eu-summary > div { display: grid; gap: 3px; }
.checklist { margin-top: 14px; }
.checklist__progress { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.checklist__progress .meter { flex: 1 1 160px; max-width: 320px; margin: 0; }
.meter--ok > span { background: var(--ok); }
.checklist__items { list-style: none; margin: 10px 0 0; padding: 0; }
.checklist__item { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.checklist__check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--ok); cursor: pointer; }
.checklist__body { flex: 1; min-width: 0; }
.checklist__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.checklist__top code { font-size: 12.5px; color: var(--muted); }
.checklist__desc { font-weight: 600; }
.checklist__item--done .checklist__desc { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.checklist__item--done .sev { opacity: .5; }
.checklist__note { margin: 4px 0 0; font-size: 14px; white-space: pre-line; }
.checklist__note-edit { margin-top: 6px; display: grid; gap: 6px; }
.checklist__actions { margin-top: 6px; align-items: center; }
.input--part { min-height: 32px; font-size: 13px; flex: 0 1 260px; padding: 0 8px; }
.eu-history { margin-top: 14px; }
.eu-history summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.danger-link { color: var(--bad); font-weight: 400; font-size: 13px; }

/* Notifications */
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.push-status p { margin: 0 0 8px; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--accent-soft); font-size: 14px; margin: 6px 0; }
.devices { margin-top: 10px; font-size: 14px; }
.devices summary { cursor: pointer; }
.cal-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-row .input { flex: 1 1 280px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.push-offer { position: fixed; right: 16px; bottom: 16px; z-index: 35; width: min(360px, calc(100vw - 32px)); padding: 14px 16px; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.push-offer p { margin: 6px 0 10px; font-size: 14px; }
.push-offer .announce__close { position: absolute; top: 8px; right: 10px; }

/* Assistant */
.chat { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.chat__side { padding: 12px; display: grid; gap: 10px; position: sticky; top: 84px; max-height: calc(100vh - 110px); overflow: auto; }
.chat__convs { display: grid; gap: 2px; }
.chat__conv { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.chat__conv--on { background: var(--accent-soft); }
.chat__convbtn { all: unset; cursor: pointer; flex: 1; min-width: 0; display: grid; padding: 7px 8px; font-size: 14px; }
.chat__convbtn span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chat__conv:hover { background: var(--surface-2); }
.chat__main { padding: 14px 16px; display: grid; gap: 10px; }
.chat__car { display: flex; flex-wrap: wrap; align-items: end; gap: 4px 12px; }
.chat__car .field { margin: 0; flex: 0 1 320px; }
.chat__msgs { display: grid; gap: 10px; min-height: 240px; max-height: 60vh; overflow-y: auto; padding: 4px 2px; }
.chat__msg { display: flex; }
.chat__msg--user { justify-content: flex-end; }
.chat__bubble { max-width: min(680px, 88%); padding: 10px 14px; border-radius: 14px; line-height: 1.5; font-size: 15px; overflow-wrap: anywhere; }
.chat__msg--user .chat__bubble { background: var(--accent); color: var(--accent-text); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat__msg--assistant .chat__bubble { background: var(--surface-2); border-bottom-left-radius: 4px; }
.chat__bubble p { margin: 0 0 8px; }
.chat__bubble p:last-child, .chat__bubble ul:last-child, .chat__bubble ol:last-child { margin-bottom: 0; }
.chat__bubble ul, .chat__bubble ol { margin: 0 0 8px; padding-left: 20px; }
.chat__bubble code { font-size: 13px; background: var(--surface); padding: 1px 4px; border-radius: 4px; }
.chat__bubble--wait { padding: 0; background: transparent !important; min-width: min(420px, 88%); }
.chat__bubble--wait .job { box-shadow: none; }
.chat__bubble--error { border: 1px solid var(--warn); }
.chat__form { display: flex; gap: 8px; align-items: end; }
.chat__input { flex: 1; min-height: 48px; }
.chat__disclaimer { margin: 0; font-size: 12.5px; color: var(--muted); }
.chat__empty { display: grid; gap: 6px; align-content: start; }
.chat__starters { display: flex; flex-wrap: wrap; gap: 6px; }
.chat__starters .chip { cursor: pointer; font: inherit; font-size: 14px; text-align: left; }
.soon { max-width: 640px; margin: 24px auto; padding: 32px 28px; text-align: center; }
.soon__icon { font-size: 44px; line-height: 1; }
.soon h1 { margin: 10px 0 8px; font-size: 26px; }
.soon__lead { font-size: 17px; margin: 0 0 14px; }
.soon__list { text-align: left; display: inline-grid; gap: 6px; margin: 0 0 16px; padding-left: 20px; }
@media (max-width: 800px) {
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat__side { position: static; max-height: 220px; }
  .chat__msgs { max-height: none; }
}

/* Car page sub-menu (EU-kontroll | Delelager) */
.subnav { display: flex; gap: 4px; margin: 0 0 12px; border-bottom: 1px solid var(--border); }
.subnav__item { padding: 10px 16px; font-weight: 600; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.subnav__item:hover { color: var(--text); }
.subnav__item[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.garage-btns { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.btn .tab__count { margin-left: 6px; }
.account__role--tester { background: var(--ok-soft); color: var(--ok); }
.adminbar__count { margin-left: 6px; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: #b42318; color: #fff; }
.requests { border-color: var(--warn); }
.requests__list li { margin: 6px 0; }
