:root {
    --sipkl-green: #2f9e6d;
    --sipkl-green-dark: #17734d;
    --sipkl-green-soft: #e8f6ef;
    --sipkl-gray: #f3f6f5;
    --sipkl-line: #dbe5e1;
    --sipkl-text: #20302a;
    --sipkl-muted: #66756f;
    --sipkl-accent: #f5b942;
    --sipkl-orange: #f28b30;
    --sipkl-shadow: 0 16px 36px rgba(32, 48, 42, .08);
}

body,
.app-modern {
    background: var(--sipkl-gray);
    color: var(--sipkl-text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

a { color: var(--sipkl-green-dark); }
a:hover { color: var(--sipkl-green); }

.main-header.navbar {
    border-bottom: 1px solid var(--sipkl-line);
    box-shadow: 0 8px 24px rgba(32, 48, 42, .06);
}

.admin-navbar-user {
    display: flex !important;
    align-items: center;
    gap: 6px;
    max-width: 240px;
    min-width: 0;
}

.admin-navbar-photo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    border: 1px solid var(--sipkl-line);
    flex: 0 0 auto;
}

.admin-navbar-name {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.main-header .navbar-nav.ml-auto {
    min-width: 0;
}

.main-header .nav-link.text-danger {
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .main-header.navbar {
        gap: 4px;
    }

    .main-header .navbar-nav:first-child {
        flex: 0 0 auto;
    }

    .main-header .navbar-nav.ml-auto {
        flex: 1 1 auto;
        justify-content: flex-end;
        overflow: hidden;
    }

    .admin-navbar-user {
        max-width: calc(100vw - 168px);
        padding-left: 2px;
        padding-right: 2px;
        gap: 5px;
    }

    .admin-navbar-photo {
        width: 22px;
        height: 22px;
    }

    .admin-navbar-name {
        font-size: 13px;
    }

    .main-header .nav-link {
        padding-left: 6px;
        padding-right: 6px;
    }

    .main-header .nav-link.text-danger {
        font-size: 14px;
    }
}

.main-sidebar {
    background: linear-gradient(180deg, #164b37 0%, #102f25 100%) !important;
}

.brand-school {
    display: flex !important;
    align-items: center;
    min-height: 66px;
    border-bottom: 1px solid rgba(255,255,255,.12) !important;
}

.brand-school .brand-image {
    width: 42px;
    height: 42px;
    object-fit: contain;
    background: #fff;
    padding: 4px;
}

.brand-school .brand-text {
    color: #fff;
    letter-spacing: 0;
}

.school-name {
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    line-height: 1.25;
}

.user-panel small {
    color: #cde7dc;
}

.nav-sidebar .nav-header {
    color: #aee0c8 !important;
    font-size: 11px;
    letter-spacing: .08em;
}

.nav-sidebar .nav-link {
    border-radius: 8px;
    color: #d9eee5 !important;
    margin-bottom: 4px;
}

.nav-sidebar .nav-link.active,
.nav-sidebar .nav-link:hover {
    background: rgba(255, 255, 255, .14) !important;
    color: #fff !important;
}

.content-wrapper {
    background: var(--sipkl-gray);
}

.content-header h1,
h1, h2, h3, h4, h5 {
    color: var(--sipkl-text);
    letter-spacing: 0;
}

.card {
    border: 1px solid var(--sipkl-line);
    border-radius: 10px;
    box-shadow: var(--sipkl-shadow);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--sipkl-line);
    border-radius: 10px 10px 0 0 !important;
}

.card-primary.card-outline,
.card-primary:not(.card-outline) > .card-header,
.card-success:not(.card-outline) > .card-header {
    background: var(--sipkl-green) !important;
    color: #fff;
}

.btn {
    border-radius: 8px;
    font-weight: 700;
}

.btn-primary,
.bg-primary,
.small-box.bg-primary {
    background-color: var(--sipkl-green) !important;
    border-color: var(--sipkl-green) !important;
}

.btn-primary:hover {
    background-color: var(--sipkl-green-dark) !important;
    border-color: var(--sipkl-green-dark) !important;
}

.btn-warning,
.bg-warning,
.small-box.bg-warning {
    background-color: var(--sipkl-accent) !important;
    border-color: var(--sipkl-accent) !important;
    color: #2c2615 !important;
}

.btn-danger,
.bg-danger,
.small-box.bg-danger {
    background-color: var(--sipkl-orange) !important;
    border-color: var(--sipkl-orange) !important;
}

.small-box {
    border-radius: 10px;
    box-shadow: var(--sipkl-shadow);
    overflow: hidden;
}

.small-box .icon {
    opacity: .22;
}

.table {
    background: #fff;
}

.table th {
    white-space: nowrap;
    background: var(--sipkl-green-soft);
    color: var(--sipkl-green-dark);
    border-color: var(--sipkl-line);
}

.form-control {
    border-radius: 8px;
    border-color: var(--sipkl-line);
}

.form-control:focus {
    border-color: var(--sipkl-green);
    box-shadow: 0 0 0 .2rem rgba(47, 158, 109, .16);
}

.badge {
    border-radius: 999px;
    padding: .42em .7em;
}

.brand-preview {
    width: 132px;
    height: 132px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--sipkl-line);
    border-radius: 16px;
    padding: 10px;
}

.role-dashboard {
    min-height: 100vh;
    background: var(--sipkl-gray);
}

.role-navbar {
    background: #fff;
    border-bottom: 1px solid var(--sipkl-line);
    box-shadow: 0 8px 24px rgba(32, 48, 42, .06);
    min-height: 58px;
    position: relative;
    z-index: 20;
}

.role-menu-toggle {
    display: none;
    border: 0;
    background: transparent;
    color: var(--sipkl-muted);
    font-size: 24px;
    line-height: 1;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    z-index: 30;
}

.role-menu-toggle:hover {
    background: var(--sipkl-green-soft);
    color: var(--sipkl-green-dark);
}

.role-sidebar-backdrop {
    display: none;
}

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

.role-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sipkl-text);
    text-decoration: none;
}

