html, body, form {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f5f7fa;
    font-size: 14px;
}

/* Sidebar */
.sidebar-hover {
    position: fixed;
    top: 0;
    left: 0;
    width: 64px;
    height: 100vh;
    background-color: #1f2937;
    overflow-x: hidden;
    overflow-y: auto;
    transition: width 0.25s ease;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.08);
}

    .sidebar-hover:hover,
.sidebar-hover.sidebar-open {
    width: 260px;
}

.sidebar-inner {
    padding: 14px 10px;
}

.sidebar-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.sidebar-brand {
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    white-space: nowrap;
    overflow: hidden;
    font-weight: 600;
    font-size: 18px;
    flex: 1 1 auto;
    min-width: 0;
}

    .sidebar-brand:hover {
        color: #ffffff;
        background-color: rgba(255,255,255,0.08);
    }

.sidebar-toggle {
    display: none;
    border: 0;
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

    .sidebar-toggle:hover,
    .sidebar-toggle:focus {
        background: rgba(255,255,255,0.14);
        outline: none;
    }

.sidebar-nav {
    width: 100%;
}

.sidebar-link,
.sidebar-sublink {
    color: #d1d5db;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
}

    .sidebar-link:hover,
    .sidebar-sublink:hover {
        color: #ffffff;
        background-color: rgba(255,255,255,0.08);
    }

    .sidebar-link.active,
    .sidebar-sublink.active {
        background-color: rgba(148, 163, 184, 0.22);
        color: #f8fafc !important;
    }

.menu-icon {
    min-width: 20px;
    font-size: 18px;
    text-align: center;
}

.menu-text {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.sidebar-hover:hover .menu-text,
.sidebar-hover.sidebar-open .menu-text {
    opacity: 1;
}

.has-submenu {
    position: relative;
}

.has-submenu > .submenu {
    list-style: none;
    margin: 0 0 8px 0;
    padding-left: 32px;
    display: none;
    position: relative;
    z-index: 5;
}

/* Hover bridge: houdt submenu open tijdens diagonale muisbewegingen */
.has-submenu::after { display:none; }

/* Desktop: open bij hover of focus, en ook via JS class .open */
.has-submenu.open > .submenu {
    display: block;
}

.sidebar-sublink {
    padding: 8px 12px;
    font-size: 13px;
}

.main-content {
    margin-left: 64px;
    min-height: 100vh;
    padding: 0;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.grid-compact th,
.grid-compact td {
    white-space: nowrap;
    vertical-align: middle;
}

.grid-compact .wrap-text {
    white-space: normal;
    min-width: 220px;
}

.grid-actions {
    min-width: 180px;
}

.building-action-cell {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.building-action-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .78rem;
    font-weight: 600;
    color: #495057;
}


.grid-id {
    width: 70px;
}

.buildings-grid th:first-child,
.buildings-grid td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 220px;
    max-width: 280px;
    background: #fff;
    box-shadow: 8px 0 12px -12px rgba(15, 23, 42, .55);
}

.buildings-grid thead th:first-child {
    z-index: 3;
    background: #f8f9fa;
}

.buildings-grid.table-striped > tbody > tr:nth-of-type(odd) > td:first-child {
    background: var(--bs-table-striped-bg);
}

.buildings-grid.table-hover > tbody > tr:hover > td:first-child {
    background: var(--bs-table-hover-bg);
}

.grid-short {
    min-width: 120px;
}

.date-nowrap {
    white-space: nowrap;
    min-width: 92px;
}

.grid-medium {
    min-width: 180px;
}

.grid-email {
    min-width: 220px;
}

.a-text-col {
    width: 820px;
    max-width: 820px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.actie-knoppen {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    white-space: nowrap;
    align-items: center;
}

    .actie-knoppen .btn {
        padding: 0.25rem 0.45rem;
        flex: 0 0 auto;
    }

.bewaken-rij,
.tr.bewaken-rij td {
    background-color: #fff3cd !important;
}

.status-urgent {
    background-color: #f8d7da;
}

.status-ok {
    background-color: #d4edda;
}


/* Production-ready submenu gedrag */
.sidebar-link,
.sidebar-sublink {
    position: relative;
}

.has-submenu > .sidebar-link {
    min-height: 42px;
}

.sidebar-hover {
    overflow-x: visible;
}

.sidebar-inner,
.sidebar-nav {
    position: relative;
}

@media (hover: none), (pointer: coarse) {
    .sidebar-hover {
        width: 64px;
    }

        .sidebar-hover.sidebar-open {
            width: 260px;
        }

    .sidebar-hover:hover:not(.sidebar-open) {
        width: 64px;
    }

    .sidebar-hover:not(.sidebar-open) .sidebar-nav,
    .sidebar-hover:not(.sidebar-open) .submenu,
    .sidebar-hover:not(.sidebar-open) .submenu-arrow {
        display: none;
    }

    .menu-text {
        opacity: 0;
    }

    .sidebar-hover.sidebar-open .menu-text {
        opacity: 1;
    }

    .sidebar-top {
        position: relative;
        height: 42px;
    }

    .sidebar-brand {
        display: none;
    }

    .sidebar-hover.sidebar-open .sidebar-brand {
        display: flex;
    }

    .sidebar-toggle {
        display: inline-flex;
        position: absolute;
        left: 4px;
        top: 3px;
    }

    .sidebar-hover.sidebar-open .sidebar-toggle {
        left: auto;
        right: 0;
    }

    .has-submenu::after { display:none; }
}

.submenu-arrow { margin-left:auto; transition: transform .2s ease; font-size:12px; }
.has-submenu.open .submenu-arrow { transform: rotate(90deg); }

/* Expliciete tablet/touch-modus: voorkomt sticky hover op iPad/Android tablets. */
.sidebar-hover.sidebar-touch {
    width: 64px !important;
}

    .sidebar-hover.sidebar-touch:hover {
        width: 64px !important;
    }

    .sidebar-hover.sidebar-touch.sidebar-open,
    .sidebar-hover.sidebar-touch.sidebar-open:hover {
        width: 260px !important;
    }

    .sidebar-hover.sidebar-touch:not(.sidebar-open) .sidebar-nav,
    .sidebar-hover.sidebar-touch:not(.sidebar-open) .submenu,
    .sidebar-hover.sidebar-touch:not(.sidebar-open) .submenu-arrow {
        display: none !important;
    }

    .sidebar-hover.sidebar-touch .menu-text {
        opacity: 0 !important;
    }

    .sidebar-hover.sidebar-touch.sidebar-open .menu-text {
        opacity: 1 !important;
    }

    .sidebar-hover.sidebar-touch .sidebar-top {
        position: relative;
        height: 42px;
    }

    .sidebar-hover.sidebar-touch .sidebar-brand {
        display: none;
    }

    .sidebar-hover.sidebar-touch.sidebar-open .sidebar-brand {
        display: flex;
    }

    .sidebar-hover.sidebar-touch .sidebar-toggle {
        display: inline-flex !important;
        position: absolute;
        left: 4px;
        top: 3px;
    }

    .sidebar-hover.sidebar-touch.sidebar-open .sidebar-toggle {
        left: auto;
        right: 0;
    }

@media (max-width: 1024px) {
    .sidebar-hover {
        width: 64px !important;
    }

        .sidebar-hover:hover {
            width: 64px !important;
        }

        .sidebar-hover.sidebar-open,
        .sidebar-hover.sidebar-open:hover {
            width: 260px !important;
        }

        .sidebar-hover:not(.sidebar-open) .sidebar-nav,
        .sidebar-hover:not(.sidebar-open) .submenu,
        .sidebar-hover:not(.sidebar-open) .submenu-arrow {
            display: none !important;
        }

        .sidebar-hover .menu-text {
            opacity: 0 !important;
        }

        .sidebar-hover.sidebar-open .menu-text {
            opacity: 1 !important;
        }

        .sidebar-hover .sidebar-top {
            position: relative;
            height: 42px;
        }

        .sidebar-hover .sidebar-brand {
            display: none;
        }

        .sidebar-hover.sidebar-open .sidebar-brand {
            display: flex;
        }

        .sidebar-hover .sidebar-toggle {
            display: inline-flex !important;
            position: absolute;
            left: 4px;
            top: 3px;
        }

        .sidebar-hover.sidebar-open .sidebar-toggle {
            left: auto;
            right: 0;
        }
}
