/* ==========================================================================
   Qudrat Rawan — Unified Student & Exam Design System (RTL First)
   Design Tokens, Persistent Sidebar, and Distraction-Free Exam Engine
   ========================================================================== */

:root {
    /* Brand Colors */
    --brand-primary: #0284C7;
    --brand-primary-hover: #0369A1;
    --brand-primary-light: #E0F2FE;
    --brand-primary-dark: #075985;
    --brand-accent: #38BDF8;

    /* Semantic Status */
    --status-success: #10B981;
    --status-success-light: #ECFDF5;
    --status-warning: #F59E0B;
    --status-warning-light: #FFFBEB;
    --status-danger: #EF4444;
    --status-danger-light: #FEF2F2;
    --status-info: #6366F1;
    --status-info-light: #EEF2FF;

    /* Neutrals & Surfaces */
    --surface-bg: #F8FAFC;
    --surface-card: #FFFFFF;
    --surface-hover: #F1F5F9;
    --surface-active: #E2E8F0;
    
    /* Text Colors */
    --text-heading: #0F172A;
    --text-body: #334155;
    --text-muted: #64748B;
    --text-subtle: #94A3B8;
    --text-on-primary: #FFFFFF;

    /* Borders & Shadows */
    --border-subtle: #E2E8F0;
    --border-hover: #CBD5E1;
    --border-focus: #0284C7;
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 6px -1px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 25px -4px rgba(15, 23, 42, 0.1);
    --shadow-xl: 0 20px 35px -6px rgba(15, 23, 42, 0.14);

    /* Typography */
    --font-heading: 'Cairo', system-ui, -apple-system, sans-serif;
    --font-body: 'IBM Plex Sans Arabic', 'Cairo', system-ui, sans-serif;

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 9999px;

    /* Layout metrics */
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 72px;
}

/* Base RTL Reset & Styles */
body {
    direction: rtl;
    text-align: right;
    font-family: var(--font-body);
    background-color: var(--surface-bg);
    color: var(--text-body);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. Standardized Persistent Student Sidebar
   ========================================================================== */
.student-sidebar {
    width: var(--sidebar-width);
    background: var(--surface-card);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    flex-shrink: 0;
    z-index: 50;
    transition: width 250ms cubic-bezier(0.4, 0, 0.2, 1), padding 250ms cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.student-sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    padding: 20px 8px;
}

.sidebar-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 14px;
}

.sidebar-brand-box {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-width: 0;
}

.sidebar-brand-box img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex-shrink: 0;
}

.sidebar-brand-title {
    font-family: var(--font-heading);
    font-weight: 900;
    font-size: 1.05rem;
    color: var(--text-heading);
    line-height: 1.2;
    white-space: nowrap;
}

.sidebar-brand-sub {
    font-size: 0.72rem;
    color: var(--brand-primary);
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-collapse-btn {
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: var(--brand-primary-light);
    border-color: #BAE6FD;
    color: var(--brand-primary);
    transform: scale(1.05);
}

.student-sidebar.collapsed .sidebar-header-row {
    justify-content: center;
    padding-bottom: 12px;
}

.student-sidebar.collapsed .sidebar-brand-box {
    display: none;
}

.student-sidebar.collapsed .sidebar-collapse-btn {
    margin: 0 auto;
}

.student-sidebar.collapsed .collapse-arrow {
    transform: rotate(180deg);
    transform-origin: center;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-hover);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer;
}

.sidebar-user-card:hover {
    background: var(--surface-active);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.sidebar-user-card .avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid #BAE6FD;
    background: #FFFFFF;
    flex-shrink: 0;
}

.student-sidebar.collapsed .sidebar-user-card {
    padding: 8px 4px;
    justify-content: center;
}

/* Unified Navigation Items */
.sidebar-nav-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
}

.student-nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    text-align: right;
    width: 100%;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--font-body);
    text-decoration: none;
    box-sizing: border-box;
    position: relative;
}

.student-nav-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #64748B;
    transition: color 0.2s;
}

.student-nav-btn:hover {
    background: var(--surface-hover);
    color: var(--text-heading);
    border-color: var(--border-subtle);
    transform: translateX(-2px);
}

