/* Herbruikbare componenten. Alles via tokens, dus werkt op licht én donker. */

/* ---- Knoppen ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
    height: var(--tap); padding: 0 var(--sp-4);
    border-radius: var(--radius); border: 1px solid transparent;
    font-size: var(--fs-base); font-weight: 500; white-space: nowrap;
    transition: background-color .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn--secondary { background: var(--surface-2); border-color: var(--line-strong); color: var(--text); }
.btn--secondary:hover:not(:disabled) { background: var(--surface); }
.btn--ghost { color: var(--text-muted); }
.btn--ghost:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.btn--danger { background: var(--neg); color: #fff; }
.btn--danger:hover:not(:disabled) { filter: brightness(1.06); }
.btn--sm { height: 34px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn--cta {
    font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em;
    font-weight: 700; height: 56px; font-size: var(--fs-lg); border-radius: var(--radius-lg);
}
.btn--block { width: 100%; }
.btn .ic { width: 18px; height: 18px; }

/* Kleine ronde stap-knop (winkelwagen +/-) */
.stepper { display: inline-flex; align-items: center; gap: var(--sp-2); }
.stepper__btn {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
    display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-lg);
}
.stepper__btn:hover { background: var(--surface); }
.stepper__val { min-width: 2ch; text-align: center; font-family: var(--font-mono); }

/* ---- Formuliervelden ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
.field__hint { font-size: var(--fs-xs); color: var(--text-faint); }
.input, .select, .textarea {
    height: var(--tap); padding: 0 var(--sp-3);
    background: var(--surface-2); color: var(--text);
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    font-size: var(--fs-base); width: 100%;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.textarea { height: auto; min-height: 88px; padding: var(--sp-2) var(--sp-3); resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--text-faint); }
.input--mono { font-family: var(--font-mono); }
.input--lg { height: 52px; font-size: var(--fs-md); }

/* ---- Kaarten & panelen ---- */
.card {
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.card--pad { padding: var(--sp-5); }
.panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.panel__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line);
}
.panel__title { font-family: var(--font-display); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: var(--fs-sm); color: var(--text-muted); }
.panel__body { padding: var(--sp-4); }

/* ---- Tabellen ---- */
.table { font-size: var(--fs-sm); }
.table th {
    text-align: left; font-family: var(--font-display); font-weight: 600;
    text-transform: uppercase; letter-spacing: .08em; font-size: var(--fs-xs);
    color: var(--text-faint); padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}
.table td { padding: var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface); }
.table td.num, .table th.num { text-align: right; font-family: var(--font-mono); }
.table .sub { display: block; color: var(--text-faint); font-size: var(--fs-xs); }
.sort-btn { display: inline-flex; align-items: center; gap: 4px; color: inherit; font: inherit; text-transform: inherit; letter-spacing: inherit; }
.sort-btn[data-dir="asc"]::after { content: "↑"; }
.sort-btn[data-dir="desc"]::after { content: "↓"; }

/* ---- Pills / badges / chips ---- */
.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 9px; border-radius: var(--radius-pill);
    font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
    background: var(--surface); color: var(--text-muted);
}
.pill--pos { background: var(--pos-soft); color: var(--pos-text); }
.pill--neg { background: var(--neg-soft); color: var(--neg-text); }
.pill--signal { background: var(--signal-soft); color: var(--signal-text); }
.pill--accent { background: var(--accent-soft); color: var(--accent-text); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--groove); flex: 0 0 auto; }
.status-dot--on { background: var(--pos); }
.status-dot--warn { background: var(--signal); }
.status-dot--off { background: var(--neg); }

/* ---- KPI-tegels ---- */
.kpi { background: var(--surface); border-radius: var(--radius); padding: var(--sp-4); }
.kpi__label { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); }
.kpi__value { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl); margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi__value--spot { color: var(--accent-text); }
.kpi__value--pos { color: var(--pos); }
.kpi__delta { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 2px; }

