:root {
    /* Color Palette - Light Mode (Brand HSL) */
    --primary: 192 100% 40%;
    /* Brand Cyan */
    --primary-hover: 192 100% 32%;
    --primary-light: 192 100% 95%;

    --background: 210 40% 98%;
    --surface: 0 0% 100%;

    --text-primary: 222 47% 11%;
    --text-secondary: 215 16% 47%;

    --border: 214 32% 91%;

    /* Semantic Colors */
    --success: 142 71% 45%;
    --success-bg: 142 71% 95%;
    --warning: 45 100% 47%;
    /* Brand Yellow for warning/accents */
    --warning-bg: 45 100% 95%;
    --danger: 348 83% 47%;
    --danger-bg: 348 83% 95%;

    /* Geometry & Effects */
    --radius-soft: 12px;
    --radius-full: 9999px;
    --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --premium-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass-bg: hsla(0, 0%, 100%, 0.7);
    --glass-border: hsla(0, 0%, 100%, 0.3);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --primary: 192 100% 45%;
    --primary-hover: 192 100% 55%;
    --primary-light: 192 40% 15%;

    --background: 222 47% 7%;
    --surface: 222 47% 11%;

    --text-primary: 0 0% 98%;
    --text-secondary: 215 20% 65%;

    --border: 217 32% 17%;

    --success-bg: 142 71% 15%;
    --warning-bg: 45 100% 15%;
    --danger-bg: 348 83% 15%;

    --premium-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    --glass-bg: hsla(222, 47%, 11%, 0.7);
    --glass-border: hsla(222, 47%, 17%, 0.3);
}

/* Reset & Base Setting */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--text-primary));
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Layout */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: hsl(var(--surface));
    border-right: 1px solid hsl(var(--border));
    display: flex;
    flex-direction: column;
    transition: var(--transition-smooth);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid hsl(var(--border));
    background: linear-gradient(180deg, hsl(var(--background)) 0%, transparent 100%);
}

.logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    /* Increased gap */
    margin-bottom: 36px;
    padding: 12px 0;
}

.logo-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.logo-img {
    width: 72px;
    /* Increased from 56px */
    height: 72px;
    /* Increased from 56px */
    object-fit: cover;
    border-radius: 18px;
    /* Slightly more rounded */
    box-shadow: 0 12px 30px -5px hsl(var(--primary) / 0.5), 0 0 0 2px hsl(var(--primary) / 0.1);
    /* Stronger shadow + outer ring */
    border: 3px solid white;
    transition: var(--transition-smooth);
    background: white;
}

.logo-img:hover {
    transform: translateY(-6px) scale(1.08);
    /* More pronounced hover */
    box-shadow: 0 25px 40px -10px hsl(var(--primary) / 0.6), 0 0 20px hsl(var(--primary) / 0.3);
    /* Add glow on hover */
}

.logo h2 {
    font-size: 1.75rem;
    /* Slightly larger */
    font-weight: 900;
    /* Uniform bold weight */
    letter-spacing: -1.2px;
    line-height: 1;
    /* Apply uniform gradient to whole name */
    background: linear-gradient(135deg, hsl(192, 100%, 40%) 0%, hsl(192, 100%, 25%) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .logo h2 {
    background: linear-gradient(135deg, hsl(192, 100%, 65%) 0%, hsl(192, 100%, 45%) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Remove unique b styling as we want uniform gradient */
.logo h2 b {
    font-weight: inherit;
    background: none;
    -webkit-text-fill-color: inherit;
}

.logo-slogan {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    color: hsl(var(--text-secondary));
    opacity: 0.7;
    margin-top: 4px;
    text-align: center;
    width: 100%;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: hsl(var(--background));
    border-radius: var(--radius-soft);
    border: 1px solid hsl(var(--border));
    box-shadow: inset 0 2px 4px 0 rgb(255 255 255 / 0.5), var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .user-profile {
    box-shadow: inset 0 1px 1px 0 rgb(255 255 255 / 0.05), var(--shadow-soft);
}

.user-profile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, hsl(var(--primary)), hsl(45, 100%, 47%));
    border-radius: 4px 0 0 4px;
}

/* Notifications */
.notification-wrapper {
    position: relative;
    display: inline-flex;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: hsl(var(--danger));
    color: white;
    font-size: 0.70rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid hsl(var(--surface));
    transform: translate(30%, -30%);
    box-shadow: 0 2px 4px hsl(var(--danger) / 0.3);
}

.notification-badge.hidden {
    display: none;
}

.avatar {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border-radius: 12px;
    /* Smoother squircle look instead of full circle */
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--warning)));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 10px hsl(var(--primary) / 0.25);
}

