/* ==========================================================================
   paginas.css: vernieuwde schermen naast Dashboard, Apparaten en Kaart
   - toestelpagina: kruimelpad, stip, potlood en het menu met acties (tk-*)
   - tabblad Grafieken: periode, kerncijfers, losse grafieken (hg-*)
   - Rapportage in drie stappen met een samenvatting (rp-*)
   - Beheer als klikbare tegels (bt-*)
   Alles met de tokens uit ui.css, zodat licht en donker vanzelf kloppen.
   ========================================================================== */

/* ---------------------------------------------------------------- kop */
.tk-kruimel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    margin: 0 0 6px;
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
}

.tk-kruimel button,
.tk-kruimel span {
    width: auto;
    min-height: 32px;
    margin: 0;
    padding: 0 6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    color: var(--alp-text-secondary);
    font: inherit;
    font-weight: 500;
    line-height: 32px;
}

.tk-kruimel button:first-child {
    padding-left: 0;
}

.tk-kruimel button:hover {
    background: transparent;
    color: var(--alp-text-primary);
    text-decoration: underline;
}

.tk-kruimel button[aria-current="page"] {
    color: var(--alp-text-primary);
}

.tk-kruimel .tk-kruimel-schuin {
    padding: 0 2px;
    color: var(--alp-outline);
}

#device-detail .toestel-kop-titel {
    gap: 10px;
}

.tk-stip {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--alp-status-klaar);
    vertical-align: middle;
}

.tk-stip.is-offline {
    background: var(--alp-status-aandacht);
}

.tk-stip.is-alarm {
    background: var(--alp-status-blokkade);
    box-shadow: 0 0 0 4px var(--alp-status-blokkade-bg);
}

.tk-stip.is-online {
    box-shadow: 0 0 0 4px var(--alp-status-klaar-bg);
}

#device-detail .toestel-kop-titel > span {
    display: inline-flex;
}

.tk-potlood {
    display: inline-grid;
    place-items: center;
    width: 32px !important;
    height: 32px;
    min-height: 32px;
    margin: 0;
    padding: 0 !important;
    border: 1px solid var(--alp-outline) !important;
    border-radius: 10px;
    background: var(--alp-surface) !important;
    box-shadow: none !important;
    color: var(--alp-text-secondary) !important;
}

.tk-potlood:hover {
    background: var(--alp-surface-muted) !important;
    color: var(--alp-text-primary) !important;
}

.tk-stand {
    color: var(--alp-text-primary);
    font-weight: 500;
}

.toestel-kop-acties {
    align-items: center;
}

.tk-menu-wikkel {
    position: relative;
}

.tk-menu-knop {
    display: grid;
    place-items: center;
    width: 44px !important;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 !important;
    border: 1px solid var(--alp-outline) !important;
    border-radius: 12px;
    background: var(--alp-surface) !important;
    box-shadow: none !important;
    color: var(--alp-text-primary) !important;
}

.tk-menu-knop:hover,
.tk-menu-knop[aria-expanded="true"] {
    background: var(--alp-surface-muted) !important;
}

.tk-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 50;
    display: grid;
    width: 240px;
    padding: 6px;
    border: 1px solid var(--alp-outline);
    border-radius: 14px;
    background: var(--alp-surface);
    box-shadow: var(--alp-shadow-lg);
}

.tk-menu[hidden] {
    display: none;
}

.tk-menu button {
    width: 100%;
    min-height: 40px;
    margin: 0;
    padding: 0 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    box-shadow: none;
    color: var(--alp-text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: left;
}

.tk-menu button:hover,
.tk-menu button:focus-visible {
    background: var(--alp-surface-muted);
    color: var(--alp-text-primary);
}

.tk-menu button.is-rood,
.tk-menu button.is-rood:hover {
    color: var(--alp-status-blokkade);
}

.tk-menu hr {
    width: 100%;
    margin: 6px 0;
    border: 0;
    border-top: 1px solid var(--alp-outline);
}

/* ---------------------------------------------------------------- grafieken */
#device-detail .hg {
    gap: 16px;
}

.hg-balk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
}

.hg-periode {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    border-radius: 14px;
    background: var(--alp-spoor);
}

.hg-periode button {
    width: auto;
    min-height: 36px;
    margin: 0;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
}

