:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --accent: #7c3aed;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f1f5f9;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 40px rgba(79, 70, 229, 0.12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* App shell */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.125rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.sidebar-brand-text strong {
    display: block;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem 0.375rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 0.125rem;
    transition: all 0.15s ease;
}

.nav-link:hover {
    background: var(--surface-2);
    color: var(--text);
}

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

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 0.9375rem;
    opacity: 0.85;
}

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

.user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-info strong {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.user-info span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    height: var(--topbar-h);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    font-size: 1.125rem;
    color: var(--text);
}

.content {
    flex: 1;
    padding: 1.75rem 1.5rem 3rem;
    max-width: 1200px;
    width: 100%;
}

/* Page header */
.page-header {
    margin-bottom: 1.75rem;
}

.page-header h1 {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.section-header {
    margin: 2rem 0 1rem;
}

.section-header h2 {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Alerts */
.alert {
    border-radius: var(--radius);
    padding: 0.875rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background: var(--danger-bg);
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-success {
    background: var(--success-bg);
    border: 1px solid #a7f3d0;
    color: var(--success);
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.hero-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    color: #fff;
    margin-bottom: 1.75rem;
    position: relative;
    overflow: hidden;
    border: none;
    box-shadow: var(--shadow-lg);
}

.hero-banner::after {
    content: '';
    position: absolute;
    width: 280px;
    height: 280px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
    top: -120px;
    right: -60px;
}

.hero-banner-greeting {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.375rem;
    position: relative;
}

.hero-banner-name {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    position: relative;
}

/* Grid */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
}

.list-card:hover {
    border-color: #c7d2fe;
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px) scale(1.01);
}

.list-card-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    margin-bottom: 0.875rem;
}

.list-card h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.list-card p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.list-card-arrow {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--primary);
    font-weight: 500;
}

/* Progress */
.progress-card .progress-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.progress-card .student-name {
    font-size: 0.9375rem;
    font-weight: 600;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.progress-bar {
    height: 8px;
    background: var(--surface-2);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 99px;
    transform-origin: left center;
    animation: progressGrow 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes progressGrow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }

/* Buttons */
.btn, .btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5625rem 1.125rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    color: #fff;
}

.btn-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--surface-2);
    color: var(--text);
}

.btn-danger {
    background: var(--danger-bg);
    border-color: #fecaca;
    color: var(--danger);
}

.btn-danger:hover { background: #fee2e2; }

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    font-weight: 500;
    padding: 0;
}

.btn-link:hover { color: var(--primary-dark); text-decoration: underline; }

