/* [hidden] wint altijd, ook van klassen die display zetten (bv. .btn, .field) */
[hidden] { display: none !important; }

:root {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --surface-2: #fafbfc;   /* subtiele achtergrond (tabelkop, ruwe feed) */
    --border: #e3e6ea;
    --text: #1d2025;
    --muted: #6b7280;
    --code-bg: #f1f2f4;
    --shadow: rgba(0, 0, 0, 0.12);
    --brand: #ffa641; /* meubelbaas oranje/amber */
    --brand-dark: #ff8c1a;
    --brand-tint: rgba(255, 166, 65, 0.10);
    --brand-tint-soft: rgba(255, 166, 65, 0.06);
    --radius: 10px;
    --sidebar-width: 240px;
    color-scheme: light;
}

/* Donkere modus: alleen de variabelen omzetten (structuur gebruikt deze). */
html[data-theme="dark"] {
    --bg: #15171c;
    --surface: #1d2025;
    --surface-2: #23262d;
    --border: #313640;
    --text: #e6e8eb;
    --muted: #9aa1ac;
    --code-bg: #2a2e36;
    --shadow: rgba(0, 0, 0, 0.5);
    --brand-tint: rgba(255, 166, 65, 0.18);
    --brand-tint-soft: rgba(255, 166, 65, 0.10);
    color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* hidden-attribuut wint van .field/.btn-display */

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--brand-dark);
    text-decoration: none;
}

