:root {
  color-scheme: light;
  --bg: #f4f3f0;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e0da;
  --grid: #ebe9e4;
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #7a7973;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --series-bol: #2a78d6;
  --series-woo: #eb6834;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-ink: #006300;
  --warning-ink: #7a5200;
  --serious-ink: #9a3d17;
  --critical-ink: #a32424;
  /* Webshop identity colours (always shown together with the shop name) */
  --shop-aqua: #1baf7a;
  --shop-violet: #4a3aa7;
  --shop-magenta: #e87ba4;
  --shop-yellow: #eda100;
  --shop-green: #008300;
  --shop-red: #e34948;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 16px rgb(0 0 0 / 0.04);
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --border: #33322f;
    --grid: #2a2a28;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --text-3: #93928a;
    --accent: #3987e5;
    --series-bol: #3987e5;
    --series-woo: #d95926;
    --good-ink: #5fd35f;
    --warning-ink: #fab219;
    --serious-ink: #f09a78;
    --critical-ink: #f08080;
    --shop-aqua: #199e70;
    --shop-violet: #9085e9;
    --shop-magenta: #d55181;
    --shop-yellow: #c98500;
    --shop-green: #008300;
    --shop-red: #e66767;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211;
  --surface: #1a1a19;
  --surface-2: #232321;
  --border: #33322f;
  --grid: #2a2a28;
  --text: #ffffff;
  --text-2: #c3c2b7;
  --text-3: #93928a;
  --accent: #3987e5;
  --series-bol: #3987e5;
  --series-woo: #d95926;
  --good-ink: #5fd35f;
  --warning-ink: #fab219;
  --serious-ink: #f09a78;
  --critical-ink: #f08080;
  --shop-aqua: #199e70;
  --shop-violet: #9085e9;
  --shop-magenta: #d55181;
  --shop-yellow: #c98500;
  --shop-green: #008300;
  --shop-red: #e66767;
  --shadow: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 17px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; color: var(--text-2); font-weight: 600; }
.muted { color: var(--text-2); margin: 0; }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
button, input, select { font: inherit; color: inherit; }

