[hidden] { display: none !important; }
:root {
  --bg: #f6f7f9; --panel: #fff; --text: #1d1d1f; --muted: #6b6b73; --border: #e1e3e8;
  --accent: #2457d6; --accent-text: #fff; --best: #e7f6ec; --best-text: #146c2e;
  --err: #b42318; --err-bg: #fdecea; --ok: #146c2e; --ok-bg: #e7f6ec;
  --warn: #8a4b00; --warn-bg: #fff1dc; --info: #3b4a63; --info-bg: #e9eef6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416; --panel: #1d1d20; --text: #ececf0; --muted: #9a9aa3; --border: #303036;
    --accent: #7aa2ff; --accent-text: #0b1530; --best: #12301d; --best-text: #7ee2a0;
    --err: #ff8a80; --err-bg: #3a1513; --ok: #7ee2a0; --ok-bg: #12301d;
    --warn: #ffc370; --warn-bg: #3a2610; --info: #b6c6e3; --info-bg: #1f2736;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
header.top { background: var(--panel); border-bottom: 1px solid var(--border); }
header.top .inner { margin: 0 auto; padding: 10px 16px; display: flex; gap: 18px;
                    align-items: center; flex-wrap: wrap; }
header.top .brand { font-weight: 700; font-size: 17px; text-decoration: none; color: var(--text); margin-right: auto; }
header.top nav { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
header.top nav a { text-decoration: none; color: var(--muted); }
header.top nav a.active { color: var(--text); font-weight: 600; }
header.top nav form { margin: 0; }
main { margin: 0 auto; padding: 24px 24px 48px; }
@media (max-width: 600px) { main { padding: 16px 16px 40px; } }
main.narrow { max-width: 520px; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 28px 0 10px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

input[type=text], input[type=password], input[type=number], input[type=url], input[type=search], select {
  width: 100%; padding: 9px 11px; font: inherit; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text);
}
input[type=file] { font: inherit; color: var(--text); }
textarea { width: 100%; padding: 9px 11px; font: inherit; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); resize: vertical; }
label.field { display: block; margin: 0 0 14px; }
label.field > span { display: block; font-weight: 600; margin-bottom: 4px; font-size: 14px; }
label.field .help { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; font-weight: normal; }
label.check { display: flex; gap: 8px; align-items: center; margin: 0 0 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; font-size: 15px; margin: 18px 0 8px; padding: 0; }

button, .button { display: inline-block; padding: 9px 16px; font: inherit; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; white-space: nowrap; }
button.secondary, .button.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
button.danger { background: transparent; color: var(--err); border: 1px solid var(--border); }
button.link { background: none; border: 0; padding: 0; color: var(--muted); }
button:disabled { opacity: .6; cursor: progress; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--err-bg); color: var(--err); }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.badge.err, .badge.eol { color: var(--err); background: var(--err-bg); border-color: transparent; }
.badge.eol { font-weight: 700; }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.badge.info { color: var(--info); background: var(--info-bg); border-color: transparent; }

/* zoeken */
.searchbar { display: flex; gap: 8px; flex-wrap: wrap; }
.searchbar input { flex: 1 1 320px; font-size: 16px; padding: 10px 12px; }
.supplier-picks { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; color: var(--muted); font-size: 14px; }
.supplier-picks label { display: inline-flex; gap: 4px; align-items: center; }
.status { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.chip { font-size: 13px; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel);
        display: inline-flex; align-items: center; gap: 6px; transition: background .2s, color .2s; }
.chip.busy { color: var(--warn); background: var(--warn-bg); border-color: transparent; font-weight: 600; }
.chip.ok { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.chip.err { color: var(--err); background: var(--err-bg); border-color: transparent; }
.chip.notice { color: var(--info); background: var(--info-bg); border-color: transparent; }
.spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
        display: inline-block; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2s; } }
#go.busy::before { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent;
        border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: -1px; animation: spin .7s linear infinite; }
