:root {
    --hse-green: #1D9E75;
    --hse-green-dark: #0F6E56;
    --hse-green-light: #E1F5EE;
    --hse-amber: #BA7517;
    --hse-amber-light: #FAEEDA;
    --hse-red: #A32D2D;
    --hse-red-light: #FCEBEB;
    --hse-blue: #185FA5;
    --hse-blue-light: #E6F1FB;
    --hse-sidebar: #0a1628;
    --hse-sidebar-alt: #111f38;
    --hse-accent: #1D9E75;
    --body-bg: #f0f4f0;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--body-bg);
    color: #1a1a1a;
    min-height: 100vh;
}

.form-label-hse {
    font-size: .8rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
    display: block;
    letter-spacing: .2px;
}

.form-input-hse {
    width: 100%;
    border: 1px solid #e0e4e0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: .875rem;
    color: #333;
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.form-input-hse:focus {
    border-color: var(--hse-green);
    box-shadow: 0 0 0 3px rgba(29, 158, 117, .1);
}

.is-invalid-hse {
    border-color: var(--hse-red) !important;
    box-shadow: 0 0 0 3px rgba(163, 45, 45, .08) !important;
}

.invalid-msg-hse {
    font-size: 11px;
    color: var(--hse-red);
    margin-top: 4px;
}

/* ── Override DataTables biar sesuai desain HSE ── */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    font-size: .825rem;
    border: 1px solid #e0e4e0;
    border-radius: 8px;
    padding: 5px 10px;
    outline: none;
    color: #333;
    background: #fff;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--hse-green);
    box-shadow: 0 0 0 3px rgba(29, 158, 117, .1);
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info {
    font-size: .8rem;
    color: #888;
}

/* Pagination */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    font-size: .8rem !important;
    border-radius: 7px !important;
    padding: 4px 10px !important;
    border: none !important;
    color: #555 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--hse-green-light) !important;
    color: var(--hse-green-dark) !important;
    border: none !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--hse-green) !important;
    color: #fff !important;
    border: none !important;
}

/* Sort icon warna hijau */
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
    opacity: .5;
    color: var(--hse-green);
}

/* Avatar inisial */
.karyawan-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--hse-green-light);
    color: var(--hse-green-dark);
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Action buttons */
.btn-act {
    border: none;
    border-radius: 7px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: opacity .15s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-act:hover {
    opacity: .82;
}

.btn-act-edit {
    background: var(--hse-blue-light);
    color: var(--hse-blue);
}

.btn-act-delete {
    background: var(--hse-red-light);
    color: var(--hse-red);
}

.btn-act-view {
    background: var(--hse-green-light);
    color: var(--hse-green-dark);
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-display {
    font-family: 'Syne', sans-serif;
}

/* ── Sidebar ── */
#sidebar {
    width: 260px;
    height: 100vh;
    /* ganti dari min-height */
    overflow: hidden;
    /* tambahkan ini */
    background: var(--hse-sidebar);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: transform .3s ease;
    display: flex;
    flex-direction: column;
}



.sidebar-brand {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-badge {
    background: var(--hse-green);
    color: #fff;
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 1.5px;
    padding: 3px 8px;
    border-radius: 4px;
}

.brand-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.brand-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, .4);
    letter-spacing: .5px;
    margin: 0;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, .3);
    text-transform: uppercase;
    padding: .75rem 1.25rem .25rem;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, .6);
    font-size: .875rem;
    padding: .55rem 1.25rem;
    border-radius: 8px;
    margin: 1px .75rem;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all .2s;
}

.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .07);
}

.sidebar-nav .nav-link.active {
    color: #fff;
    background: var(--hse-green);
}

.sidebar-nav .nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .07);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--hse-green);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
    flex-shrink: 0;
}

.user-name {
    font-size: .825rem;
    font-weight: 500;
    color: #fff;
    margin: 0;
}

.user-role {
    font-size: 11px;
    color: rgba(255, 255, 255, .4);
    margin: 0;
}

/* ── Main Layout ── */
#main-content {
    margin-left: 260px;
    min-height: 100vh;
    transition: margin .3s ease;
}

/* ── Topbar ── */
.topbar {
    background: #fff;
    border-bottom: 1px solid #e5e8e5;
    padding: .75rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-title {
    font-family: 'Syne', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.topbar-sub {
    font-size: 12px;
    color: #888;
    margin: 0;
}

.btn-toggle-sidebar {
    border: none;
    background: none;
    font-size: 1.2rem;
    color: #555;
    cursor: pointer;
    display: none;
    padding: 0;
}

/* ── Stat Cards ── */
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 1.25rem 1.4rem;
    border: 1px solid #e5e8e5;
    height: 100%;
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .07);
}