.btn-logout {
    width: 100%;
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.btn-logout:hover { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }

.actions { display: flex; gap: 0.625rem; flex-wrap: wrap; }

/* Forms */
.form-group { margin-bottom: 1.125rem; }

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9375rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-group input.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.error-msg { color: var(--danger); font-size: 0.8125rem; margin-top: 0.25rem; }

/* Table */
.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.data-table thead th:first-child { border-radius: 10px 0 0 0; }
.data-table thead th:last-child { border-radius: 0 10px 0 0; }

.data-table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:hover { background: #fafbff; }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-link {
    color: var(--primary);
    font-weight: 500;
    font-size: 0.8125rem;
}

.table-link:hover { text-decoration: underline; }

/* Empty state */
.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state p { font-size: 0.9375rem; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 1.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

.back-link:hover { color: var(--primary); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 90;
}

/* Auth layout */
.auth-body {
    min-height: 100vh;
    display: flex;
    background: var(--bg);
}

.auth-panel {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 2rem;
}

.auth-brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.auth-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.auth-brand p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.auth-heading {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.375rem;
}

.auth-subheading {
    font-size: 0.9375rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

.auth-hero {
    flex: 1;
    background: linear-gradient(145deg, #312e81 0%, var(--primary) 40%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.auth-hero-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.auth-hero-content h2 {
    font-size: 2.125rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}

.auth-hero-content > p {
    font-size: 1rem;
    opacity: 0.88;
    line-height: 1.65;
}

.auth-features {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    font-size: 0.9375rem;
}

.auth-feature-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    flex-shrink: 0;
}

.auth-checkbox-row {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    cursor: pointer;
}

.auth-checkbox-label input { accent-color: var(--primary); }

.btn-auth {
    width: 100%;
    padding: 0.8125rem;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
    transition: all 0.15s ease;
}

.btn-auth:hover { opacity: 0.95; transform: translateY(-1px); }

@media (max-width: 768px) {
    .sidebar,
    .sidebar-overlay,
    .topbar.desktop-only,
    .menu-toggle { display: none !important; }

    .app-body {
        background: #eef2ff;
        -webkit-tap-highlight-color: transparent;
        overscroll-behavior: none;
    }

    .app-main {
        margin-left: 0;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
    }

    .mobile-app-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: calc(0.75rem + env(safe-area-inset-top, 0px)) 1rem 0.75rem;
        background: rgba(255, 255, 255, 0.88);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-bottom: 1px solid rgba(226, 232, 240, 0.8);
        position: sticky;
        top: 0;
        z-index: 50;
    }

    .mobile-app-header-left {
        display: flex;
        align-items: center;
        gap: 0.625rem;
        min-width: 0;
    }

    .mobile-app-logo {
        width: 38px;
        height: 38px;
        border-radius: 11px;
        background: linear-gradient(135deg, var(--primary), var(--accent));
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 1rem;
        flex-shrink: 0;
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    }

    .mobile-app-title {
        display: block;
        font-size: 0.9375rem;
        font-weight: 700;
        line-height: 1.2;
        color: var(--text);
    }

    .mobile-app-subtitle {
        display: block;
        font-size: 0.75rem;
        color: var(--text-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    .mobile-app-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--primary), var(--accent));
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.8125rem;
        font-weight: 700;
        text-decoration: none;
        flex-shrink: 0;
        box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
    }

    .content {
        flex: 1;
        padding: 1rem 1rem calc(5.5rem + env(safe-area-inset-bottom, 0px));
        max-width: none;
    }

    .page-header h1 { font-size: 1.375rem; }
    .page-header { margin-bottom: 1.25rem; }

    .hero-banner {
        border-radius: 20px;
        padding: 1.5rem;
        margin-bottom: 1.25rem;
    }

    .hero-banner-name { font-size: 1.5rem; }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .list-card {
        border-radius: 16px;
        padding: 1rem 1.125rem;
        display: grid;
        grid-template-columns: 44px 1fr auto;
        grid-template-rows: auto auto;
        align-items: center;
        column-gap: 0.875rem;
        row-gap: 0.125rem;
    }

    .list-card-icon {
        margin-bottom: 0;
        grid-row: 1 / 3;
        grid-column: 1;
        width: 44px;
        height: 44px;
        font-size: 1.25rem;
    }

    .list-card h3 {
        font-size: 0.9375rem;
        grid-column: 2;
        grid-row: 1;
        align-self: end;
    }

    .list-card p {
        font-size: 0.8125rem;
        grid-column: 2;
        grid-row: 2;
        align-self: start;
    }

    .list-card-arrow {
        grid-row: 1 / 3;
        grid-column: 3;
        margin-top: 0;
        margin-left: 0;
        align-self: center;
    }

    .card {
        border-radius: 16px;
        padding: 1.125rem;
        border: none;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
    }

    .card[style*="padding: 0"] {
        border-radius: 16px;
        overflow: hidden;
    }

    .data-table thead { display: none; }

    .data-table tbody tr {
        display: block;
        padding: 1rem;
        margin-bottom: 0.625rem;
        background: var(--surface);
        border-radius: 14px;
        border: 1px solid var(--border);
        box-shadow: var(--shadow-sm);
    }

    .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.375rem 0;
        border: none;
        font-size: 0.875rem;
    }

    .data-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        margin-right: 1rem;
    }

    .data-table tbody td:last-child {
        justify-content: flex-end;
        padding-top: 0.625rem;
        margin-top: 0.375rem;
        border-top: 1px solid var(--border);
    }

    .data-table tbody td:last-child::before { display: none; }

    .btn {
        min-height: 44px;
        padding: 0.625rem 1.125rem;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn {
        width: 100%;
        justify-content: center;
    }

    .page-header-row {
        flex-direction: column;
        align-items: stretch;
    }

    .empty-state {
        border-radius: 20px;
        padding: 2.5rem 1.5rem;
    }

    .alert {
        border-radius: 14px;
        font-size: 0.8125rem;
    }

    .back-link {
        font-size: 0.8125rem;
        padding: 0.5rem 0;
    }
}