.hg-periode button:hover {
    background: var(--alp-spoor-hover);
    color: var(--alp-text-primary);
}

.hg-periode button.active,
.hg-periode button.active:hover {
    background: var(--alp-brand-primary);
    color: var(--alp-on-brand-primary, #fff);
}

.hg-meta {
    margin-left: auto;
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
}

.hg-opties {
    position: relative;
}

.hg-opties summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--alp-outline);
    border-radius: 12px;
    background: var(--alp-surface);
    color: var(--alp-text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.hg-opties summary::-webkit-details-marker {
    display: none;
}

.hg-opties-paneel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 40;
    display: grid;
    gap: 10px;
    width: min(460px, calc(100vw - 32px));
    padding: 14px;
    border: 1px solid var(--alp-outline);
    border-radius: 14px;
    background: var(--alp-surface);
    box-shadow: var(--alp-shadow-lg);
    font-size: 0.8125rem;
}

.hg-opties-paneel label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--alp-text-primary);
    font-weight: 500;
}

.hg-opties-paneel input {
    width: auto;
    margin: 0;
}

.hg-opties-paneel button {
    width: auto;
    justify-self: start;
    min-height: 36px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--alp-outline);
    border-radius: 10px;
    background: var(--alp-surface);
    box-shadow: none;
    color: var(--alp-text-primary);
    font-size: 0.8125rem;
}

.hg-opties-paneel span {
    color: var(--alp-text-secondary);
    font-size: 0.75rem;
}

.hg-ververs {
    display: grid;
    place-items: center;
    width: 44px !important;
    height: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0 !important;
    border: 1px solid var(--alp-outline) !important;
    border-radius: 12px;
    background: var(--alp-surface) !important;
    box-shadow: none !important;
    color: var(--alp-text-primary) !important;
}

.hg-ververs:hover {
    background: var(--alp-surface-muted) !important;
}

.hg-tegels {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.hg-tegels:empty {
    display: none;
}

.hg-tegels.hg-aantal-1 { grid-template-columns: minmax(0, 1fr); }
.hg-tegels.hg-aantal-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hg-tegels.hg-aantal-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Weergave > Kaarten bovenaan */
.hg-kaartkeuze {
    display: grid;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--alp-outline);
}

.hg-kaartkeuze:empty {
    display: none;
}

.hg-kk-kop {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    color: var(--alp-text-primary);
    font-size: 0.8125rem;
}

.hg-kk-kop strong {
    font-weight: 600;
}

.hg-kaartkeuze .hg-kk-teller {
    color: var(--alp-text-secondary);
    font-variant-numeric: tabular-nums;
}

.hg-kk-lijst {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px 12px;
    max-height: min(340px, 50vh);
    overflow-y: auto;
    margin: 0 -4px;
    padding: 0 4px;
}

.hg-kk-lijst label {
    min-height: 32px;
    border-radius: 8px;
}

@media (max-width: 560px) {
    .hg-kk-lijst {
        grid-template-columns: minmax(0, 1fr);
    }
}

.hg-kk-lijst label.is-uit {
    color: var(--alp-text-secondary);
}

.hg-tegel {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding: 16px 20px;
    border: 1px solid var(--alp-outline);
    border-radius: var(--alp-radius-md);
    background: var(--alp-surface);
    box-shadow: var(--alp-shadow-sm);
}

.hg-tegel-label {
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
}