/* Zijbalk-navigatie */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 1000;
}
.sidebar-brand {
    padding: 1.1rem 1.2rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-nav {
    flex: 1;
    padding: 0.6rem 0 1rem;
}
.nav-section {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 1rem 1.2rem 0.35rem;
}
.nav-link {
    display: block;
    padding: 0.5rem 1.2rem;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.92rem;
    border-left: 3px solid transparent;
}
.nav-link:hover { color: var(--text); background: var(--brand-tint-soft); }
.nav-link.active {
    color: var(--brand-dark);
    background: var(--brand-tint);
    border-left-color: var(--brand);
    font-weight: 600;
}
.sidebar-user {
    margin-top: auto;
    padding: 1rem 1.2rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sidebar-user .user-name { font-size: 0.85rem; color: var(--muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .link-btn { text-align: left; padding: 0; color: var(--muted); }
.sidebar-user .link-btn:hover { color: var(--text); }

/* Hoofdvlak naast de zijbalk */
.app-main { margin-left: var(--sidebar-width); }
.app-main--full { margin-left: 0; }

/* Mobiele uitklap-knop + overlay (alleen op smal scherm zichtbaar) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.8rem;
    left: 0.9rem;
    z-index: 1100;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    justify-content: space-between;
}
.sidebar-toggle span { display: block; height: 2px; background: var(--text); border-radius: 2px; }
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.container {
    max-width: 1080px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 0 0 24px rgba(0, 0, 0, 0.15);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .sidebar-toggle { display: flex; }
    .app-main { margin-left: 0; }
    .container { margin-top: 3.4rem; }
}

h1 { font-size: 1.6rem; margin: 0 0 0.5rem; }
.lead { color: var(--muted); margin-bottom: 2rem; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
}
.card h2 { margin: 0 0 0.4rem; font-size: 1.1rem; }
.card p { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; }

.badge {
    display: inline-block;
    font-size: 0.72rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #eef0f3;
    color: var(--muted);
}
.badge--soon { background: #ffedd9; color: #b3650a; }

.footer {
    max-width: 1080px;
    margin: 3rem auto 2rem;
    padding: 0 1.5rem;
    color: var(--muted);
    font-size: 0.85rem;
}

/* Layout-helpers */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.muted { color: var(--muted); font-size: 0.9rem; }
.empty {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    color: var(--muted);
}

/* Knoppen */
.btn {
    display: inline-block;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}
.btn:hover { border-color: #c8ccd2; }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn--danger { background: var(--surface); border-color: #e0b4b4; color: #b33; }
.btn--danger:hover { background: #fdf0f0; }
.link-btn {
    background: none; border: none; color: #b33; cursor: pointer;
    font-size: 0.9rem; padding: 0; text-decoration: underline;
}

/* Tabellen */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin: 1rem 0;
}
.table th, .table td {
    text-align: left;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    vertical-align: top;
}
.table th { background: var(--surface-2); color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table code { background: var(--code-bg); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.85em; }
.row-actions { white-space: nowrap; }
.row-actions a, .row-actions form { margin-right: 0.6rem; }

/* Formulieren */
.form { max-width: 640px; margin: 1.5rem 0; }
.form--inline { max-width: 760px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.field { display: block; margin-bottom: 1rem; }
.field > span { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 0.3rem; }
.field input[type=text], .field input[type=number], .field input[type=search], .field textarea, .field select {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: var(--surface);
}
.field--check { display: flex; align-items: center; gap: 0.4rem; }
.field--check span { margin: 0; font-weight: 400; }
.form-section {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    margin-bottom: 1.2rem;
}
.form-section legend { font-weight: 600; padding: 0 0.4rem; }
.form-actions { margin-top: 1rem; }
.danger-zone { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--border); max-width: 640px; }
.filter-bar { margin: 1rem 0; max-width: 320px; }

/* Badges */
.badge--req { background: #fde8e8; color: #b33; }
/* Variantgroepen */
.badge--vg { background: #eef2fb; color: #4a5fa5; font-weight: 500; }

/* Transformeren: inklapbare veldgroepen (standaard dicht) + set-regels. */
.tf-group { margin: 0.6rem 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 0 0.8rem; }
.tf-group[open] { padding-bottom: 0.6rem; }
.tf-group-head { cursor: pointer; margin: 0; padding: 0.55rem 0; font-size: 1.02rem; font-weight: 600; list-style: revert; }
.tf-rule--set { background: var(--surface-2); border-radius: 8px; }

/* Kanalen-sectie op de feedspagina: visueel apart van de leveranciers. */
.kanaal-sectie { border-left: 3px solid var(--brand, #ffa641); padding-left: 1rem; margin-bottom: 2rem; }

/* "Al in <kanaal>"-badge achter een SKU (kleur = Shopify-status). */
.badge--kanaal { margin-left: 0.35rem; font-weight: 500; white-space: nowrap; }
.badge--kanaal-active { background: #e6f4ea; color: #1e7e34; }
.badge--kanaal-draft { background: #fdf3e0; color: #9a6a00; }
.badge--kanaal-archived { background: #ececec; color: #666; }
.badge--kanaal-dup { outline: 1px solid #d9534f; }
html[data-theme="dark"] .badge--kanaal-active { background: #1d3323; color: #7fd394; }
html[data-theme="dark"] .badge--kanaal-draft { background: #38301a; color: #e3b95e; }
html[data-theme="dark"] .badge--kanaal-archived { background: #2c2c2c; color: #9a9a9a; }
.badge--vg-axis { background: #e7f4ec; color: #2c7a4b; }
.locked-value { padding: 0.5rem 0.6rem; border: 1px dashed var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.axis-picker { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; margin: 0.6rem 0; }
.axis-picker .field--check { margin-bottom: 0; }
.table .row-current td { background: #f6f8ff; }

/* Groepen beheren (Productvelden): compacte hernoem-rij in de tabel */
.group-manage td { vertical-align: middle; }
.group-manage .row-actions { text-align: right; }
.group-manage .row-actions form { display: inline; margin: 0; }
.group-manage__form { display: flex; align-items: center; gap: 0.5rem; margin: 0; }
.group-manage__form input[type=text] {
    flex: 1;
    max-width: 280px;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: 0.92rem;
    background: var(--surface);
    color: var(--text);
}
.badge--draft { background: #eef0f3; color: var(--muted); }
.badge--active { background: #e3f5e8; color: #2c7a43; }
.badge--archived { background: #f0e9df; color: #b3650a; }

.card--link { text-decoration: none; color: inherit; transition: border-color .15s; }
.card--link:hover { border-color: var(--brand); }

/* Flash */
.flash {
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.2rem;
    font-size: 0.92rem;
}
.flash--success { background: #e3f5e8; color: #2c7a43; border: 1px solid #bfe6cb; }
.flash--error { background: #fde8e8; color: #b33; border: 1px solid #f0c2c2; }

/* Brede staging-tabel: horizontaal scrollen i.p.v. de pagina oprekken */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.table-scroll .table { margin: 0; border: none; border-radius: 0; }
.table--compact th, .table--compact td {
    padding: 0.4rem 0.6rem; font-size: 0.82rem; white-space: nowrap;
}
fieldset[disabled] { opacity: 0.6; }

/* Ingelogde gebruiker in de topbar */
.user-box { margin-left: auto; display: flex; align-items: center; gap: 0.8rem; }
.user-name { font-size: 0.9rem; color: var(--muted); }
.user-box form { margin: 0; }

/* Inlogpagina */
.login-wrap { display: flex; justify-content: center; margin-top: 4rem; }
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    max-width: 380px;
    width: 100%;
}
.login-card h1 { color: var(--brand-dark); margin-bottom: 0.2rem; }
.login-hint { margin-top: 0.8rem; }
.btn--ms {
    display: inline-flex; align-items: center; gap: 0.6rem;
    margin-top: 1.5rem; padding: 0.7rem 1.2rem;
    background: #2f2f2f; color: #fff; border-color: #2f2f2f;
}
.btn--ms:hover { background: #1f1f1f; border-color: #1f1f1f; }
.ms-logo { display: inline-grid; grid-template-columns: 9px 9px; gap: 2px; }
.ms-logo span { width: 9px; height: 9px; display: block; }
.ms-logo span:nth-child(1) { background: #f25022; }
.ms-logo span:nth-child(2) { background: #7fba00; }
.ms-logo span:nth-child(3) { background: #00a4ef; }
.ms-logo span:nth-child(4) { background: #ffb900; }

/* Mapping-editor */
.inline-fields { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.inline-fields .field { margin-bottom: 0; min-width: 160px; }
.inline-fields .form-actions { margin: 0; }
.msg-list { font-size: 0.88rem; color: var(--muted); padding-left: 1.2rem; }
.msg-list li { margin-bottom: 0.25rem; }

/* Zoek/filter-balk op één rij */
.filter-bar--row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; max-width: none; }
.filter-bar--row .field { margin-bottom: 0; min-width: 160px; }
.filter-bar--row .form-actions { margin: 0; }

/* Paginatie */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.2rem 0; flex-wrap: wrap; }
.pagination__info { color: var(--muted); font-size: 0.88rem; }
.pagination__pages { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.pagination__link {
    display: inline-block; min-width: 2rem; text-align: center;
    padding: 0.35rem 0.55rem; border: 1px solid var(--border); border-radius: 6px;
    background: var(--surface); color: var(--text); text-decoration: none; font-size: 0.88rem;
}
.pagination__link:hover { border-color: #c8ccd2; }
.pagination__link.is-current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination__gap { color: var(--muted); padding: 0 0.2rem; }

/* Geavanceerde regel-opties */
.rule-advanced { margin-top: 0.8rem; }
.rule-advanced summary { cursor: pointer; color: var(--brand-dark); font-size: 0.9rem; }
.rule-advanced .inline-fields { margin-top: 0.8rem; }

/* Gekoppelde regelsets bij een mapping */
.linked-sets { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.linked-sets li { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.3rem; }
.linked-sets form { margin: 0; }

/* Varianten-sectie op het productformulier */
.variants { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }

/* Productvelden: sleep-sorteerbare lijsten en groep-blokken */
ul.sortable { list-style: none; margin: 0.5rem 0 1rem; padding: 0; }
ul.sortable .sort-item {
    display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
    padding: 0.55rem 0.75rem; margin-bottom: 0.4rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
}
.sort-item.dragging { opacity: 0.5; }
.sort-item .drag-handle { cursor: grab; color: var(--muted, #999); user-select: none; }
.sort-item .type-pick { margin-left: auto; max-width: 220px; }
.sort-item .row-link { font-size: 0.85rem; }

/* Boom-editor voor "Keuzelijst met dieptes" */
.tree-editor { margin-top: 0.4rem; border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.75rem; background: var(--surface-2); }
.tree-editor ul.tree-children { list-style: none; margin: 0; padding-left: 1.6rem; }
.tree-editor ul.tree-root { padding-left: 0; }
.tree-node.collapsed > ul.tree-children { display: none; }
.tree-node.dragging { opacity: 0.5; }
.tree-row { display: flex; align-items: center; gap: 0.3rem; padding: 0.12rem 0; }
.tree-row .drag-handle { cursor: grab; color: var(--muted, #999); user-select: none; }
.tree-row .tree-label { flex: 0 1 260px; min-width: 120px; padding: 0.25rem 0.5rem; }
.tree-btn { background: none; border: none; cursor: pointer; color: var(--muted, #999); padding: 0 0.3rem; font-size: 0.95rem; line-height: 1.6; }
.tree-btn:hover { color: var(--brand, #ffa641); }
.tree-btn.tree-del:hover { color: #d33; }
.tree-foot { display: flex; align-items: center; gap: 1rem; margin-top: 0.6rem; }
/* Tijdens het slepen worden lege sub-lijsten zichtbaar als plek om te nesten */
.tree-editor.dragging-node ul.tree-children:empty {
    min-height: 1.3rem; margin: 0.15rem 0 0.15rem 1.6rem; padding-left: 0;
    outline: 1px dashed var(--border); border-radius: 4px;
}
.inline-fields .field--options { flex: 1 1 100%; }

.group-block {
    border: 1px solid var(--border); border-radius: 8px;
    padding: 0.75rem 1rem 0.35rem; margin-bottom: 1rem;
    background: var(--surface-2);
}
.group-block__head { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.5rem; }
.group-block__head[draggable] { cursor: grab; }
.group-block.dragging { opacity: 0.5; }
.group-block--none { background: transparent; border-style: dashed; }
ul.field-drop { min-height: 2.4rem; margin-bottom: 0.5rem; }
ul.field-drop.drop-hint { outline: 2px dashed var(--brand, #ffa641); outline-offset: 3px; border-radius: 6px; }

/* Inklapbare ruwe-feed-weergave op het mappen-scherm */
.raw-feed { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 1rem; margin-bottom: 1.5rem; background: var(--surface-2); }
.raw-feed > summary { cursor: pointer; padding: 0.3rem 0; }
.raw-feed__bar { display: flex; justify-content: flex-end; margin: 0.75rem 0 0.5rem; }
.raw-feed__body { margin-top: 0.5rem; }

/* Zoek-resultaten: gemarkeerde tekst + omlijnde cellen */
mark { background: var(--brand-tint); color: inherit; padding: 0 2px; border-radius: 3px; }
.table td.cell-hit { outline: 2px solid var(--brand); outline-offset: -2px; background: var(--brand-tint-soft); }

/* Tabel-werkbalk: zoeken + kolommanager naast elkaar */
.table-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.table-search { padding: 0.45rem 0.7rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; min-width: 200px; }

/* Kolommanager (toon/verberg kolommen in de ruwe feed) */
.col-manager { position: relative; }
.col-manager > summary { cursor: pointer; list-style: none; }
.col-manager > summary::-webkit-details-marker { display: none; }
.col-manager__list { position: absolute; right: 0; z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.75rem; margin-top: 0.3rem; max-height: 340px; overflow: auto; box-shadow: 0 6px 20px var(--shadow); min-width: 200px; }
.col-manager__list label { display: flex; gap: 0.45rem; align-items: center; padding: 0.15rem 0; white-space: nowrap; cursor: pointer; }
.col-manager__all { border-bottom: 1px solid var(--border); margin-bottom: 0.3rem; padding-bottom: 0.3rem; }

/* Mapping-overzicht: chips per koppeling (bron → doel) */
.map-list { margin: 0.5rem 0 1.5rem; }
.map-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 0.6rem 0.25rem; border-bottom: 1px solid var(--border); }
.map-row__main { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.map-arrow { color: var(--muted); margin: 0 0.2rem; }
.map-row__actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.map-row__actions form { margin: 0; }
.chip { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 6px; font-size: 0.85rem; font-weight: 600; border: 1px solid var(--border); }
.chip--src { background: var(--surface-2); color: var(--text); }
.chip--dst { background: var(--brand-tint); color: var(--brand-dark); border-color: var(--brand); }

/* Koppeling toevoegen (ruwe kolommen → productveld/eigen kolom) */
.map-add { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; max-width: 960px; }
.map-add__grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 1.2rem; align-items: start; }
.map-add__submit { align-self: end; }
.field-label { display: block; font-size: 0.88rem; font-weight: 600; margin-bottom: 0.4rem; }
.col-row { display: flex; gap: 0.4rem; margin-bottom: 0.4rem; }
.col-row .col-select { flex: 1; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.col-remove { color: #b33; }
.btn--small { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.toggle-group { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 0.6rem; }
.toggle { padding: 0.4rem 0.9rem; background: var(--surface); color: var(--muted); border: none; cursor: pointer; font: inherit; font-size: 0.88rem; }
.toggle.active { background: var(--brand-tint); color: var(--brand-dark); font-weight: 600; }
a.toggle { text-decoration: none; display: inline-block; }
/* Gebundelde productenlijst: groep-rij klapt varianten uit/in */
.vg-row { cursor: pointer; }
.vg-caret { display: inline-block; color: var(--muted); transition: transform 0.15s ease; }
.vg-row.vg-open .vg-caret { transform: rotate(90deg); }
@media (max-width: 768px) { .map-add__grid { grid-template-columns: 1fr; } }

/* Transformatieregel-kaart (bewerking per gemapt veld) */
.transform-rule { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 0.75rem; }
.transform-rule__head { margin-bottom: 0.5rem; }

/* Tabbalk (per feed: ruwe feed / mappen / preview) */
.tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 2px solid var(--border); margin: 0 0 1.5rem; }
.tabs .tab { padding: 0.6rem 1rem; text-decoration: none; color: var(--muted, #666); border-bottom: 2px solid transparent; margin-bottom: -2px; font-weight: 500; }
.tabs .tab:hover { color: var(--text, #222); }
.tabs .tab.active { color: #ffa641; border-bottom-color: #ffa641; }

/* Sub-tabs (pill-stijl, bv. Mappen / Transformeren) */
.subtabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.25rem 0; }
.subtab { padding: 0.45rem 1.1rem; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; cursor: pointer; font: inherit; font-size: 0.9rem; }
.subtab:hover { color: var(--text); }
.subtab.active { background: var(--brand-tint); color: var(--brand-dark); border-color: var(--brand); font-weight: 600; }

/* Media-velden (afbeelding/bestand/video galerij) */
.media-field { display: flex; flex-direction: column; gap: 0.5rem; }
.media-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.9rem; margin: 0.25rem 0; padding: 0; }
.media-item { position: relative; display: flex; flex-direction: column; gap: 0.3rem; align-items: stretch; width: 148px; }
.media-item img, .media-item video { width: 148px; height: 148px; border: 1px solid var(--border); border-radius: 6px; object-fit: cover; background: var(--surface-2); display: block; }
.media-zoom { display: block; line-height: 0; }
.media-zoom:hover img { border-color: var(--brand); }
.media-doc { display: block; padding: 0.6rem 1.8rem 0.6rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; overflow-wrap: anywhere; }
/* ✕-knop rechtsboven op de tegel; aangevinkt = gemarkeerd voor verwijderen bij opslaan */
.media-remove { position: absolute; top: 0.35rem; right: 0.35rem; z-index: 1; width: 1.6rem; height: 1.6rem;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    background: rgba(20, 20, 20, 0.55); color: #fff; border-radius: 50%; font-size: 0.85rem; line-height: 1; }
.media-remove:hover { background: rgba(179, 51, 51, 0.9); }
.media-remove input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.media-remove .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.media-item:has(.media-remove input:checked) { opacity: 0.45; }
.media-item:has(.media-remove input:checked) .media-remove { background: #b33; opacity: 1; }
.media-item:has(.media-remove input:checked)::after { content: "wordt verwijderd bij opslaan"; font-size: 0.72rem; color: #b33; }
.media-label { width: 100%; font-size: 0.85rem; padding: 0.25rem 0.3rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface, #fff); color: inherit; }
.media-label-text { overflow-wrap: anywhere; }

/* AI-feedopzet-wizard */
.ai-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem; padding: 0; margin: 1rem 0; }
.ai-steps li { padding: 0.4rem 0.9rem; border: 1px solid var(--border); border-radius: 999px; font-size: 0.9rem; color: var(--muted); background: var(--surface); }
.ai-steps li.is-done { border-color: #2c7a43; color: #2c7a43; }
.ai-steps li.is-current { border-color: var(--brand); color: var(--brand-dark, var(--text)); font-weight: 600; }
.ai-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.ai-cols h3 { margin: 0.4rem 0; font-size: 0.95rem; }
.ai-cols ul { margin: 0; padding-left: 1.1rem; max-height: 20rem; overflow-y: auto; }
.ai-block { margin: 0.5rem 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem 0.8rem; }
.ai-block > summary { cursor: pointer; }

/* Donkere modus: getinte accenten (badges/flashes/danger) dempen */
html[data-theme="dark"] .badge,
html[data-theme="dark"] .badge--draft { background: #2a2e36; color: var(--muted); }
html[data-theme="dark"] .badge--soon,
html[data-theme="dark"] .badge--archived { background: #3a2f1c; color: #e7b169; }
html[data-theme="dark"] .badge--req { background: #3a2326; color: #ef9a9a; }
html[data-theme="dark"] .badge--active { background: #1e3a2a; color: #8fd6a8; }
html[data-theme="dark"] .flash--success { background: #16301f; color: #9fe0b6; border-color: #265a3c; }
html[data-theme="dark"] .flash--error { background: #321c1f; color: #ef9a9a; border-color: #5a3236; }
html[data-theme="dark"] .btn--danger { color: #ef9a9a; border-color: #5a3236; }
html[data-theme="dark"] .btn--danger:hover { background: #321c1f; }
html[data-theme="dark"] .link-btn { color: #ef9a9a; }
html[data-theme="dark"] .btn:hover { border-color: #4a515c; }
html[data-theme="dark"] ul.sortable .sort-item { background: var(--surface); }

/* Thema-schakelaar in de zijbalk */
.theme-toggle { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; text-align: left; font: inherit; display: flex; align-items: center; gap: 0.4rem; }
.theme-toggle:hover { color: var(--text); }

/* ====================== Transformeren: kolom-pijplijn ====================== */
.tf-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1rem; margin: 1rem 0 1.25rem; padding: 0.75rem 1rem; background: var(--brand-tint-soft); border: 1px solid var(--border); border-radius: 8px; }
.tf-toolbar .field { margin-bottom: 0; min-width: 240px; }
.tf-toolbar small { flex: 1; min-width: 200px; }
.tf-pv-switch { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; font-weight: 600; cursor: pointer; padding-bottom: 0.5rem; white-space: nowrap; }
.tf-pv-switch input { accent-color: var(--brand); width: 1.05rem; height: 1.05rem; margin: 0; cursor: pointer; }

.tf-list { display: flex; flex-direction: column; gap: 0.75rem; }

.tf-rule { display: flex; align-items: stretch; gap: 0.6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 0.75rem; }
.tf-rule--add { border-style: dashed; background: var(--surface-2); margin-top: 0.75rem; }
.tf-rule__num { flex: 0 0 1.9rem; height: 1.9rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--brand-tint); color: var(--brand-dark); font-weight: 700; font-size: 0.9rem; }
.tf-rule__body { flex: 1 1 auto; min-width: 0; }
.tf-rule__side { flex: 0 0 auto; display: flex; flex-direction: column; gap: 0.3rem; }
.tf-rule__side form { margin: 0; }
.tf-add-title { margin: 0 0 0.6rem; font-size: 1rem; }

.icon-btn { width: 1.9rem; height: 1.9rem; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 6px; cursor: pointer; font: inherit; line-height: 1; }
.icon-btn:hover:not(:disabled) { color: var(--text); border-color: var(--brand); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn--danger:hover:not(:disabled) { color: #c0392b; border-color: #c0392b; }
html[data-theme="dark"] .icon-btn--danger:hover:not(:disabled) { color: #ef9a9a; border-color: #5a3236; }

.tf-form { margin: 0; }
.tf-grid { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.tf-grid .field, .tf-cfg .field { margin-bottom: 0; min-width: 150px; }
.tf-field-col, .tf-field-op { min-width: 170px; }
.tf-cfg { display: contents; }
.tf-cfg-field .field { min-width: 140px; }

.tf-extra { margin-top: 0.7rem; }
.tf-extra > summary { cursor: pointer; color: var(--brand-dark); font-size: 0.88rem; }
.tf-cond { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.6rem; }
.tf-cond select, .tf-cond input { padding: 0.4rem 0.55rem; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; font-size: 0.9rem; }
.tf-cond .muted { font-size: 0.88rem; }

.tf-io { margin-top: 0.7rem; padding: 0.5rem 0.7rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; font-size: 0.9rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.tf-io code { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0.1rem 0.4rem; font-size: 0.88rem; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-io .tf-out { color: var(--brand-dark); border-color: var(--brand); font-weight: 600; }
.tf-arrow { color: var(--muted); }
.tf-note { font-size: 0.8rem; color: var(--muted); font-style: italic; }
.tf-note--error { color: #b33; font-style: normal; }
.tf-io--else .tf-out { color: var(--muted); border-color: var(--border); font-weight: 400; }

/* Formule-op: expressieveld + hulptekst over de volle breedte */
.tf-cfg-field[data-ops="formula"] { flex: 1 1 100%; }
.tf-formula-help code { background: var(--surface-2); border-radius: 4px; padding: 0 0.25rem; }

/* AI-invulbalk boven een regelformulier */
.tf-ai { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.7rem; }
.tf-ai-desc { flex: 1 1 280px; }
.tf-ai-btn { white-space: nowrap; }
.tf-ai-note { flex-basis: 100%; }
.tf-ai-note--error { color: #b33; }
html[data-theme="dark"] .tf-note--error, html[data-theme="dark"] .tf-ai-note--error { color: #ef9a9a; }
.tf-form-actions { margin-top: 0.7rem; }

.tf-rulesets { margin-top: 1.5rem; border-top: 1px solid var(--border); padding-top: 1rem; }
.tf-rulesets > summary { font-weight: 600; }

/* Vaste basisgroep op /product-fields (systeemvelden, niet sleepbaar/bewerkbaar) */
.group-block--system { border-style: solid; opacity: 0.92; }
.group-block--system .group-block__note { font-weight: 400; font-size: 0.85rem; }
ul.field-static { list-style: none; margin: 0.5rem 0 0.5rem; padding: 0; }
ul.field-static li {
    display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
    padding: 0.55rem 0.75rem; margin-bottom: 0.4rem;
    background: var(--surface); border: 1px dashed var(--border); border-radius: 6px;
}

/* Numeriek veld met eenheid-suffix */
.input-unit { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
.input-unit input { flex: 1; }

/* Multi-entry veld: meerdere waarden met +/× */
.multi-field__row { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.multi-field__row input { flex: 1; }
.multi-field__remove { color: var(--muted, #999); }
.multi-field__remove:hover { color: #d33; }
.multi-field__add { font-size: 0.88rem; }

/* Tekst met opmaak: lichte editor */
.richtext { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.richtext__bar { display: flex; flex-wrap: wrap; gap: 0.15rem; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.richtext__btn {
    background: none; border: 1px solid transparent; border-radius: 5px;
    padding: 0.15rem 0.5rem; cursor: pointer; color: var(--text);
    font-size: 0.85rem; line-height: 1.5; min-width: 2rem;
}
.richtext__btn:hover { border-color: var(--border); background: var(--surface); }
.richtext__btn--b { font-weight: 700; }
.richtext__btn--i { font-style: italic; }
.richtext__btn--u { text-decoration: underline; }
.richtext__editor { min-height: 10rem; padding: 0.7rem 0.9rem; outline: none; }
.richtext__editor:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--brand, #ffa641) 45%, transparent); }
.richtext__editor p { margin: 0 0 0.7em; }
.richtext__editor h2 { font-size: 1.15rem; margin: 0.7em 0 0.35em; }
.richtext__editor h3 { font-size: 1rem; margin: 0.7em 0 0.35em; }
.richtext__editor ul, .richtext__editor ol { margin: 0 0 0.7em; padding-left: 1.4rem; }
.richtext__editor blockquote { margin: 0 0 0.7em; padding-left: 0.8rem; border-left: 3px solid var(--border); color: var(--muted); }
.richtext__editor a { color: var(--brand, #ffa641); }

/* Cron-manager */
.badge--error { background: #fde3e3; color: #b3261e; }
html[data-theme="dark"] .badge--error { background: #46201e; color: #f2a099; }
.cron-failures { color: #b3261e; font-size: 0.9rem; }
html[data-theme="dark"] .cron-failures { color: #f2a099; }

/* Kolomfilter (klikbare kolomkop + popover) */
.th-filter { background: none; border: none; padding: 0; cursor: pointer; font: inherit; font-weight: 600; color: inherit; white-space: nowrap; }
.th-filter__caret { color: var(--muted, #999); font-size: 0.75em; }
.th-filter--active, .th-filter--active .th-filter__caret { color: var(--brand, #ffa641); }
.colf {
    position: absolute; z-index: 60; min-width: 240px; max-width: 320px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18); padding: 0.6rem;
}
.colf__zoek { display: flex; gap: 0.4rem; margin-bottom: 0.4rem; }
.colf__zoek input { flex: 1; min-width: 0; }
.colf__lijst { max-height: 280px; overflow: auto; display: flex; flex-direction: column; margin-top: 0.3rem; }
.colf__item {
    display: flex; justify-content: space-between; gap: 0.8rem; width: 100%;
    background: none; border: none; text-align: left; cursor: pointer;
    padding: 0.25rem 0.4rem; border-radius: 4px; font: inherit; color: inherit;
}
.colf__item:hover { background: var(--surface-2); }
.colf__meer { padding: 0.3rem 0.4rem; font-size: 0.85rem; }

/* Varianten koppelen op de selecteren-pagina */
.vg-cel { white-space: nowrap; }
.btn--klein { padding: 0.15rem 0.45rem; font-size: 0.82rem; }
tr.vg-anker td { background: color-mix(in srgb, var(--brand, #ffa641) 12%, transparent); }

/* Modal (popup) */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; }
.modal__backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); }
.modal__paneel {
    position: relative; z-index: 1; width: 100%; max-width: 680px; max-height: 88vh; overflow: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); padding: 1.1rem 1.3rem;
}
.modal__kop { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.modal__kop h2 { margin: 0; }
.modal__body { margin-top: 0.6rem; }

/* Variantgroep-blok in de popup */
.vg-groep { border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 0.8rem; margin-bottom: 0.7rem; background: var(--surface-2); }
.vg-groep__kop { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.vg-groep__naam { display: flex; align-items: center; gap: 0.4rem; margin: 0.4rem 0; flex-wrap: wrap; }
.vg-groep__naam input { flex: 1; min-width: 180px; }
.vg-groep__velden { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin: 0.3rem 0 0; }
.vg-groep__veld { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.9rem; cursor: pointer; }
.vg-groep__veld--uit { color: var(--muted, #999); cursor: default; }
.vg-groep--let-op { color: #b3261e; font-size: 0.9rem; margin-top: 0.3rem; }
html[data-theme="dark"] .vg-groep--let-op { color: #f2a099; }

/* "Optioneel per product": gedeeld veld dat per groep te splitsen is. */
.vg-split fieldset.vg-split__fs { border: 0; padding: 0; margin: 0; min-width: 0; }
.vg-split__kop { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.vg-split__per .field { margin-left: 1rem; }
.vg-split__per .field > span { font-weight: normal; color: var(--muted, #777); }
.vg-split .js-vgsplit-toggle { font-size: 0.85rem; margin-top: 0.15rem; }

/* Conceptproduct aanvullen: weergavefilter "alleen missende velden".
   Puur weergave — verborgen velden submitten gewoon mee. */
.form--missing-only .field:not(.field--missing) { display: none; }
.form--missing-only .form-section:not(:has(.field--missing)) { display: none; }
.field--missing > span:first-child { color: var(--brand, #ffa641); font-weight: 600; }