/* ---- Tabs / sectie-navigatie ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.tab {
    padding: var(--sp-2) var(--sp-3); border-radius: var(--radius-sm);
    color: var(--text-muted); font-size: var(--fs-sm); font-weight: 500;
}
.tab:hover { background: var(--surface); color: var(--text); }
.tab.is-active { background: var(--text); color: var(--bg); }

/* ---- Toasts ---- */
.toast-host {
    position: fixed; left: 50%; bottom: var(--sp-5); transform: translateX(-50%);
    display: flex; flex-direction: column; gap: var(--sp-2); z-index: 60; width: min(92vw, 420px);
}
.toast {
    display: flex; align-items: flex-start; gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4); border-radius: var(--radius);
    background: var(--surface-2); border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-pop); animation: dd-rise .18s ease; font-size: var(--fs-sm);
}
.toast--ok { border-left: 3px solid var(--pos); }
.toast--err { border-left: 3px solid var(--neg); }
.toast--info { border-left: 3px solid var(--accent); }

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(15, 13, 9, .55);
    display: flex; align-items: center; justify-content: center; padding: var(--sp-4); z-index: 50;
    animation: dd-rise .14s ease;
}
.modal { width: min(94vw, 520px); max-height: 90vh; overflow: auto; }
.modal--wide { width: min(96vw, 860px); }
.modal__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-4); }
.modal__foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); display: flex; gap: var(--sp-2); justify-content: flex-end; }

/* ---- Lege staat ---- */
.empty { text-align: center; padding: var(--sp-7) var(--sp-4); color: var(--text-muted); }
.empty__title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-lg); color: var(--text); text-transform: uppercase; letter-spacing: .04em; }
.empty__body { margin-top: 6px; font-size: var(--fs-sm); }

/* ---- Scanner-media (gedeeld door kassa en quickscan) ---- */
.scan-media { width: 100%; border-radius: var(--radius); background: #000; aspect-ratio: 4 / 3; object-fit: cover; }

/* ---- Quickscan ---- */
.qs-toolbar { display: flex; align-items: flex-end; gap: var(--sp-3); flex-wrap: wrap; }
.qs-count-wrap { text-align: center; padding: var(--sp-3) 0; }
.qs-counter { font-family: var(--font-display); font-weight: 700; font-size: 4rem; line-height: .9; color: var(--accent-text); }
.qs-counter__label { color: var(--text-muted); font-size: var(--fs-sm); margin-top: 4px; }
.qs-recent { max-height: 260px; overflow-y: auto; }
.qs-row { display: flex; align-items: center; gap: var(--sp-3); padding: 9px var(--sp-4); border-top: 1px solid var(--line); }
.qs-row:first-child { border-top: none; }
.qs-row__sub { display: block; color: var(--text-faint); font-size: var(--fs-xs); }

/* ---- Bon (print) ---- */
#print-root { display: none; }
.receipt { max-width: 320px; margin: 0 auto; color: #000; font-family: var(--font-sans); }
.receipt__head { text-align: center; margin-bottom: 12px; }
.receipt__brand { font-family: var(--font-display); font-weight: 700; letter-spacing: .12em; font-size: 22px; }
.receipt__sub { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: #555; }
.receipt__meta { font-size: 12px; color: #333; text-align: center; margin-bottom: 12px; }
.receipt__lines { border-top: 1px dashed #999; border-bottom: 1px dashed #999; padding: 8px 0; display: flex; flex-direction: column; gap: 4px; }
.receipt__line { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.receipt__total { display: flex; justify-content: space-between; font-weight: 700; font-size: 16px; margin-top: 10px; font-family: var(--font-display); }
.receipt__foot { text-align: center; font-size: 11px; color: #666; margin-top: 16px; }
@media print {
    body > *:not(#print-root) { display: none !important; }
    #print-root { display: block; }
    .toast-host { display: none !important; }
}

/* ---- Inline melding ---- */
.notice { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); font-size: var(--fs-sm); }
.notice--ok { background: var(--pos-soft); color: var(--pos-text); }
.notice--err { background: var(--neg-soft); color: var(--neg-text); }
.notice--info { background: var(--accent-soft); color: var(--accent-text); }