.hg-tegel-waarde {
    color: var(--alp-text-primary);
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.hg-tegel-noot {
    overflow: hidden;
    color: var(--alp-text-secondary);
    font-size: 0.75rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hg-tegel.is-zacht .hg-tegel-waarde {
    color: var(--alp-text-secondary);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.6;
}

.hg-tegel.is-alarm .hg-tegel-waarde {
    color: var(--alp-status-blokkade);
}

.hg-raster {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

@media (min-width: 1100px) {
    .hg-raster {
        grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    }
}

.hg-links,
.hg-rechts {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.hg-canvas {
    position: relative;
    /* --tl-extra: ruimte voor de nummers van de tijdlijn (V3) boven de grafiek */
    height: calc(280px + var(--tl-extra, 0px));
    padding: 0 16px 16px;
}

.hg-lijst {
    padding: 0 24px 12px;
}

.hg-lijst .tp-leeg {
    padding: 8px 0 12px;
}

.hg-rij {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--alp-outline);
    font-size: 0.875rem;
}

.hg-rij:first-child {
    border-top: 0;
}

.hg-rij span {
    color: var(--alp-text-secondary);
}

.hg-rij strong {
    color: var(--alp-text-primary);
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.hg-rij strong.is-zacht {
    color: var(--alp-text-secondary);
    font-weight: 500;
}

@media (max-width: 900px) {
    .hg-tegels,
    .hg-tegels.hg-aantal-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .hg-meta {
        order: 5;
        width: 100%;
        margin-left: 0;
    }

    .hg-periode {
        flex: 1 1 100%;
        overflow-x: auto;
    }

    .hg-periode button {
        flex: 1 0 auto;
    }

    .hg-opties-paneel {
        right: auto;
        left: 0;
    }

    .hg-canvas {
        height: calc(240px + var(--tl-extra, 0px));
        padding: 0 8px 12px;
    }

    .hg-lijst {
        padding: 0 16px 8px;
    }
}

/* ---------------------------------------------------------------- rapportage */
#rapportage-view .rp {
    display: grid;
    gap: 20px;
    width: 100%;
    max-width: 1280px;
}

.rp-kop h2 {
    margin: 0;
    font-size: 1.625rem;
    letter-spacing: -0.02em;
}

.rp-kop p {
    margin: 4px 0 0;
    color: var(--alp-text-secondary);
}

.rp-raster {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

@media (min-width: 1000px) {
    .rp-raster {
        grid-template-columns: minmax(0, 1fr) 360px;
    }

    .rp-samen {
        position: sticky;
        top: calc(var(--alp-menu-hoogte, 64px) + 20px);
    }
}

.rp-kaart {
    min-width: 0;
    border: 1px solid var(--alp-outline);
    border-radius: var(--alp-radius-md);
    background: var(--alp-surface);
    box-shadow: var(--alp-shadow-sm);
}

.rp-stap {
    padding: 22px 24px;
    border-top: 1px solid var(--alp-outline);
}

.rp-stap:first-child {
    border-top: 0;
}

.rp-stap h3,
.rp-samen h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--alp-text-primary);
    font-size: 1rem;
    font-weight: 600;
}

.rp-nr {
    display: inline-grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--alp-brand-tint);
    color: var(--alp-brand-tekst);
    font-size: 0.75rem;
    font-weight: 700;
}

.rp-uitleg {
    margin: 4px 0 16px 34px;
    color: var(--alp-text-secondary);
    font-size: 0.875rem;
}

.rp-stap > :not(h3):not(.rp-uitleg):not(input[type="hidden"]) {
    margin-left: 34px;
}

.rp-velden {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 16px;
    margin-bottom: 16px;
}

.rp-veld {
    display: grid;
    gap: 6px;
    margin: 0;
    font-weight: 400;
}

.rp-veld[hidden] {
    display: none;
}

.rp-veld > span {
    color: var(--alp-text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
}

#rapportage-view .rp-veld select,
#rapportage-view .rp-veld input:not([type="checkbox"]),
#rapportage-view .rp-mail input {
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--alp-outline);
    border-radius: 12px;
    background: var(--alp-surface);
    color: var(--alp-text-primary);
    font-size: 0.875rem;
    box-sizing: border-box;
}

#rapportage-view .rp-alles,
#rapportage-view .rp-vink {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px 34px;
    color: var(--alp-text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

#rapportage-view .rp-alles[hidden] {
    display: none;
}

#rapportage-view .rp-vink {
    margin: 4px 0 0;
}

#rapportage-view input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--alp-brand-primary);
}

.rp-toestellen {
    display: grid;
    gap: 10px;
}

.rp-leeg {
    margin: 0;
    padding: 14px 16px;
    border: 1px dashed var(--alp-outline);
    border-radius: 12px;
    color: var(--alp-text-secondary);
    font-size: 0.875rem;
}

.rp-groep {
    border: 1px solid var(--alp-outline);
    border-radius: 12px;
}

.rp-groep-kop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
}

#rapportage-view .rp-groep-kop label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--alp-text-primary);
    font-weight: 600;
    cursor: pointer;
}

.rp-groep-tel {
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.rp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 14px 12px;
}