/* Bottom navigation — mobile app tab bar */
.mobile-app-header { display: none; }
.bottom-nav { display: none; }

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 200;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid rgba(226, 232, 240, 0.9);
        box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 0.625rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        transition: color 0.2s ease, transform 0.15s ease;
        -webkit-tap-highlight-color: transparent;
        position: relative;
    }

    .bottom-nav-item:active {
        transform: scale(0.92);
    }

    .bottom-nav-icon {
        font-size: 1.375rem;
        line-height: 1;
        transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    .bottom-nav-item.active {
        color: var(--primary);
    }

    .bottom-nav-item.active .bottom-nav-icon {
        transform: scale(1.15);
    }

    .bottom-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 32px;
        height: 3px;
        background: var(--primary);
        border-radius: 0 0 4px 4px;
    }

    .bottom-nav-label {
        text-transform: capitalize;
    }

    .touch-active.list-card {
        transform: scale(0.98);
        opacity: 0.9;
    }

    .touch-active.btn {
        transform: scale(0.97);
    }

    .touch-active.bottom-nav-item .bottom-nav-icon {
        transform: scale(1.05);
    }
}

@media (max-width: 900px) {
    .auth-hero { display: none; }

    .auth-body {
        background: linear-gradient(180deg, #eef2ff 0%, #f8fafc 40%, #fff 100%);
        min-height: 100dvh;
        padding-top: env(safe-area-inset-top, 0px);
    }

    .auth-panel {
        align-items: flex-start;
        padding: calc(1.5rem + env(safe-area-inset-top, 0px)) 1.25rem 2rem;
    }

    .auth-card {
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        border-radius: 24px;
        padding: 2rem 1.5rem;
        box-shadow: 0 8px 40px rgba(79, 70, 229, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.8);
    }

    .btn-auth {
        min-height: 50px;
        border-radius: 14px;
        font-size: 1rem;
    }

    .form-group input {
        min-height: 48px;
        border-radius: 12px;
        font-size: 16px;
    }
}

/* ─── Animations ─── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes pulseSoft {
    0%, 100% { box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35); }
    50% { box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5); }
}

.page-enter > * {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.page-enter > *:nth-child(1) { animation-delay: 0.05s; }
.page-enter > *:nth-child(2) { animation-delay: 0.1s; }
.page-enter > *:nth-child(3) { animation-delay: 0.15s; }
.page-enter > *:nth-child(4) { animation-delay: 0.2s; }
.page-enter > *:nth-child(5) { animation-delay: 0.25s; }

.sidebar-brand-icon {
    animation: pulseSoft 3s ease-in-out infinite;
}

.sidebar .nav-link {
    animation: slideInLeft 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: 0.15s;
}

.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link.active::before,
.nav-link:hover::before {
    transform: translateY(-50%) scaleY(1);
}

.hero-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 50%, #9333ea 100%);
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
}

.grid .list-card,
.grid .card,
.grid-2 .card,
.grid-3 .list-card {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.grid .list-card:nth-child(1), .grid-3 .list-card:nth-child(1) { animation-delay: 0.08s; }
.grid .list-card:nth-child(2), .grid-3 .list-card:nth-child(2) { animation-delay: 0.14s; }
.grid .list-card:nth-child(3), .grid-3 .list-card:nth-child(3) { animation-delay: 0.2s; }
.grid .list-card:nth-child(4), .grid-3 .list-card:nth-child(4) { animation-delay: 0.26s; }
.grid .list-card:nth-child(5), .grid-3 .list-card:nth-child(5) { animation-delay: 0.32s; }
.grid .list-card:nth-child(6), .grid-3 .list-card:nth-child(6) { animation-delay: 0.38s; }

.grid-2 .card:nth-child(1) { animation-delay: 0.1s; }
.grid-2 .card:nth-child(2) { animation-delay: 0.18s; }
.grid-2 .card:nth-child(3) { animation-delay: 0.26s; }

.list-card-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-card:hover .list-card-icon {
    transform: scale(1.1) rotate(-3deg);
}

.list-card-arrow {
    transition: transform 0.25s ease, opacity 0.25s ease;
    opacity: 0.7;
}

.list-card:hover .list-card-arrow {
    transform: translateX(4px);
    opacity: 1;
}

.btn-primary {
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.btn-primary:hover::after {
    transform: translateX(100%);
}

.btn, .btn-auth {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:active, .btn-auth:active {
    transform: scale(0.97);
}

.alert {
    animation: fadeInDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card {
    animation: scaleIn 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow);
}

.data-table tbody tr {
    animation: fadeInUp 0.4s ease both;
}

.data-table tbody tr:nth-child(1) { animation-delay: 0.04s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.08s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.12s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.16s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.2s; }
.data-table tbody tr:nth-child(6) { animation-delay: 0.24s; }
.data-table tbody tr:nth-child(7) { animation-delay: 0.28s; }
.data-table tbody tr:nth-child(8) { animation-delay: 0.32s; }

.data-table tbody tr {
    transition: background 0.2s ease, transform 0.2s ease;
}

.topbar {
    animation: fadeInDown 0.4s ease;
}

.auth-card {
    animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-brand-icon {
    animation: float 4s ease-in-out infinite;
}

.auth-hero-content {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-feature {
    animation: fadeInUp 0.5s ease both;
}

.auth-feature:nth-child(1) { animation-delay: 0.3s; }
.auth-feature:nth-child(2) { animation-delay: 0.45s; }
.auth-feature:nth-child(3) { animation-delay: 0.6s; }

.form-group input,
.form-group select,
.form-group textarea {
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    transform: translateY(-1px);
}

.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.empty-state-icon {
    animation: float 3s ease-in-out infinite;
}

.user-avatar {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.user-card:hover .user-avatar {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.sidebar-overlay {
    transition: opacity 0.3s ease;
}

/* Folder view (documents) */
.folder-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.folder-breadcrumb-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.folder-breadcrumb-link:hover {
    text-decoration: underline;
}

.folder-breadcrumb-sep {
    opacity: 0.5;
}

.folder-breadcrumb-current {
    color: var(--text);
    font-weight: 600;
}

.folder-view {
    animation: fadeInUp 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.folder-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.folder-toolbar-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.folder-toolbar-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(145deg, #fde68a, #fbbf24);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.folder-toolbar h1 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.125rem;
}

.folder-toolbar p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.folder-back-btn,
.btn-sm {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-height: 220px;
}

.folder-item-form {
    margin: 0;
    min-width: 0;
}

.folder-item {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    border-radius: 14px;
    padding: 1rem 0.75rem 0.875rem;
    cursor: pointer;
    text-align: center;
    color: inherit;
    font: inherit;
    appearance: none;
    -webkit-appearance: none;
    display: block;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.folder-item:hover,
.folder-item:focus-visible {
    background: var(--primary-light);
    border-color: #c7d2fe;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.12);
    outline: none;
}

.folder-item-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.folder-item-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.folder-item-icon-pdf {
    background: linear-gradient(160deg, #fee2e2 0%, #fecaca 100%);
    border-radius: 12px 12px 4px 12px;
    box-shadow: 0 4px 0 #f87171, 0 8px 16px rgba(239, 68, 68, 0.18);
    position: relative;
}

.folder-item-icon-pdf span {
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #b91c1c;
}

.folder-item-icon-file {
    background: var(--primary-light);
    border-radius: 12px;
    font-size: 1.75rem;
}

.folder-item-name {
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.folder-item-meta {
    margin-top: 0.375rem;
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.folder-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.folder-empty-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.folder-empty h3 {
    font-size: 1rem;
    margin-bottom: 0.375rem;
}

.folder-empty p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.folder-grid .folder-item-form:nth-child(1) { animation: fadeInUp 0.4s ease both 0.05s; }
.folder-grid .folder-item-form:nth-child(2) { animation: fadeInUp 0.4s ease both 0.1s; }
.folder-grid .folder-item-form:nth-child(3) { animation: fadeInUp 0.4s ease both 0.15s; }
.folder-grid .folder-item-form:nth-child(4) { animation: fadeInUp 0.4s ease both 0.2s; }
.folder-grid .folder-item-form:nth-child(5) { animation: fadeInUp 0.4s ease both 0.25s; }
.folder-grid .folder-item-form:nth-child(6) { animation: fadeInUp 0.4s ease both 0.3s; }

@media (max-width: 768px) {
    .folder-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
    }

    .folder-back-btn {
        align-self: flex-start;
    }

    .folder-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 0.75rem;
        padding: 1rem;
    }

    .folder-item-icon {
        width: 60px;
        height: 60px;
    }

    .folder-item {
        padding: 0.75rem 0.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