.student-nav-btn:hover svg {
    color: var(--brand-primary);
}

.student-nav-btn.active {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    font-weight: 800;
    border-color: rgba(2, 132, 199, 0.25);
    box-shadow: 0 1px 4px rgba(2, 132, 199, 0.08);
}

.student-nav-btn.active svg {
    color: var(--brand-primary);
}

.student-sidebar.collapsed .student-nav-btn {
    padding: 10px 0;
    justify-content: center;
}

.student-sidebar.collapsed .sidebar-hide {
    display: none !important;
}

/* Standardized Nav Badges */
.nav-badge-pill {
    margin-right: auto;
    background: var(--surface-hover);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 800;
    border: 1px solid var(--border-subtle);
}

.student-nav-btn.active .nav-badge-pill {
    background: var(--brand-primary);
    color: #FFFFFF;
    border-color: var(--brand-primary);
}

/* Conditional "Practice from Mistakes" Nav Item */
.student-nav-btn.nav-mistakes-disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    background: transparent !important;
    color: var(--text-subtle) !important;
    pointer-events: auto;
}

.student-nav-btn.nav-mistakes-disabled:hover {
    background: transparent !important;
    transform: none;
}

.student-nav-btn.nav-mistakes-disabled svg {
    color: var(--text-subtle) !important;
}

.nav-badge-mistakes-locked {
    margin-right: auto;
    background: #F1F5F9;
    color: var(--text-subtle);
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-badge-mistakes-active {
    margin-right: auto;
    background: var(--status-danger-light);
    color: var(--status-danger);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.72rem;
    font-weight: 800;
    border: 1px solid #FECDD3;
}

/* Integrated Sidebar Footer & Logout */
.sidebar-footer-box {
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}

.sidebar-logout-btn {
    width: 100%;
    padding: 10px 14px;
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.88rem;
    color: #64748B;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--font-body);
}

.sidebar-logout-btn svg {
    width: 17px;
    height: 17px;
    color: #64748B;
    transition: color 0.2s ease;
}

.sidebar-logout-btn:hover {
    background: #FEF2F2;
    border-color: #FECACA;
    color: #DC2626;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.12);
}

.sidebar-logout-btn:hover svg {
    color: #DC2626;
}

.student-sidebar.collapsed .sidebar-logout-btn {
    padding: 10px 0;
}

/* Mobile Drawer & Backdrop */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    z-index: 45;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 991px) {
    .student-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 50;
        box-shadow: var(--shadow-xl);
    }
    .student-sidebar.mobile-open {
        transform: translateX(0);
    }
}

/* ==========================================================================
   2. Distraction-Free Exam / Quiz Layout Engine
   ========================================================================== */
.exam-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #F8FAFC;
    color: var(--text-heading);
}

/* Exam Top Bar */
.exam-top-bar {
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

.exam-info-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}

.exam-tag {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.exam-title-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text-heading);
}

/* High-Legibility Countdown Timer */
.exam-timer-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #F1F5F9;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-heading);
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.exam-timer-box.timer-urgent {
    background: #FEF2F2;
    border-color: #FCA5A5;
    color: #DC2626;
    animation: timerPulse 1.2s infinite ease-in-out;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

/* Progress Bar Strip */
.exam-progress-container {
    width: 100%;
    height: 4px;
    background: #E2E8F0;
    position: sticky;
    top: 61px;
    z-index: 99;
}

.exam-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0284C7, #38BDF8);
    transition: width 0.3s ease;
}

/* Exam Main Content Matrix */
.exam-workspace {
    max-width: 1100px;
    width: 100%;
    margin: 24px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    flex: 1;
    align-items: start;
}

@media (max-width: 900px) {
    .exam-workspace {
        grid-template-columns: 1fr;
    }
}

/* Question Focus Card */
.question-focus-card {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.question-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.question-counter-badge {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--brand-primary);
    background: var(--brand-primary-light);
    padding: 4px 12px;
    border-radius: var(--radius-pill);
}

.question-flag-btn {
    background: #F8FAFC;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.question-flag-btn:hover {
    border-color: var(--status-warning);
    color: #B45309;
}

.question-flag-btn.flagged {
    background: #FFFBEB;
    border-color: #FCD34D;
    color: #B45309;
}