button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(1.07); }
button.danger { color: var(--critical-ink); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand-icon { width: 28px; height: 28px; color: var(--accent); }
.channels { display: flex; gap: 8px; flex-wrap: wrap; }
.channel-pill {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px 4px 8px;
  font-size: 12px; color: var(--text-2); background: var(--surface);
}
.channel-pill b { color: var(--text); font-weight: 600; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.swatch.bol { background: var(--series-bol); }
.swatch.woocommerce { background: var(--series-woo); }
.live { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.live.on .dot { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }
.live.off .dot { background: var(--critical); }

.banner {
  background: color-mix(in srgb, var(--warning) 18%, var(--surface));
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  font-size: 13px;
}

main { max-width: 1400px; margin: 0 auto; padding: 20px 24px 48px; display: grid; gap: 20px; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.kpi .label { color: var(--text-2); font-size: 12px; }
.kpi .value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 4px; }
.kpi .sub { color: var(--text-2); font-size: 12px; margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.kpi .sub span { display: inline-flex; align-items: center; gap: 5px; }
button.kpi { text-align: left; cursor: pointer; }
button.kpi:hover { border-color: var(--text-3); background: var(--surface); }

/* Panels */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.panel-head { display: flex; align-items: baseline; gap: 10px; padding: 14px 16px 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.toolbar input[type="search"] { flex: 1 1 220px; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button { border: 0; border-radius: 0; padding: 6px 12px; background: transparent; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active { background: var(--surface-2); font-weight: 600; }
.window-select { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }

/* Products table */
.table-wrap { overflow-x: auto; }
table.products { width: 100%; border-collapse: collapse; }
.products th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--text-2);
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none;
}
.products th[data-sort] { cursor: pointer; }
.products th[data-sort]:hover { color: var(--text); }
.products th.sorted::after { content: " ↓"; }
.products th.sorted.asc::after { content: " ↑"; }
.products td { padding: 10px 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.products tbody tr { cursor: pointer; transition: background-color 0.3s; }
.products tbody tr:hover { background: var(--surface-2); }
.products tbody tr.flash { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.products tbody tr:last-child td { border-bottom: 0; }
.pname { font-weight: 500; }
.psku { color: var(--text-3); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.stock { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stock.neg { color: var(--critical-ink); }
.sync { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.sync span { display: inline-flex; align-items: center; gap: 6px; }
.sync .state { color: var(--text-3); }
.sync .state.pending { color: var(--warning-ink); }
.sync .state.error { color: var(--critical-ink); }
.trend { font-size: 11px; color: var(--text-3); display: block; }
.days { font-variant-numeric: tabular-nums; white-space: nowrap; }
.days b { font-size: 15px; }
.runway { height: 4px; background: var(--grid); border-radius: 2px; margin-top: 5px; position: relative; min-width: 90px; }
.runway i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--text-3); }
.runway i.warning { background: var(--warning); }
.runway i.critical { background: var(--serious); }
.runway em { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-2); }
.spark { display: block; }

/* User menu */
.user-menu { position: relative; }
#user-button { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 600;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.14); padding: 6px; display: grid;
}
.menu-head { display: grid; padding: 6px 10px 8px; border-bottom: 1px solid var(--grid); margin-bottom: 4px; }
.menu button { border: 0; text-align: left; background: transparent; padding: 8px 10px; }
.menu button:hover { background: var(--surface-2); }
.users-inner { padding: 20px; display: grid; gap: 16px; width: min(760px, calc(100vw - 32px)); }
.user-add { display: grid; grid-template-columns: 1fr 1.3fr auto auto; gap: 8px; }
.users-table td { vertical-align: middle; }
.users-table select { padding: 4px 6px; }
.users-table .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.users-table .row-actions button { padding: 4px 8px; font-size: 12px; }
.users-table tr.disabled td:not(:last-child) { opacity: 0.55; }
.password-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; font-weight: 600; user-select: all; }

a.button {
  display: inline-flex; align-items: center; border: 1px solid var(--border); background: var(--surface);
  border-radius: 8px; padding: 7px 12px; color: var(--text); text-decoration: none; cursor: pointer;
}
a.button:hover { background: var(--surface-2); }
label.button { display: inline-flex; align-items: center; border-radius: 8px; padding: 7px 12px; cursor: pointer; border: 1px solid var(--border); }
label.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button:disabled { opacity: 0.6; cursor: progress; }

.badge.uncounted { color: var(--text-2); background: var(--surface-2); border-color: var(--border); }
.paused-banner { background: color-mix(in srgb, var(--serious) 14%, var(--surface)); }
.paused-banner a { color: inherit; font-weight: 600; }
.blocked-banner { background: color-mix(in srgb, var(--critical) 16%, var(--surface)); }
.shop-card .conn .paused { color: var(--serious-ink); font-weight: 600; }
.warn-box { background: color-mix(in srgb, var(--warning) 16%, var(--surface)); }
.stock.muted { color: var(--text-3); }

.components { display: grid; gap: 8px; }
.component-row { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; align-items: center; }
.component-row .unit { font-size: 12px; color: var(--text-2); }
.unit-label { font-size: 12px; font-weight: 500; color: var(--text-2); margin-left: 2px; }
.used-in { font-size: 11px; color: var(--text-3); }
.listing-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.listing-row .grow { flex: 1; min-width: 180px; }
.listing-row .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.listing-row button { padding: 3px 8px; font-size: 12px; }

#packs-box, #unlinked-box, #dropship-box { display: grid; gap: 8px; }
.pack-group { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; font-size: 13px; }
.pack-group label { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.pack-group ul { margin: 0; padding-left: 26px; color: var(--text-2); font-size: 12px; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow); padding: 28px; display: grid; gap: 20px;
}
.login-card .brand { margin: 0; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
.login-form button { padding: 10px; }

/* Webshops */
.c-aqua { --shop: var(--shop-aqua); }
.c-violet { --shop: var(--shop-violet); }
.c-magenta { --shop: var(--shop-magenta); }
.c-yellow { --shop: var(--shop-yellow); }
.c-green { --shop: var(--shop-green); }
.c-red { --shop: var(--shop-red); }
.shop-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--shop, var(--text-3)); }
.shop-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.shop-tabs {
  display: flex; gap: 4px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: thin;
}
.shop-tabs button {
  border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent;
  padding: 11px 12px 9px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--text-2);
}
.shop-tabs button:hover { background: var(--surface-2); color: var(--text); }
.shop-tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; border-bottom-color: var(--shop, var(--accent)); }
.tab-count {
  font-size: 11px; font-weight: 600; min-width: 18px; padding: 1px 6px; border-radius: 999px; text-align: center;
  background: color-mix(in srgb, var(--serious) 18%, transparent); color: var(--serious-ink);
}
.shop-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.shop-card {
  text-align: left; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--shop);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 10px; cursor: pointer;
}
.shop-card:hover { border-color: var(--text-3); border-top-color: var(--shop); background: var(--surface); }
.shop-card h3 { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 15px; }
.shop-card .figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shop-card .figures div { display: grid; }
.shop-card .figures b { font-size: 20px; font-variant-numeric: tabular-nums; }
.shop-card .figures span { font-size: 11px; color: var(--text-2); }
.shop-card .statuses { display: flex; gap: 6px; flex-wrap: wrap; min-height: 22px; }
.shop-card .conn { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.shop-card .conn span { display: inline-flex; align-items: center; gap: 5px; }
.shop-card .conn .err { color: var(--critical-ink); }
.no-shops { padding: 24px; display: grid; gap: 10px; }
.shop-list { display: grid; gap: 8px; }
.shop-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px solid var(--border); border-left: 4px solid var(--shop); border-radius: 8px; padding: 10px 12px; }
.shop-row .grow { flex: 1; min-width: 180px; }
.shop-row .meta { font-size: 12px; color: var(--text-2); display: flex; gap: 12px; flex-wrap: wrap; }
.shop-row .ok { color: var(--good-ink); }
.shop-row .missing { color: var(--serious-ink); }
.shop-row .row-actions { display: flex; gap: 6px; }
.shop-row .row-actions button { padding: 4px 8px; font-size: 12px; }
.test-result { flex-basis: 100%; font-size: 12px; display: grid; gap: 2px; }
.colors { border: 0; padding: 0; margin: 0; }
.colors legend { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
#shop-colors { display: flex; gap: 8px; flex-wrap: wrap; }
#shop-colors label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px 4px 6px; cursor: pointer; font-size: 12px; color: var(--text-2); }
#shop-colors input { margin: 0; }
#shop-colors label:has(input:checked) { border-color: var(--shop); color: var(--text); box-shadow: 0 0 0 1px var(--shop); }
.form-grid h4 { margin: 6px 0 -4px; font-size: 13px; font-weight: 600; }
.copy-row { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.copy-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; }
.copy-row button { padding: 4px 10px; font-size: 12px; }
.field { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
.access { position: relative; }
.access summary { cursor: pointer; font-size: 13px; list-style: none; display: inline-flex; gap: 4px; align-items: center; }
.access summary::after { content: "▾"; color: var(--text-3); }
.access .access-list { position: absolute; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: grid; gap: 6px; min-width: 260px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.14); }
.access .access-list label { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.users-inner .table-wrap { overflow: visible; }

/* Status badges: always icon + label, never colour alone */
.badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 999px;
  border: 1px solid transparent;
}
.badge svg { width: 12px; height: 12px; flex: none; }
.badge.ok { color: var(--good-ink); background: color-mix(in srgb, var(--good) 12%, transparent); }
.badge.warning { color: var(--warning-ink); background: color-mix(in srgb, var(--warning) 20%, transparent); }
.badge.critical { color: var(--serious-ink); background: color-mix(in srgb, var(--serious) 18%, transparent); }
.badge.out { color: var(--critical-ink); background: color-mix(in srgb, var(--critical) 14%, transparent); }

.empty { padding: 32px; text-align: center; color: var(--text-2); }

/* Activity */
.activity { list-style: none; margin: 0; padding: 4px 16px 12px; max-height: 320px; overflow-y: auto; }
.activity li { display: grid; grid-template-columns: 64px 12px 1fr; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--grid); font-size: 13px; }
.activity li:last-child { border-bottom: 0; }
.activity time { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.activity .marker { width: 8px; height: 8px; border-radius: 2px; background: var(--text-3); align-self: center; }
.activity .marker.bol { background: var(--series-bol); }
.activity .marker.woocommerce { background: var(--series-woo); }
.activity li.warn .msg { color: var(--warning-ink); }
.activity li.error .msg { color: var(--critical-ink); }
.activity li.new { animation: fadein 0.6s ease; }
@keyframes fadein { from { background: color-mix(in srgb, var(--accent) 12%, transparent); } to { background: transparent; } }

/* Drawer & modal */
dialog { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0; }
dialog::backdrop { background: rgb(0 0 0 / 0.35); }
.drawer {
  margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(760px, 100vw); max-width: 100vw;
  border-radius: 0; border-width: 0 0 0 1px;
}
.drawer-inner { padding: 20px 24px 40px; display: grid; gap: 20px; }
.drawer-head { display: flex; gap: 12px; align-items: flex-start; }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 18px; }
.close { border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 4px 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.stat .label { font-size: 12px; color: var(--text-2); }
.stat .value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 11px; color: var(--text-3); }
.explain { font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin: 0; }
.chart-card { display: grid; gap: 8px; }
.chart-card .legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.chart-card .legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .line { width: 16px; height: 0; border-top: 2px solid var(--text); }
.legend .line.dashed { border-top-style: dashed; border-top-color: var(--text-2); }
.legend .line.ref { border-top: 1px dashed var(--serious); }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .gridline { stroke: var(--grid); stroke-width: 1; }
svg.chart .axis { fill: var(--text-3); font-size: 11px; }
svg.chart .stock-line { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .projection { fill: none; stroke: var(--text-2); stroke-width: 2; stroke-dasharray: 5 4; }
svg.chart .reorder { stroke: var(--serious); stroke-width: 1; stroke-dasharray: 3 3; }
svg.chart .reorder-label { fill: var(--serious-ink); font-size: 11px; }
svg.chart .today { stroke: var(--text-3); stroke-width: 1; }
svg.chart .bar-bol { fill: var(--series-bol); }
svg.chart .bar-woo { fill: var(--series-woo); }
svg.chart .crosshair { stroke: var(--text-3); stroke-width: 1; }
svg.chart .hover-dot { fill: var(--text); stroke: var(--surface); stroke-width: 2; }
svg.chart .hit { fill: transparent; }
.channel-rows { display: grid; gap: 8px; }
.channel-row { display: flex; align-items: center; gap: 10px; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.channel-row .grow { flex: 1; }
.forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.mini-form { border: 1px solid var(--border); border-radius: 8px; padding: 12px; display: grid; gap: 8px; }
.mini-form .row { display: flex; gap: 8px; }
.mini-form .row input { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 20px; width: min(560px, calc(100vw - 32px)); }
.form-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
.form-grid h2 { grid-column: 1 / -1; }
.span-2 { grid-column: 1 / -1; }
.actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.form-error { color: var(--critical-ink); margin: 0; font-size: 13px; }
.modal { border-radius: 12px; }
table.moves { width: 100%; border-collapse: collapse; font-size: 13px; }
.moves th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.moves td { padding: 6px 8px; border-bottom: 1px solid var(--grid); }
.moves .plus { color: var(--good-ink); }
.moves .minus { color: var(--text); }
.moves .history { color: var(--text-3); }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 18px rgb(0 0 0 / 0.14);
  min-width: 120px;
}
.tooltip .t-title { font-weight: 600; margin-bottom: 4px; }
.tooltip .t-row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tooltip .t-row span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip .t-row b { font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .shop-tabs { padding: 0 8px; }
  .topbar { padding: 12px 16px; }
  main { padding: 16px 16px 40px; }
  .banner { padding: 8px 16px; }
  .hide-sm { display: none; }
  .drawer-inner { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .user-add { grid-template-columns: 1fr 1fr; }
  #user-name { display: none; }
  .kpi .value { font-size: 22px; }
  .kpis { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .hide-xs { display: none; }
  .products td, .products th { padding: 10px 8px; }
}

/* Bol.com offers without a product (after "link Bol.com offers") */
.bol-unmatched { display: grid; gap: 6px; margin-top: 8px; max-height: 320px; overflow: auto; }
.bol-offer { display: flex; gap: 10px; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.bol-offer.done { opacity: .6; }
.bol-offer button { flex: none; }

.badge.dropship { color: var(--text-2); background: var(--surface-2); border-color: var(--border); }

/* Returns (return portal) */
.view-switch { justify-self: start; align-self: start; width: max-content; }
.view-switch button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 16px; }
.returns-table tbody tr { cursor: pointer; }
.returns-table tbody tr:hover { background: var(--surface-2); }
.returns-table td { vertical-align: top; }
#returns-portals a { color: var(--accent); }
#return-dialog .mini-table { width: 100%; border-collapse: collapse; margin: 8px 0 12px; font-size: 14px; }
#return-dialog .mini-table th, #return-dialog .mini-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
#return-dialog .timeline { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; }
#return-dialog .timeline li { display: grid; }
#return-dialog .timeline span { color: var(--text-2); font-size: 12px; }
#return-dialog details.mail { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; }
#return-dialog details.mail pre { white-space: pre-wrap; font: inherit; margin: 8px 0 0; }
#return-dialog .form-error { margin: 0 0 10px; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: normal; }
label.check input { width: auto; margin: 0; }
#returns-form .form-grid label.check { grid-column: 1 / -1; }

/* Link a webshop to another: products chosen by hand */
.mirror-manual { display: grid; gap: 8px; margin: 4px 0 10px; }
.mirror-manual label { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr); gap: 10px; align-items: center; font-weight: 400; }
.mirror-manual select { width: 100%; }
@media (max-width: 640px) { .mirror-manual label { grid-template-columns: 1fr; } }
#qls-fetch-msg.ok { color: var(--good-ink); }
#qls-fetch-msg.form-error { display: inline; }
#return-dialog details.label-address { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; }
#return-dialog details.label-address summary { cursor: pointer; font-weight: 600; }
#return-dialog details.label-address[open] summary { margin-bottom: 6px; }
#label-address-form { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }
#label-address-form label { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
#label-address-form .form-error, #label-address-form .actions { grid-column: 1 / -1; margin: 0; }
@media (max-width: 560px) { #label-address-form { grid-template-columns: 1fr; } }
#bol-returns-dialog .mini-table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; }
#bol-returns-dialog .mini-table th, #bol-returns-dialog .mini-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
#bol-returns-dialog h3 { margin: 14px 0 4px; }
#return-dialog details.refund { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; }
#return-dialog details.refund summary { cursor: pointer; font-weight: 600; margin-bottom: 6px; }
#return-dialog .refund-form { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; }
#return-dialog .refund-form label { display: grid; gap: 4px; font-size: 12px; color: var(--text-2); }
#return-dialog .refund-form input { width: 120px; }
#return-dialog .mini-table td.num { text-align: right; white-space: nowrap; }
#return-dialog p.ok { color: var(--good-ink); }

/* Verzenden: packing list grouped by content */
#shipping-panel .test-note { margin: 0; padding: 10px 16px; background: color-mix(in srgb, var(--warning, #eda100) 12%, transparent); font-size: 13px; }
#shipping-list { padding: 8px 16px 16px; }
#shipping-list h3 { margin: 16px 0 6px; }
.ship-group { border: 1px solid var(--border); border-radius: 10px; margin: 10px 0; overflow: hidden; }
.ship-group.unknown { border-color: var(--bad, #d43d3c); }
.ship-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: color-mix(in srgb, var(--text-2, #888) 6%, transparent); }
.ship-head .grow { flex: 1; min-width: 0; }
.ship-head select { max-width: 280px; }
.ship-orders { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.ship-orders td:nth-child(2) { width: 120px; }
.ship-orders td:nth-child(3) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ship-orders td { padding: 6px 12px; border-top: 1px solid var(--border); vertical-align: middle; }
.ship-orders td.sel { width: 28px; }
.ship-orders td.actions-cell, .ship-orders td.packed-cell { white-space: nowrap; text-align: right; }
.ship-orders td.actions-cell { width: 170px; }
.ship-orders td.packed-cell { width: 100px; }
/* Packed: light green, still easy to read. */
.ship-orders tr.packed td { background: color-mix(in srgb, var(--good, #1baf7a) 16%, transparent); }
button.link { background: none; border: 0; padding: 0 4px; color: var(--accent, #2a6fdb); cursor: pointer; font-size: 12px; text-decoration: underline; }
#info-dialog .mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#info-dialog .mini-table th, #info-dialog .mini-table td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
@media (max-width: 640px) {
  .ship-head { flex-wrap: wrap; }
  .ship-head select { max-width: 100%; width: 100%; }
  .ship-orders td.actions-cell, .ship-orders td:nth-child(4) { display: none; }
  .ship-orders td:nth-child(2) { width: 70px; }
}
#shipping-panel .live-note { margin: 0; padding: 10px 16px; background: color-mix(in srgb, var(--bad, #d43d3c) 14%, transparent); font-size: 13px; }
.ship-head .weight { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.ship-head .weight input { width: 72px; }
.ship-orders td:nth-child(4) { width: 190px; }
#shipping-mode.danger { color: #fff; background: var(--bad, #d43d3c); border-color: transparent; }
.print-form { display: grid; gap: 8px; min-width: min(360px, 80vw); }
.print-form .start-pos { border: 0; padding: 0; margin: 4px 0 0; }
.print-form .start-pos[disabled] { opacity: 0.4; }
.print-form .sheet { display: grid; grid-template-columns: 56px 56px; grid-template-rows: 76px 76px; gap: 4px; padding: 6px; border: 1px solid var(--border); border-radius: 4px; width: max-content; margin-top: 4px; }
.print-form .sheet label { position: relative; }
.print-form .sheet input { position: absolute; opacity: 0; inset: 0; }
.print-form .sheet span { display: grid; place-items: center; height: 100%; border: 1px dashed var(--border); border-radius: 3px; font-weight: 600; cursor: pointer; }
.print-form .sheet input:checked + span { background: var(--accent, #2a6fdb); color: #fff; border-style: solid; }
.print-form .sheet input:focus-visible + span { outline: 2px solid var(--accent, #2a6fdb); }
.ship-head .group-packed { white-space: nowrap; }
.progress { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--text-2, #888) 18%, transparent); overflow: hidden; margin: 4px 0; }
.progress span { display: block; height: 100%; background: var(--good, #1baf7a); transition: width 0.4s; }
.ship-orders tr.closed td:nth-child(2)::after { content: ' ✓'; color: var(--good-ink); }
.ship-orders .mark-error { white-space: normal; margin-top: 2px; line-height: 1.3; }
#shipping-hidden { margin: 0; padding: 6px 16px 0; }
.ship-photos { display: flex; gap: 8px; flex: none; }
.ship-photo { position: relative; display: inline-block; width: 48px; height: 48px; }
.ship-photo img, .ship-photo .noimg { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: #fff; display: block; }
.ship-photo .noimg { display: grid; place-items: center; font-weight: 700; color: var(--text-2); background: var(--surface-2, #f3f3f3); }
.ship-photo .qty { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--bad, #d43d3c); color: #fff; font-size: 12px; line-height: 20px; text-align: center; }
.ship-photo .kind { position: absolute; left: 1px; right: 1px; bottom: 1px; border-radius: 0 0 5px 5px; color: #fff; font-size: 9px; font-weight: 800; letter-spacing: .03em; text-align: center; line-height: 14px; }
.ship-photo .tone-sample { background: #6b3fd4; }
.ship-photo .tone-tile { background: #2a6fdb; }
.ship-photo .tone-box { background: #e07b00; }
.ship-photo .tone-length { background: #0f8f8a; }

/* Verzenden: an order split over several parcels */
.parcels-link { color: var(--text-2); margin-left: 6px; }
.parcels-link.split { color: var(--critical-ink); font-weight: 600; }
.parcels-badge { margin-left: 6px; }
.parcel-fields { display: grid; gap: 6px; margin: 8px 0; }
.parcel-weight input { width: 80px; margin: 0 4px; }

/* Verzenden: address field by field, each with a copy button */
.address-link { color: var(--text-2); margin-left: 6px; }
.address-copy { display: grid; gap: 6px; min-width: min(420px, 80vw); }
.address-row { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--border); }
.address-row output { font-weight: 600; overflow-wrap: anywhere; }
.address-copy button.copied:not(.primary) { color: var(--good-ink); }
@media (max-width: 480px) { .address-row { grid-template-columns: 1fr auto; } .address-row > span { grid-column: 1 / -1; } }
.postnl-help { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); line-height: 1.5; }
.bookmarklet { display: inline-block; margin-top: 4px; padding: 3px 10px; border-radius: 6px; background: #ed7000; color: #fff !important; font-weight: 700; text-decoration: none; cursor: grab; }
.manual-ship { display: grid; gap: 6px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
.manual-ship input { width: 100%; max-width: 260px; display: block; margin-top: 3px; text-transform: uppercase; }
.manual-ship button { justify-self: start; }