#rapportage-view .rp-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--alp-outline);
    border-radius: 10px;
    background: var(--alp-surface);
    color: var(--alp-text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

#rapportage-view .rp-chip small {
    color: var(--alp-text-secondary);
    font-size: 0.75rem;
}

#rapportage-view .rp-chip:has(input:checked) {
    border-color: var(--alp-brand-primary);
    background: var(--alp-brand-primary);
    color: var(--alp-on-brand-primary, #fff);
}

#rapportage-view .rp-chip:has(input:checked) small {
    color: rgba(255, 255, 255, 0.75);
}

#rapportage-view .rp-chip:has(input:checked) input {
    accent-color: #fff;
}

.rp-keuze {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-bottom: 4px;
    padding: 4px;
    border-radius: 14px;
    background: var(--alp-spoor);
}

.rp-keuze button,
.rp-mini button {
    width: auto;
    min-height: 36px;
    margin: 0;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
    font-weight: 600;
}

.rp-keuze button:hover {
    background: var(--alp-spoor-hover);
    color: var(--alp-text-primary);
}

.rp-keuze button.active,
.rp-keuze button.active:hover {
    background: var(--alp-brand-primary);
    color: var(--alp-on-brand-primary, #fff);
}

.rp-keuze-vol {
    display: flex;
    margin: 16px 0 0;
}

.rp-keuze-vol button {
    flex: 1 1 0;
}

#rap-custom-dates {
    margin-top: 12px;
}

.rp-schakelaars {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0 28px;
}

#rapportage-view .rp-schakel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 46px;
    margin: 0;
    border-bottom: 1px solid var(--alp-outline);
    color: var(--alp-text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

#rapportage-view .rp-schakel small {
    color: var(--alp-text-secondary);
    font-weight: 400;
}

/* Vinkje als schakelaar */
#rapportage-view .rp-schakel input {
    flex: 0 0 auto;
    position: relative;
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: var(--alp-schakelaar-uit);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

#rapportage-view .rp-schakel input::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease;
}

#rapportage-view .rp-schakel input:checked {
    background: var(--alp-brand-primary);
}

#rapportage-view .rp-schakel input:checked::after {
    transform: translateX(16px);
}

.rp-mini {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

.rp-mini button {
    border: 1px solid var(--alp-outline);
    background: var(--alp-surface);
    color: var(--alp-text-primary);
}

.rp-meer {
    border-top: 1px solid var(--alp-outline);
}

.rp-meer summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 16px;
    padding: 18px 24px 18px 58px;
    color: var(--alp-text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
    list-style: none;
}

.rp-meer summary::-webkit-details-marker {
    display: none;
}

.rp-meer summary strong::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-left: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-3px);
}

.rp-meer[open] summary strong::after {
    transform: rotate(-135deg) translateY(-1px);
}

.rp-meer summary span {
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
}

.rp-velden-meer {
    margin: 0;
    padding: 0 24px 22px 58px;
}

.rp-samen {
    padding: 22px 24px;
}

.rp-sam {
    margin-top: 10px;
}

.rp-sam-rij {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 10px 0;
    border-top: 1px solid var(--alp-outline);
    font-size: 0.875rem;
}

.rp-sam-rij:first-child {
    border-top: 0;
}

.rp-sam-rij span {
    color: var(--alp-text-secondary);
}

.rp-sam-rij strong {
    color: var(--alp-text-primary);
    font-weight: 600;
    text-align: right;
}

.rp-sam-rij strong.is-zacht {
    color: var(--alp-text-secondary);
    font-weight: 500;
}

#rapportage-view .rp-knop {
    width: 100%;
    min-height: 46px;
    margin: 12px 0 0;
}

.rp-mail {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

#rapportage-view .rp-mail .btn {
    flex: 0 0 auto;
    width: auto;
    min-height: 44px;
    margin: 0;
}

.rp-noot {
    margin: 6px 0 0;
    color: var(--alp-text-secondary);
    font-size: 0.75rem;
}

#rapportage-view .rp-link {
    display: block;
    width: auto;
    min-height: 36px;
    margin: 10px auto 0;
    padding: 0 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
    color: var(--alp-brand-tekst);
    font-size: 0.8125rem;
    font-weight: 600;
}

#rapportage-view .rp-link:hover {
    text-decoration: underline;
}