/* Question Text & Media */
.question-body-text {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.8;
    color: var(--text-heading);
    letter-spacing: -0.2px;
}

.question-media-box {
    margin: 12px 0;
    text-align: center;
    background: #F8FAFC;
    padding: 16px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

.question-media-box img {
    max-width: 100%;
    max-height: 320px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

/* Clean 4-Option Selector Cards */
.options-selector-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-choice-card {
    background: #FFFFFF;
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.option-choice-card:hover {
    border-color: var(--brand-primary);
    background: #F0F9FF;
    transform: translateY(-1px);
}

.option-choice-card.selected {
    border-color: var(--brand-primary);
    background: var(--brand-primary-light);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.option-letter-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #F1F5F9;
    color: var(--text-body);
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.option-choice-card.selected .option-letter-badge {
    background: var(--brand-primary);
    color: #FFFFFF;
}

.option-text-content {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-heading);
    flex: 1;
    line-height: 1.6;
}

/* Exam Controls Dock */
.exam-controls-dock {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    gap: 12px;
}

/* Questions Matrix Navigator Sidebar */
.questions-navigator-card {
    background: #FFFFFF;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 85px;
}

.navigator-header {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--text-heading);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.matrix-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-height: 360px;
    overflow-y: auto;
    padding: 4px;
}

.matrix-item-btn {
    aspect-ratio: 1/1;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: #F8FAFC;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.15s ease;
}

.matrix-item-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.matrix-item-btn.current {
    border: 2px solid var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
    font-weight: 900;
}

.matrix-item-btn.answered {
    background: var(--brand-primary);
    color: #FFFFFF;
    border-color: var(--brand-primary);
}

.matrix-item-btn.flagged::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    background: var(--status-warning);
    border-radius: 50%;
}

.matrix-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-subtle);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

/* ==========================================================================
   2. Mobile Bottom Navigation Sheet & Floating Action Button (FAB)
   ========================================================================== */

.mobile-nav-fab {
    display: none;
}

.mobile-sheet-backdrop {
    display: none;
}

.mobile-bottom-sheet {
    display: none;
}

