/* ===== Dashboards (Editors/Dashboard) =====
   Gedeelde opmaak van alle dashboards: kop, grote kaarten, tegelrijen, Aanpassen-modus, kaarten met een
   grafiek of tabel, ouderdomsbalk en signalen. Oorspronkelijk de stijl van het servicedashboard; één bestand,
   zodat elk dashboard er hetzelfde uitziet. Donkere modus (X Modern) onderaan. */

/* Geen max-width: het bord vult de beschikbare breedte. Het aantal tegels per rij volgt uit de grid. */
.db-board { padding: 22px 26px 30px; color: #1f2430; }

/* --- Kop --- */
.db-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.db-title { display: flex; flex-direction: column; line-height: 1.15; }
.db-kicker { font-size: 13px; color: #9aa1ad; font-weight: 500; }
.db-name { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.db-top-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.db-date { font-size: 13px; color: #9aa1ad; text-transform: capitalize; }
.db-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid #e9ebf2; background: #fff; color: #5a6472; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s ease; }
.db-btn:hover { color: #5b52d9; border-color: #cfcbf3; }
.db-btn--icon { width: 32px; padding: 0; }
.db-btn--on, .db-btn--on:hover { background: #5b52d9; border-color: #5b52d9; color: #fff; }
.db-select { height: 32px; padding: 0 10px; border-radius: 9px; border: 1px solid #e9ebf2; background: #fff; color: #1f2430; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.db-error { background: #fdecec; color: #b42318; border: 1px solid #f6c9c6; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 18px; }
.db-edit-hint { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: #f3f1fe; color: #4a42c4; border: 1px dashed #cfcbf3; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 18px; }
.db-edit-reset { border: none; background: none; padding: 0; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

/* --- Periode- en magazijnkeuze (DashboardFilterBar) --- */
.db-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 22px; }
.db-chip { height: 30px; padding: 0 14px; border-radius: 999px; border: 1px solid #e9ebf2; background: #fff; color: #5a6472; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: all .15s ease; }
.db-chip:hover { color: #5b52d9; border-color: #cfcbf3; }
/* Dubbele klasse: de algemene knopstijl van het thema won het van één klasse, waardoor de gekozen periode wit op wit stond */
.db-chip.db-chip--on, .db-chip.db-chip--on:hover { background: #5b52d9; border-color: #5b52d9; color: #fff; }
.db-range { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px; }
.db-range-label { font-size: 12px; color: #9aa1ad; }
.db-date { height: 30px; padding: 0 8px; border-radius: 9px; border: 1px solid #e9ebf2; background: #fff; color: #1f2430; font: inherit; font-size: 13px; }

/* --- Grote kaarten --- */
.db-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 26px; }
.db-stats--narrow { max-width: 900px; }
.db-stat { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; background: #fff; border: 1px solid #edeef4; border-radius: 16px; padding: 18px 20px; box-shadow: 0 1px 2px rgba(31,36,48,.04); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.db-stat:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(31,36,48,.10); border-color: #e2e0f7; }
.db-stat--static, .db-stat--static:hover { cursor: default; transform: none; box-shadow: 0 1px 2px rgba(31,36,48,.04); border-color: #edeef4; }
.db-stat-head, .db-section-label, .db-card-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #9aa1ad; }
.db-stat-big { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; margin: 6px 0 12px; font-variant-numeric: tabular-nums; }
.db-stat-bar { height: 7px; border-radius: 999px; background: #eef0f6; overflow: hidden; }
.db-stat-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #5b52d9, #7c5cff); transition: width .4s ease; }
.db-stat-sub { font-size: 12.5px; color: #7a828f; margin-top: 9px; }

/* --- Tegelrijen --- */
.db-section-label { margin: 0 2px 12px; }
.db-section-label:not(:first-child) { margin-top: 22px; }
.db-empty { font-size: 13px; color: #9aa1ad; padding: 2px 2px 4px; }
.db-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.db-tile { position: relative; text-align: left; display: flex; flex-direction: column; gap: 2px; font: inherit; color: inherit; background: #fff; border: 1px solid #edeef4; border-radius: 16px; padding: 18px 18px 16px; cursor: pointer; overflow: hidden; box-shadow: 0 1px 2px rgba(31,36,48,.04); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.db-tile::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); opacity: .9; }
.db-tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(31,36,48,.10); border-color: #e2e0f7; }
.db-tile--static, .db-tile--static:hover { cursor: default; transform: none; box-shadow: 0 1px 2px rgba(31,36,48,.04); border-color: #edeef4; }
.db-tile-ico { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; margin-bottom: 12px; box-shadow: 0 4px 10px rgba(31,36,48,.12); }
.db-tile-num { font-size: 30px; font-weight: 750; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.db-tile-label { font-size: 14px; font-weight: 650; margin-top: 6px; }
.db-tile-sub { font-size: 12px; color: #9aa1ad; }
.db-up { color: #12b886; }
.db-down { color: #e5484d; }

/* Aanpassen-modus: per tegel een oog. Een verborgen tegel staat er half doorzichtig en met een gestippelde
   rand bij, zodat je hem kunt terughalen. */
.db-tile-eye { position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: #f3f4f8; color: #5a6472; transition: all .15s ease; }
.db-tile--editing:hover .db-tile-eye { background: #e9e7fb; color: #5b52d9; }
.db-tile--hidden { opacity: .45; border-style: dashed; box-shadow: none; }
.db-tile--hidden::before { opacity: .35; }
.db-tile--hidden:hover { opacity: .75; }
.db-tile--editing { cursor: grab; }
.db-tile--dragging { opacity: .35; }
.db-tile--dragover { outline: 2px dashed #5b52d9; outline-offset: 3px; }

/* Eigen tegels: potlood en prullenbak rechtsboven links van het oog, zodat ze de tekst onderaan niet raken, en
   een "+"-tegel aan het eind van de rij. */
.db-tile-tools { position: absolute; top: 13px; right: 46px; display: inline-flex; gap: 4px; }
.db-tile-tool { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; background: #f3f4f8; color: #5a6472; cursor: pointer; transition: all .15s ease; }
.db-tile-tool:hover { background: #e9e7fb; color: #5b52d9; }
.db-tile-tool--danger:hover { background: #fdecec; color: #e5484d; }
.db-tile--add { align-items: center; justify-content: center; min-height: 120px; border-style: dashed; border-width: 2px; border-color: #d9dbe5; background: transparent; box-shadow: none; color: #7a828f; }
.db-tile--add::before { display: none; }
.db-tile--add:hover { border-color: #5b52d9; color: #5b52d9; box-shadow: none; }
.db-tile-add-ico { display: inline-flex; margin-bottom: 4px; }

/* Rijen per gebruiker: in de Aanpassen-modus knoppen naast de rijtitel, een vlak om in een lege rij te slepen en
   een markering op de rij waar een tegel boven hangt. */
.db-row-head { display: flex; align-items: center; gap: 10px; }
.db-row-head--editing { min-height: 26px; }
.db-row-tools { display: inline-flex; gap: 4px; text-transform: none; letter-spacing: 0; }
button.db-tile-tool { border: 0; padding: 0; font: inherit; }
button.db-tile-tool:disabled { opacity: .35; cursor: default; background: #f3f4f8; color: #5a6472; }
.db-row-drop { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; min-height: 72px; border: 2px dashed #d9dbe5; border-radius: 16px; color: #9aa1ad; font-size: 13px; }
.db-tiles--dragover { outline: 2px dashed #5b52d9; outline-offset: 6px; border-radius: 16px; }

/* Compacte weergave: alleen maten, geen kleuren, zodat de donkere modus vanzelf meegaat. Meer tegels per rij,
   kleinere getallen en minder witruimte. */
.db-board--compact { padding: 16px 20px 22px; }
.db-board--compact .db-stats { gap: 10px; margin-bottom: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.db-board--compact .db-stat { padding: 12px 14px; border-radius: 12px; }
.db-board--compact .db-stat-big { font-size: 24px; margin: 4px 0 8px; }
.db-board--compact .db-stat-sub { margin-top: 6px; }
.db-board--compact .db-section-label { margin-bottom: 8px; }
.db-board--compact .db-section-label:not(:first-child) { margin-top: 16px; }
.db-board--compact .db-tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.db-board--compact .db-tile { padding: 11px 12px 10px; border-radius: 12px; }
.db-board--compact .db-tile-ico { width: 24px; height: 24px; border-radius: 7px; margin-bottom: 6px; }
.db-board--compact .db-tile-ico svg { width: 14px; height: 14px; }
.db-board--compact .db-tile-num { font-size: 22px; }
.db-board--compact .db-tile-label { font-size: 13px; margin-top: 3px; }
.db-board--compact .db-tile-sub { font-size: 11px; }
.db-board--compact .db-tile-eye { top: 8px; right: 8px; width: 24px; height: 24px; }
.db-board--compact .db-tile-tools { top: 9px; right: 36px; }
.db-board--compact .db-tile-tool { width: 22px; height: 22px; }
.db-board--compact .db-tile--add { min-height: 84px; }
.db-board--compact .db-row-drop { min-height: 56px; border-radius: 12px; }
.db-board--compact .db-card { padding: 12px 14px; border-radius: 12px; }
.db-board--compact .db-card-big { font-size: 24px; }

/* --- Kaarten met inhoud (grafiek, ouderdom, signalen, tabel) --- */
.db-row-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .db-row-2-1 { grid-template-columns: minmax(0, 1fr); } }
.db-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.db-card { background: #fff; border: 1px solid #edeef4; border-radius: 16px; padding: 18px 20px; box-shadow: 0 1px 2px rgba(31,36,48,.04); min-width: 0; }
.db-card--flush { padding: 0; overflow: hidden; }
.db-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.db-card-big { font-size: 34px; font-weight: 750; letter-spacing: -0.02em; margin: 6px 0 0; font-variant-numeric: tabular-nums; }
.db-seg { display: inline-flex; border: 1px solid #e9ebf2; border-radius: 8px; overflow: hidden; }
.db-seg button { font: inherit; font-size: 12px; padding: 4px 10px; border: 0; background: #fff; color: #5a6472; cursor: pointer; }
.db-seg button.db-seg--on { background: #f3f1fe; color: #4a42c4; font-weight: 600; }
.db-link { font: inherit; color: inherit; text-align: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.db-link:hover { color: #5b52d9; text-decoration: underline; }
.db-link--accent { color: #5b52d9; font-weight: 600; font-size: 13px; }

/* Ouderdomsbalk: elk vak is klikbaar. */
.db-age { display: flex; height: 14px; border-radius: 999px; overflow: hidden; gap: 2px; margin: 14px 0 12px; }
.db-age button { border: 0; padding: 0; cursor: pointer; min-width: 4px; transition: filter .15s ease; }
.db-age button:hover { filter: brightness(1.1); }
.db-age-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; font-size: 12.5px; color: #7a828f; }
.db-age-legend button { display: flex; align-items: center; gap: 6px; font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.db-age-legend button:hover { color: #5b52d9; }
.db-age-legend b { color: #1f2430; font-variant-numeric: tabular-nums; margin-left: auto; }
.db-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* Signalen */
.db-signal { display: flex; gap: 10px; border-radius: 12px; background: #fff; border: 1px solid #e2e0f7; padding: 12px; margin-top: 10px; }
.db-signal-ico { width: 28px; height: 28px; flex: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.db-signal-text { font-size: 13px; line-height: 1.45; }
.db-signal-actions { display: flex; gap: 12px; margin-top: 6px; font-size: 12px; font-weight: 600; flex-wrap: wrap; }
.db-signal-actions button { font: inherit; border: 0; background: none; padding: 0; cursor: pointer; color: #9aa1ad; }
.db-signal-actions button:first-child { color: #5b52d9; }
.db-signal-actions button:hover { text-decoration: underline; }
.db-signal-list--open { max-height: 620px; overflow-y: auto; padding-right: 6px; margin-right: -6px; }
.db-badge { font-size: 11px; font-weight: 600; color: #f0642a; background: #fff1ea; border-radius: 999px; padding: 3px 9px; }
.db-signal--bad .db-signal-ico { background: #fdecec; color: #e5484d; }
.db-signal--warn .db-signal-ico { background: #fdf1dc; color: #c98a2e; }
.db-signal--good .db-signal-ico { background: #e3f7ef; color: #12b886; }
.db-signal--info .db-signal-ico { background: #eceafd; color: #5b52d9; }

/* Tabel in een kaart */
.db-table-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 4px; gap: 12px; }
.db-table-scroll { max-height: 440px; overflow: auto; }
.db-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.db-table th { position: sticky; top: 0; z-index: 1; background: #fff; text-align: right; font-weight: 700; padding: 12px 16px; border-bottom: 1px solid #e9ebf2; white-space: nowrap; }
.db-table td { text-align: right; padding: 10px 16px; border-bottom: 1px solid #f0f1f5; font-variant-numeric: tabular-nums; white-space: nowrap; }
.db-table :is(th, td):first-child, .db-table :is(th, td).db-left { text-align: left; }
.db-table tbody tr:nth-child(even) td { background: #f7f8fb; }
.db-pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.db-pill--good { background: #e3f7ef; color: #0b7a5c; }
.db-pill--warn { background: #fdf1dc; color: #9a6512; }
.db-pill--bad { background: #fdecec; color: #b42318; }
.db-pill--info { background: #eceafd; color: #4a42c4; }
.db-sub { font-size: 12px; color: #9aa1ad; white-space: normal; }
.db-warn { color: #e5484d; font-weight: 600; }
/* Kleine balk in een tabelcel, zoals de bezetting van een werkplek */
.db-meter { display: inline-block; width: 140px; vertical-align: middle; margin-right: 8px; }

/* Grafiek: de DxChart vult zijn kaart. */
.db-chart { width: 100%; height: 300px; }

/* ===== Donkere modus (X Modern) ===== */
html[data-pfx-theme="dark"] .db-board { color: var(--pfx-ink); }
html[data-pfx-theme="dark"] :is(.db-btn, .db-select) { background: var(--pfx-surface); border-color: var(--pfx-line); color: var(--pfx-text-soft); }
html[data-pfx-theme="dark"] .db-btn:hover { color: #B8ACFA; border-color: #8B83EA; }
html[data-pfx-theme="dark"] :is(.db-btn--on, .db-btn--on:hover) { background: #5b52d9; border-color: #5b52d9; color: #fff; }
html[data-pfx-theme="dark"] .db-error { background: rgba(214,69,80,.14); color: #F08A92; border-color: rgba(214,69,80,.35); }
html[data-pfx-theme="dark"] .db-edit-hint { background: rgba(139,131,234,.12); color: #B8ACFA; border-color: rgba(139,131,234,.4); }
html[data-pfx-theme="dark"] :is(.db-stat, .db-tile, .db-card, .db-signal) { background: var(--pfx-surface); border-color: var(--pfx-card-line); box-shadow: none; }
html[data-pfx-theme="dark"] :is(.db-stat:hover, .db-tile:hover) { border-color: var(--pfx-line); box-shadow: 0 10px 24px rgba(0,0,0,.35); }
html[data-pfx-theme="dark"] :is(.db-stat--static:hover, .db-tile--static:hover) { border-color: var(--pfx-card-line); box-shadow: none; }
html[data-pfx-theme="dark"] .db-stat-bar { background: var(--pfx-line-soft); }
html[data-pfx-theme="dark"] :is(.db-stat-sub, .db-age-legend) { color: var(--pfx-muted); }
html[data-pfx-theme="dark"] .db-age-legend b { color: var(--pfx-ink); }
html[data-pfx-theme="dark"] .db-tile--dragover { outline-color: #8B83EA; }
html[data-pfx-theme="dark"] .db-tile-eye { background: var(--pfx-line-soft); color: var(--pfx-text-soft); }
html[data-pfx-theme="dark"] .db-tile--editing:hover .db-tile-eye { background: var(--pfx-line); color: #B8ACFA; }
html[data-pfx-theme="dark"] .db-tile-tool { background: var(--pfx-line-soft); color: var(--pfx-text-soft); }
html[data-pfx-theme="dark"] .db-tile-tool:hover { background: var(--pfx-line); color: #B8ACFA; }
html[data-pfx-theme="dark"] .db-tile-tool--danger:hover { background: rgba(229,72,77,.18); color: #ff8a8e; }
html[data-pfx-theme="dark"] .db-tile--add { background: transparent; border-color: var(--pfx-line); color: var(--pfx-muted); }
html[data-pfx-theme="dark"] button.db-tile-tool:disabled { background: var(--pfx-line-soft); color: var(--pfx-text-soft); }
html[data-pfx-theme="dark"] .db-row-drop { border-color: var(--pfx-line); color: var(--pfx-muted); }
html[data-pfx-theme="dark"] .db-tiles--dragover { outline-color: #8B83EA; }
html[data-pfx-theme="dark"] .db-tile--add:hover { border-color: #8B83EA; color: #B8ACFA; box-shadow: none; }
html[data-pfx-theme="dark"] :is(.db-seg, .db-seg button) { background: var(--pfx-surface); border-color: var(--pfx-line); color: var(--pfx-text-soft); }
html[data-pfx-theme="dark"] .db-seg button.db-seg--on { background: rgba(139,131,234,.18); color: #B8ACFA; }
html[data-pfx-theme="dark"] :is(.db-link:hover, .db-link--accent, .db-age-legend button:hover, .db-signal-actions button:first-child) { color: #B8ACFA; }
html[data-pfx-theme="dark"] .db-table th { background: var(--pfx-surface); border-bottom-color: var(--pfx-line); }
html[data-pfx-theme="dark"] .db-table td { border-bottom-color: var(--pfx-line-soft); }
html[data-pfx-theme="dark"] .db-table tbody tr:nth-child(even) td { background: rgba(255,255,255,.03); }
html[data-pfx-theme="dark"] .db-signal { border-color: rgba(139,131,234,.3); }
html[data-pfx-theme="dark"] .db-chip:not(.db-chip--on) { background: var(--pfx-surface); border-color: var(--pfx-line); color: var(--pfx-text-soft); }
html[data-pfx-theme="dark"] .db-chip:not(.db-chip--on):hover { color: #B8ACFA; border-color: #8B83EA; }
html[data-pfx-theme="dark"] .db-date { background: var(--pfx-surface-3); border-color: var(--pfx-line); color: var(--pfx-ink); color-scheme: dark; }
html[data-pfx-theme="dark"] :is(.db-range-label, .db-sub) { color: var(--pfx-muted); }
html[data-pfx-theme="dark"] .db-warn { color: #F08A92; }
