@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ============================================================
   E-Permit — Enterprise Design System
   Corporate Blue | Professional | National Scale
   ============================================================ */

/* === DESIGN TOKENS === */
:root {
    /* Corporate Blue Palette */
    --brand-primary: #1a6ddc;
    --brand-primary-dark: #0f4c9e;
    --brand-primary-light: #3b82f6;
    --brand-accent: #0ea5e9;
    --brand-grad: linear-gradient(135deg, #0f4c9e 0%, #1a6ddc 50%, #0ea5e9 100%);
    --brand-grad-subtle: linear-gradient(135deg, #1a6ddc 0%, #3b82f6 100%);

    /* Background Layers */
    --bg-base: #080f1f;
    --bg-surface: #0d1930;
    --bg-elevated: #112040;
    --bg-card: rgba(13, 25, 48, 0.85);
    --bg-card-hover: rgba(17, 32, 64, 0.95);
    --bg-input: rgba(15, 28, 55, 0.8);
    --glass-bg: rgba(13, 25, 48, 0.85);

    /* Borders */
    --border-subtle: rgba(99, 155, 255, 0.12);
    --border-medium: rgba(99, 155, 255, 0.2);
    --border-strong: rgba(99, 155, 255, 0.35);

    /* Text */
    --text-primary: #eef2ff;
    --text-secondary: #94afd4;
    --text-muted: #5e7899;
    --text-link: #60a5fa;

    /* Semantic Colors */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --success-border: rgba(16, 185, 129, 0.25);
    --success-grad: linear-gradient(135deg, #059669 0%, #10b981 100%);

    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --warning-border: rgba(245, 158, 11, 0.25);
    --warning-grad: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);

    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --danger-border: rgba(239, 68, 68, 0.25);
    --danger-grad: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);

    --info: #06b6d4;
    --info-bg: rgba(6, 182, 212, 0.1);
    --info-border: rgba(6, 182, 212, 0.25);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.45), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-brand: 0 8px 24px rgba(26, 109, 220, 0.35);
    --shadow-brand-lg: 0 12px 40px rgba(26, 109, 220, 0.45);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;

    /* Sidebar width */
    --sidebar-w: 288px;

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* === LIGHT THEME OVERRIDES === */
html[data-theme="light"] {
    --bg-base: #f0f4fb;
    --bg-surface: #ffffff;
    --bg-elevated: #f8faff;
    --bg-card: rgba(255, 255, 255, 0.96);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-input: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.95);

    --border-subtle: #dde5f5;
    --border-medium: #c4d2eb;
    --border-strong: #93afd6;

    --text-primary: #0d1b35;
    --text-secondary: #3d5a82;
    --text-muted: #6b84a8;
    --text-link: #1a6ddc;

    --brand-grad-subtle: linear-gradient(135deg, #1a6ddc 0%, #0ea5e9 100%);

    --shadow-sm: 0 1px 3px rgba(30, 50, 100, 0.08);
    --shadow-md: 0 4px 16px rgba(30, 50, 100, 0.1);
    --shadow-lg: 0 10px 40px rgba(30, 50, 100, 0.12);
    --shadow-xl: 0 20px 60px rgba(30, 50, 100, 0.15);
}

/* === BASE === */
html {
    min-width: 320px;
    background: var(--bg-base);
    scroll-behavior: smooth;
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ambient background glow */
body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: -5%;
    width: 55vw;
    height: 55vw;
    background: radial-gradient(ellipse, rgba(26, 109, 220, 0.08) 0%, transparent 65%);
    z-index: -1;
    pointer-events: none;
}
body::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: -5%;
    width: 55vw;
    height: 55vw;
    background: radial-gradient(ellipse, rgba(14, 165, 233, 0.06) 0%, transparent 65%);
    z-index: -1;
    pointer-events: none;
}
html[data-theme="light"] body::before { background: radial-gradient(ellipse, rgba(26, 109, 220, 0.07) 0%, transparent 65%); }
html[data-theme="light"] body::after  { background: radial-gradient(ellipse, rgba(14, 165, 233, 0.06) 0%, transparent 65%); }

/* Accessibility */
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 3px;
}
.min-w-0 { min-width: 0; }
.flex-1 { flex: 1 1 0; }
.fs-7 { font-size: 0.82rem; }
.fs-8 { font-size: 0.74rem; }


/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 16px;
    left: 16px;
    bottom: 16px;
    width: var(--sidebar-w);
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* Top accent line */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--brand-grad);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.75rem 1.25rem 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}
.sidebar-inner::-webkit-scrollbar { display: none; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    margin-bottom: 2rem;
    padding: 0 0.25rem;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
    background: var(--brand-grad);
    color: #fff;
    font-size: 1.1rem;
    box-shadow: var(--shadow-brand);
}
.brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}
.brand-text small {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.brand-text strong {
    font-size: 1.1rem;
    font-weight: 800;
    background: var(--brand-grad-subtle);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.3px;
    line-height: 1.2;
}
html[data-theme="light"] .brand-text strong { background: linear-gradient(135deg, #0f4c9e, #1a6ddc); -webkit-background-clip: text; background-clip: text; }

/* Sidebar nav sections */
.sidebar-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 0.5rem;
    margin: 0.5rem 0 0.6rem;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.72rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s var(--ease);
    position: relative;
    min-height: 48px;
    border: 1px solid transparent;
}

.sidebar-link i {
    font-size: 1.05rem;
    flex: 0 0 20px;
    text-align: center;
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: rgba(26, 109, 220, 0.1);
    border-color: var(--border-subtle);
}

.sidebar-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(26, 109, 220, 0.25), rgba(14, 165, 233, 0.15));
    border-color: rgba(26, 109, 220, 0.3);
    font-weight: 600;
}
.sidebar-link.active i { color: var(--brand-accent); }
html[data-theme="light"] .sidebar-link.active { color: #0f4c9e; background: linear-gradient(135deg, rgba(26, 109, 220, 0.1), rgba(14, 165, 233, 0.06)); }
html[data-theme="light"] .sidebar-link:hover { color: #0f4c9e; background: rgba(26, 109, 220, 0.07); }

/* Pending badge on nav */
.nav-badge {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    background: var(--warning-grad);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* Sidebar user section */
.sidebar-user {
    margin-top: auto;
    background: rgba(26, 109, 220, 0.06);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 1.5rem;
}
html[data-theme="light"] .sidebar-user { background: var(--bg-elevated); border-color: var(--border-subtle); }

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 10px;
    background: var(--brand-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: var(--shadow-brand);
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: capitalize;
    margin-top: 1px;
}

.logout-button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    color: var(--text-muted);
    background: transparent;
    border: 0;
    border-radius: 8px;
    font-size: 1.05rem;
    transition: all 0.2s var(--ease);
}
.logout-button:hover { background: var(--danger-bg); color: var(--danger); }

/* Sidebar bottom branding */
.sidebar-footer {
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    padding: 0.75rem 0 0;
    border-top: 1px solid var(--border-subtle);
    margin-top: 1rem;
    letter-spacing: 0.05em;
}
.sidebar-footer strong { color: var(--text-secondary); }

/* Sidebar backdrop & mobile menu toggle */
.sidebar-backdrop { display: none; }
.menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    background: var(--bg-elevated);
    font-size: 1.35rem;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease);
}
.menu-toggle:hover { background: var(--bg-card); border-color: var(--border-medium); }