.user-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.name {
    font-weight: 700;
    font-size: 0.95rem;
    color: hsl(var(--text-primary));
    line-height: 1.2;
    margin-bottom: 2px;
    /* Allow name to wrap instead of being truncated */
    white-space: normal;
    word-break: break-word;
}

.role {
    font-size: 0.8rem;
    font-weight: 500;
    color: hsl(var(--text-secondary));
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: hsl(var(--text-secondary));
    border-radius: var(--radius-soft);
    font-weight: 500;
    transition: var(--transition-smooth);
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    font-family: inherit;
}

.nav-item i {
    width: 20px;
    height: 20px;
}

.nav-item:hover {
    background-color: hsl(var(--primary-light));
    color: hsl(var(--primary));
}

.nav-item.active {
    background-color: hsl(var(--primary-light));
    color: hsl(var(--primary));
    font-weight: 600;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid hsl(var(--border));
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: 72px;
    background-color: hsl(var(--surface));
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.breadcrumb {
    font-size: 1.25rem;
    font-weight: 600;
    color: hsl(var(--text-primary));
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.date-widget {
    font-size: 0.9rem;
    color: hsl(var(--text-secondary));
    font-weight: 500;
    background: hsl(var(--background));
    padding: 8px 16px;
    border-radius: var(--radius-full);
}

.icon-btn {
    background: transparent;
    border: none;
    color: hsl(var(--text-secondary));
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-full);
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: hsl(var(--background));
    color: hsl(var(--primary));
}

.mobile-menu-toggle {
    display: none;
}

/* View Container */
.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    scroll-behavior: smooth;
}

/* Common UI Components */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-soft);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
    font-family: inherit;
    text-decoration: none;
}

.btn i {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: hsl(var(--primary));
    color: white;
}

.btn-primary:hover {
    background: hsl(var(--primary-hover));
    box-shadow: 0 4px 12px hsl(var(--primary) / 0.2);
}

.btn-outline {
    background: transparent;
    border-color: hsl(var(--border));
    color: hsl(var(--text-primary));
}

.btn-outline:hover {
    background: hsl(var(--background));
    border-color: hsl(var(--text-secondary));
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.card {
    background: hsl(var(--surface));
    border-radius: var(--radius-soft);
    border: 1px solid hsl(var(--border));
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.view-header {
    margin-bottom: 24px;
}

.view-header h1 {
    font-size: 1.75rem;
    margin-bottom: 8px;
}

.view-header p {
    color: hsl(var(--text-secondary));
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 20px;
    border-bottom: 1px solid hsl(var(--border));
    text-align: left;
}

.data-table th {
    background: hsl(var(--background));
    font-size: 0.8rem;
    font-weight: 600;
    color: hsl(var(--text-secondary));
    text-transform: uppercase;
}

.data-table tr:hover td {
    background-color: hsl(var(--surface));
}

.form-group {
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-soft);
    font-family: inherit;
    font-size: 0.95rem;
    background-color: hsl(var(--background));
    color: hsl(var(--text-primary));
    transition: var(--transition-smooth);
    display: block;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

[data-theme="dark"] select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
}

.form-control:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary-light));
}

.flex-between {
    display: flex;
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

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

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

::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--text-secondary));
}