.role-brand img,
.login-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
    padding: 4px;
    border: 1px solid var(--sipkl-line);
}

.role-brand strong {
    display: block;
    line-height: 1.15;
}

.role-brand small {
    color: var(--sipkl-muted);
}

.login-page-modern {
    min-height: 100vh;
    background: linear-gradient(135deg, #eff8f3 0%, #f5f7f6 58%, #fff6df 100%);
}

.login-card-modern {
    border: 1px solid var(--sipkl-line);
    border-radius: 14px;
    box-shadow: var(--sipkl-shadow);
}

.login-logo {
    width: 88px;
    height: 88px;
    border-radius: 18px;
}

.user-photo-sm {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 4px 14px rgba(32, 48, 42, .12);
}

.role-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: calc(100vh - 58px);
    background: var(--sipkl-gray);
}

.role-sidebar-panel {
    background: linear-gradient(180deg, #164b37 0%, #102f25 100%);
    border-right: 0;
    padding: 16px 10px;
    position: sticky;
    top: 0;
    height: calc(100vh - 58px);
    overflow-y: auto;
    box-shadow: 8px 0 24px rgba(16, 47, 37, .12);
}

.role-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 10px 18px;
    border-bottom: 1px solid rgba(255,255,255,.12);
    margin-bottom: 16px;
}

.role-user-photo {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.75);
    background: #fff;
}

.role-user strong {
    display: block;
    line-height: 1.2;
    color: #fff;
}

.role-user small {
    color: #cde7dc;
}

.role-user-link {
    color: #fff;
    text-decoration: none;
}

.role-user-link:hover {
    color: #fff;
    text-decoration: none;
}

