:root {
    --erp-sidebar-width: 250px;
    --erp-topbar-height: 72px;

    --erp-bg: #f5f7fa;
    --erp-surface: #ffffff;

    --erp-sidebar-bg: #111827;
    --erp-sidebar-hover: #1f2937;

    --erp-text: #111827;
    --erp-muted: #6b7280;

    --erp-border: #e5e7eb;

    --erp-primary: #2563eb;
    --erp-primary-soft: rgba(37, 99, 235, 0.12);

    --erp-radius: 12px;
}


/* ==========================================================
   BASE
========================================================== */

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--erp-bg);
    color: var(--erp-text);
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}


/* ==========================================================
   ERP LAYOUT
========================================================== */

.erp-layout {
    min-height: 100vh;
}


/* ==========================================================
   SIDEBAR
========================================================== */

.erp-sidebar {
    position: fixed;

    top: 0;
    left: 0;
    bottom: 0;

    width: var(--erp-sidebar-width);

    background: var(--erp-sidebar-bg);

    display: flex;
    flex-direction: column;

    z-index: 1040;

    overflow-y: auto;
}


.sidebar-brand {
    height: var(--erp-topbar-height);

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 0 20px;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.08);
}


.brand-mark {
    width: 38px;
    height: 38px;

    border-radius: 10px;

    background: var(--erp-primary);

    display: flex;
    align-items: center;
    justify-content: center;

    color: white;

    font-weight: 800;
    font-size: 18px;
}


.brand-title {
    color: white;

    font-weight: 700;
    font-size: 16px;

    line-height: 1.1;
}


.brand-subtitle {
    color: #9ca3af;

    font-size: 11px;

    margin-top: 3px;

    letter-spacing: 0.12em;
}


.sidebar-nav {
    flex: 1;

    padding: 18px 12px;
}


.sidebar-section {
    color: #6b7280;

    font-size: 10px;

    font-weight: 700;

    letter-spacing: 0.12em;

    padding: 0 12px;

    margin-bottom: 7px;
}


.sidebar-link {
    min-height: 44px;

    display: flex;
    align-items: center;

    gap: 12px;

    margin-bottom: 4px;

    padding: 0 13px;

    border-radius: 9px;

    color: #cbd5e1;

    text-decoration: none;

    font-size: 14px;

    font-weight: 500;

    transition: 0.15s ease;
}


.sidebar-link i {
    width: 20px;

    font-size: 17px;
}


.sidebar-link:hover {
    background: var(--erp-sidebar-hover);

    color: white;
}


.sidebar-link.active {
    background: var(--erp-primary-soft);

    color: #93c5fd;
}


.disabled-link {
    opacity: 0.42;

    cursor: default;
}


.disabled-link:hover {
    background: transparent;

    color: #cbd5e1;
}


.sidebar-footer {
    padding: 12px;

    border-top:
        1px solid rgba(255, 255, 255, 0.08);
}


/* ==========================================================
   MAIN AREA
========================================================== */

.erp-main {
    min-height: 100vh;

    margin-left: var(--erp-sidebar-width);
}


/* ==========================================================
   TOPBAR
========================================================== */

.erp-topbar {
    height: var(--erp-topbar-height);

    position: sticky;

    top: 0;

    z-index: 1020;

    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;

    padding: 0 28px;

    background: rgba(255, 255, 255, 0.97);

    border-bottom: 1px solid var(--erp-border);
}


.erp-topbar > .d-flex {
    min-width: 0;
    flex: 1 1 auto;
}


.topbar-page-title {
    font-size: 17px;

    font-weight: 700;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}


.topbar-actions {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;

    align-items: center;

    gap: 10px;
}


.topbar-icon-button {
    width: 40px;
    height: 40px;

    border: none;

    border-radius: 9px;

    background: transparent;

    color: #4b5563;

    display: flex;
    align-items: center;
    justify-content: center;
}


.topbar-icon-button:hover {
    background: #f3f4f6;
}


.user-menu {
    display: flex;
    flex-wrap: nowrap;
    flex-shrink: 0;

    align-items: center;

    gap: 10px;

    border: none;

    background: transparent;

    border-radius: 10px;

    padding: 5px 8px;
}


.user-menu:hover {
    background: #f3f4f6;
}


.user-avatar {
    width: 38px;
    height: 38px;

    border-radius: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #e5e7eb;

    color: #374151;

    font-weight: 700;
}


.user-details {
    text-align: left;
}


.user-name {
    font-size: 13px;

    font-weight: 600;
}


.user-role {
    font-size: 11px;

    color: var(--erp-muted);
}