/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-wrapper {
    margin-left: calc(var(--sidebar-w) + 32px);
    min-height: 100vh;
    padding: 2rem clamp(1.5rem, 3vw, 3rem) 3rem 1.5rem;
    max-width: 1600px;
    overflow-x: hidden;
}

.guest-wrapper { min-height: 100dvh; }


/* ============================================================
   TOP NAVBAR
   ============================================================ */
.top-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--brand-primary-light);
    margin-bottom: 4px;
}

.page-heading {
    margin: 0;
    font-size: clamp(1.4rem, 2.5vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-subtitle {
    margin: 4px 0 0;
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 400;
}

.header-actions { display: flex; align-items: center; gap: 0.75rem; }

.role-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.role-chip-owner {
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.role-chip-supervisor {
    color: #c084fc;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.3);
}
.role-chip-admin {
    color: #93c5fd;
    background: rgba(26, 109, 220, 0.12);
    border: 1px solid rgba(26, 109, 220, 0.25);
}
.role-chip-employee {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.22);
}
html[data-theme="light"] .role-chip-owner { color: #d97706; background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.25); }
html[data-theme="light"] .role-chip-supervisor { color: #7e22ce; background: rgba(168, 85, 247, 0.1); border-color: rgba(168, 85, 247, 0.25); }
html[data-theme="light"] .role-chip-admin { color: #1a6ddc; background: rgba(26, 109, 220, 0.08); border-color: rgba(26, 109, 220, 0.18); }
html[data-theme="light"] .role-chip-employee { color: #059669; background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.2); }


/* ============================================================
   CARDS
   ============================================================ */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--border-medium);
}

html[data-theme="light"] .glass-card { background: var(--bg-card); border-color: var(--border-subtle); box-shadow: var(--shadow-md); }
html[data-theme="light"] .glass-card:hover { border-color: var(--border-medium); }


/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.stat-card:hover { transform: translateY(-3px); }

.stat-card::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    top: -30px;
    right: -25px;
}

.stat-card-blue   { background: linear-gradient(135deg, #0f4c9e 0%, #1a6ddc 100%); box-shadow: 0 8px 24px rgba(26, 109, 220, 0.35); }
.stat-card-green  { background: linear-gradient(135deg, #047857 0%, #10b981 100%); box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3); }
.stat-card-yellow { background: linear-gradient(135deg, #b45309 0%, #f59e0b 100%); box-shadow: 0 8px 24px rgba(245, 158, 11, 0.3); }
.stat-card-red    { background: linear-gradient(135deg, #b91c1c 0%, #ef4444 100%); box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3); }
.stat-card-teal   { background: linear-gradient(135deg, #0e7490 0%, #06b6d4 100%); box-shadow: 0 8px 24px rgba(6, 182, 212, 0.3); }

.stat-card-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    font-weight: 800;
    color: #fff;
    line-height: 1;
    letter-spacing: -1px;
    margin-bottom: 0.75rem;
}
.stat-card-value span { font-size: 0.9rem; font-weight: 500; letter-spacing: 0; margin-left: 4px; }

.stat-card-icon {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.15);
}

/* Quota progress bar */
.quota-bar {
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.5rem;
}
.quota-bar-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 999px;
    transition: width 1s ease;
}
.stat-card-sub {
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 0.4rem;
}


/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    transition: all 0.2s var(--ease);
    letter-spacing: 0.01em;
}

.btn-glass-primary {
    background: var(--brand-grad-subtle);
    color: #fff;
    border: 1px solid rgba(26, 109, 220, 0.4);
    padding: 0.6rem 1.4rem;
    box-shadow: var(--shadow-brand);
}
.btn-glass-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-brand-lg);
    color: #fff;
    background: linear-gradient(135deg, #1557c0 0%, #2575e8 100%);
}
.btn-glass-primary:active { transform: translateY(0); }

.btn-glass-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    padding: 0.6rem 1.4rem;
}
.btn-glass-secondary:hover {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-medium);
    transform: translateY(-1px);
}
html[data-theme="light"] .btn-glass-secondary { background: #f4f7fb; color: #3d5a82; border-color: var(--border-subtle); }
html[data-theme="light"] .btn-glass-secondary:hover { background: #e8eef8; color: #0d1b35; }

.btn-glass-danger {
    background: var(--danger-grad);
    color: #fff;
    border: 1px solid rgba(239, 68, 68, 0.4);
    padding: 0.6rem 1.4rem;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.btn-glass-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
    color: #fff;
}

.btn-glass-success {
    background: var(--success-grad);
    color: #fff;
    border: 1px solid rgba(16, 185, 129, 0.4);
    padding: 0.6rem 1.4rem;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.btn-glass-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
    color: #fff;
}

/* Loading state */
.btn.loading { pointer-events: none; opacity: 0.75; }
.btn.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-left: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ============================================================
   FORM CONTROLS
   ============================================================ */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.45rem;
    letter-spacing: 0.01em;
}

.form-glass {
    background: var(--bg-input) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-primary) !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.925rem !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 400 !important;
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease) !important;
    min-height: 48px;
}

.form-glass::placeholder { color: var(--text-muted) !important; opacity: 1; }

.form-glass:focus {
    background: rgba(26, 109, 220, 0.06) !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(26, 109, 220, 0.15) !important;
    outline: none !important;
    color: var(--text-primary) !important;
}

.form-glass option { background-color: var(--bg-surface); color: var(--text-primary); }

textarea.form-glass { min-height: auto; resize: vertical; }

.input-group .form-glass { border-radius: 0 var(--radius-md) var(--radius-md) 0 !important; }
.input-group-text.form-glass {
    min-height: 48px;
    border-radius: var(--radius-md) 0 0 var(--radius-md) !important;
    color: var(--text-muted);
    background: var(--bg-elevated) !important;
}

html[data-theme="light"] .form-glass { background: #fff !important; border-color: var(--border-subtle) !important; color: var(--text-primary) !important; }
html[data-theme="light"] .form-glass:focus { background: #fafbff !important; }
html[data-theme="light"] .form-glass option { background: #fff; color: #0d1b35; }
html[data-theme="light"] .input-group-text.form-glass { background: #f4f7fb !important; border-color: var(--border-subtle) !important; }

/* Dark mode explicit */
html[data-theme="dark"] .form-glass { color: #eef2ff !important; background: rgba(15, 28, 55, 0.9) !important; border-color: rgba(99, 155, 255, 0.18) !important; }
html[data-theme="dark"] .form-glass::placeholder { color: #5e7899 !important; opacity: 1; }
html[data-theme="dark"] .form-glass:focus { color: #fff !important; background: rgba(26, 109, 220, 0.1) !important; border-color: var(--brand-primary) !important; }
html[data-theme="dark"] .input-group-text.form-glass { color: #7da0c4 !important; background: rgba(10, 20, 42, 0.9) !important; border-color: rgba(99, 155, 255, 0.15) !important; }
html[data-theme="dark"] .text-muted { color: #7da0c4 !important; }

/* File upload */
.custom-file-upload {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: rgba(26, 109, 220, 0.03);
    transition: all 0.25s var(--ease);
}
.custom-file-upload:hover {
    border-color: var(--brand-primary);
    background: rgba(26, 109, 220, 0.07);
}
.custom-file-upload i { font-size: 2rem; color: var(--text-muted); margin-bottom: 0.5rem; }
html[data-theme="light"] .custom-file-upload { background: #f8faff; border-color: var(--border-medium); }
html[data-theme="light"] .custom-file-upload:hover { background: #eef3ff; border-color: var(--brand-primary); }


/* ============================================================
   TABLE
   ============================================================ */
.table-responsive-custom {
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.custom-table {
    margin: 0;
    background: transparent;
    color: var(--text-primary);
    width: 100%;
}

.custom-table th {
    background: rgba(26, 109, 220, 0.04);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.9rem 1rem;
    white-space: nowrap;
}

.custom-table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    background: transparent;
    font-size: 0.9rem;
}

.custom-table tr:last-child td { border-bottom: none; }
.custom-table tbody tr { transition: background 0.15s ease; }
.custom-table tbody tr:hover { background: rgba(26, 109, 220, 0.04); }

html[data-theme="light"] .custom-table th { background: #f4f8ff; color: var(--text-muted); border-color: var(--border-subtle); }
html[data-theme="light"] .custom-table td { border-color: var(--border-subtle); }
html[data-theme="light"] .custom-table tbody tr:hover { background: #f4f8ff; }
html[data-theme="light"] .table-responsive-custom { border-color: var(--border-subtle); }

/* Employee avatar in table */
.emp-avatar {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--brand-grad);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    flex: 0 0 34px;
}


/* ============================================================
   BADGES
   ============================================================ */
.badge-custom {
    padding: 0.4em 0.85em;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 999px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
}

.badge-pending  { background: var(--warning-bg);  color: var(--warning);  border-color: var(--warning-border); }
.badge-approved { background: var(--success-bg);  color: var(--success);  border-color: var(--success-border); }
.badge-rejected { background: var(--danger-bg);   color: var(--danger);   border-color: var(--danger-border); }
.badge-cuti     { background: rgba(26,109,220,0.12); color: var(--brand-accent); border-color: rgba(26,109,220,0.25); }
.badge-izin     { background: rgba(6,182,212,0.1);   color: var(--info);         border-color: rgba(6,182,212,0.22); }

html[data-theme="light"] .badge-pending  { background: #fffbeb; color: #92400e; border-color: #fde68a; }
html[data-theme="light"] .badge-approved { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
html[data-theme="light"] .badge-rejected { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
html[data-theme="light"] .badge-cuti     { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
html[data-theme="light"] .badge-izin     { background: #ecfeff; color: #155e75; border-color: #a5f3fc; }


/* ============================================================
   TOAST NOTIFICATION SYSTEM
   ============================================================ */

/* Container — fixed top-right stack */
.toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 1040; /* Di bawah Bootstrap modal (1055) agar tidak menghalangi klik */
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: min(360px, calc(100vw - 2rem));
    pointer-events: none;
}

/* Individual toast card */
.toast-notify {
    pointer-events: all;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.9rem 1.1rem;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-left-width: 3px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    animation: toastIn 0.32s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}

.toast-notify.hiding {
    animation: toastOut 0.28s ease forwards;
}

/* Type border colors */
.toast-notify.toast-success { border-left-color: var(--success); }
.toast-notify.toast-error   { border-left-color: var(--danger);  }
.toast-notify.toast-warning { border-left-color: var(--warning); }
.toast-notify.toast-info    { border-left-color: var(--brand-primary-light); }

/* Icon */
.toast-icon {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 0.9rem;
    margin-top: 1px;
}
.toast-success .toast-icon { color: var(--success);              background: var(--success-bg); }
.toast-error   .toast-icon { color: var(--danger);               background: var(--danger-bg);  }
.toast-warning .toast-icon { color: var(--warning);              background: var(--warning-bg); }
.toast-info    .toast-icon { color: var(--brand-primary-light);  background: rgba(26,109,220,0.12); }

/* Body */
.toast-body {
    flex: 1;
    min-width: 0;
}
.toast-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 2px;
}
.toast-success .toast-title { color: var(--success); }
.toast-error   .toast-title { color: var(--danger);  }
.toast-warning .toast-title { color: var(--warning); }
.toast-info    .toast-title { color: var(--brand-primary-light); }

.toast-msg {
    font-size: 0.865rem;
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1.45;
    word-break: break-word;
}

/* Close button */
.toast-close {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    margin-top: -2px;
    margin-right: -2px;
}
.toast-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
html[data-theme="light"] .toast-close:hover { background: rgba(0,0,0,0.06); }

/* Auto-dismiss progress bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: toastProgress linear forwards;
    transform-origin: left;
}
.toast-success .toast-progress { background: var(--success); }
.toast-error   .toast-progress { background: var(--danger);  }
.toast-warning .toast-progress { background: var(--warning); }
.toast-info    .toast-progress { background: var(--brand-primary-light); }

/* Light theme adjustments */
html[data-theme="light"] .toast-notify {
    background: rgba(255, 255, 255, 0.97);
    border-color: var(--border-subtle);
    box-shadow: 0 8px 32px rgba(30, 50, 100, 0.14);
}
html[data-theme="light"] .toast-msg { color: var(--text-secondary); }

/* Keyframes */
@keyframes toastIn {
    from { opacity: 0; transform: translateX(110%) scale(0.95); }
    to   { opacity: 1; transform: translateX(0)    scale(1);    }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0)    scale(1);    max-height: 120px; margin-bottom: 0; }
    to   { opacity: 0; transform: translateX(110%) scale(0.95); max-height: 0;     margin-bottom: -0.65rem; }
}
@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* Mobile: full width at bottom */
@media (max-width: 480px) {
    .toast-container {
        top: auto;
        bottom: 4.5rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
    }
}

/* Legacy .app-alert — kept for inline info-box usage in views */
.app-alert {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-radius: var(--radius-md);
    border-width: 1px;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1.25rem;
    padding: 0.85rem 1rem;
}


/* ============================================================
   AUTH PAGES — Split Layout
   ============================================================ */
.auth-split {
    min-height: 100dvh;
    display: flex;
}

/* Left panel — corporate hero */
.auth-hero {
    flex: 0 0 46%;
    background: var(--brand-grad);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.auth-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 70%, rgba(14, 165, 233, 0.3), transparent),
        radial-gradient(ellipse 60% 50% at 80% 20%, rgba(255,255,255,0.05), transparent);
}

/* Geometric decorators */
.auth-hero-geo {
    position: absolute;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 50%;
}
.geo-1 { width: 300px; height: 300px; top: -80px; right: -80px; }
.geo-2 { width: 180px; height: 180px; bottom: 10%; right: 5%; }
.geo-3 { width: 100px; height: 100px; bottom: 20%; left: 20%; border-style: dashed; }

.auth-hero-content { position: relative; z-index: 1; }
.auth-hero-footer  { position: relative; z-index: 1; }

.auth-hero-logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 3rem;
}
.auth-hero-logo-mark {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    color: #fff;
    backdrop-filter: blur(8px);
}
.auth-hero-logo-text {
    display: flex;
    flex-direction: column;
}
.auth-hero-logo-text small {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.65);
}
.auth-hero-logo-text strong {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.5px;
}

.auth-hero h1 {
    font-size: clamp(1.6rem, 2.5vw, 2.1rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    letter-spacing: -0.5px;
    margin-bottom: 1rem;
}
.auth-hero p {
    color: rgba(255,255,255,0.7);
    font-size: 0.95rem;
    line-height: 1.65;
    max-width: 380px;
}

/* Hero feature list */
.auth-hero-features {
    list-style: none;
    padding: 0;
    margin: 1.75rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.auth-hero-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    color: rgba(255,255,255,0.8);
    font-weight: 500;
}
.auth-hero-features li::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.6);
    flex: 0 0 6px;
}

.auth-hero-footer-text {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.03em;
}

/* Right panel — form */
.auth-form-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1.5rem, 5vw, 3rem);
    background: var(--bg-base);
    overflow-y: auto;
}

html[data-theme="light"] .auth-form-panel { background: #f0f4fb; }

.auth-form-container {
    width: 100%;
    max-width: 440px;
}

.auth-form-header { margin-bottom: 2rem; }
.auth-form-header h2 {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin-bottom: 0.35rem;
}
.auth-form-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.auth-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}
html[data-theme="light"] .auth-form-card { background: #fff; border-color: var(--border-subtle); }

/* Legacy fallback for old auth layout */
.auth-wrapper {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(1rem, 4vw, 2rem);
}
.auth-card { width: 100%; max-width: 460px; padding: clamp(1.5rem, 5vw, 2.5rem); }
.auth-header { text-align: center; margin-bottom: 1.75rem; }
.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 58px; height: 58px;
    border-radius: 16px;
    background: var(--brand-grad-subtle);
    box-shadow: var(--shadow-brand);
    margin-bottom: 1.25rem;
    color: #fff;
    font-size: 1.65rem;
}


/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--text-primary); }

.text-gradient {
    background: linear-gradient(135deg, #1a6ddc, #0ea5e9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
html[data-theme="light"] .text-gradient { background: linear-gradient(135deg, #0f4c9e, #1a6ddc); -webkit-background-clip: text; background-clip: text; }


/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: rgba(26, 109, 220, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.filter-bar > div { min-width: min(100%, 175px); flex: 1 1 175px; }
.filter-bar .form-glass { min-height: 42px; padding-block: 0.45rem !important; font-size: 0.875rem !important; }
.filter-reset { align-self: center; color: var(--text-link); font-size: 0.84rem; text-decoration: none; white-space: nowrap; }
.filter-reset:hover { color: var(--text-primary); text-decoration: underline; }
html[data-theme="light"] .filter-bar { background: #f4f8ff; border-color: var(--border-subtle); }


/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-wrap { display: flex; justify-content: center; padding-top: 1.25rem; }
.pagination-wrap nav { width: 100%; overflow-x: auto; }
.pagination-wrap svg { width: 1rem; height: 1rem; }


/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-summary { padding: 2rem 1.5rem; }
.profile-avatar {
    display: grid;
    place-items: center;
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    border-radius: 22px;
    background: var(--brand-grad);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 800;
    box-shadow: var(--shadow-brand-lg);
    position: relative;
}

/* Ring around avatar */
.profile-avatar::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 26px;
    border: 2px solid rgba(26, 109, 220, 0.3);
}

.profile-summary hr { border-color: var(--border-subtle); opacity: 1; }

.profile-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0;
    color: var(--text-muted);
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-subtle);
}
.profile-meta:last-child { border-bottom: none; }
.profile-meta strong { color: var(--text-primary); font-weight: 600; }

.form-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.75rem 0 1.25rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
}
.form-divider::before, .form-divider::after { content: ''; height: 1px; flex: 1; background: var(--border-subtle); }
.form-divider small { color: var(--text-muted); font-weight: 400; }

html[data-theme="light"] .profile-meta { color: var(--text-muted); border-color: var(--border-subtle); }
html[data-theme="light"] .profile-meta strong { color: var(--text-primary); }
html[data-theme="light"] .profile-summary hr { border-color: var(--border-subtle); }
html[data-theme="light"] .form-divider { color: var(--text-secondary); }


/* ============================================================
   STATUS TIMELINE (show page)
   ============================================================ */
.status-timeline {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 1.75rem;
    padding: 1.25rem 1.5rem;
    background: rgba(26, 109, 220, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow-x: auto;
}
.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 80px;
    position: relative;
}
.timeline-step::after {
    content: '';
    position: absolute;
    top: 17px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-subtle);
    z-index: 0;
}
.timeline-step:last-child::after { display: none; }

.timeline-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 2px solid var(--border-medium);
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}
.timeline-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    white-space: nowrap;
}

.timeline-step.done .timeline-dot { background: var(--success-bg); border-color: var(--success); color: var(--success); }
.timeline-step.done .timeline-label { color: var(--success); }
.timeline-step.done::after { background: var(--success); }

.timeline-step.active .timeline-dot { background: rgba(26,109,220,0.15); border-color: var(--brand-primary); color: var(--brand-primary); box-shadow: 0 0 0 4px rgba(26,109,220,0.15); }
.timeline-step.active .timeline-label { color: var(--brand-primary); font-weight: 700; }

.timeline-step.rejected-step .timeline-dot { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.timeline-step.rejected-step .timeline-label { color: var(--danger); }

html[data-theme="light"] .status-timeline { background: #f4f8ff; border-color: var(--border-subtle); }
html[data-theme="light"] .timeline-dot { background: #f0f4fb; border-color: var(--border-medium); }


/* ============================================================
   INFO BOXES
   ============================================================ */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.5;
}
.info-box-blue { background: rgba(26,109,220,0.08); border: 1px solid rgba(26,109,220,0.2); color: #93c5fd; }
.info-box-yellow { background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning); }
.info-box i { flex: 0 0 18px; font-size: 1rem; margin-top: 1px; }
html[data-theme="light"] .info-box-blue { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
html[data-theme="light"] .info-box-yellow { background: #fffbeb; border-color: #fde68a; color: #92400e; }


/* ============================================================
   THEME TOGGLE FAB
   ============================================================ */
.theme-fab {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 1030;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border-medium);
    border-radius: 999px;
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    font-size: 0.85rem;
    font-weight: 700;
    backdrop-filter: blur(16px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Inter', sans-serif;
}
.theme-fab:hover { transform: translateY(-2px); color: var(--text-primary); box-shadow: var(--shadow-lg); }
.theme-fab i { color: #f59e0b; font-size: 1rem; }
html[data-theme="light"] .theme-fab i { color: #1a6ddc; }
html[data-theme="light"] .theme-fab { border-color: var(--border-subtle); }


/* ============================================================
/* ============================================================
   RESPONSIVE BREAKPOINTS & MOBILE OPTIMIZATION
   ============================================================ */
@media (max-width: 1199.98px) {
    :root { --sidebar-w: 260px; }
    .main-wrapper { padding-right: 1.5rem; }
}

@media (max-width: 991.98px) {
    .sidebar {
        top: 0; left: 0; bottom: 0;
        width: min(84vw, 320px);
        border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
        transform: translateX(-110%);
        transition: transform 0.3s var(--ease);
        z-index: 1060;
    }
    .sidebar.show { 
        transform: translateX(0); 
        box-shadow: 0 10px 40px rgba(0,0,0,0.6); 
    }
    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1050;
        background: rgba(2, 6, 23, 0.7);
        backdrop-filter: blur(4px);
    }
    .main-wrapper { 
        margin-left: 0 !important; 
        width: 100% !important;
        max-width: 100% !important;
        padding: 1.25rem 1rem 3rem !important; 
    }
    .menu-toggle { display: inline-flex !important; }
    .top-navbar { 
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    .header-actions {
        margin-left: auto;
    }

    /* Auth split: stack vertically */
    .auth-split { flex-direction: column; }
    .auth-hero { flex: 0 0 auto; padding: 2rem; min-height: 200px; }
    .auth-hero h1 { font-size: 1.35rem; }
    .auth-hero-features { display: none; }
    .geo-1, .geo-2, .geo-3 { display: none; }
    .auth-form-panel { padding: 1.5rem; }
}

@media (max-width: 575.98px) {
    .auth-form-panel { padding: 1rem 0.75rem; }
    .auth-form-card { padding: 1.5rem 1.15rem; }
}

@media (max-width: 767.98px) {
    .main-wrapper { padding: 1rem 0.75rem 2.5rem !important; }
    .top-navbar { 
        margin-bottom: 1.25rem; 
        padding-bottom: 1rem;
    }
    .page-heading { font-size: clamp(1.2rem, 5vw, 1.5rem); }
    .page-subtitle { display: none; }
    .role-chip { 
        padding: 0.35rem 0.65rem; 
        font-size: 0.72rem; 
    }
    
    .card, .glass-card { 
        padding: 1.2rem !important; 
        border-radius: var(--radius-lg) !important;
    }
    .stat-card { min-height: 110px; }
    .stat-card.p-4 { padding: 1rem !important; }
    .stat-card-value { font-size: 1.8rem; }
    .stat-card-icon { font-size: 2.2rem; }

    /* Responsive Table Wrappers */
    .table-responsive, .table-responsive-custom {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-md);
        margin-inline: 0 !important;
        padding-bottom: 6px;
    }
    .custom-table { min-width: 620px; }
    .custom-table th, .custom-table td { padding: 0.65rem 0.75rem; }

    /* Touch & Action buttons */
    .btn-glass-primary, .btn-glass-secondary, .btn-glass-danger { 
        padding-inline: 1rem; 
    }
    .auth-hero { display: none; }

    /* Mobile Timeline Scroll */
    .timeline-scroll-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }
}

@media (max-width: 575.98px) {
    .main-wrapper { padding: 0.75rem 0.5rem 2rem !important; }
    .card, .glass-card { padding: 1rem !important; }
    .page-heading { font-size: 1.15rem; }

    /* Stack filter bars & quick actions cleanly */
    .filter-bar { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
    .filter-bar > div { min-width: 0; }
    .filter-bar .btn { width: 100%; }
    .filter-reset { grid-column: 1 / -1; text-align: center; }

    /* Action buttons in modals & footers */
    .modal-dialog { margin: 0.5rem; }
    .modal-footer { flex-direction: column-reverse; gap: 0.5rem; }
    .modal-footer .btn { width: 100% !important; margin: 0 !important; }

    .theme-fab { right: 0.75rem; bottom: 0.75rem; width: 42px; height: 42px; justify-content: center; padding: 0; }
    .theme-toggle-label { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ============================================================
   AKSESIBILITAS PENGGUNA & TOUCH TARGET COMPLIANCE
   ============================================================ */
/* 1. Basis Tabel & Label */
.table {
    --bs-table-bg: transparent !important;
    --bs-table-color: var(--text-primary) !important;
    --bs-table-border-color: var(--border-subtle) !important;
    --bs-table-hover-bg: rgba(99, 155, 255, 0.06) !important;
    --bs-table-hover-color: var(--text-primary) !important;
    color: var(--text-primary) !important;
}

table, .table, .table td, .table th {
    color: var(--text-primary) !important;
    background-color: transparent !important;
    border-color: var(--border-subtle) !important;
}

.table thead th {
    color: var(--text-muted) !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
    font-size: 0.85rem !important;
    white-space: nowrap;
}

.table tbody td, .table th, .custom-table td, .custom-table th {
    font-size: 16px !important;
    vertical-align: middle;
    color: var(--text-primary) !important;
}

.table-responsive {
    background: transparent !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

label, .form-label, .col-form-label {
    font-size: 16px !important;
    font-weight: 600;
    color: var(--text-primary) !important;
    margin-bottom: 0.45rem;
}

/* 2. Tombol Aksi Utama & Pengambilan Keputusan (Minimal Touch Target 48x48px) */
.btn-touch,
.btn-action,
.btn-approve,
.btn-reject,
.btn-action-decision,
.btn-primary:not(.btn-sm),
.btn-success:not(.btn-sm),
.btn-danger:not(.btn-sm),
.modal-footer .btn {
    min-height: 48px !important;
    min-width: 48px !important;
    padding: 12px 24px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
}

/* Tombol aksi dalam baris tabel (Compact & Touch-friendly) */
.btn-sm, 
.table .btn {
    min-height: 38px !important;
    min-width: 38px !important;
    padding: 6px 12px !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
}

/* Jarak pemisah antar tombol aksi */
.d-flex.gap-2, .d-flex.gap-3, .action-buttons {
    gap: 12px !important;
}

/* 3. Modal Dialog Styling (Kontras Tinggi & Tema Konsisten) */
.modal-content {
    background: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-strong) !important;
    box-shadow: var(--shadow-xl) !important;
    border-radius: var(--radius-lg) !important;
}
.modal-header {
    border-bottom: 1px solid var(--border-subtle) !important;
}
.modal-footer {
    border-top: 1px solid var(--border-subtle) !important;
}
.modal-title {
    color: var(--text-primary) !important;
    font-weight: 700 !important;
    font-size: 1.15rem !important;
}
.modal-body p, .modal-body label {
    color: var(--text-secondary) !important;
}
.modal-body label {
    color: var(--text-primary) !important;
    font-weight: 600 !important;
}

/* ============================================================
   CARD & FORM THEME ADAPTATION (LIGHT & DARK HARMONY)
   ============================================================ */
.card {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-subtle) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.form-control,
.form-select {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-md) !important;
    font-size: 16px !important;
    min-height: 48px !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(26, 109, 220, 0.25) !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.85;
}

.form-select option {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}

.input-group-text {
    background-color: var(--bg-elevated) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-medium) !important;
    font-size: 16px !important;
}

/* Tutorial Cards (Theme-Adaptive & Responsive) */
.tutorial-card {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border-subtle) !important;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-lg);
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.tutorial-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-primary-light) !important;
}
.tutorial-card h6 {
    color: var(--text-primary) !important;
}
.tutorial-card p {
    color: var(--text-secondary) !important;
}

/* Dark Mode Overrides for Legacy Bootstrap Utility Classes */
html[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .text-muted {
    color: var(--text-secondary) !important;
}
html[data-theme="dark"] .bg-light {
    background-color: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .bg-white {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .border {
    border-color: var(--border-subtle) !important;
}
html[data-theme="dark"] .card {
    border-color: rgba(99, 155, 255, 0.15) !important;
}
html[data-theme="dark"] .shadow-sm {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

/* Smooth color transitions on theme toggle */
body, .sidebar, .card, .top-navbar, .form-control, .form-select, .modal-content {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* ============================================================
   MODAL DIALOG THEME ADAPTATION
   ============================================================ */
.modal-content {
    background-color: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-medium) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-xl) !important;
}
.modal-header {
    border-bottom: 1px solid var(--border-subtle) !important;
}
.modal-footer {
    border-top: 1px solid var(--border-subtle) !important;
}
.modal-body {
    color: var(--text-secondary) !important;
}
.modal-body strong, 
.modal-body label,
.modal-body h5,
.modal-body h6 {
    color: var(--text-primary) !important;
}
html[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ============================================================
   BADGE & EMPHASIS CONTRAST STANDARDS (WCAG AA)
   ============================================================ */
/* Enforce dark text and dark icons on ALL warning/yellow elements across themes */
.bg-warning,
.bg-warning *,
.badge.bg-warning,
.badge.bg-warning *,
.rounded-circle.bg-warning,
.rounded-circle.bg-warning *,
.btn-warning,
.btn-warning *,
.bg-warning.text-dark,
.badge.bg-warning.text-dark,
html[data-theme="dark"] .bg-warning,
html[data-theme="dark"] .bg-warning *,
html[data-theme="dark"] .badge.bg-warning,
html[data-theme="dark"] .badge.bg-warning *,
html[data-theme="dark"] .rounded-circle.bg-warning,
html[data-theme="dark"] .rounded-circle.bg-warning *,
html[data-theme="dark"] .bg-warning.text-dark,
html[data-theme="dark"] .badge.bg-warning.text-dark {
    color: #0f172a !important;
}

/* High-Contrast Emphasis Utilities */
html[data-theme="dark"] .text-primary-emphasis   { color: #93c5fd !important; }
html[data-theme="dark"] .text-danger-emphasis    { color: #fca5a5 !important; }
html[data-theme="dark"] .text-info-emphasis      { color: #7dd3fc !important; }
html[data-theme="dark"] .text-success-emphasis   { color: #86efac !important; }
html[data-theme="dark"] .text-warning-emphasis   { color: #fde047 !important; }
html[data-theme="dark"] .text-secondary-emphasis { color: #cbd5e1 !important; }

html[data-theme="light"] .text-primary-emphasis   { color: #1e40af !important; }
html[data-theme="light"] .text-danger-emphasis    { color: #991b1b !important; }
html[data-theme="light"] .text-info-emphasis      { color: #0369a1 !important; }
html[data-theme="light"] .text-success-emphasis   { color: #065f46 !important; }
html[data-theme="light"] .text-warning-emphasis   { color: #92400e !important; }
html[data-theme="light"] .text-secondary-emphasis { color: #334155 !important; }

/* Text Warning & Success Contrast Overrides (Ensures legibility on light & dark cards) */
html[data-theme="light"] .text-warning { color: #d97706 !important; }
html[data-theme="dark"] .text-warning  { color: #fbbf24 !important; }
html[data-theme="light"] .text-success { color: #059669 !important; }
html[data-theme="dark"] .text-success  { color: #34d399 !important; }

/* Dark theme subtle badges */
html[data-theme="dark"] .badge.bg-warning-subtle {
    background-color: rgba(245, 158, 11, 0.2) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
}
html[data-theme="dark"] .badge.bg-info-subtle {
    background-color: rgba(14, 165, 233, 0.2) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(14, 165, 233, 0.35) !important;
}
html[data-theme="dark"] .badge.bg-success-subtle {
    background-color: rgba(16, 185, 129, 0.2) !important;
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.35) !important;
}
html[data-theme="dark"] .badge.bg-danger-subtle {
    background-color: rgba(239, 68, 68, 0.2) !important;
    color: #f87171 !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
}
html[data-theme="dark"] .badge.bg-primary-subtle {
    background-color: rgba(59, 130, 246, 0.2) !important;
    color: #60a5fa !important;
    border: 1px solid rgba(59, 130, 246, 0.35) !important;
}
html[data-theme="dark"] .badge.bg-secondary-subtle {
    background-color: rgba(148, 163, 184, 0.15) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(148, 163, 184, 0.25) !important;
}
html[data-theme="dark"] .badge.bg-dark {
    background-color: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-medium) !important;
}

/* Light Theme subtle badges */
html[data-theme="light"] .badge.bg-warning-subtle {
    background-color: #fef3c7 !important;
    color: #92400e !important;
    border: 1px solid #fde68a !important;
}
html[data-theme="light"] .badge.bg-info-subtle {
    background-color: #e0f2fe !important;
    color: #0369a1 !important;
    border: 1px solid #bae6fd !important;
}
html[data-theme="light"] .badge.bg-success-subtle {
    background-color: #d1fae5 !important;
    color: #065f46 !important;
    border: 1px solid #a7f3d0 !important;
}
html[data-theme="light"] .badge.bg-danger-subtle {
    background-color: #fee2e2 !important;
    color: #991b1b !important;
    border: 1px solid #fecaca !important;
}
html[data-theme="light"] .badge.bg-primary-subtle {
    background-color: #dbeafe !important;
    color: #1e40af !important;
    border: 1px solid #bfdbfe !important;
}
html[data-theme="light"] .badge.bg-secondary-subtle {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #e2e8f0 !important;
}

/* Stat card content text contrast protection */
.stat-card .stat-card-value {
    color: #ffffff !important;
}
.stat-card .stat-card-label {
    color: rgba(255, 255, 255, 0.85) !important;
}
.stat-card .stat-card-sub {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* Button Light & Outline Secondary Themes */
html[data-theme="dark"] .btn-light {
    background-color: var(--bg-elevated) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-medium) !important;
}
html[data-theme="dark"] .btn-light:hover {
    background-color: var(--bg-card-hover) !important;
    color: #ffffff !important;
    border-color: var(--brand-primary) !important;
}
html[data-theme="dark"] .btn-outline-secondary {
    color: var(--text-secondary) !important;
    border-color: var(--border-medium) !important;
}
html[data-theme="dark"] .btn-outline-secondary:hover {
    background-color: var(--bg-elevated) !important;
    color: #ffffff !important;
    border-color: var(--brand-primary) !important;
}

/* ============================================================
   ALERT SYSTEM (ENTERPRISE THEME HARMONIZATION)
   ============================================================ */
.alert {
    border-radius: var(--radius-lg) !important;
    border: 1px solid var(--border-subtle) !important;
    font-size: 0.95rem;
}

/* Light Theme Alerts */
html[data-theme="light"] .alert-warning {
    background-color: #fffbeb !important;
    border-color: #fde68a !important;
    border-left: 4px solid #f59e0b !important;
    color: #92400e !important;
}
html[data-theme="light"] .alert-warning strong,
html[data-theme="light"] .alert-warning h5,
html[data-theme="light"] .alert-warning h6 {
    color: #78350f !important;
}
html[data-theme="light"] .alert-warning .text-muted {
    color: #b45309 !important;
}

html[data-theme="light"] .alert-info {
    background-color: #f0f9ff !important;
    border-color: #bae6fd !important;
    border-left: 4px solid #0284c7 !important;
    color: #0369a1 !important;
}
html[data-theme="light"] .alert-info strong,
html[data-theme="light"] .alert-info h5,
html[data-theme="light"] .alert-info h6 {
    color: #0c4a6e !important;
}
html[data-theme="light"] .alert-info .text-muted {
    color: #0284c7 !important;
}

html[data-theme="light"] .alert-success {
    background-color: #f0fdf4 !important;
    border-color: #bbf7d0 !important;
    border-left: 4px solid #16a34a !important;
    color: #15803d !important;
}
html[data-theme="light"] .alert-success strong {
    color: #14532d !important;
}

html[data-theme="light"] .alert-danger {
    background-color: #fef2f2 !important;
    border-color: #fecaca !important;
    border-left: 4px solid #dc2626 !important;
    color: #b91c1c !important;
}
html[data-theme="light"] .alert-danger strong {
    color: #7f1d1d !important;
}

/* Dark Theme Alerts */
html[data-theme="dark"] .alert-warning {
    background-color: rgba(245, 158, 11, 0.16) !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
    border-left: 4px solid #f59e0b !important;
    color: #fef08a !important;
}
html[data-theme="dark"] .alert-warning strong,
html[data-theme="dark"] .alert-warning h5,
html[data-theme="dark"] .alert-warning h6 {
    color: #ffffff !important;
}
html[data-theme="dark"] .alert-warning .text-muted {
    color: #fde047 !important;
}

html[data-theme="dark"] .alert-info {
    background-color: rgba(14, 165, 233, 0.16) !important;
    border-color: rgba(14, 165, 233, 0.35) !important;
    border-left: 4px solid #0ea5e9 !important;
    color: #bae6fd !important;
}
html[data-theme="dark"] .alert-info strong,
html[data-theme="dark"] .alert-info h5,
html[data-theme="dark"] .alert-info h6 {
    color: #ffffff !important;
}
html[data-theme="dark"] .alert-info .text-muted {
    color: #7dd3fc !important;
}

html[data-theme="dark"] .alert-success {
    background-color: rgba(16, 185, 129, 0.16) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
    border-left: 4px solid #10b981 !important;
    color: #bbf7d0 !important;
}
html[data-theme="dark"] .alert-success strong {
    color: #ffffff !important;
}

html[data-theme="dark"] .alert-danger {
    background-color: rgba(239, 68, 68, 0.18) !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
    border-left: 4px solid #ef4444 !important;
    color: #fecaca !important;
}
html[data-theme="dark"] .alert-danger strong {
    color: #ffffff !important;
}

/* ============================================================
   MOBILE & TABLET RESPONSIVE REFINEMENTS (OUT-OF-POSITION FIXES)
   ============================================================ */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
}

.main-wrapper {
    box-sizing: border-box !important;
    max-width: 100vw !important;
}

.card, .glass-card {
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden;
}

.timeline-scroll-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .main-wrapper {
        padding: 1rem 0.75rem 3rem !important;
        overflow-x: hidden !important;
    }
    .container-fluid.px-0 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    .row {
        margin-left: -0.5rem !important;
        margin-right: -0.5rem !important;
    }
    .row > * {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    .action-button-group {
        width: 100% !important;
        justify-content: stretch !important;
    }
    .action-button-group .btn,
    .btn-action-mobile {
        width: 100% !important;
        min-width: 0 !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

@media (max-width: 575.98px) {
    .page-heading {
        font-size: 1.25rem !important;
    }
    .top-navbar {
        padding: 0.75rem 1rem !important;
    }
    .card, .glass-card {
        padding: 1.1rem !important;
    }
    .stat-card.p-4 {
        padding: 1rem !important;
    }
    .main-wrapper {
        padding: 0.75rem 0.5rem 3rem !important;
    }
    .container-fluid.px-0 {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }
    .row {
        margin-left: -0.25rem !important;
        margin-right: -0.25rem !important;
    }
    .row > * {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }
    .badge {
        white-space: normal !important;
        text-align: center;
        max-width: 100%;
        line-height: 1.35;
    }
}

/* ========================================================
   MODERN THEMED PAGINATION (BOOTSTRAP 5)
   ======================================================== */
.pagination {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.page-item .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 10px !important;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.page-item .page-link:hover {
    color: var(--brand-primary);
    background: var(--bg-card-hover, rgba(59, 130, 246, 0.08));
    border-color: var(--brand-primary);
    transform: translateY(-1px);
}

.page-item.active .page-link {
    color: #ffffff !important;
    background: linear-gradient(135deg, #0f4c9e 0%, #1a6ddc 100%) !important;
    border-color: transparent !important;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(15, 76, 158, 0.35) !important;
}

.page-item.disabled .page-link {
    color: var(--text-muted) !important;
    background: var(--bg-body) !important;
    border-color: var(--border-subtle) !important;
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}