#verifikasi-absen,
#monitoring,
#informasi,
#catatan {
    scroll-margin-top: 90px;
}

.role-menu-title {
    font-size: 11px;
    color: #aee0c8;
    font-weight: 800;
    letter-spacing: .08em;
    margin: 18px 8px 8px;
    text-transform: uppercase;
}

.role-menu {
    display: grid;
    gap: 4px;
}

.role-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d9eee5;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 700;
    min-height: 40px;
}

.role-menu a.active,
.role-menu a:hover {
    background: rgba(255, 255, 255, .14);
    color: #fff;
}

.role-main {
    min-width: 0;
    padding: 24px;
    background: var(--sipkl-gray);
}

.role-dashboard .card {
    border-radius: 10px;
    border: 1px solid var(--sipkl-line) !important;
    box-shadow: var(--sipkl-shadow) !important;
}

.role-dashboard .card-header {
    border-bottom: 1px solid var(--sipkl-line);
}

.role-dashboard .table-primary,
.role-dashboard .table-primary > th,
.role-dashboard .table-primary > td {
    background: var(--sipkl-green-soft) !important;
    color: var(--sipkl-green-dark) !important;
}

@media (max-width: 992px) {
    body.role-dashboard {
        overflow-x: hidden;
    }

    .role-navbar {
        min-height: auto;
        padding: 10px 12px;
    }

    .role-navbar .container-fluid {
        gap: 10px;
        flex-wrap: nowrap;
    }

    .role-menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 auto;
    }

    .role-brand {
        min-width: 0;
        flex: 1;
    }

    .role-brand span {
        min-width: 0;
    }

    .role-brand strong {
        font-size: 14px;
        white-space: normal;
    }

    .role-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .role-sidebar-panel {
        position: fixed;
        left: 0;
        top: 0;
        width: min(82vw, 320px);
        max-width: 320px;
        height: 100vh;
        z-index: 1050;
        transform: translateX(-105%);
        transition: transform .22s ease;
        border-right: 0;
        padding: 12px;
        box-shadow: 0 8px 24px rgba(16, 47, 37, .12);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .role-sidebar-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 64px;
        padding: 8px 12px 16px;
        margin: -2px -2px 12px;
        border-bottom: 1px solid rgba(255,255,255,.12);
        color: #fff;
        font-size: 26px;
        line-height: 1;
    }

    .role-sidebar-brand img {
        width: 52px;
        height: 52px;
        object-fit: contain;
        background: #fff;
        border-radius: 50%;
        padding: 5px;
    }

    .role-sidebar-brand strong {
        color: #fff;
        font-weight: 800;
        letter-spacing: 0;
    }

    .role-sidebar-open .role-sidebar-panel {
        transform: translateX(0);
    }

    .role-sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(12, 22, 18, .45);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: opacity .22s ease, visibility .22s ease;
    }

    .role-sidebar-open .role-sidebar-backdrop {
        opacity: 1;
        visibility: visible;
    }

    .role-user {
        margin-bottom: 10px;
        padding: 10px 14px 18px;
    }

    .role-user-photo {
        width: 50px;
        height: 50px;
    }

    .role-menu-title {
        margin: 18px 18px 10px;
        font-size: 12px;
    }

    .role-menu {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .role-menu a {
        justify-content: flex-start;
        text-align: left;
        min-height: 44px;
        padding: 12px 18px;
        font-size: 18px;
        line-height: 1.2;
        border-radius: 10px;
    }

    .role-main {
        padding: 18px 12px;
    }

    .role-dashboard .table-responsive {
        border: 0;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding-bottom: 20px;
    }

    .content-header {
        padding: 18px 16px 8px;
    }

    .content {
        padding: 0 8px;
    }

    .card-body {
        padding: 1rem;
    }

    .role-brand img {
        width: 40px;
        height: 40px;
    }

    .role-brand strong {
        font-size: 14px;
    }

    .role-brand small {
        display: none;
    }

    .role-main {
        padding: 14px 10px;
    }

    .role-menu {
        grid-template-columns: 1fr;
    }

    .role-dashboard h4,
    .role-dashboard .h4 {
        font-size: 18px;
    }

    .role-dashboard .card-body {
        padding: .9rem;
    }

    .role-dashboard .btn {
        white-space: normal;
    }
}