.user-chevron {
    margin-left: 4px;

    color: #9ca3af;

    font-size: 11px;
}


.mobile-menu-button {
    display: none;

    border: none;

    background: transparent;

    font-size: 24px;

    margin-right: 10px;
}


/* ==========================================================
   PAGE CONTENT
========================================================== */

.erp-content {
    padding: 26px 30px 40px;

    max-width: 1800px;
}


/* ==========================================================
   BOOTSTRAP REFINEMENTS
========================================================== */

.card {
    border-radius: var(--erp-radius);
}


.shadow-sm {
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.04),
        0 4px 12px rgba(0, 0, 0, 0.035)
        !important;
}


.table > :not(caption) > * > * {
    padding-top: 14px;
    padding-bottom: 14px;
}


.table thead th {
    font-size: 12px;

    text-transform: uppercase;

    letter-spacing: 0.035em;

    color: #6b7280;

    border-bottom-width: 1px;
}


.form-control,
.form-select {
    min-height: 42px;

    border-radius: 8px;

    border-color: #d1d5db;
}


.form-control:focus,
.form-select:focus {
    border-color: #93c5fd;

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.1);
}


.btn {
    border-radius: 8px;

    min-height: 40px;

    font-weight: 500;
}


.btn-dark {
    background: #111827;

    border-color: #111827;
}


/* ==========================================================
   MOBILE SIDEBAR
========================================================== */

.sidebar-overlay {
    display: none;
}


@media (max-width: 991.98px) {

    .erp-sidebar {
        transform: translateX(-100%);

        transition: transform 0.22s ease;
    }


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


    .erp-main {
        margin-left: 0;
    }


    .mobile-menu-button {
        display: flex;

        align-items: center;

        justify-content: center;
    }


    .sidebar-overlay.show {
        display: block;

        position: fixed;

        inset: 0;

        z-index: 1030;

        background: rgba(0, 0, 0, 0.35);
    }


    .erp-content {
        padding: 20px 16px;
    }


    .erp-topbar {
        padding: 0 15px;
    }


    .user-details,
    .user-chevron {
        display: none;
    }

}


/* ==========================================================
   LOGIN
========================================================== */

.login-layout {
    min-height: 100vh;

    background: var(--erp-bg);

    padding: 20px;
}


/* ==========================================================
   SYSTEM ADMINISTRATION
========================================================== */

.admin-action-card {
    display: flex;
    align-items: center;
    gap: 14px;

    padding: 16px 0;

    border-bottom: 1px solid var(--erp-border);

    text-decoration: none;
}

.admin-action-card:last-child {
    border-bottom: 0;
}

.admin-action-card:hover .fw-bold {
    color: var(--erp-primary) !important;
}

.admin-action-icon {
    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 11px;

    background: #f1f5f9;

    color: #334155;

    font-size: 18px;
}


/* ==========================================================
   ATTENDANCE GEOFENCE WARNING
========================================================== */

.geofence-warning-card {
    display: flex;
    gap: 16px;

    margin-bottom: 22px;
    padding: 18px;

    border: 1px solid #fecaca;
    border-left: 5px solid #dc2626;
    border-radius: 14px;

    background: #fef2f2;
}

.geofence-warning-icon {
    flex-shrink: 0;

    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: #fee2e2;

    color: #dc2626;
    font-size: 20px;
}

.geofence-warning-content {
    flex: 1;
}

.geofence-warning-title {
    color: #991b1b;

    font-size: 1rem;
    font-weight: 800;
}

.geofence-warning-description {
    margin-top: 4px;

    color: #7f1d1d;

    font-size: 0.9rem;
}

.geofence-status-box {
    height: 100%;

    padding: 14px;

    border-radius: 11px;
    border: 1px solid #e2e8f0;

    background: #ffffff;
}

.geofence-status-danger {
    border-color: #fecaca;

    background: #fffafa;
}

.geofence-status-ok {
    border-color: #d1fae5;
}

.geofence-status-heading {
    margin-bottom: 9px;

    color: #475569;

    font-size: 0.8rem;
    font-weight: 800;

    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.geofence-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    padding: 5px 8px;

    border-radius: 7px;

    font-size: 0.7rem;
    font-weight: 900;
}

.geofence-status-badge.danger {
    color: #991b1b;
    background: #fee2e2;
}

.geofence-status-badge.success {
    color: #166534;
    background: #dcfce7;
}

.geofence-status-badge.neutral {
    color: #475569;
    background: #f1f5f9;
}

.geofence-distance {
    margin-top: 9px;

    color: #475569;

    font-size: 0.85rem;
}

@media (max-width: 576px) {

    .geofence-warning-card {
        flex-direction: column;
    }

}