/* WhatsApp Floating Button */
.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: #25D366;
    color: white;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
    transition: var(--transition-smooth);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .app-layout {
        flex-direction: column;
        position: relative;
    }

    /* Off-Canvas Sidebar for Tableth & Mobile */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        /* Fallback */
        height: 100dvh;
        z-index: 2000;
        box-shadow: var(--shadow-hover);
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid hsl(var(--border));
        border-bottom: none;
        flex-direction: column;
        padding: 0;
        /* Padding for iOS home bar/Safari toolbar */
        padding-bottom: env(safe-area-inset-bottom, 20px);
        overflow-x: hidden;
        background-color: hsl(var(--surface));
    }

    .sidebar.open {
        left: 0;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        /* Fallback */
        height: 100dvh;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        z-index: 1999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        position: fixed;
        opacity: 1;
        pointer-events: all;
    }

    /* Top Bar Tablet Improvements */
    .top-bar {
        height: 64px;
        padding: 0 20px;
    }

    .date-widget {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .breadcrumb {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    /* Rules for small mobile */

    /* Handled by 1200px query */

    .sidebar-header {
        border-bottom: 1px solid hsl(var(--border));
        padding: 24px 20px;
        display: block;
    }

    .logo {
        margin-bottom: 24px;
    }

    .logo h2,
    .user-profile {
        display: flex;
    }

    .sidebar-nav {
        flex-direction: column;
        padding: 24px 16px;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .nav-item {
        padding: 12px 16px;
        white-space: normal;
        justify-content: flex-start;
    }

    .nav-item span {
        display: inline;
    }

    .sidebar-footer {
        border-top: 1px solid hsl(var(--border));
        padding: 16px;
    }

    .sidebar-footer span {
        display: inline;
    }

    /* Top Bar Mobile */
    .top-bar {
        padding: 0 16px;
        height: 60px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .mobile-menu-toggle {
        display: flex !important;
        margin-right: -4px;
    }

    .top-bar-actions {
        gap: 8px;
    }

    .breadcrumb {
        font-size: 1rem;
        font-weight: 700;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .date-widget {
        display: none !important;
    }

    .whatsapp-float {
        bottom: 90px;
        /* Elevated on mobile to not block footer buttons */
        right: 16px;
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .view-container {
        padding: 12px;
    }

@media (max-width: 380px) {
    .view-container {
        padding: 8px;
    }
}

    /* Handled by 1200px query */

    /* View Specific overrides */
    .view-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 16px;
    }

    .attendance-actions {
        width: 100%;
        justify-content: space-between;
        flex-direction: column;
        gap: 12px;
    }

    .attendance-actions>* {
        width: 100%;
    }

    .btn {
        padding: 12px 16px;
        font-size: 0.95rem;
        text-align: center;
        justify-content: center;
    }

    .dashboard-content {
        grid-template-columns: 1fr !important;
    }

    .form-group.row {
        flex-direction: column;
        gap: 16px;
    }

    .tabs-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    /* Improved Modal Responsiveness */
    .modal-content {
        width: 95% !important;
        margin: 10px !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    .form-header h3 {
        font-size: 1.1rem;
    }

    /* Table adjustments */
    .data-table th,
    .data-table td {
        padding: 12px 14px;
        font-size: 0.85rem;
    }

    .icon-btn-refined {
        width: 38px;
        height: 38px;
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

/* --- Login Styles --- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #ffffff;
    /* White base */
    padding: 24px;
    position: relative;
    overflow: hidden;
}

/* Antigravity Dynamic Background */
.ag-background {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    background-color: #ffffff;
}

.ag-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(to right, hsla(var(--primary) / 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, hsla(var(--primary) / 0.06) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 10%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, black 10%, transparent 80%);
}

/* Base Mesh Gradient Effect */
.ag-background::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(at 0% 0%, hsla(192, 100%, 50%, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(45, 100%, 50%, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, hsla(192, 100%, 50%, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(45, 100%, 50%, 0.1) 0px, transparent 50%);
    filter: blur(40px);
    opacity: 0.4;
}

.ag-noise {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0.015;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.ag-blob {
    position: absolute;
    filter: blur(100px);
    border-radius: 50%;
    opacity: 0.5;
    mix-blend-mode: multiply;
}

[data-theme="dark"] .ag-blob {
    mix-blend-mode: plus-lighter;
    opacity: 0.4;
}

.ag-blob-1 {
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, hsla(192, 100%, 45%, 0.4) 0%, transparent 70%);
    top: -150px;
    left: -150px;
    animation: ag-float-1 30s infinite alternate ease-in-out;
}

.ag-blob-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, hsla(45, 100%, 50%, 0.4) 0%, transparent 70%);
    bottom: -200px;
    right: -150px;
    animation: ag-float-2 25s infinite alternate ease-in-out;
}

.ag-blob-3 {
    width: 650px;
    height: 650px;
    background: radial-gradient(circle, hsla(192, 100%, 60%, 0.3) 0%, transparent 70%);
    top: 50%;
    left: 40%;
    transform: translate(-50%, -50%);
    animation: ag-float-3 35s infinite alternate ease-in-out;
}

.ag-blob-4 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, hsla(30, 100%, 60%, 0.3) 0%, transparent 70%);
    top: 20%;
    right: 20%;
    animation: ag-float-4 40s infinite alternate ease-in-out;
}

.ag-blob-5 {
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, hsla(180, 100%, 40%, 0.3) 0%, transparent 70%);
    bottom: 20%;
    left: 20%;
    animation: ag-float-5 45s infinite alternate ease-in-out;
}

@keyframes ag-float-4 {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    50% { transform: translate(-15vw, 20vh) scale(1.1) rotate(60deg); }
    100% { transform: translate(10vw, -10vh) scale(0.9) rotate(120deg); }
}

@keyframes ag-float-5 {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20vw, -15vh) scale(1.2); }
    100% { transform: translate(-10vw, 25vh) scale(1); }
}

@keyframes ag-float-1 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(30vw, 20vh) scale(1.1);
    }

    66% {
        transform: translate(10vw, 40vh) scale(0.9);
    }

    100% {
        transform: translate(-10vw, 10vh) scale(1.05);
    }
}

