/* Datorbygget (/bygg-dator). Tokens från styles.css. Färgerna följer färgreglerna där: grönt bara för pris och
   mätta fakta, så "Stämmer enligt uppgifterna" är neutral med bock. --bd-bad är byggets enda egna färg (krock). */
:root { --bd-bad: #b42318; --bd-bad-bg: #fde8e6; }
@media (prefers-color-scheme: dark) { :root { --bd-bad: #ff8a7a; --bd-bad-bg: #3a1714; } }

.bd { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 18px; }
@media (min-width: 960px) {
  .bd { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  /* panelen får inte bli högre än skärmen: pris och knappar står kvar, kontrollistan skrollar inuti */
  .bd .bd-side { position: sticky; top: 84px; max-height: calc(100vh - 100px); display: flex; flex-direction: column; }
  .bd .bd-side .bd-pbox { flex: none; }
  .bd .bd-side .bd-cbox { flex: 0 1 auto; min-height: 120px; overflow: auto; overscroll-behavior: contain; }
}
.bd[aria-busy="true"] .bd-main { opacity: .7; }
.bd-slots { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.bd-slot { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 14px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.bd-slot:first-child { border-top: 0; }
.bd-l { font-weight: 600; font-size: 15px; }
.bd-l small { display: block; font-weight: 400; color: var(--ink-3); font-size: 13px; }
.bd-add { justify-self: start; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 1px dashed var(--field-line);
  border-radius: var(--r-m); background: none; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; text-decoration: none; }
.bd-add:hover { border-style: solid; background: var(--surface-2); }
.bd-add span { font-size: 18px; line-height: 1; }
.bd-slot.has, .bd-slot.gone { grid-template-columns: 140px minmax(0, 1fr); }
.bd-part { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.bd-part > img, .bd-part > .ph, .bd-c > img, .bd-c > .ph { width: 56px; height: 56px; border-radius: var(--r-s); background: var(--surface-2); object-fit: contain; padding: 3px; }
.bd-part > img.ok, .bd-c > img.ok { background: #fff; }
.bd-t { min-width: 0; }
.bd-t a { color: var(--ink); text-decoration: none; }
.bd-t a:hover b { text-decoration: underline; }
.bd-t b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; line-height: 1.3; }
.bd-t small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.bd-st { margin-top: 4px; }
.bd-pr { text-align: right; white-space: nowrap; }
.bd-pr small { display: block; font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.bd-p { font-weight: 700; font-size: 17px; }
.bd-p.oos { color: var(--ink-3); font-weight: 500; }
.bd-acts { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 14px; }
.bd-acts .go { font-size: 14px; }
.lnk { background: none; border: 0; padding: 4px 0; color: var(--accent); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.bd-q { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.bd-q select { height: 32px; border: 1px solid var(--field-line); border-radius: var(--r-s); background: var(--surface); color: var(--ink); font: inherit; padding: 0 6px; }
.bd-gone p { margin: 0 0 6px; color: var(--ink-2); }
.bd-more { margin-top: 14px; }
.bd-more > summary { cursor: pointer; font-weight: 600; padding: 6px 0 10px; }
.bd-shared { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.bd-shared span { flex: 1 1 200px; }

/* nivåerna: ikon och ord, aldrig bara färg */
.bd-lv { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.bd-i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-size: 11px; font-weight: 700; line-height: 1; border: 1.5px solid currentColor; flex: none; }
.bd-lv.fail { color: var(--bd-bad); }
.bd-lv.warn { color: var(--warn); }
.bd-lv.unknown { color: var(--ink-3); font-weight: 500; }
.bd-lv.ok { color: var(--ink); }
.bd-lv.info { color: var(--ink-2); font-weight: 500; }

.bd-side { display: grid; gap: 14px; }
.bd-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.bd-box h2 { margin: 0 0 8px; }
.bd-sum { margin: 0 0 10px; font-weight: 600; }
.bd-chks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bd-chks li { padding: 10px 0 0; border-top: 1px solid var(--line); }
.bd-chks li:first-child { border-top: 0; padding-top: 0; }
.bd-chks li.fail { border-left: 3px solid var(--bd-bad); padding-left: 10px; }
.bd-chks p { margin: 4px 0 0; font-size: 15px; line-height: 1.4; }
.bd-chks small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.bd-chks details { margin-top: 4px; font-size: 14px; }
.bd-chks summary { cursor: pointer; color: var(--ink-2); }
.bd-tot { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.bd-tot b { font-size: 22px; }
.bd-box .muted { margin: 4px 0 0; }
.bd-h3 { font-size: 15px; margin: 14px 0 6px; }
.bd-single { list-style: none; margin: 0; padding: 0; }
.bd-single li { display: flex; justify-content: space-between; padding: 4px 0; border-top: 1px solid var(--line); }
.bd-single li:first-child { border-top: 0; }
.bd-miss { margin: 8px 0 0; font-size: 14px; color: var(--warn); }
.bd-btns { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.bd-note { margin-top: 18px; }
.bd-err { color: var(--ink-2); }

/* väljaren */
.bd-pick .dlg-b { gap: 10px; flex: 1 1 auto; min-height: 0; grid-auto-rows: max-content; }
.bd-pf { padding: 12px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.bd-pf input[type=search] { height: 42px; border: 1px solid var(--field-line); border-radius: var(--r-m); padding: 0 12px; background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; width: 100%; }
.bd-ps { margin: 0; padding: 10px 18px 0; }
.bd-pf2 { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font-size: 14px; }
.bd-tg { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.bd-tg input { width: 18px; height: 18px; accent-color: var(--ink); }
.bd-so select { height: 32px; border: 1px solid var(--field-line); border-radius: var(--r-s); background: var(--surface); color: var(--ink); font: inherit; margin-left: 4px; }
/* overflow: clip (inte hidden): en rad med hidden får krympa i dialogens grid, så listan klipptes i stället för att skrolla */
.bd-cl { display: grid; border: 1px solid var(--line); border-radius: var(--r); overflow: clip; }
.bd-c { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 0; border-top: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; width: 100%; }
.bd-c:first-child { border-top: 0; }
.bd-c:hover, .bd-c:focus-visible { background: var(--surface-2); }
.bd-c > img, .bd-c > .ph { width: 48px; height: 48px; }
.bd-c.bad > img { opacity: .55; }
.bd-c.bad { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.bd-ct { min-width: 0; }
.bd-ct b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; line-height: 1.3; font-size: 15px; }
.bd-ct small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.bd-cs { display: block; margin-top: 3px; }
.bd-why { font-size: 13px; color: var(--ink-2); }
.bd-cp { text-align: right; white-space: nowrap; }
.bd-cp .num { font-weight: 700; }
.bd-cp small { display: block; font-size: 12px; color: var(--ink-2); }
.bd-pg { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 6px 0; }

@media (max-width: 640px) {
  .bd-slot, .bd-slot.has, .bd-slot.gone { grid-template-columns: minmax(0, 1fr); }
  .bd-acts { grid-column: 1; }
  .bd-part { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .bd-part > img, .bd-part > .ph { width: 48px; height: 48px; }
}

.bd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bd-pbox .bd-btns { margin-top: 12px; }

/* plus för mer lagring och fläktar, i stället för en ruta med valfria delar */
.bd-addrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 14px 10px 168px; border-top: 1px dashed var(--line); }
.bd-plus { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 4px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 15px; cursor: pointer; }
.bd-plus span { font-size: 19px; line-height: 1; }
.bd-plus:hover { text-decoration: underline; text-underline-offset: 3px; }
.bd-addch { display: inline-flex; gap: 8px; }
.bd-addch[hidden] { display: none; }
.bd-sttot { margin-left: auto; }

/* filter i väljaren */
dialog.sheet.bd-pick { width: min(640px, 100vw); }
.bd-pbody { flex: 1 1 auto; min-height: 0; display: flex; }
.bd-pbody > .bd-pl { flex: 1 1 auto; min-width: 0; }
.bd-fp { display: none; flex-direction: column; min-height: 0; }
.bd-fpt { margin: 0; font-size: 16px; padding: 12px 18px 4px; }
.bd-fpt:focus { outline: none; }
#bdFacets { flex: 1 1 auto; overflow: auto; padding: 4px 18px 12px; }
.bd-fpf { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 18px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.bd-fbtn[hidden] { display: none; }
.bd-fs { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
.bd-fs legend { font-weight: 600; font-size: 14px; padding: 0; margin-bottom: 8px; }
.bd-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.bd-pill { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); font-size: 14px; cursor: pointer; user-select: none; }
.bd-pill[hidden] { display: none; }
.bd-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bd-pill small { color: var(--ink-3); font-size: 12px; }
.bd-pill:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.bd-pill:has(input:checked) small { color: inherit; opacity: .75; }
.bd-pill:has(input:checked) span::before { content: "✓ "; }
.bd-pill:has(input:disabled) { opacity: .45; cursor: default; }
.bd-pill:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.bd-morebtn { margin-top: 6px; }
.bd-rv { margin: 0 0 6px; font-size: 14px; color: var(--ink-2); }
.bd-track { position: relative; height: 44px; margin: 0 11px; touch-action: none; }
.bd-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--surface-2); }
.bd-fill { position: absolute; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--ink); }
.bd-th { position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink); cursor: grab; touch-action: none; }
.bd-th::after { content: ""; position: absolute; inset: -11px; }      /* tryckyta 44 px */
.bd-th:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.bd-nums { display: flex; gap: 10px; margin-top: 4px; font-size: 14px; color: var(--ink-2); }
.bd-nums label { display: flex; align-items: center; gap: 6px; flex: 1; }
.bd-nums input { width: 100%; height: 34px; border: 1px solid var(--field-line); border-radius: var(--r-s); background: var(--surface); color: var(--ink); font: inherit; padding: 0 8px; }
.bd-miss { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 14px; color: var(--ink-2); }
.bd-miss[hidden] { display: none; }
.bd-act { display: flex; gap: 6px; overflow-x: auto; white-space: nowrap; padding-bottom: 2px; scrollbar-width: none; }
.bd-act[hidden] { display: none; }
.bd-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 0; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.bd-act .lnk { flex: none; }
/* mobil: "Filter (n)" byter listan mot filtervyn */
.bd-pick.bd-fopen .bd-fp { display: flex; flex: 1 1 auto; }
.bd-pick.bd-fopen .bd-pbody > .bd-pl { display: none; }
@media (min-width: 900px) {
  dialog.sheet.bd-pick { width: min(960px, 100vw); }
  .bd-fp { display: flex; flex: 0 0 260px; border-right: 1px solid var(--line); }
  .bd-fpt, .bd-fpf #bdShow, .bd-fbtn { display: none; }
  .bd-pick.bd-fopen .bd-pbody > .bd-pl { display: block; }
}

/* mobil: dockan nederst */
.bd-dock { display: none; }
@media (max-width: 959px) {
  .bd-dock { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 18; background: var(--surface); border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgb(0 0 0 / .06); padding-bottom: env(safe-area-inset-bottom); }
  .bd-dock[hidden] { display: none; }
  .bd-dockrow { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 8px 16px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
  .bd-dp .num { font-weight: 700; font-size: 18px; }
  .bd-dp small { color: var(--ink-3); font-size: 13px; }
  .bd-ds { margin-left: auto; }
  .bd-sheet { max-height: 60vh; overflow: auto; padding: 14px 16px 4px; border-bottom: 1px solid var(--line); }
  .bd-sheet h2 { margin: 0 0 6px; }
  .bd-sheet h2:focus { outline: none; }
  .bd-dlv { list-style: none; margin: 8px 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
  body.bd-hasdock .foot { padding-bottom: calc(var(--bd-dock-h, 64px) + 16px); }
  html:has(body.bd-hasdock) { scroll-padding-bottom: calc(var(--bd-dock-h, 64px) + 16px); }
  body.bd-hasdock .toast { bottom: calc(var(--bd-dock-h, 64px) + 12px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: no-preference) { .bd-sheet { animation: bd-up .16s ease-out; } }
@keyframes bd-up { from { transform: translateY(8px); opacity: 0; } }
@media (max-width: 640px) { .bd-addrow { padding-left: 14px; } }

/* jämför processorer (/jamfor/processor) */
.jf { margin-top: 18px; }
.jf-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.jf-t { width: 100%; border-collapse: collapse; font-size: 15px; }
.jf-t th, .jf-t td { padding: 10px 14px; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.jf-t thead th, .jf-t thead td { border-top: 0; }
.jf-t tbody th { font-weight: 600; color: var(--ink-2); width: 30%; min-width: 120px; }
.jf-t td { width: 35%; }
.jf-h { min-width: 180px; }
.jf-h img { display: block; width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: var(--r-s); padding: 3px; margin-bottom: 6px; }
.jf-h a { display: block; font-weight: 600; color: var(--ink); text-decoration: none; line-height: 1.3; }
.jf-h a:hover { text-decoration: underline; }
.jf-p { display: block; margin: 4px 0; }
.jf-p .num { font-weight: 700; }
.jf-p small { color: var(--ink-2); }
.jf-s { position: relative; font-weight: 400; }
.jf-sl { display: block; font-size: 14px; color: var(--ink-2); margin-bottom: 4px; }
.jf-s input { width: 100%; height: 40px; border: 1px solid var(--field-line); border-radius: var(--r-m); background: var(--surface); color: var(--ink); font: inherit; padding: 0 10px; }
.jf-r { list-style: none; margin: 4px 0 0; padding: 0; }
.jf-r button { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 6px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.jf-r button:hover, .jf-r button:focus-visible { background: var(--surface-2); }
.jf-r li.muted { padding: 8px 6px; }
.jf-note, .jf-src { margin-top: 12px; }
@media (max-width: 600px) {
  /* mobil: rubriken på egen rad, de två värdena bredvid varandra under (ingen sidledsskroll) */
  .jf-wrap { overflow: visible; }
  .jf-t, .jf-t thead, .jf-t tbody { display: block; }
  .jf-t tr { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
  .jf-t thead tr { border-top: 0; }
  .jf-t thead td:first-child { display: none; }
  .jf-t th, .jf-t td { border-top: 0; width: auto; min-width: 0; padding: 8px 12px; }
  .jf-t tbody th { grid-column: 1 / -1; padding-bottom: 0; font-size: 13px; width: auto; }
  .jf-h { min-width: 0; }
}
.jf-b td b { font-size: 17px; }
.jf-sim { margin-top: 18px; }
.jf-sim h2 { margin: 0 0 6px; }
.jf-sim p { margin: 4px 0; line-height: 1.6; }
.bd-mv { grid-column: 2; margin: 2px 0 0; font-size: 14px; line-height: 1.45; }
.bd-mv .lnk { margin-left: 6px; }
@media (max-width: 640px) { .bd-mv { grid-column: 1; } }
