:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-main: #f1f5f9;
    --sidebar-bg: #0f172a;
    --sidebar-text: rgba(203, 213, 225, 0.85);
    --sidebar-active-bg: rgba(99, 102, 241, 0.18);
    --sidebar-active-text: #a5b4fc;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --sidebar-section-label: rgba(100, 116, 139, 0.7);
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    padding: 40px;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

.input-modern {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    transition: all 0.3s ease;
    outline: none;
}

.input-modern:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
}

.sidebar {
    width: 272px;
    background: var(--sidebar-bg);
    padding: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow: hidden;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.15);
}

/* Custom scrollbar for sidebar nav */
.sidebar-nav-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 14px 12px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.25) transparent;
}
.sidebar-nav-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-nav-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav-scroll::-webkit-scrollbar-thumb { background: rgba(99, 102, 241, 0.3); border-radius: 4px; }
.sidebar-nav-scroll::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.5); }

.main-content {
    flex: 1;
    padding: 40px;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 14px;
    border-radius: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    margin-bottom: 3px;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.nav-link:hover {
    background: var(--sidebar-hover-bg);
    color: #e2e8f0;
    transform: translateX(2px);
}

.nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 700;
    box-shadow: inset 3px 0 0 #6366f1, 0 0 16px rgba(99, 102, 241, 0.08);
}

.nav-link.active i {
    color: #818cf8;
}

.nav-link i {
    font-size: 0.9375rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    color: rgba(148, 163, 184, 0.7);
    transition: color 0.2s;
}

.nav-link:hover i {
    color: #a5b4fc;
}

/* Section Labels */
.sidebar-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--sidebar-section-label);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 0 14px;
    margin: 22px 0 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--sidebar-border);
}

/* Mobile Toggle */
/* Mobile Toggle Style */
.mobile-toggle {
    display: none;
}

/* ==========================================================================
   SIPINTAR Ultra-Premium Modern Header Styles
   ========================================================================== */
.sp-top-bar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 64px !important;
    background: rgba(255, 255, 255, 0.88) !important;
    backdrop-filter: blur(16px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(180%) !important;
    border-bottom: 1px solid rgba(226, 232, 240, 0.85) !important;
    display: none !important;
    /* Hidden on desktop */
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 16px !important;
    z-index: 9999 !important;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03) !important;
    box-sizing: border-box !important;
    transition: all 0.3s ease !important;
}

.sp-menu-btn {
    width: 42px !important;
    height: 42px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    color: #3b82f6 !important;
    cursor: pointer !important;
    font-size: 1.15rem !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02) !important;
}

.sp-menu-btn:hover {
    background: #ffffff !important;
    color: #2563eb !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15) !important;
    transform: scale(1.04) !important;
}

.sp-menu-btn:active {
    transform: scale(0.96) !important;
}

.sp-title-area {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 !important;
    margin: 0 12px !important;
}

.sp-brand-badge {
    display: flex !important;
    align-items: center !important;
    gap: 9px !important;
    padding: 6px 14px !important;
    background: rgba(241, 245, 249, 0.65) !important;
    border: 1px solid rgba(226, 232, 240, 0.75) !important;
    border-radius: 100px !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02) !important;
}

.sp-brand-logo {
    width: 26px !important;
    height: 26px !important;
    object-fit: contain !important;
    border-radius: 6px !important;
}

.sp-brand-icon {
    width: 26px !important;
    height: 26px !important;
    background: linear-gradient(135deg, #6366f1 0%, #3b82f6 100%) !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: white !important;
    font-size: 0.8rem !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35) !important;
}

.sp-app-title {
    font-size: 1.05rem !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin: 0 !important;
    letter-spacing: -0.3px !important;
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    white-space: nowrap !important;
}

.sp-logout-btn {
    width: 42px !important;
    height: 42px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #fef2f2 !important;
    color: #ef4444 !important;
    border: 1px solid #fee2e2 !important;
    text-decoration: none !important;
    cursor: pointer !important;
    font-size: 1.1rem !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.05) !important;
}