@media (max-width: 420px) {
    .role-navbar .container-fluid {
        align-items: flex-start;
    }

    .role-brand img {
        width: 36px;
        height: 36px;
    }

    .role-brand strong {
        font-size: 13px;
    }

    .role-navbar .btn,
    .role-navbar .btn-sm {
        padding: 6px 8px;
        font-size: 12px;
    }

    .role-user {
        align-items: flex-start;
    }

    .role-menu {
        grid-template-columns: 1fr;
    }

    .role-menu a {
        justify-content: flex-start;
        text-align: left;
        min-height: 40px;
    }

    .role-main {
        padding: 12px 8px;
    }
}

/* Restore role dashboards to the original non-AdminLTE layout. */
.role-dashboard .role-menu-toggle,
.role-dashboard .role-sidebar-backdrop,
.role-dashboard .role-sidebar-brand {
    display: none !important;
}

.role-dashboard .role-navbar {
    background: #fff;
    border-bottom: 1px solid var(--sipkl-line);
    box-shadow: 0 8px 24px rgba(32, 48, 42, .06);
}

.role-dashboard .role-shell {
    display: grid !important;
    grid-template-columns: 270px minmax(0, 1fr) !important;
    min-height: calc(100vh - 73px) !important;
    background: var(--sipkl-gray) !important;
}

.role-dashboard .role-sidebar-panel {
    background: #fff !important;
    border-right: 1px solid var(--sipkl-line) !important;
    padding: 18px 14px !important;
    position: sticky !important;
    top: 0 !important;
    height: calc(100vh - 73px) !important;
    overflow-y: auto !important;
    box-shadow: none !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
    z-index: auto !important;
    left: auto !important;
}

.role-dashboard .role-user {
    padding: 12px 8px 18px;
    border-bottom: 1px solid var(--sipkl-line);
    margin-bottom: 16px;
}

.role-dashboard .role-user-photo {
    width: 58px;
    height: 58px;
    border: 3px solid var(--sipkl-green-soft);
}

.role-dashboard .role-user strong,
.role-dashboard .role-user-link {
    color: var(--sipkl-text);
}

.role-dashboard .role-user small {
    color: var(--sipkl-muted);
}

.role-dashboard .role-user-link:hover {
    color: var(--sipkl-green-dark);
}

.role-dashboard .role-menu-title {
    color: var(--sipkl-muted);
    margin: 18px 8px 8px;
    font-size: 11px;
}

.role-dashboard .role-menu {
    display: grid !important;
    gap: 6px !important;
}

.role-dashboard .role-menu a {
    color: var(--sipkl-text) !important;
    padding: 10px 12px !important;
    border-radius: 8px !important;
    font-size: inherit !important;
    min-height: auto !important;
    justify-content: flex-start !important;
    text-align: left !important;
}

.role-dashboard .role-menu a.active,
.role-dashboard .role-menu a:hover {
    background: var(--sipkl-green);
    color: #fff;
}

.role-dashboard .role-main {
    padding: 24px;
}

@media (max-width: 768px) {
    .role-dashboard .role-shell {
        grid-template-columns: 1fr !important;
    }

    .role-dashboard .role-sidebar-panel {
        position: static !important;
        height: auto !important;
        border-right: 0 !important;
        border-bottom: 1px solid var(--sipkl-line) !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
    }

    .role-dashboard .role-main {
        padding: 18px 12px !important;
    }

    .role-dashboard .role-menu {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 420px) {
    .role-dashboard .role-menu {
        grid-template-columns: 1fr !important;
    }
}