@media (max-width: 768px) {
    /* Persistent Floating Action Button */
    .mobile-nav-fab {
        display: flex !important;
        position: fixed;
        bottom: 22px;
        right: 20px;
        z-index: 99997;
        background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
        color: #FFFFFF;
        border: 1.5px solid rgba(255, 255, 255, 0.28);
        border-radius: 999px;
        padding: 10px 18px 10px 16px;
        box-shadow: 0 10px 25px -4px rgba(2, 132, 199, 0.5), 0 4px 10px rgba(0, 0, 0, 0.12);
        cursor: pointer;
        align-items: center;
        gap: 8px;
        font-family: var(--font-heading, 'Cairo', sans-serif);
        font-weight: 800;
        font-size: 0.92rem;
        transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .mobile-nav-fab:active {
        transform: scale(0.94);
    }

    .mobile-nav-fab.is-open {
        background: #0F172A;
        border-color: #334155;
        box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.5);
    }

    .fab-icon-wrap {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        position: relative;
    }

    .fab-menu-icon, .fab-close-icon {
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    .mobile-nav-fab .fab-close-icon {
        display: none;
    }

    .mobile-nav-fab.is-open .fab-menu-icon {
        display: none;
    }

    .mobile-nav-fab.is-open .fab-close-icon {
        display: block;
    }

    .fab-text {
        letter-spacing: -0.01em;
    }

    .fab-badge {
        background: #EF4444;
        color: #FFFFFF;
        font-size: 0.7rem;
        font-weight: 900;
        padding: 2px 7px;
        border-radius: 999px;
        margin-right: 2px;
        border: 1.5px solid #FFFFFF;
        box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    }

    /* Backdrop with Frosted Glass */
    .mobile-sheet-backdrop {
        display: block !important;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.48);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 99998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 280ms cubic-bezier(0.16, 1, 0.3, 1), visibility 280ms cubic-bezier(0.16, 1, 0.3, 1);
    }

    .mobile-sheet-backdrop.active {
        opacity: 1;
        visibility: visible;
    }

    /* Bottom Sheet Container */
    .mobile-bottom-sheet {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 88vh;
        background: #FFFFFF;
        border-radius: 26px 26px 0 0;
        border-top: 1px solid rgba(226, 232, 240, 0.9);
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.16), 0 -2px 10px rgba(0, 0, 0, 0.04);
        z-index: 99999;
        padding: 12px 18px max(24px, env(safe-area-inset-bottom, 24px));
        transform: translateY(105%);
        transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }

    .mobile-bottom-sheet.active {
        transform: translateY(0);
    }

    /* Drag Handle */
    .sheet-drag-handle {
        width: 44px;
        height: 5px;
        background: #CBD5E1;
        border-radius: 999px;
        margin: 0 auto 14px;
        flex-shrink: 0;
    }

    /* Sheet Header */
    .sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 14px;
        border-bottom: 1px solid #F1F5F9;
        margin-bottom: 16px;
    }

    .sheet-user-meta {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .sheet-avatar {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        border: 1.5px solid #BAE6FD;
        object-fit: cover;
    }

    .sheet-user-info {
        display: flex;
        flex-direction: column;
        line-height: 1.25;
    }

    .sheet-user-greeting {
        font-size: 0.74rem;
        color: #64748B;
        font-weight: 600;
    }

    .sheet-user-name {
        font-family: var(--font-heading, 'Cairo', sans-serif);
        font-size: 0.95rem;
        font-weight: 800;
        color: #0F172A;
    }

    .sheet-close-btn {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        background: #F1F5F9;
        border: 1px solid #E2E8F0;
        color: #64748B;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .sheet-close-btn:active {
        background: #E2E8F0;
        color: #0F172A;
        transform: scale(0.95);
    }

    /* Grid layout for sheet navigation items */
    .sheet-nav-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding-bottom: 6px;
    }

    @media (max-width: 380px) {
        .sheet-nav-grid {
            grid-template-columns: 1fr;
            gap: 8px;
        }
    }

    .sheet-nav-item {
        display: flex;
        align-items: center;
        gap: 10px;
        background: #F8FAFC;
        border: 1px solid #E2E8F0;
        border-radius: 14px;
        padding: 10px 12px;
        text-decoration: none;
        color: #1E293B;
        position: relative;
        transition: all 0.2s ease;
        -webkit-tap-highlight-color: transparent;
        box-sizing: border-box;
    }

    .sheet-nav-item:active {
        background: #F0F9FF;
        border-color: #BAE6FD;
        transform: scale(0.98);
    }

    .sheet-nav-item.is-active {
        background: #EFF6FF;
        border-color: #0284C7;
        box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
    }

    .sheet-nav-item.is-active .sheet-nav-title {
        color: #0284C7;
        font-weight: 900;
    }

    .sheet-nav-icon {
        width: 38px;
        height: 38px;
        border-radius: 11px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .icon-blue { background: #E0F2FE; color: #0284C7; }
    .icon-indigo { background: #EEF2FF; color: #6366F1; }
    .icon-rose { background: #FFE4E6; color: #E11D48; }
    .icon-emerald { background: #ECFDF5; color: #059669; }
    .icon-amber { background: #FEF3C7; color: #D97706; }
    .icon-purple { background: #F3E8FF; color: #9333EA; }
    .icon-slate { background: #F1F5F9; color: #475569; }
    .icon-red { background: #FEF2F2; color: #EF4444; }

    .sheet-nav-label-box {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
    }

    .sheet-nav-title {
        font-family: var(--font-heading, 'Cairo', sans-serif);
        font-size: 0.84rem;
        font-weight: 800;
        color: #0F172A;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sheet-nav-sub {
        font-size: 0.68rem;
        color: #64748B;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        margin-top: 2px;
    }

    .sheet-item-badge {
        font-size: 0.68rem;
        font-weight: 800;
        padding: 2px 7px;
        border-radius: 999px;
        flex-shrink: 0;
    }

    .badge-blue { background: #E0F2FE; color: #0284C7; }
    .badge-rose { background: #FFE4E6; color: #E11D48; }

    .sheet-nav-logout {
        background: #FFF1F2;
        border-color: #FECDD3;
    }

    .sheet-nav-logout:active {
        background: #FFE4E6;
    }
}