.stat-card .icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.stat-card .stat-label {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    letter-spacing: .3px;
    margin-bottom: 2px;
}

.stat-card .stat-value {
    font-family: 'Syne', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-delta {
    font-size: 12px;
    margin-top: 6px;
}

.ic-green {
    background: var(--hse-green-light);
    color: var(--hse-green);
}

.ic-red {
    background: var(--hse-red-light);
    color: var(--hse-red);
}

.ic-amber {
    background: var(--hse-amber-light);
    color: var(--hse-amber);
}

.ic-blue {
    background: var(--hse-blue-light);
    color: var(--hse-blue);
}

.delta-up {
    color: var(--hse-red);
}

.delta-down {
    color: var(--hse-green);
}

/* ── Section Cards ── */
.panel {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e5e8e5;
    overflow: hidden;
}

.panel-header {
    padding: 1rem 1.25rem .75rem;
    border-bottom: 1px solid #f0f2f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-title {
    font-family: 'Syne', sans-serif;
    font-size: .95rem;
    font-weight: 700;
    margin: 0;
}

/* ── Alert Banner ── */
.alert-banner {
    background: linear-gradient(135deg, #0a1628 0%, #0F6E56 100%);
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 1rem;
    border: none;
}

.alert-banner .alert-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

/* ── Table ── */
.tilang-table {
    font-size: .85rem;
}

.tilang-table thead th {
    background: #f6f8f6;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: #666;
    border: none;
    padding: .65rem 1rem;
}

.tilang-table tbody td {
    padding: .65rem 1rem;
    border-color: #f0f2f0;
    vertical-align: middle;
}

.tilang-table tbody tr:hover {
    background: #fafbfa;
}

/* ── Badge ── */
.badge-hse {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: .3px;
}

.badge-merah {
    background: var(--hse-red-light);
    color: var(--hse-red);
}

.badge-kuning {
    background: var(--hse-amber-light);
    color: var(--hse-amber);
}

.badge-hijau {
    background: var(--hse-green-light);
    color: var(--hse-green-dark);
}

.badge-biru {
    background: var(--hse-blue-light);
    color: var(--hse-blue);
}

/* ── Progress Bar ── */
.progress-hse {
    height: 7px;
    border-radius: 10px;
    background: #eef2ee;
}

.progress-hse .progress-bar {
    border-radius: 10px;
}

/* ── Chart Placeholder ── */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 140px;
    padding: .5rem .5rem 0;
}

.bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.bar {
    border-radius: 5px 5px 0 0;
    width: 100%;
    transition: opacity .2s;
}

.bar:hover {
    opacity: .8;
}

.bar-label {
    font-size: 10px;
    color: #888;
}

/* ── Donut SVG ── */
.donut-wrap {
    position: relative;
    width: 110px;
    height: 110px;
    flex-shrink: 0;
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-val {
    font-family: 'Syne', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}

.donut-sub {
    font-size: 10px;
    color: #888;
}

/* ── Map Placeholder ── */
.map-zone {
    background: #e8f4ec;
    border-radius: 10px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.map-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent, transparent 20px, rgba(29, 158, 117, .07) 20px, rgba(29, 158, 117, .07) 21px),
        repeating-linear-gradient(90deg, transparent, transparent 20px, rgba(29, 158, 117, .07) 20px, rgba(29, 158, 117, .07) 21px);
}

.map-pin {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* ── Timeline ── */
.timeline-item {
    display: flex;
    gap: 12px;
    padding: .6rem 0;
}

.tl-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.tl-line {
    width: 1px;
    background: #e5e8e5;
    margin: 0 4.5px;
}

.tl-text {
    font-size: .825rem;
    color: #444;
}

.tl-time {
    font-size: 11px;
    color: #aaa;
}

/* ── Risk Meter ── */
.risk-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.risk-label {
    font-size: .8rem;
    color: #555;
    min-width: 90px;
}

.risk-bar {
    flex: 1;
}

/* ── Responsive ── */
@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
    }

    #sidebar.show {
        transform: translateX(0);
    }

    #main-content {
        margin-left: 0;
    }

    .btn-toggle-sidebar {
        display: block;
    }

    .sidebar-overlay.active {
        display: block !important;
    }

    /* Pastikan default-nya none */
    .sidebar-overlay {
        display: none;
    }
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    z-index: 1039;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}