.sp-logout-btn:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3) !important;
    transform: translateY(-1px) scale(1.04) !important;
}

.sp-logout-btn:active {
    transform: scale(0.96) !important;
}

.mobile-logout {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: #ef4444 !important;
    color: white !important;
    border: none;
    border-radius: 12px;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    text-decoration: none;
}

.mobile-logout i {
    color: white !important;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    display: none;
    backdrop-filter: blur(4px);
}

/* Responsiveness */
@media (max-width: 1024px) {
    .app-container {
        display: block !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 64px;
        bottom: 0;
        transform: translateX(-100%);
        padding-top: 20px;
        height: calc(100vh - 64px);
        max-height: calc(100vh - 64px);
        width: 280px;
        max-width: 85vw;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-logout {
        display: flex;
    }

    .main-content {
        padding: 80px 16px 40px !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .main-content header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 20px;
    }

    /* Grid layout in views needs adjustment */
    .grid-mobile-1 {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 20px !important;
    }

    .grid-mobile-1 > div {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-toggle {
        display: flex !important;
        position: relative;
        top: auto;
        left: auto;
    }

    .sp-top-bar {
        display: flex !important;
        /* Show on mobile */
    }

    .card-responsive {
        padding: 20px 16px !important;
        border-radius: 18px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .table-toolbar-flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .table-toolbar-flex form {
        flex-direction: column !important;
        width: 100% !important;
        gap: 8px !important;
    }

    .table-toolbar-flex form > div,
    .table-toolbar-flex form input,
    .table-toolbar-flex form select,
    .table-toolbar-flex form button,
    .table-toolbar-flex > button {
        width: 100% !important;
    }
}

/* ==========================================================================
   Universal Responsive Table & Card Styles
   ========================================================================== */
.grid-mobile-1 {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    align-items: start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.grid-mobile-1 > div {
    min-width: 0;
    max-width: 100%;
}

.card-responsive {
    background: white;
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-soft);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.responsive-table-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin-bottom: 16px;
    border-radius: 12px;
    display: block !important;
    padding-bottom: 8px;
    border: 1px solid #f1f5f9;
}

.responsive-table-wrapper::-webkit-scrollbar {
    height: 6px;
}
.responsive-table-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 6px;
}
.responsive-table-wrapper::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 6px;
}

.responsive-table {
    width: 100% !important;
    min-width: 620px !important;
    border-collapse: collapse !important;
}

.responsive-table th,
.responsive-table td {
    white-space: nowrap !important;
}

.table-toolbar-flex {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 640px) {
    .glass-card {
        padding: 24px;
    }
}

@media print {

    .sidebar,
    header,
    .sp-top-bar,
    .main-content > header,
    .btn-primary:not(.print-visible),
    .nav-link,
    .mobile-toggle,
    .sidebar-overlay {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    .app-container {
        display: block !important;
    }

    body {
        background: white !important;
    }
}

/* Searchable Select Component */
.searchable-select-container {
    position: relative;
    width: 100%;
}

.searchable-select-display {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    height: 46.5px;
    /* Match standard input height */
}

.searchable-select-display:hover {
    border-color: var(--primary);
}

.searchable-select-display.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.searchable-select-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: none;
    overflow: hidden;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-input-wrapper {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.search-input-wrapper input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    outline: none;
    font-size: 0.8125rem;
}

.options-container {
    max-height: 250px;
    overflow-y: auto;
}

.option-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    border-bottom: 1px solid #f8fafc;
}

.option-item:last-child {
    border-bottom: none;
}

.option-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.option-item.selected {
    background: #eff6ff;
    color: var(--primary);
    font-weight: 600;
}

.option-item.hidden {
    display: none;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Password Toggle Helpers */
.input-wrapper {
    position: relative;
    width: 100%;
}

.input-wrapper input {
    padding-right: 40px;
    /* Space for icon */
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.3s;
    z-index: 10;
}

.toggle-password:hover {
    color: var(--primary);
}