.rp-status:not(:empty) {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--alp-surface-muted);
    color: var(--alp-text-primary);
    font-size: 0.8125rem;
}

@media (max-width: 700px) {
    #rapportage-view .rp-alles {
        margin-left: 0;
    }

    .rp-stap,
    .rp-samen {
        padding: 18px 16px;
    }

    .rp-uitleg,
    .rp-stap > :not(h3):not(.rp-uitleg):not(input[type="hidden"]) {
        margin-left: 0;
    }

    .rp-meer summary,
    .rp-velden-meer {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ==================== Beheer: klikbare tegels (bt-) ==================== */
.bt-tegels {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.bt-tegel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 20px 22px;
    border: 1px solid var(--alp-outline);
    border-radius: var(--alp-radius-md);
    background: var(--alp-surface);
    box-shadow: var(--alp-shadow-sm);
    color: var(--alp-text-primary);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.bt-tegel:hover {
    border-color: var(--alp-brand-primary);
    box-shadow: var(--alp-shadow-lg);
    text-decoration: none;
}

.bt-tegel:focus-visible {
    outline: 2px solid var(--alp-brand-primary);
    outline-offset: 2px;
}

.bt-tegel-kop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.bt-icoon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--alp-brand-tint);
    color: var(--alp-brand-tekst);
}

.bt-pijl {
    color: var(--alp-text-secondary);
    transition: transform .15s, color .15s;
}

.bt-tegel:hover .bt-pijl {
    color: var(--alp-brand-tekst);
    transform: translateX(2px);
}