@keyframes ag-float-2 {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(-25vw, -30vh) scale(1.15);
    }

    66% {
        transform: translate(-40vw, 10vh) scale(0.85);
    }

    100% {
        transform: translate(-10vw, -10vh) scale(1.05);
    }
}

@keyframes ag-float-3 {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

    33% {
        transform: translate(calc(-50% + 20vw), calc(-50% - 30vh)) scale(1.2);
    }

    66% {
        transform: translate(calc(-50% - 20vw), calc(-50% - 40vh)) scale(0.8);
    }

    100% {
        transform: translate(calc(-50% + 10vw), calc(-50% + 20vh)) scale(1.1);
    }
}

.login-card {
    position: relative;
    z-index: 10;
    background: hsla(var(--surface) / 0.85);
    /* Adaptive surface surface */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 48px;
    border-radius: 28px;
    box-shadow:
        0 25px 80px -20px rgba(0, 0, 0, 0.15),
        var(--premium-shadow);
    width: 100%;
    max-width: 460px;
    border: 1px solid hsla(var(--border) / 0.8);
}

[data-theme="dark"] .login-card {
    background: hsla(var(--surface) / 0.8);
    border-color: hsla(var(--border) / 1);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: rgba(79, 70, 229, 0.1);
    /* Soft indigo background */
    color: #4f46e5;
    /* Indigo icon */
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    border: 1px solid rgba(79, 70, 229, 0.2);
}

.login-logo i {
    width: 32px;
    height: 32px;
}

.login-header h2 {
    font-size: 1.75rem;
    color: hsl(var(--text-primary));
    margin-bottom: 8px;
    font-weight: 700;
}

.login-header p {
    color: hsl(var(--text-secondary));
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: hsl(var(--text-secondary));
    font-size: 0.95rem;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon i.input-icon-left,
.input-with-icon>svg:first-child,
.input-with-icon>i:first-child {
    position: absolute;
    left: 16px;
    color: #9ca3af;
    width: 20px;
    height: 20px;
    transition: color 0.3s ease;
    z-index: 2;
}

.input-with-icon input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 1px solid hsl(var(--border) / 0.5);
    border-radius: var(--radius-soft);
    font-family: inherit;
    font-size: 1rem;
    background: hsl(var(--background) / 0.7);
    color: hsl(var(--text-primary));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.01);
}

.input-with-icon input::placeholder {
    color: hsl(var(--text-secondary) / 0.6);
}

.input-with-icon input:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow:
        inset 0 2px 4px 0 rgba(0, 0, 0, 0.01),
        0 0 0 4px hsl(var(--primary) / 0.15);
    background: #ffffff;
    transform: translateY(-1px);
}

.input-with-icon input:focus~i.input-icon-left,
.input-with-icon input:focus~svg:first-child,
.input-with-icon input:focus~i:first-child {
    color: hsl(var(--primary));
}

.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    outline: none;
    z-index: 2;
}

.password-toggle-btn:hover {
    color: hsl(var(--primary));
    background: rgba(0, 0, 0, 0.03);
}

.password-toggle-btn:focus-visible {
    box-shadow: 0 0 0 2px hsl(var(--primary) / 0.3);
}

.password-toggle-btn i {
    width: 18px;
    height: 18px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    border-radius: var(--radius-soft);
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--warning)));
    color: white;
    border: none;
    box-shadow: 0 4px 15px hsl(var(--primary) / 0.3);
    transition: all 0.3s ease;
}

.login-btn:hover {
    box-shadow: 0 6px 20px hsl(var(--primary) / 0.5);
    transform: translateY(-1px);
}

.login-error {
    background: hsl(var(--danger-bg));
    color: hsl(var(--danger));
    border: 1px solid hsl(var(--danger) / 0.2);
    padding: 12px;
    border-radius: var(--radius-soft);
    font-size: 0.9rem;
    text-align: center;
    font-weight: 500;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    color: hsl(var(--text-secondary));
}