#results th[data-k] { cursor: pointer; user-select: none; }
tr.best td { background: var(--best); }
tr.best td.price { color: var(--best-text); font-weight: 700; }
.note { color: var(--muted); font-size: 12px; }
.empty { padding: 24px; color: var(--muted); text-align: center; }
tr.eol td { color: var(--muted); }
tr.eol td.price { text-decoration: line-through; }
details.advanced { margin: 18px 0 8px; border-top: 1px solid var(--border); padding-top: 12px; }
details.advanced > summary { cursor: pointer; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.small-btn { padding: 4px 10px; font-size: 13px; }

.projectbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.projectbar > label { font-weight: 600; }
#new-project, a.icon-btn { min-width: 40px; text-align: center; text-decoration: none; font-size: 18px; line-height: 1; padding-left: 12px; padding-right: 12px; }
.projectbar select { width: auto; min-width: 220px; }
button.star { background: none; border: 0; padding: 0 4px; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; }
button.star.on { color: #e3a008; }
#results th[data-k]::after { content: " ↕"; opacity: .35; font-size: 11px; }
#results th[data-dir="asc"]::after { content: " ▲"; opacity: .9; }
#results th[data-dir="desc"]::after { content: " ▼"; opacity: .9; }

a.button.ms-login { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; box-sizing: border-box;
  background: #fff; color: #1f1f1f; border: 1px solid #8c8c8c; font-weight: 600; }
a.button.ms-login:hover { background: #f3f3f3; }

.results-bar { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin: 12px 0; }
.results-bar .status { margin: 0; }
.view-options { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; margin-left: auto;
  color: var(--muted); font-size: 14px; }
.view-options label { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.projectbar .view-options select { min-width: 0; width: auto; }

/* Gegroepeerde resultaten: kopregel per product, leveranciers eronder */
tr.group > td { background: var(--panel); border-top: 2px solid var(--border); font-weight: 600; cursor: pointer; }
tr.member:not(.best) > td { background: var(--bg); }
tr.group .note { font-weight: 400; }
tr.group button.toggle { border: 0; background: none; cursor: pointer; padding: 0; color: var(--muted); height: 24px;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; }
tr.group button.toggle:hover { color: var(--text); background: var(--bg); }
tr.group button.toggle svg { width: 20px; height: 20px; flex: none; display: block; transition: transform .15s ease; }
tr.group button.toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
/* Eerste kolom: uitklappijltje en ster precies onder elkaar */
#results tbody td:first-child { width: 48px; min-width: 48px; box-sizing: border-box; padding-left: 8px; padding-right: 0; text-align: left; }
#results tbody td:first-child button { width: 24px; text-align: center; }
/* Subregels beginnen iets meer naar rechts: witte marge links, grijs vlak pas daarna */
#results tbody tr.member > td:first-child { padding-left: 30px; box-shadow: inset 22px 0 0 var(--panel); }
tr.member > td:nth-child(2) { padding-left: 30px; }
/* Resultaten: elke regel op één regel; volledige tekst bij de muisaanwijzer */
#results tbody td { height: 42px; vertical-align: middle; white-space: nowrap; }
#results tbody td .note { display: inline; }
.desc-cell { display: flex; align-items: center; gap: 6px; }
/* Omschrijving vult de vrije ruimte tot aan de Info-knop (telt zelf niet mee voor de kolombreedte) */
#results tbody td.desc-td { width: 100%; }
.desc-cell .clamp { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; width: 0; min-width: 180px; }
.desc-cell .info-btn { margin-left: auto; flex: none; }
.supplier-cell { display: flex; align-items: center; gap: 6px; }
.supplier-cell span { display: inline-block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
a.view-link { text-decoration: none; }
a.view-link:hover span { text-decoration: underline; }
tr.member.hidden-row { display: none; }

/* Productinformatie */
dialog.info-dialog { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 1px solid var(--border);
  border-radius: 12px; padding: 0; color: inherit; background: var(--panel); }
dialog.info-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.info-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: inherit; }
#info-body { padding: 16px; overflow: auto; }
.info-top { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 16px; }
@media (max-width: 640px) { .info-top { grid-template-columns: 1fr; } }
.info-images img.main { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--border); }
.info-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.info-thumbs img { width: 46px; height: 46px; object-fit: contain; background: #fff; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.info-specs { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.info-specs th { text-align: left; font-weight: 600; padding: 10px 0 4px; }
.info-specs td { padding: 3px 8px 3px 0; border-top: 1px solid var(--border); vertical-align: top; }
.info-specs td:first-child { color: var(--muted); width: 40%; }
button.info-btn { border: 1px solid var(--border); background: var(--panel); color: var(--accent); border-radius: 999px;
  font-size: 12px; font-weight: 500; padding: 1px 8px; margin-left: 4px; cursor: pointer; white-space: nowrap; vertical-align: 1px; }
button.info-btn:hover { border-color: var(--accent); }
#results tbody .info-btn { padding: 0 7px; line-height: 18px; }
#results tbody .small-btn { padding-top: 2px; padding-bottom: 2px; }