.bt-titel {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.bt-tekst {
    color: var(--alp-text-secondary);
    font-size: 0.875rem;
    line-height: 1.4;
}

.bt-meta {
    margin-top: auto;
    padding-top: 14px;
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.bt-meta.is-alarm {
    color: var(--alp-status-blokkade-tekst, var(--alp-status-blokkade));
    font-weight: 600;
}

.bt-meldingen {
    max-width: 760px;
}

.bt-mail {
    display: flex;
    gap: 8px;
    align-items: center;
}

.bt-mail input {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.bt-mail .btn {
    flex: none;
    margin: 0;
    width: auto;
}

.bt-status {
    margin-top: 8px;
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
    min-height: 1em;
}

@media (max-width: 1000px) {
    .bt-tegels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .bt-tegels { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .bt-tegel { padding: 16px; }
    .bt-tegel-kop { margin-bottom: 6px; }
    .bt-meta { padding-top: 8px; }
    .bt-mail { flex-wrap: wrap; }
    .bt-mail input { flex-basis: 100%; }
    .bt-mail .btn { flex: 1; }
}

/* ==================== Diagnose (dg-) ==================== */
.dg-kop-rechts {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dg-toestel {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.dg-toestel strong {
    display: block;
    font-weight: 600;
}

.dg-toestel small {
    display: block;
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
    font-weight: 400;
}

.dg-mac {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    color: var(--alp-text-primary);
    background: transparent !important;
    padding: 0 !important;
}

.dg-wifi {
    display: inline-flex;
    align-items: flex-end;
    gap: 8px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.dg-balkjes {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 15px;
}

.dg-balkjes i {
    width: 4px;
    border-radius: 1px;
    background: var(--alp-outline);
}

.dg-wifi.is-goed .dg-balkjes i.aan { background: var(--alp-status-klaar); }
.dg-wifi.is-krap .dg-balkjes i.aan { background: var(--alp-status-aandacht); }
.dg-wifi.is-slecht .dg-balkjes i.aan { background: var(--alp-status-blokkade); }

.dg-waarde { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dg-waarde.is-krap { color: var(--alp-status-aandacht-tekst, var(--alp-status-aandacht)); font-weight: 600; }
.dg-waarde.is-slecht { color: var(--alp-status-blokkade-tekst); font-weight: 600; }

.dg-details {
    padding: 0 24px 8px;
    overflow-y: auto;
}

.dg-rij {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 11px 0;
    border-bottom: 1px solid var(--alp-outline);
    font-size: 0.875rem;
}

.dg-rij:last-child { border-bottom: 0; }
.dg-rij > span { color: var(--alp-text-secondary); }
.dg-rij > strong { font-weight: 600; text-align: right; }

.bd-venster-voet.dg-venster-voet {
    justify-content: space-between;
    align-items: center;
}

.dg-voet-rest {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.bh button.dg-link-rood {
    min-height: 40px;
    padding: 0 4px;
    border: 0;
    background: transparent;
    color: var(--alp-status-blokkade-tekst);
    font-weight: 600;
}

.bh button.dg-link-rood:hover {
    background: transparent;
    text-decoration: underline;
}

.bh a.bh-knop-rustig.dg-open {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--alp-outline);
    border-radius: 10px;
    background: var(--alp-surface);
    color: var(--alp-text-primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
}

.bh a.bh-knop-rustig.dg-open:hover { background: var(--alp-surface-muted); }

@media (max-width: 640px) {
    .bd-venster-voet.dg-venster-voet { flex-wrap: wrap; }
    .dg-voet-rest { width: 100%; }
}
#device-modal .bd-venster-kader { max-width: 580px; }

/* ==================== Kleine dingen (F) ==================== */
/* NO/NC: de gekozen kant is gevuld in de merkkleur (zoals elke keuze) */
#device-detail .tp-keuze2 {
    background: var(--alp-spoor);
}

#device-detail .tp-keuze2 input:checked ~ .tp-keuze2-aan,
#device-detail .tp-keuze2 input:not(:checked) ~ .tp-keuze2-uit {
    background: var(--alp-brand-primary);
    box-shadow: none;
    color: var(--alp-on-brand-primary);
}

/* Firmwarebestand kiezen: Nederlandse knop i.p.v. 'Choose File' */
.ota-bestand {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 4px 4px 4px 4px;
    border: 1px dashed var(--alp-outline);
    border-radius: 10px;
    background: var(--alp-surface);
    cursor: pointer;
}

.ota-bestand:hover { border-color: var(--alp-brand-primary); }

.ota-bestand input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.ota-bestand:has(input:focus-visible) {
    outline: 2px solid var(--alp-brand-primary);
    outline-offset: 2px;
}

.ota-bestand-knop {
    flex: none;
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--alp-outline);
    border-radius: 8px;
    background: var(--alp-surface-muted);
    color: var(--alp-text-primary);
    font-size: 0.875rem;
    font-weight: 600;
}

.ota-bestand-naam {
    min-width: 0;
    overflow: hidden;
    color: var(--alp-text-secondary);
    font-size: 0.875rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ota-bestand-naam.is-gekozen { color: var(--alp-text-primary); font-weight: 500; }

/* Gebruikers: bedrijven aanvinken i.p.v. Ctrl-klik in een lijst */
.gb-bedrijven {
    display: grid;
    gap: 2px;
    max-height: 220px;
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--alp-outline);
    border-radius: 10px;
    background: var(--alp-surface);
}

.gb-bedrijf {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    margin: 0;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--alp-text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.gb-bedrijf:hover { background: var(--alp-surface-muted); }
.gb-bedrijf:has(input:checked) { background: var(--alp-brand-tint); color: var(--alp-brand-tekst); }

.gb-bedrijf input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--alp-brand-primary);
    flex: none;
}

/* ==========================================================================
   Bedrijven (admin-companies.html)
   ========================================================================== */

@media (min-width: 1100px) {
    .bd-indeling { grid-template-rows: auto; }
    .bd-detail { grid-row: 1; }
}

.bh-kop > button { flex: none; }

/* ---- Lijst: initialen, naam met aantallen, rechts alarm of offline */
.bd-lijst-kaart .bd-zoekbalk { padding-top: 16px; }

.bd-lijst { max-height: 560px; }

.bd-lijst .company-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    column-gap: 12px;
    align-items: center;
    min-height: 56px;
    position: relative;
}

.bd-lijst .company-item:not([data-diepte='0'])::before {
    content: "";
    position: absolute;
    top: -2px;
    bottom: -2px;
    inset-inline-start: -9px;
    border-inline-start: 1px solid var(--alp-outline);
}

.bd-lijst .company-item .bd-item-tekst {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: inherit;
    font-size: inherit;
}

.bd-lijst .company-item .bd-item-tekst > span:empty { display: none; }

.bd-avatar {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    overflow: hidden;
    border-radius: 10px;
    background: var(--alp-surface-muted);
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.bd-lijst .company-item span.bd-avatar {
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
    opacity: 1;
}

.bd-lijst .company-item.active span.bd-avatar {
    background: rgba(255, 255, 255, 0.18);
    color: var(--alp-on-brand-primary);
}

.bd-avatar-groot {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--alp-brand-primary);
    color: var(--alp-on-brand-primary);
    font-size: 1.0625rem;
}

.bd-avatar-groot:empty { display: none; }

.bd-avatar.met-logo {
    padding: 6px;
    border: 1px solid var(--alp-outline);
    background: var(--alp-surface);
}

.bd-avatar.met-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.bd-pil {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.bd-lijst .company-item span.bd-pil {
    overflow: visible;
    font-size: 0.75rem;
    opacity: 1;
}

.bd-lijst .company-item span.bd-pil.is-alarm,
.bd-pil.is-alarm {
    background: var(--alp-status-blokkade-bg);
    color: var(--alp-status-blokkade-tekst);
}

.bd-lijst .company-item span.bd-pil.is-uit,
.bd-pil.is-uit {
    background: var(--alp-surface-muted);
    color: var(--alp-text-secondary);
}

.bd-pil .tk-stip { width: 7px; height: 7px; box-shadow: none; }

.bd-lijst .company-item .bd-stip { width: 8px; height: 8px; margin-right: 6px; }

.bd-telling {
    margin: 0;
    padding: 10px 24px 16px;
    border-top: 1px solid var(--alp-outline);
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
}

/* ---- Kop van het gekozen bedrijf */
.bd-kop-naam {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.bd-kop-naam > div { min-width: 0; }

.bd-bedrijf-kop .bh-acties { align-items: center; }

.bh button.bd-menu-knop {
    width: 40px !important;
    height: 40px;
    min-height: 40px;
    border-radius: 10px !important;
    font-size: 0.75rem;
    letter-spacing: 1px;
}

.bh button.bd-menu-klein {
    width: 34px !important;
    height: 34px;
    min-height: 34px;
    border-color: transparent !important;
    background: transparent !important;
    color: var(--alp-text-secondary) !important;
}

.bh button.bd-menu-klein:hover,
.bh button.bd-menu-klein[aria-expanded="true"] {
    border-color: var(--alp-outline) !important;
    background: var(--alp-surface-muted) !important;
    color: var(--alp-text-primary) !important;
}

.bd-rijmenu { display: inline-block; }

.bd-rijmenu .tk-menu {
    position: fixed;
    right: auto;
    width: 220px;
    z-index: 1500;
}

.bd-menu-cel { width: 1%; text-align: right; }

/* Tabbladen met een aantal */
#company-tabs button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.bd-tel {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 99px;
    background: var(--alp-surface);
    color: var(--alp-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.bd-tel:empty { display: none; }

#company-tabs button.active .bd-tel {
    background: rgba(255, 255, 255, 0.2);
    color: var(--alp-on-brand-primary);
}

/* ---- Overzicht: vier klikbare tegels */
.bd-tegels {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.bh button.bd-tegel {
    position: relative;
    display: grid;
    justify-content: stretch;
    justify-items: start;
    align-content: start;
    gap: 6px;
    min-width: 0;
    min-height: 0;
    padding: 18px 40px 18px 20px;
    border: 1px solid var(--alp-outline);
    border-radius: var(--alp-radius-md) !important;
    background: var(--alp-surface);
    box-shadow: var(--alp-shadow-sm);
    color: var(--alp-text-primary);
    font-weight: 400;
    text-align: left;
    white-space: normal;
}

.bh button.bd-tegel:hover {
    border-color: var(--alp-text-secondary);
    background: var(--alp-surface);
}

.bh button.bd-tegel::after {
    content: "\203A";
    position: absolute;
    top: 14px;
    right: 18px;
    color: var(--alp-text-secondary);
    font-size: 1.25rem;
    line-height: 1;
}

.bd-tegel .bh-tegel-noot {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-height: 1.4;
}

/* Menu-items links uitgelijnd (de gewone knop in .bh centreert) */
.bh .tk-menu button { justify-content: flex-start; }

.bd-tegel.is-alarm .bh-tegel-waarde { color: var(--alp-status-blokkade); }
.bd-tegel.is-alarm .bh-tegel-noot { color: var(--alp-status-blokkade-tekst); font-weight: 500; }
.bd-tegel.is-uit .bh-tegel-noot { color: var(--alp-status-aandacht-tekst); font-weight: 500; }

/* ---- Overzicht: gegevens en laatste wijzigingen naast elkaar */
.bd-duo {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

/* Zonder logboek (klant) staan de gegevens over de hele breedte */
.bd-duo:has(> #overview-recent-kaart[hidden]) { grid-template-columns: minmax(0, 1fr); }

.bd-duo .bd-gegevens { grid-template-columns: minmax(0, 1fr); }

.bd-duo .bd-gegevens > div,
.bd-duo .bd-gegevens > div:last-child {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    grid-column: auto;
    padding: 12px 24px;
    border-bottom: 1px solid var(--alp-outline);
}

.bd-duo .bd-gegevens > div:last-child { border-bottom: 0; }
.bd-duo .bd-gegevens dd { text-align: right; font-size: 0.875rem; }

.bd-leeg-gegevens {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 24px 20px;
    padding: 14px 16px;
    border: 1px dashed var(--alp-outline);
    border-radius: 12px;
    color: var(--alp-text-secondary);
    font-size: 0.875rem;
}

.bd-leeg-gegevens.is-klein {
    margin: 0;
    padding: 12px 24px 16px;
    border: 0;
    border-top: 1px solid var(--alp-outline);
    border-radius: 0;
    font-size: 0.8125rem;
}

.bd-leeg-gegevens button { flex: none; }

.bd-recent { border-top: 1px solid var(--alp-outline); }

.bd-recent-rij {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--alp-outline);
    font-size: 0.875rem;
}

.bd-recent-rij:last-child { border-bottom: 0; }

.bd-recent-wat {
    min-width: 0;
    overflow: hidden;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bd-recent-wie {
    flex: none;
    margin-left: auto;
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
}

.bd-recent-leeg {
    margin: 0;
    padding: 16px 24px 20px;
    color: var(--alp-text-secondary);
    font-size: 0.875rem;
}

/* ---- Tabellen */
.bd-onder {
    display: block;
    margin-top: 2px;
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
    font-weight: 400;
}

.bd-toestel {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.bd-toestel .tk-stip { width: 8px; height: 8px; flex: none; }
.bd-getal { font-variant-numeric: tabular-nums; }

.bd-vak-leeg { margin: 0; padding: 10px; font-size: 0.875rem; }

.bd-formulier .bh-kaart-voet { justify-content: flex-end; gap: 10px; }

.bd-voet-uitleg {
    align-self: center;
    margin-right: auto;
    color: var(--alp-text-secondary);
    font-size: 0.8125rem;
}

@media (max-width: 1199px) {
    .bd-tegels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .bd-duo { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
    .bd-tegels { gap: 10px; }
    .bh button.bd-tegel { padding: 14px 32px 14px 16px; }
    .bh button.bd-tegel::after { right: 12px; }
    .bd-avatar-groot { width: 44px; height: 44px; border-radius: 12px; font-size: 0.9375rem; }
    .bd-bedrijf-kop .bh-acties { flex-direction: row; }
    .bd-bedrijf-kop .bh-acties button.bd-menu-knop { flex: none; }
    .bd-duo .bd-gegevens > div,
    .bd-duo .bd-gegevens > div:last-child { padding: 12px 16px; }
    .bd-recent-rij { flex-direction: column; align-items: stretch; gap: 2px; padding: 12px 16px; }
    .bd-recent-wat { white-space: normal; overflow-wrap: anywhere; }
    .bd-recent-wie { margin-left: 0; }
    .bd-leeg-gegevens { margin: 0 16px 16px; flex-direction: column; align-items: stretch; }
    .bd-voet-uitleg { display: none; }
    .bd-menu-cel { width: auto; text-align: left; }
}

/* ---- Uitnodigingen die wachten op bevestiging (Bedrijven > Gebruikers) */
.bd-uitnodigingen {
    border-top: 1px solid var(--alp-outline);
    padding: 14px 24px 18px;
}

.bd-uitn-titel {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--alp-text-secondary);
}

.bd-uitn-lijst {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bd-uitn-lijst li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px dashed var(--alp-outline);
}

.bd-uitn-lijst li:first-child { border-top: 0; }

.bd-uitn-wie {
    min-width: 0;
    overflow-wrap: anywhere;
}