.login-footer p {
    margin-bottom: 8px;
    font-weight: 500;
}

.login-footer small {
    display: block;
    line-height: 1.6;
}

.forgot-password-link {
    color: hsl(var(--primary));
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

.forgot-password-link:hover {
    color: hsl(var(--primary-hover));
    text-decoration: underline;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

/* --- Dashboard Stats Elements --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card {
    background: hsl(var(--surface));
    border-radius: var(--radius-soft);
    border: 1px solid hsl(var(--border));
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-soft);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    width: 32px;
    height: 32px;
}

.stat-info h3 {
    font-size: 0.95rem;
    color: hsl(var(--text-secondary));
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: hsl(var(--text-primary));
}

.text-success {
    color: hsl(var(--success));
}

.text-danger {
    color: hsl(var(--danger));
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-active {
    background-color: hsl(var(--success));
}

.status-inactive {
    background-color: hsl(var(--danger));
}

/* --- Modal Components --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: hsl(var(--surface));
    border-radius: var(--radius-soft);
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    animation: fadeIn 0.2s ease-out;
}

.form-header {
    padding: 20px 24px;
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.form-body {
    padding: 24px;
}

/* --- Notification Dropdown --- */
.notification-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 360px;
    background: hsl(var(--surface));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius-soft);
    box-shadow: var(--shadow-hover);
    z-index: 1000;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.notif-header {
    padding: 16px 20px;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--background));
}

.notif-header h3 {
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

#markAllReadBtn:hover {
    background: hsl(var(--primary-light)) !important;
}

.notif-list {
    max-height: 480px;
    overflow-y: auto;
}

.notif-empty {
    padding: 40px 20px;
    text-align: center;
    color: hsl(var(--text-secondary));
    font-size: 0.9rem;
}

.notif-item {
    padding: 16px 20px;
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    gap: 12px;
    transition: background 0.2s;
    cursor: default;
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item.unread {
    background: hsl(var(--primary-light), 0.3);
}

.notif-item:hover {
    background: hsl(var(--background));
}

.notif-item.is-read {
    opacity: 0.8;
}

@media (max-width: 768px) {
    .notification-dropdown {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
    }
}

/* --- Premium Notifications (Toasts) --- */
.premium-toast {
    background: hsla(220, 20%, 98%, 0.85); /* Fallback surface */
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(0,0,0,0.1);
    padding: 14px 20px;
    border-radius: 18px;
    box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 280px;
    max-width: 420px;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto;
    z-index: 10000;
}

[data-theme="dark"] .premium-toast {
    background: hsla(220, 10%, 15%, 0.85);
    border-color: rgba(255,255,255,0.1);
}

.premium-toast.hide {
    animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-success .toast-icon { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.toast-error .toast-icon { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.toast-warning .toast-icon { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.toast-info .toast-icon { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }

.toast-content p {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

@keyframes toastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
    to { transform: translateX(120%); opacity: 0; }
}

/* --- Premium Confirm Modal --- */
.premium-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    padding: 24px;
}

.premium-confirm-modal {
    max-width: 420px;
    width: 100%;
    background: hsl(var(--surface));
    border-radius: 32px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
    border: 1px solid hsl(var(--primary) / 0.15);
}

[data-theme="dark"] .premium-confirm-modal {
    background: #1e1e1e;
    border-color: rgba(255,255,255,0.05);
}

.confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.confirm-icon i { width: 32px; height: 32px; }

.confirm-icon.icon-danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.confirm-icon.icon-warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.confirm-icon.icon-primary { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }

.confirm-body h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.confirm-body p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 32px;
}

.confirm-footer {
    display: flex;
    gap: 12px;
}

.confirm-footer button {
    flex: 1;
    height: 46px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.confirm-footer .btn-outline {
    background: hsl(var(--primary) / 0.05);
    border: 1.5px solid hsl(var(--primary) / 0.2);
    color: hsl(var(--text-primary));
}

.confirm-footer .btn-outline:hover {
    background: hsl(var(--primary) / 0.1);
    border-color: hsl(var(--primary) / 0.4);
}

.fade-in { animation: fadeInConfirm 0.25s ease-out forwards; }
.fade-out { animation: fadeOutConfirm 0.2s ease-in forwards; }

@keyframes fadeInConfirm {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes fadeOutConfirm {
    to { transform: scale(1.05); opacity: 0; }
}