/* Custom Styles for ChandSaat - Touch First & Desktop Responsive */
:root {
    /* Fluid Typography Scale */
    --text-2xs: clamp(0.65rem, 0.58rem + 0.25vw, 0.75rem);
    --text-xs: clamp(0.725rem, 0.675rem + 0.25vw, 0.8125rem);
    --text-sm: clamp(0.8125rem, 0.76rem + 0.3vw, 0.9375rem);
    --text-base: clamp(0.9375rem, 0.875rem + 0.35vw, 1.0625rem);
    --text-lg: clamp(1.0625rem, 0.98rem + 0.45vw, 1.25rem);
    --text-xl: clamp(1.25rem, 1.125rem + 0.6vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 1.3rem + 1vw, 2rem);
    --text-3xl: clamp(1.875rem, 1.55rem + 1.5vw, 2.75rem);

    /* Fluid Layout & Spacing */
    --space-page-x: clamp(0.75rem, 2.5vw, 2rem);
    --space-card-p: clamp(1rem, 2vw, 1.75rem);
    --mobile-nav-height: max(3.85rem, calc(3.6rem + env(safe-area-inset-bottom, 0px)));
}

body, html, input, button, select, textarea, optgroup, option { 
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
    background-color: #F8FAFC;
    color: #0F172A;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    overscroll-behavior-y: contain;
}

*, *::before, *::after {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.font-mono, [class*="font-mono"] {
    font-family: 'Vazirmatn', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
    font-feature-settings: "tnum" on, "lnum" on;
}

/* Base defensive image, media, and SVG sizing fallback */
img, svg, video, canvas, audio, iframe {
    max-width: 100%;
    vertical-align: middle;
    display: inline-block;
}

.app-header-logo {
    width: 2rem !important;
    height: 2rem !important;
    min-width: 2rem !important;
    min-height: 2rem !important;
    max-width: 2rem !important;
    max-height: 2rem !important;
    object-fit: contain !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
}

#app-header {
    height: 3.5rem !important;
    max-height: 3.5rem !important;
}


/* Touchscreen & Mobile Touch Dynamics */
button, a, input, select, textarea, .btn-interact {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item {
    min-width: 44px;
    min-height: 44px;
}

.pt-safe {
    padding-top: env(safe-area-inset-top, 0px);
}
.pb-safe {
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #E2E8F0; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #CBD5E1; }

/* Custom Border Radius & Shadow Tokens */
.rounded-3xl { border-radius: 1.5rem !important; }
.rounded-4xl { border-radius: 2rem !important; }
.rounded-5xl { border-radius: 2.5rem !important; }
.shadow-subtle { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02) !important; }
.shadow-soft { box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.03) !important; }
.shadow-floating { box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.08) !important; }

.window-titlebar { -webkit-app-region: drag; }

.window-no-drag { -webkit-app-region: no-drag; }

.view-panel {
    animation: viewFadeIn 0.25s ease-out forwards;
}

@keyframes viewFadeIn {
    from { opacity: 0; transform: scale(0.99); }
    to { opacity: 1; transform: scale(1); }
}

.focus-enter-anim {
    animation: focusZoomIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes focusZoomIn {
    0% { opacity: 0; transform: scale(0.94); }
    100% { opacity: 1; transform: scale(1); }
}

/* Tactile Embossed Modal Dialogs */
.modal-morph {
    animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%) !important;
    border: 1px solid rgba(203, 213, 225, 0.9) !important;
    box-shadow: 
        inset 0 2px 2px rgba(255, 255, 255, 1),
        inset 0 -2.5px 5px rgba(15, 23, 42, 0.05),
        0 25px 60px -10px rgba(15, 23, 42, 0.35),
        0 10px 20px -5px rgba(0, 0, 0, 0.1) !important;
}

.modal-morph-no-anim {
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%) !important;
    border: 1px solid rgba(203, 213, 225, 0.9) !important;
    box-shadow: 
        inset 0 2px 2px rgba(255, 255, 255, 1),
        inset 0 -2.5px 5px rgba(15, 23, 42, 0.05),
        0 25px 60px -10px rgba(15, 23, 42, 0.35),
        0 10px 20px -5px rgba(0, 0, 0, 0.1) !important;
}

@keyframes modalFadeIn {
    0% { opacity: 0; transform: scale(0.96); }
    100% { opacity: 1; transform: scale(1); }
}

.nav-item,
.nav-item:hover,
.nav-item:active,
.nav-item:hover:active,
.nav-item:focus,
.nav-item:focus-visible,
.nav-item.active,
.nav-item.active:hover,
.nav-item.active:active,
.nav-item.active:focus {
    transform: none !important;
    outline: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.nav-item {
    position: relative;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-item:hover {
    background: #F8FAFC !important;
    border-color: #F1F5F9 !important;
    color: #0F172A !important;
}

.nav-item.active {
    background: linear-gradient(180deg, #EEF2FF 0%, #E0E7FF 100%) !important;
    border: 1px solid #C7D2FE !important;
    color: #3B57CE !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 6px -1px rgba(75, 105, 225, 0.12) !important;
    font-weight: 700;
}

.nav-item.active svg {
    color: #3B57CE !important;
    stroke: #3B57CE !important;
}

/* ==========================================
   TACTILE 3D BUTTONS & TOUCH STATES
   ========================================== */

.btn-tactile-indigo {
    background: linear-gradient(180deg, #6494F3 0%, #4B69E1 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.38),
        inset 0 -1.5px 2px rgba(0, 0, 0, 0.2),
        0 2px 5px rgba(75, 105, 225, 0.22) !important;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease !important;
}

.btn-tactile-emerald {
    background: linear-gradient(180deg, #10B981 0%, #059669 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.38),
        inset 0 -1.5px 2px rgba(0, 0, 0, 0.2),
        0 2px 5px rgba(16, 185, 129, 0.22) !important;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease !important;
}

.btn-tactile-slate {
    background: linear-gradient(180deg, #FFFFFF 0%, #F1F5F9 100%) !important;
    border: 1px solid #CBD5E1 !important;
    color: #334155 !important;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        inset 0 -1px 1px rgba(0, 0, 0, 0.05),
        0 1.5px 3px rgba(0, 0, 0, 0.04) !important;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease !important;
}

.btn-tactile-rose {
    background: linear-gradient(180deg, #F43F5E 0%, #E11D48 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.38),
        inset 0 -1.5px 2px rgba(0, 0, 0, 0.2),
        0 2px 5px rgba(244, 63, 94, 0.22) !important;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease !important;
}

/* DESKTOP ONLY HOVER STATES (Must come BEFORE :active states in CSS cascade) */
@media (hover: hover) and (pointer: fine) {
    .btn-tactile-indigo:hover {
        background: linear-gradient(180deg, #4B69E1 0%, #3B57CE 100%) !important;
        box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 3px 7px rgba(75, 105, 225, 0.32) !important;
    }
    .btn-tactile-emerald:hover {
        background: linear-gradient(180deg, #059669 0%, #047857 100%) !important;
        box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 3px 7px rgba(16, 185, 129, 0.32) !important;
    }
    .btn-tactile-slate:hover {
        background: linear-gradient(180deg, #F8FAFC 0%, #E2E8F0 100%) !important;
        border-color: #94A3B8 !important;
        color: #0F172A !important;
    }
    .btn-tactile-rose:hover {
        background: linear-gradient(180deg, #E11D48 0%, #BE123C 100%) !important;
        box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 3px 7px rgba(244, 63, 94, 0.32) !important;
    }
    .wizard-course-pill:hover,
    .timer-course-pill:hover,
    .preset-chip:hover {
        border-color: #A5B4FC;
        background: linear-gradient(180deg, #EEF2FF 0%, #E0E7FF 100%);
    }
    .timer-mode-card:hover {
        border-color: #A5B4FC;
        background: linear-gradient(180deg, #EEF2FF 0%, #E0E7FF 100%);
    }
    .history-item:hover {
        border-color: #CBD5E1 !important;
        background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%) !important;
    }
    .mini-timer-capsule:hover {
        border-color: #818CF8 !important;
        background: linear-gradient(180deg, #FFFFFF 0%, #EEF2FF 100%) !important;
        box-shadow: 
            inset 0 2px 2px rgba(255, 255, 255, 1),
            0 18px 36px -8px rgba(15, 23, 42, 0.22),
            0 6px 20px rgba(75, 105, 225, 0.25) !important;
    }
    .mini-timer-capsule.break-mode:hover {
        border-color: #34D399 !important;
        background: linear-gradient(180deg, #FFFFFF 0%, #ECFDF5 100%) !important;
        box-shadow: 
            inset 0 2px 2px rgba(255, 255, 255, 1),
            0 18px 36px -8px rgba(6, 78, 59, 0.2),
            0 6px 20px rgba(16, 185, 129, 0.22) !important;
    }
}

/* TOUCH & CLICK ACTIVE PRESS STATES (Must come AFTER :hover to override on click) */
.btn-tactile-indigo:active,
.btn-tactile-indigo:hover:active {
    background: linear-gradient(180deg, #3730A3 0%, #312E81 100%) !important;
    border-color: #312E81 !important;
    box-shadow: 
        inset 0 3px 6px rgba(0, 0, 0, 0.5),
        inset 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    transform: translateY(1px) scale(0.98) !important;
    opacity: 0.98 !important;
}

.btn-tactile-emerald:active,
.btn-tactile-emerald:hover:active {
    background: linear-gradient(180deg, #047857 0%, #065F46 100%) !important;
    border-color: #065F46 !important;
    box-shadow: 
        inset 0 3px 6px rgba(0, 0, 0, 0.5),
        inset 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    transform: translateY(1px) scale(0.98) !important;
    opacity: 0.98 !important;
}

.btn-tactile-slate:active,
.btn-tactile-slate:hover:active {
    background: linear-gradient(180deg, #CBD5E1 0%, #94A3B8 100%) !important;
    border-color: #64748B !important;
    color: #0F172A !important;
    box-shadow: 
        inset 0 2.5px 5px rgba(15, 23, 42, 0.25),
        inset 0 1px 1px rgba(15, 23, 42, 0.15) !important;
    transform: translateY(1px) scale(0.98) !important;
    opacity: 0.98 !important;
}

.btn-tactile-rose:active,
.btn-tactile-rose:hover:active {
    background: linear-gradient(180deg, #BE123C 0%, #9F1239 100%) !important;
    border-color: #9F1239 !important;
    box-shadow: 
        inset 0 3px 6px rgba(0, 0, 0, 0.5),
        inset 0 1px 2px rgba(0, 0, 0, 0.3) !important;
    transform: translateY(1px) scale(0.98) !important;
    opacity: 0.98 !important;
}

.mini-timer-capsule:active,
.mini-timer-capsule:hover:active {
    transform: scale(0.97) translateY(0) !important;
    box-shadow: 
        inset 0 2px 4px rgba(15, 23, 42, 0.12),
        0 4px 12px rgba(15, 23, 42, 0.1) !important;
}

button:active:not(.btn-no-tactile):not(.segmented-tab):not(.nav-item):not(.todo-subtasks-toggle-btn),
.btn-interact:active:not(.segmented-tab):not(.nav-item):not(.todo-subtasks-toggle-btn),
.timer-course-pill:active,
.wizard-course-pill:active,
.preset-chip:active,
.timer-mode-card:active {
    box-shadow: inset 0 2.5px 5px rgba(0, 0, 0, 0.25) !important;
    transform: translateY(1px) scale(0.98) !important;
    opacity: 0.98 !important;
}

.btn-no-tactile:active:not(.todo-subtasks-toggle-btn),
#focus-cancel-bar button:active {
    box-shadow: none !important;
    transform: scale(0.98) !important;
    opacity: 0.75 !important;
}

/* TOGGLE SWITCH */
.toggle-switch-track {
    width: 2.75rem;
    height: 1.5rem;
    background: #E2E8F0;
    border: 1px solid #CBD5E1;
    border-radius: 9999px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

input:checked + .toggle-switch-track {
    background: #4B69E1;
    border-color: #3B57CE;
}

.toggle-switch-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

input:checked + .toggle-switch-track .toggle-switch-knob {
    transform: translateX(1.25rem);
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ==========================================
   TOAST NOTIFICATION SYSTEM (Top-Center Spring Physics)
   ========================================== */
#toast-container {
    position: fixed;
    top: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    pointer-events: none;
    width: auto;
    max-width: 90vw;
}

.toast-item {
    pointer-events: auto;
    min-width: 300px;
    max-width: 440px;
    max-height: 120px;
    padding: 0.75rem 1.15rem;
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.95),
        0 20px 40px -10px rgba(15, 23, 42, 0.16),
        0 4px 12px rgba(15, 23, 42, 0.05);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    direction: rtl;
    animation: toastSpringIn 0.42s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.toast-item.toast-hiding {
    animation: toastExit 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
    overflow: hidden !important;
}

@keyframes toastSpringIn {
    0% {
        opacity: 0;
        transform: translateY(-28px) scale(0.86);
        filter: blur(6px);
    }
    70% {
        opacity: 1;
        transform: translateY(3px) scale(1.02);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes toastExit {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
        max-height: 120px;
    }
    100% {
        opacity: 0;
        transform: translateY(-28px) scale(0.82);
        filter: blur(10px);
        max-height: 0;
        margin-top: -0.625rem;
        padding-top: 0;
        padding-bottom: 0;
    }
}

.toast-icon-bg {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.toast-success .toast-icon-bg { background: linear-gradient(180deg, #ECFDF5 0%, #D1FAE5 100%); color: #059669; border: 1px solid #A7F3D0; }
.toast-info .toast-icon-bg { background: linear-gradient(180deg, #EEF2FF 0%, #E0E7FF 100%); color: #4B69E1; border: 1px solid #C7D2FE; }
.toast-warning .toast-icon-bg { background: linear-gradient(180deg, #FFFBEB 0%, #FEF3C7 100%); color: #D97706; border: 1px solid #FDE68A; }
.toast-error .toast-icon-bg { background: linear-gradient(180deg, #FFF1F2 0%, #FFE4E6 100%); color: #E11D48; border: 1px solid #FECDD3; }

/* Toast in Dark Mode */
html.dark .toast-item {
    background: rgba(19, 30, 53, 0.92) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        0 25px 50px -12px rgba(0, 0, 0, 0.75),
        0 4px 16px rgba(0, 0, 0, 0.4) !important;
    color: #F8FAFC !important;
}

html.dark .toast-item .text-slate-800 {
    color: #F8FAFC !important;
}

html.dark .toast-item button {
    color: #94A3B8 !important;
}
html.dark .toast-item button:hover {
    color: #FFFFFF !important;
}

html.dark .toast-success .toast-icon-bg {
    background: rgba(16, 185, 129, 0.2) !important;
    color: #34D399 !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.25) !important;
}

html.dark .toast-info .toast-icon-bg {
    background: rgba(100, 148, 243, 0.2) !important;
    color: #818CF8 !important;
    border: 1px solid rgba(100, 148, 243, 0.4) !important;
    box-shadow: 0 0 12px rgba(100, 148, 243, 0.25) !important;
}

html.dark .toast-warning .toast-icon-bg {
    background: rgba(245, 158, 11, 0.2) !important;
    color: #FBBF24 !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.25) !important;
}

html.dark .toast-error .toast-icon-bg {
    background: rgba(244, 63, 94, 0.2) !important;
    color: #FB7185 !important;
    border: 1px solid rgba(244, 63, 94, 0.4) !important;
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.25) !important;
}

/* CARDS & PILLS */
.card-morph {
    background: linear-gradient(180deg, #FFFFFF 0%, #FAFAFC 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1.5px 4px rgba(0, 0, 0, 0.03);
    border: 1px solid #E2E8F0;
}

input[type="text"],
input[type="number"],
textarea,
select {
    box-shadow: inset 0 1.5px 3px rgba(15, 23, 42, 0.06) !important;
    border: 1px solid #E2E8F0 !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease !important;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: #6494F3 !important;
    box-shadow: inset 0 1.5px 2px rgba(15, 23, 42, 0.04), 0 0 0 3px rgba(100, 148, 243, 0.15) !important;
}

.wizard-course-pill,
.timer-course-pill,
.preset-chip {
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    border: 1px solid #E2E8F0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1px 2px rgba(0, 0, 0, 0.03);
    transition: all 0.15s ease;
}

html.dark .wizard-course-pill:not(.selected),
html.dark .timer-course-pill:not(.selected),
html.dark .preset-chip:not(.active) {
    background: #17243B !important;
    border: 1px solid #2B3D5E !important;
    color: #CBD5E1 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

html.dark .wizard-course-pill:not(.selected):hover,
html.dark .timer-course-pill:not(.selected):hover,
html.dark .preset-chip:not(.active):hover {
    background: rgba(100, 148, 243, 0.18) !important;
    border-color: rgba(100, 148, 243, 0.45) !important;
    color: #C7D2FE !important;
}

.wizard-course-pill.selected,
.timer-course-pill.selected,
.preset-chip.active {
    background: linear-gradient(180deg, #6494F3 0%, #4B69E1 100%) !important;
    border-color: #3B57CE !important;
    color: #FFFFFF !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.38), inset 0 -1px 2px rgba(0, 0, 0, 0.2), 0 2px 5px rgba(75, 105, 225, 0.22) !important;
}

html.dark .wizard-course-pill.selected,
html.dark .timer-course-pill.selected,
html.dark .preset-chip.active {
    background: linear-gradient(180deg, #6494F3 0%, #4B69E1 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.38), 0 4px 14px rgba(75, 105, 225, 0.45) !important;
}

html.dark .wizard-course-pill.selected:hover,
html.dark .timer-course-pill.selected:hover,
html.dark .preset-chip.active:hover {
    background: linear-gradient(180deg, #4B69E1 0%, #3B57CE 100%) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    color: #FFFFFF !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 6px 18px rgba(75, 105, 225, 0.6) !important;
}

.wizard-course-pill.selected svg,
.timer-course-pill.selected svg {
    color: #FFFFFF !important;
    stroke: #FFFFFF !important;
}

main {
    scrollbar-gutter: stable;
}

/* Segmented Control Container with Sliding Active Indicator */

/* Segmented Control Container with Sliding Active Indicator */
.segmented-control {
    position: relative;
    display: inline-flex;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 9999px;
    padding: 3px;
    user-select: none;
}

.segmented-indicator {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 0;
    width: 0;
    background: #FFFFFF;
    border-radius: 9999px;
    box-shadow: 0 2px 8px -1px rgba(75, 105, 225, 0.12), 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
    pointer-events: none;
}

.segmented-control button,
.segmented-tab,
.segmented-tab:hover,
.segmented-tab:active,
.segmented-tab:hover:active,
.segmented-tab:focus,
.segmented-tab:focus-visible,
.segmented-tab.active,
.segmented-tab.active:hover,
.segmented-tab.active:active,
.segmented-tab.active:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    transform: none !important;
    opacity: 1 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.segmented-tab {
    position: relative;
    z-index: 2;
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 700;
    color: #64748B;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}


.segmented-tab.active {
    color: #4B69E1 !important;
}

.segmented-tab.active svg {
    stroke: #4B69E1 !important;
}

/* Floating Mini Timer Widget - Unified ChandSaat Design Tokens */
.mini-timer-capsule {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 45;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%) !important;
    border: 1px solid rgba(203, 213, 225, 0.9) !important;
    border-radius: 9999px;
    padding: 8px 16px 8px 12px;
    box-shadow: 
        inset 0 2px 2px rgba(255, 255, 255, 1),
        inset 0 -2px 4px rgba(15, 23, 42, 0.05),
        0 15px 35px -8px rgba(15, 23, 42, 0.2),
        0 4px 20px rgba(75, 105, 225, 0.12) !important;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.3s ease;
    transform-origin: bottom left;
}

.mini-timer-capsule:hover {
    border-color: #C7D2FE !important;
    box-shadow: 
        inset 0 2px 2px rgba(255, 255, 255, 1),
        0 20px 40px -8px rgba(15, 23, 42, 0.25),
        0 6px 24px rgba(75, 105, 225, 0.22) !important;
}

.mini-timer-capsule.break-mode:hover {
    border-color: #6EE7B7 !important;
    box-shadow: 
        inset 0 2px 2px rgba(255, 255, 255, 1),
        0 20px 40px -8px rgba(6, 78, 59, 0.22),
        0 6px 24px rgba(16, 185, 129, 0.28) !important;
}

/* Hide number input spin arrows globally */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
  -webkit-appearance: none; 
  margin: 0; 
}
input[type=number] {
  -moz-appearance: textfield;
}

.mini-timer-capsule.break-mode {
    border-color: #A7F3D0 !important;
    box-shadow: 
        inset 0 2px 2px rgba(255, 255, 255, 1),
        0 15px 35px -8px rgba(6, 78, 59, 0.18),
        0 4px 20px rgba(16, 185, 129, 0.18) !important;
}

/* Pulsing effect for active focus & break */
@keyframes ringPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.03); opacity: 0.85; }
}

.animate-pulse-glow {
    animation: ringPulse 3s infinite ease-in-out;
}

/* Smooth Timer Progress Ring */
#timer-progress-ring {
    transition: stroke-dashoffset 1s linear, stroke 0.5s ease;
}

/* Active Morph Container Shadow */
#active-morph-element {
    will-change: left, top, width, height, border-radius, box-shadow;
}

/* ==========================================
   FULLSCREEN FOCUS MODE (حالت تمرکز کامل)
   ========================================== */

#focus-overlay.is-focus-fullscreen {
    background-color: #F8FAFC !important;
    backdrop-filter: blur(20px) !important;
    padding: 0 !important;
    transition: background-color 0.3s ease, opacity 0.3s ease !important;
}

#focus-overlay.is-focus-fullscreen #focus-overlay-card {
    max-width: 100vw !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: max(1.5rem, env(safe-area-inset-top, 1.5rem)) max(2.5rem, env(safe-area-inset-right, 2.5rem)) max(2rem, env(safe-area-inset-bottom, 2rem)) max(2.5rem, env(safe-area-inset-left, 2.5rem)) !important;
    overflow-y: auto !important;
}

/* Widescreen Landscape 2-Column Grid Layout */
#focus-overlay.is-focus-fullscreen #focus-body-content {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2rem !important;
    width: 100% !important;
    max-width: 1100px !important;
    margin: auto 0 !important;
}

@media (min-width: 768px) {
    #focus-overlay.is-focus-fullscreen #focus-body-content {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        align-items: center !important;
        justify-items: center !important;
        gap: 3.5rem !important;
    }

    #focus-overlay.is-focus-fullscreen #focus-details-col {
        text-align: right !important;
        align-items: flex-start !important;
        width: 100% !important;
    }

    #focus-overlay.is-focus-fullscreen #focus-stats-grid {
        width: auto !important;
        max-width: 360px !important;
        padding: 0.65rem 1.75rem !important;
        margin-top: 1rem !important;
        margin-bottom: 0.25rem !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        align-self: flex-start !important;
        border-radius: 9999px !important;
        background-color: rgba(255, 255, 255, 0.85) !important;
        backdrop-filter: blur(12px) !important;
    }

    #focus-overlay.is-focus-fullscreen #live-active-time,
    #focus-overlay.is-focus-fullscreen #live-paused-time {
        font-size: 1.1rem !important;
    }

    #focus-overlay.is-focus-fullscreen #focus-buttons-container {
        margin-left: 0 !important;
        margin-right: 0 !important;
        align-self: flex-start !important;
        width: 100% !important;
        max-width: 320px !important;
        margin-top: 0.5rem !important;
    }

    #focus-overlay.is-focus-fullscreen #focus-controls-bar {
        width: 100% !important;
    }

    #focus-overlay.is-focus-fullscreen #skip-break-wrapper {
        width: 100% !important;
    }

    #focus-overlay.is-focus-fullscreen #focus-cancel-bar {
        text-align: right !important;
        display: flex !important;
        justify-content: flex-start !important;
        width: 100% !important;
        max-width: 320px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        align-self: flex-start !important;
        margin-top: 0.25rem !important;
    }
}

/* Animated Skip Break Container */
.skip-break-wrapper {
    max-height: 0;
    opacity: 0;
    transform: scale(0.92) translateY(-4px);
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                opacity 0.25s ease, 
                transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                padding 0.25s ease;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    pointer-events: none;
    overflow: hidden;
}

.skip-break-wrapper.show-break {
    max-height: 48px;
    opacity: 1;
    transform: scale(1) translateY(0);
    padding-top: 0.75rem !important;
    pointer-events: auto;
}

/* Scaled up clock container in Fullscreen Focus Mode */
#focus-overlay.is-focus-fullscreen #focus-clock-container {
    width: clamp(260px, 42vh, 420px) !important;
    height: clamp(260px, 42vh, 420px) !important;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    margin: 0 auto !important;
}

#focus-overlay.is-focus-fullscreen #focus-clock {
    font-size: clamp(3.2rem, 7vw, 6rem) !important;
    transition: all 0.3s ease !important;
}

#focus-overlay.is-focus-fullscreen #focus-badge-text {
    font-size: clamp(0.95rem, 1.6vw, 1.35rem) !important;
    margin-bottom: 0.5rem !important;
    margin-top: 0 !important;
}

#focus-overlay.is-focus-fullscreen #focus-status-subtitle {
    font-size: clamp(0.85rem, 1.3vw, 1.1rem) !important;
}

#focus-header-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.625rem !important;
}

#focus-overlay.is-focus-fullscreen #focus-header-info {
    gap: 0.875rem !important;
}

#focus-overlay.is-focus-fullscreen #focus-course-name {
    font-size: clamp(1.6rem, 3.2vw, 2.75rem) !important;
    line-height: 1.25 !important;
}

#focus-overlay.is-focus-fullscreen #focus-topic-name {
    font-size: clamp(0.95rem, 1.6vw, 1.2rem) !important;
    line-height: 1.45 !important;
}

/* Base Stats Grid Animation */
#focus-stats-grid {
    max-height: 80px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease,
                margin 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.3s ease !important;
}

/* Hide Time Numbers Mode (Clock area clicked) */
#focus-overlay.hide-time-numbers #focus-clock,
#focus-overlay.hide-time-numbers #focus-status-subtitle,
#focus-overlay.hide-time-numbers #focus-badge-text {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: scale(0.9) !important;
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease !important;
}

#focus-overlay.hide-time-numbers #focus-stats-grid {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-color: transparent !important;
    transform: scale(0.95) !important;
    pointer-events: none !important;
}

#focus-overlay.hide-time-numbers #focus-hidden-icon {
    opacity: 1 !important;
    visibility: visible !important;
    transform: scale(1) !important;
    transition: opacity 0.3s ease 0.1s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s, visibility 0.3s ease !important;
}

#focus-hidden-icon {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.85);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease !important;
}

#focus-overlay #focus-clock,
#focus-overlay #focus-status-subtitle,
#focus-overlay #focus-badge-text {
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease !important;
}

/* Mini Timer Capsule Widget - Hide Time Numbers State */
#mini-timer-widget.hide-time-numbers #mini-timer-clock {
    display: none !important;
}

/* Slow Rotating Aura Orbit for Custom Study Emblem */
@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-spin-slow {
    animation: spinSlow 24s linear infinite;
    transform-origin: 32px 32px;
}

/* ==========================================
   HABIT TRACKER & ROUTINES CUSTOM STYLES
   ========================================== */

.habit-card {
    transition: background-color 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
}

@media (hover: hover) and (pointer: fine) {
    .habit-card:hover {
        border-color: #CBD5E1;
        box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.04);
    }
}

.habit-check-btn {
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    user-select: none;
}

.habit-check-btn:active {
    transform: scale(0.94);
}

.habit-check-btn.checked {
    animation: habitCheckPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes habitCheckPop {
    0% { transform: scale(0.9); }
    50% { transform: scale(1.06); }
    100% { transform: scale(1); }
}

.streak-flame-badge {
    background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
    border: 1px solid #FED7AA;
    color: #C2410C;
}

.streak-flame-badge.active-fire {
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
    border: 1px solid #FECACA;
    color: #DC2626;
}

.matrix-cell-btn {
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.matrix-cell-btn:hover {
    opacity: 0.85;
}

.matrix-cell-btn:active {
    transform: scale(0.92);
}

.habit-chip-filter {
    transition: all 0.15s ease;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
    color: #64748B;
}

.habit-chip-filter:hover {
    border-color: #CBD5E1;
    color: #0F172A;
    background: #F8FAFC;
}

.habit-chip-filter.active {
    background: linear-gradient(180deg, #EEF2FF 0%, #E0E7FF 100%) !important;
    border: 1px solid #C7D2FE !important;
    color: #3B57CE !important;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 5px -1px rgba(75, 105, 225, 0.15);
}

html.dark .habit-chip-filter:not(.active) {
    background: #17243B !important;
    border: 1px solid #2B3D5E !important;
    color: #94A3B8 !important;
}

html.dark .habit-chip-filter:not(.active):hover {
    background: rgba(100, 148, 243, 0.18) !important;
    border-color: rgba(100, 148, 243, 0.45) !important;
    color: #C7D2FE !important;
}

html.dark .habit-chip-filter.active {
    background: linear-gradient(180deg, #6494F3 0%, #4B69E1 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(75, 105, 225, 0.4) !important;
}

/* Habit 14-day interactive timeline cells in dark mode */
html.dark #habits-cards-container button.bg-slate-50,
html.dark #habits-cards-container button.bg-slate-50\/80 {
    background-color: #17243B !important;
    border-color: #283958 !important;
    color: #94A3B8 !important;
}

html.dark #habits-cards-container button.bg-slate-50:hover {
    background-color: #1F3050 !important;
    border-color: #3D5480 !important;
    color: #FFFFFF !important;
}

html.dark .habit-card .w-0\.5.bg-slate-200\/90,
html.dark .habit-card .w-0\.5 {
    background-color: rgba(255, 255, 255, 0.12) !important;
}

/* Habit kebab menu dropdown in dark mode */
html.dark .habit-dropdown-container button:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    color: #F8FAFC !important;
}

html.dark [id^="habit-menu-dropdown-"] {
    background-color: #131E35 !important;
    border-color: #203052 !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.6) !important;
}

html.dark [id^="habit-menu-dropdown-"] button {
    color: #CBD5E1 !important;
}

html.dark [id^="habit-menu-dropdown-"] button:hover {
    background-color: rgba(100, 148, 243, 0.18) !important;
    color: #FFFFFF !important;
}

/* Color Accent Variants for Habit Badges */
.habit-accent-indigo {
    background-color: #EEF2FF;
    color: #4B69E1;
    border-color: #C7D2FE;
}
.habit-accent-emerald {
    background-color: #ECFDF5;
    color: #059669;
    border-color: #A7F3D0;
}
.habit-accent-amber {
    background-color: #FFFBEB;
    color: #D97706;
    border-color: #FDE68A;
}
.habit-accent-rose {
    background-color: #FFF1F2;
    color: #E11D48;
    border-color: #FECDD3;
}
.habit-accent-sky {
    background-color: #F0F9FF;
    color: #0284C7;
    border-color: #BAE6FD;
}
.habit-accent-purple {
    background-color: #FAF5FF;
    color: #9333EA;
    border-color: #E9D5FF;
}

/* ==========================================
   TODOS & STUDY TASKS CUSTOM STYLES
   ========================================== */

.todo-card {
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
}

/* Subtasks Accordion & Non-Tactile Toggle Button */
.todo-subtasks-toggle-btn {
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.todo-subtasks-toggle-btn,
.todo-subtasks-toggle-btn:hover,
.todo-subtasks-toggle-btn:active,
.todo-subtasks-toggle-btn:hover:active,
.todo-subtasks-toggle-btn:focus,
.todo-subtasks-toggle-btn:focus-visible {
    transform: none !important;
    scale: 1 !important;
    box-shadow: none !important;
    outline: none !important;
}

.todo-subtasks-toggle-btn.is-open {
    background: rgba(100, 148, 243, 0.08) !important;
    border-color: rgba(100, 148, 243, 0.25) !important;
    color: #4B69E1 !important;
}

html.dark .todo-subtasks-toggle-btn.is-open {
    background: rgba(100, 148, 243, 0.15) !important;
    border-color: rgba(100, 148, 243, 0.35) !important;
    color: #A5B4FC !important;
}

/* Subtasks Accordion Smooth Collapse/Expand Animation */
.todo-subtasks-wrapper {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease, margin-top 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
}

.todo-subtasks-wrapper.open {
    grid-template-rows: 1fr;
    opacity: 1;
    margin-top: 0.5rem;
}

.todo-subtasks-inner {
    overflow: hidden;
    min-height: 0;
}

.todo-check-btn {
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    user-select: none;
}

.todo-check-btn:active {
    transform: scale(0.88);
}

.todo-check-btn.checked {
    animation: todoCheckPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes todoCheckPop {
    0% { transform: scale(0.85); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.todo-chip-filter {
    transition: all 0.15s ease;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
    color: #64748B;
}

.todo-chip-filter:hover {
    border-color: #CBD5E1;
    color: #0F172A;
    background: #F8FAFC;
}

.todo-chip-filter.active {
    background: linear-gradient(180deg, #EEF2FF 0%, #E0E7FF 100%) !important;
    border: 1px solid #C7D2FE !important;
    color: #3B57CE !important;
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 5px -1px rgba(75, 105, 225, 0.15);
}

.todo-prio-btn,
.todo-date-btn,
.todo-course-pill {
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.todo-prio-btn:active,
.todo-date-btn:active,
.todo-course-pill:active {
    transform: scale(0.95);
}

.subtask-item {
    transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

/* ==========================================
   CHANDSAAT MODULAR DESIGN SYSTEM TOKENS & UTILITIES
   ========================================== */

/* 1. Segmented Control Sizing Variants */
.segmented-control.segmented-sm {
    padding: 2px;
    border-radius: 9999px;
}
.segmented-control.segmented-sm .segmented-indicator,
.segmented-control.segmented-sm .segmented-tab {
    padding: 4px 12px;
    font-size: 10px;
    border-radius: 9999px;
    gap: 4px;
}
.segmented-control.segmented-lg {
    padding: 4px;
    border-radius: 9999px;
}
.segmented-control.segmented-lg .segmented-indicator,
.segmented-control.segmented-lg .segmented-tab {
    padding: 8px 20px;
    font-size: 13px;
    border-radius: 9999px;
    gap: 8px;
}


/* 2. Tactile Button Sizing & Additional Color Variants */
.btn-tactile-amber {
    background: linear-gradient(180deg, #F59E0B 0%, #D97706 100%) !important;
    border: 1px solid #B45309 !important;
    box-shadow: 
        inset 0 1.5px 1px rgba(255, 255, 255, 0.4),
        0 4px 14px rgba(217, 119, 6, 0.35),
        0 1px 2px rgba(0, 0, 0, 0.1) !important;
}
.btn-tactile-amber:hover {
    box-shadow: 
        inset 0 1.5px 1px rgba(255, 255, 255, 0.5),
        0 6px 18px rgba(217, 119, 6, 0.45),
        0 2px 4px rgba(0, 0, 0, 0.12) !important;
    transform: translateY(-1px);
}
.btn-tactile-amber:active {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25) !important;
    transform: translateY(1px) !important;
}

.btn-tactile-sky {
    background: linear-gradient(180deg, #0EA5E9 0%, #0284C7 100%) !important;
    border: 1px solid #0369A1 !important;
    box-shadow: 
        inset 0 1.5px 1px rgba(255, 255, 255, 0.4),
        0 4px 14px rgba(2, 132, 199, 0.35),
        0 1px 2px rgba(0, 0, 0, 0.1) !important;
}
.btn-tactile-sky:hover {
    box-shadow: 
        inset 0 1.5px 1px rgba(255, 255, 255, 0.5),
        0 6px 18px rgba(2, 132, 199, 0.45),
        0 2px 4px rgba(0, 0, 0, 0.12) !important;
    transform: translateY(-1px);
}
.btn-tactile-sky:active {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.25) !important;
    transform: translateY(1px) !important;
}

.btn-tactile-sm {
    padding: 6px 12px !important;
    font-size: 11px !important;
    border-radius: 0.75rem !important;
}
.btn-tactile-lg {
    padding: 12px 24px !important;
    font-size: 14px !important;
    border-radius: 1.25rem !important;
}

/* ==========================================================================
   MODULAR TAB NAVIGATION SYSTEM
   ========================================================================== */
.module-tabs-container {
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 1.25rem;
    padding: 0.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    overflow-x: auto;
}

.module-tab-btn,
.settings-tab-btn {
    background: transparent;
    color: #64748B;
    border: 1px solid transparent;
    border-radius: 0.875rem;
    padding: 0.45rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: all 0.15s ease;
    box-shadow: none !important;
}

.module-tab-btn:hover:not(.active),
.settings-tab-btn:hover:not(.active) {
    background: #E2E8F0;
    color: #1E293B;
}

.module-tab-btn.active,
.settings-tab-btn.active {
    background: #FFFFFF !important;
    color: #4B69E1 !important;
    border: 1px solid #E2E8F0 !important;
    font-weight: 800;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important;
}

.module-tab-btn.active svg,
.settings-tab-btn.active svg {
    color: #4B69E1 !important;
}

/* Dark Mode - Modular Tab Navigation */
html.dark .module-tabs-container {
    background: #0B132B;
    border: 1px solid #1E2D4A;
}

html.dark .module-tab-btn,
html.dark .settings-tab-btn {
    color: #94A3B8;
}

html.dark .module-tab-btn:hover:not(.active),
html.dark .settings-tab-btn:hover:not(.active) {
    background: #17243B;
    color: #F1F5F9;
}

html.dark .module-tab-btn.active,
html.dark .settings-tab-btn.active {
    background: #1E2D4A !important;
    color: #818CF8 !important;
    border: 1px solid #2B3D5E !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
}

html.dark .module-tab-btn.active svg,
html.dark .settings-tab-btn.active svg {
    color: #818CF8 !important;
}

/* 3. Modular App Badges */
.app-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}
.app-badge-indigo {
    background-color: #EEF2FF;
    color: #4B69E1;
    border-color: #C7D2FE;
}
.app-badge-emerald {
    background-color: #ECFDF5;
    color: #059669;
    border-color: #A7F3D0;
}
.app-badge-amber {
    background-color: #FFFBEB;
    color: #D97706;
    border-color: #FDE68A;
}
.app-badge-rose {
    background-color: #FFF1F2;
    color: #E11D48;
    border-color: #FECDD3;
}
.app-badge-sky {
    background-color: #F0F9FF;
    color: #0284C7;
    border-color: #BAE6FD;
}
.app-badge-slate {
    background-color: #F1F5F9;
    color: #475569;
    border-color: #CBD5E1;
}
.app-badge-purple {
    background-color: #FAF5FF;
    color: #9333EA;
    border-color: #E9D5FF;
}

/* 4. Modular Metric / Stat Cards */
.app-card-stat {
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 1.5rem;
    padding: 1.25rem;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.9),
        0 4px 12px -2px rgba(15, 23, 42, 0.05);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}
.app-card-stat:hover {
    transform: translateY(-2px);
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 1),
        0 12px 24px -4px rgba(15, 23, 42, 0.08);
    border-color: #CBD5E1;
}

/* 5. Modular Inputs */
.app-input {
    width: 100%;
    background-color: #FFFFFF;
    border: 1px solid #E2E8F0;
    color: #0F172A;
    border-radius: 1rem;
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.app-input:focus {
    border-color: #6494F3;
    box-shadow: 0 0 0 3px rgba(100, 148, 243, 0.15);
}
.app-input::placeholder {
    color: #94A3B8;
}

/* 6. Modular Progress Ring Styles */
.progress-ring-circle {
    transition: stroke-dashoffset 0.6s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.3s ease;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

/* ==========================================
   7. MODULAR CUSTOM SELECT & DROPDOWN SYSTEM
   ========================================== */

.custom-select {
    position: relative;
    width: 100%;
    user-select: none;
}

.select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    border: 1px solid #E2E8F0;
    border-radius: 1rem;
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #0F172A;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 1.5px 3px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    outline: none;
}

.select-trigger:hover {
    border-color: #CBD5E1;
    background: #FFFFFF;
}

.custom-select.open .select-trigger,
.select-trigger:focus-visible {
    border-color: #6494F3 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(100, 148, 243, 0.15) !important;
}

.select-chevron {
    width: 1rem;
    height: 1rem;
    color: #94A3B8;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.custom-select.open .select-chevron {
    transform: rotate(180deg);
    color: #4B69E1;
}

/* Dropdown Panel with Spring Animation & Morphism */
.select-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 60;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 1.25rem;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 20px 40px -10px rgba(15, 23, 42, 0.18),
        0 4px 12px rgba(15, 23, 42, 0.05);
    padding: 0.375rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), 
                visibility 0.22s ease;
    transform-origin: top center;
    overflow: hidden;
}

/* Dropup Support (Opens Upwards when near bottom) */
.custom-select.dropup .select-dropdown {
    top: auto;
    bottom: calc(100% + 6px);
    transform: translateY(8px) scale(0.97);
    transform-origin: bottom center;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 1),
        0 -20px 40px -10px rgba(15, 23, 42, 0.18),
        0 -4px 12px rgba(15, 23, 42, 0.05);
}

.custom-select.open .select-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.custom-select.compact .select-trigger {
    padding: 0.35rem 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    min-width: 4.5rem;
    gap: 0.5rem;
}

.custom-select.compact .select-dropdown {
    min-width: 5.5rem;
    border-radius: 1rem;
    padding: 0.25rem;
}

.custom-select.compact .select-option {
    padding: 0.35rem 0.65rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
}

/* Search Box inside dropdown */
.select-search-box {
    position: relative;
    padding: 0.25rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid #F1F5F9;
}

.select-search-input {
    width: 100%;
    background-color: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 0.75rem;
    padding: 0.45rem 2rem 0.45rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #0F172A;
    outline: none;
    transition: all 0.15s ease;
}

.select-search-input:focus {
    background-color: #FFFFFF;
    border-color: #6494F3;
    box-shadow: 0 0 0 2px rgba(100, 148, 243, 0.12);
}

.select-search-icon {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.875rem;
    height: 0.875rem;
    color: #94A3B8;
    pointer-events: none;
}

/* Scrollable Options List with refined floating scrollbar */
.select-options-list {
    max-height: 210px;
    overflow-y: auto;
    padding: 0.25rem 0.25rem 0.25rem 0.5rem;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E1 transparent;
}

.select-options-list::-webkit-scrollbar {
    width: 4px;
}
.select-options-list::-webkit-scrollbar-track {
    background: transparent;
    margin: 8px 0;
}
.select-options-list::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 9999px;
}
.select-options-list::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Options Items */
.select-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.875rem;
    border-radius: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    margin-bottom: 2px;
    transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
    user-select: none;
}


.select-option:hover {
    background-color: #F1F5F9;
    color: #0F172A;
}

.select-option:active {
    transform: scale(0.99);
}

.select-option.selected {
    background: linear-gradient(180deg, #EEF2FF 0%, #E0E7FF 100%) !important;
    color: #3B57CE !important;
    font-weight: 700;
}

.select-option-check {
    width: 1rem;
    height: 1rem;
    color: #4B69E1;
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.select-option.selected .select-option-check {
    opacity: 1;
    transform: scale(1);
}

/* Multi-select Tags / Chips */
.select-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.625rem;
    flex: 1;
}

.select-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: linear-gradient(180deg, #EEF2FF 0%, #E0E7FF 100%);
    color: #3B57CE;
    border: 1px solid #C7D2FE;
    border-radius: 9999px;
    padding: 0.28rem 0.75rem 0.28rem 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
    box-shadow: 0 1px 2px rgba(75, 105, 225, 0.08);
    transition: all 0.15s ease;
    animation: chipPopIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.select-tag-chip:hover {
    border-color: #A5B4FC;
    box-shadow: 0 2px 5px rgba(75, 105, 225, 0.14);
}

@keyframes chipPopIn {
    0% { opacity: 0; transform: scale(0.82) translateY(2px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.select-tag-chip-remove {
    cursor: pointer;
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 9999px;
    background-color: rgba(100, 148, 243, 0.14);
    color: #4B69E1;
    font-size: 0.6875rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.15s ease;
}

.select-tag-chip-remove:hover {
    color: #E11D48;
    background-color: #FEE2E2;
    transform: scale(1.12);
}

.select-clear-all-btn {
    cursor: pointer;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #94A3B8;
    background: #F1F5F9;
    border-radius: 9999px;
    padding: 0.2rem 0.5rem;
    transition: all 0.15s ease;
}
.select-clear-all-btn:hover {
    color: #E11D48;
    background: #FEE2E2;
}


/* Size Variants */
.custom-select.select-sm .select-trigger {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.75rem;
}
.custom-select.select-sm .select-option {
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
}

.custom-select.select-md .select-trigger {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    border-radius: 1rem;
}

.custom-select.select-lg .select-trigger {
    padding: 0.875rem 1.25rem;
    font-size: 0.9375rem;
    border-radius: 1.25rem;
}
.custom-select.select-lg .select-option {
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
}

/* Disabled State */
.custom-select.disabled {
    opacity: 0.55;
    pointer-events: none;
}



/* ==========================================================================
   BADGES ARENA - SEAMLESS PATTERN (PROPORTIONAL SCALED TILES)
   ========================================================================== */

body.view-badges-active main {
    background-color: #0b1120 !important;
    background-image: url('../images/badges/badges_bg_pattern.png') !important;
    background-repeat: repeat !important;
    background-size: 260px auto !important; /* Scaled down perfectly while preserving 100% natural aspect ratio */
    background-position: 0 0 !important;
    background-attachment: local !important;
}

body.view-badges-active #view-badges {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

/* Badges Header Banner */
.badges-arena-header {
    background: rgba(15, 23, 42, 0.88) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

.badges-arena-header h2 {
    color: #FFFFFF !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.badges-arena-header p {
    color: #94A3B8 !important;
}

.badges-arena-count {
    background: rgba(30, 41, 59, 0.85) !important;
    color: #FDE047 !important;
    border: 1px solid rgba(253, 224, 71, 0.4) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   AUTHENTIC FULL GAME CARD SYSTEM (Tactile 3D Card Style)
   ========================================================================== */

.badge-card {
    position: relative;
    background: transparent;
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    aspect-ratio: 3 / 4.2;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), filter 0.25s ease;
    border: none;
    box-shadow: none;
    overflow: visible;
}

.badge-card:hover {
    z-index: 40;
    transform: translateY(-6px) scale(1.03);
    filter: drop-shadow(0 14px 24px rgba(15, 23, 42, 0.25));
}

/* Full Game Card Template Styles */
.badge-card.game-card-gold {
    background-image: url('../images/badges/full_card_gold.png');
}

.badge-card.game-card-champion {
    background-image: url('../images/badges/full_card_champion.png');
}

.badge-card.game-card-silver {
    background-image: url('../images/badges/full_card_silver.png');
}

.badge-card.game-card-bronze {
    background-image: url('../images/badges/full_card_bronze.png');
}

.badge-card.game-card-wood {
    background-image: url('../images/badges/full_card_wood.png');
}

.badge-card.game-card-locked {
    background-image: url('../images/badges/full_card_locked.png');
    opacity: 0.92;
}

/* Internal Badge Asset Window - Perfectly centered in the middle opening */
.badge-game-window {
    position: absolute;
    top: 22%;
    left: 50%;
    transform: translateX(-50%);
    width: 68%;
    height: 48%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}

.badge-game-window .badge-img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.45));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge-card:hover .badge-game-window .badge-img {
    transform: scale(1.12);
}

.badge-card.locked .badge-img {
    filter: grayscale(0.95) drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25));
    opacity: 0.75;
}

/* Bottom Title Ribbon & Hover Tooltip - Positioned exactly on the bottom ribbon plate */
.badge-game-nameplate {
    position: absolute;
    bottom: 9%;
    left: 50%;
    transform: translateX(-50%);
    width: 78%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
    z-index: 10;
}

.badge-game-title {
    font-family: 'Vazirmatn', sans-serif;
    color: #FFFFFF;
    font-size: 0.96rem;
    font-weight: bold;
    letter-spacing: -0.01em;
    text-shadow: 
        0 1px 0 rgba(0, 0, 0, 0.85),
        0 2px 4px rgba(0, 0, 0, 0.95),
        0 0 12px rgba(0, 0, 0, 0.75);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.badge-card.game-card-wood .badge-game-title {
    color: #FEF3C7;
    text-shadow: 0 2px 4px rgba(69, 26, 3, 0.95), 0 0 8px rgba(0, 0, 0, 0.8);
}

/* ==========================================================================
   AUTHENTIC 3D GAME PLAQUE TOOLTIP (Tactile 3D Plaque Style)
   ========================================================================== */

.badge-top-tooltip {
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(8px) scale(0.95);
    width: max-content;
    max-width: 220px;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
    z-index: 60;
}

.badge-card:hover .badge-top-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

.badge-tooltip-content {
    position: relative;
    background: linear-gradient(180deg, #1E1B4B 0%, #0F172A 100%);
    border: 2px solid #F59E0B;
    border-radius: 1.1rem;
    padding: 0.65rem 0.85rem;
    text-align: center;
    box-shadow: 
        inset 0 1.5px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6),
        0 14px 28px -4px rgba(0, 0, 0, 0.7),
        0 0 20px rgba(245, 158, 11, 0.3);
}

.badge-tooltip-title {
    display: block;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.78rem;
    font-weight: 900;
    color: #FDE047;
    letter-spacing: -0.01em;
    text-shadow: 
        0 1px 0 #78350F,
        0 2px 4px rgba(0, 0, 0, 0.95);
    margin-bottom: 0.25rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-tooltip-desc {
    font-family: 'Vazirmatn', sans-serif;
    font-size: 0.7rem;
    line-height: 1.5;
    color: #F8FAFC;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    margin: 0;
}

/* 3D Beveled Downward Arrow with Matching Border */
.badge-tooltip-arrow {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-6px) rotate(45deg);
    width: 12px;
    height: 12px;
    background: #0F172A;
    border-right: 2px solid #F59E0B;
    border-bottom: 2px solid #F59E0B;
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4);
    z-index: -1;
}

/* Tier Specific Tooltip Materials matching Card Elements */
.badge-card.game-card-champion .badge-tooltip-content {
    background: linear-gradient(180deg, #2E1065 0%, #0F172A 100%);
    border-color: #C084FC;
    box-shadow: 
        inset 0 1.5px 0 rgba(255, 255, 255, 0.5),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6),
        0 14px 28px -4px rgba(0, 0, 0, 0.7),
        0 0 22px rgba(168, 85, 247, 0.4);
}
.badge-card.game-card-champion .badge-tooltip-title {
    color: #E9D5FF;
    text-shadow: 0 1px 0 #581C87, 0 2px 4px rgba(0, 0, 0, 0.95);
    border-bottom-color: rgba(192, 132, 252, 0.3);
}
.badge-card.game-card-champion .badge-tooltip-arrow {
    background: #0F172A;
    border-color: #C084FC;
}

.badge-card.game-card-silver .badge-tooltip-content {
    background: linear-gradient(180deg, #1E293B 0%, #0F172A 100%);
    border-color: #94A3B8;
    box-shadow: 
        inset 0 1.5px 0 rgba(255, 255, 255, 0.5),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6),
        0 14px 28px -4px rgba(0, 0, 0, 0.7),
        0 0 18px rgba(148, 163, 184, 0.3);
}
.badge-card.game-card-silver .badge-tooltip-title {
    color: #E2E8F0;
    text-shadow: 0 1px 0 #334155, 0 2px 4px rgba(0, 0, 0, 0.95);
    border-bottom-color: rgba(148, 163, 184, 0.3);
}
.badge-card.game-card-silver .badge-tooltip-arrow {
    background: #0F172A;
    border-color: #94A3B8;
}

.badge-card.game-card-bronze .badge-tooltip-content {
    background: linear-gradient(180deg, #431407 0%, #0F172A 100%);
    border-color: #FB923C;
    box-shadow: 
        inset 0 1.5px 0 rgba(255, 255, 255, 0.4),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6),
        0 14px 28px -4px rgba(0, 0, 0, 0.7),
        0 0 18px rgba(234, 88, 12, 0.3);
}
.badge-card.game-card-bronze .badge-tooltip-title {
    color: #FFEDD5;
    text-shadow: 0 1px 0 #7C2D12, 0 2px 4px rgba(0, 0, 0, 0.95);
    border-bottom-color: rgba(251, 146, 60, 0.3);
}
.badge-card.game-card-bronze .badge-tooltip-arrow {
    background: #0F172A;
    border-color: #FB923C;
}

.badge-card.game-card-wood .badge-tooltip-content {
    background: linear-gradient(180deg, #451A03 0%, #1C1917 100%);
    border-color: #D97706;
    box-shadow: 
        inset 0 1.5px 0 rgba(255, 255, 255, 0.35),
        inset 0 -2px 0 rgba(0, 0, 0, 0.6),
        0 14px 28px -4px rgba(0, 0, 0, 0.7),
        0 0 16px rgba(217, 119, 6, 0.25);
}
.badge-card.game-card-wood .badge-tooltip-title {
    color: #FEF3C7;
    text-shadow: 0 1px 0 #78350F, 0 2px 4px rgba(0, 0, 0, 0.95);
    border-bottom-color: rgba(217, 119, 6, 0.3);
}
.badge-card.game-card-wood .badge-tooltip-arrow {
    background: #1C1917;
    border-color: #D97706;
}

/* Progress bar inside locked game card */
.badge-game-progress-box {
    position: absolute;
    bottom: 3.5%;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    z-index: 15;
}

.badge-game-progress {
    width: 100%;
    height: 6px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    overflow: hidden;
}

.badge-game-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #F59E0B 0%, #FBBF24 100%);
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   تنظیمات اختصاصی موقعیت نشان و متن برای هر سطح (قابل ویرایش توسط شما)
   ========================================================================== */

/* 🪵 ۱. سطح چوبی (Wood) */
.badge-card.game-card-wood .badge-game-window {
    top: 22%; /* فاصله آیکون از بالا */
    height: 48%; /* ارتفاع محفظه آیکون */
}
.badge-card.game-card-wood .badge-game-nameplate {
    bottom: 13%; /* فاصله متن از پایین */
}

/* 🥉 ۲. سطح برنزی (Bronze) */
.badge-card.game-card-bronze .badge-game-window {
    top: 22%; /* فاصله آیکون از بالا */
    height: 48%; /* ارتفاع محفظه آیکون */
}
.badge-card.game-card-bronze .badge-game-nameplate {
    bottom: 17.5%; /* فاصله متن از پایین */
}

/* 🥈 ۳. سطح نقره‌ای (Silver) */
.badge-card.game-card-silver .badge-game-window {
    top: 22%; /* فاصله آیکون از بالا */
    height: 48%; /* ارتفاع محفظه آیکون */
}
.badge-card.game-card-silver .badge-game-nameplate {
    bottom: 17.5%; /* فاصله متن از پایین */
}

/* 🥇 ۴. سطح طلایی (Gold) */
.badge-card.game-card-gold .badge-game-window {
    top: 22%; /* فاصله آیکون از بالا */
    height: 48%; /* ارتفاع محفظه آیکون */
}
.badge-card.game-card-gold .badge-game-nameplate {
    bottom: 18.5%; /* فاصله متن از پایین */
}

/* 💎 ۵. سطح چمپیون (Champion) */
.badge-card.game-card-champion .badge-game-window {
    top: 22%; /* فاصله آیکون از بالا */
    height: 48%; /* ارتفاع محفظه آیکون */
}
.badge-card.game-card-champion .badge-game-nameplate {
    bottom: 19%; /* فاصله متن از پایین */
}

/* 🔒 ۶. کارت‌های قفل‌شده (Locked) */
.badge-card.game-card-locked .badge-game-window {
    top: 22%; /* فاصله آیکون از بالا */
    height: 48%; /* ارتفاع محفظه آیکون */
}
.badge-card.game-card-locked .badge-game-nameplate {
    bottom: 12%; /* فاصله متن از پایین */
}


/* ==========================================================================
   SOFT & CALM LOCK SHAKE (NO RED GLOW, NATURAL SPRING RATTLE)
   ========================================================================== */

@keyframes lockCardSpringShake {
    0% {
        transform: translateY(-6px) scale(1.03) translate3d(0, 0, 0) rotate(0deg);
        filter: drop-shadow(0 14px 24px rgba(15, 23, 42, 0.25));
    }
    18% {
        transform: translateY(-6px) scale(1.025) translate3d(-3.5px, 0, 0) rotate(-1.5deg);
        filter: drop-shadow(0 14px 24px rgba(15, 23, 42, 0.3));
    }
    38% {
        transform: translateY(-6px) scale(1.028) translate3d(3px, 0, 0) rotate(1.2deg);
        filter: drop-shadow(0 14px 24px rgba(15, 23, 42, 0.28));
    }
    58% {
        transform: translateY(-6px) scale(1.03) translate3d(-1.5px, 0, 0) rotate(-0.6deg);
        filter: drop-shadow(0 14px 24px rgba(15, 23, 42, 0.25));
    }
    78% {
        transform: translateY(-6px) scale(1.03) translate3d(0.8px, 0, 0) rotate(0.3deg);
        filter: drop-shadow(0 14px 24px rgba(15, 23, 42, 0.25));
    }
    100% {
        transform: translateY(-6px) scale(1.03) translate3d(0, 0, 0) rotate(0deg);
        filter: drop-shadow(0 14px 24px rgba(15, 23, 42, 0.25));
    }
}

@keyframes lockPadlockRattle {
    0%, 100% {
        transform: scale(1.1) rotate(0deg);
    }
    20% {
        transform: scale(1.12) rotate(-3deg);
    }
    45% {
        transform: scale(1.11) rotate(2deg);
    }
    70% {
        transform: scale(1.1) rotate(-0.8deg);
    }
}

.badge-card.lock-shake {
    animation: lockCardSpringShake 0.38s cubic-bezier(0.25, 1, 0.5, 1) both !important;
    z-index: 50 !important;
}

.badge-card.lock-shake .badge-img {
    animation: lockPadlockRattle 0.38s cubic-bezier(0.25, 1, 0.5, 1) both !important;
}

/* ==========================================================================
   🌙 DARK MODE & THEME SYSTEM (Dark Glassmorphism & High-End Visuals)
   ========================================================================== */
html.dark {
    color-scheme: dark;
}

html.dark body { 
    background-color: #090D16 !important;
    color: #F1F5F9 !important;
}

html.dark #app-container {
    background-color: #090D16 !important;
}

html.dark #app-header {
    background-color: #0F172A !important;
    border-color: #1E293B !important;
}

html.dark #app-sidebar {
    background-color: #0F172A !important;
    border-color: #1E293B !important;
}

html.dark .bg-white {
    background-color: #131C31 !important;
}

html.dark .bg-window-bg {
    background-color: #090D16 !important;
}

html.dark .bg-slate-50,
html.dark .bg-slate-50\/60,
html.dark .bg-slate-50\/70,
html.dark .bg-slate-50\/80,
html.dark .bg-slate-50\/90 {
    background-color: #19243B !important;
}

html.dark .bg-slate-100,
html.dark .bg-slate-100\/80 {
    background-color: #23314D !important;
}

html.dark .bg-slate-200,
html.dark .bg-slate-200\/60,
html.dark .bg-slate-200\/80 {
    background-color: #2E3E5C !important;
}

html.dark .border-slate-100,
html.dark .border-slate-200,
html.dark .border-slate-200\/50,
html.dark .border-slate-200\/60,
html.dark .border-slate-200\/80,
html.dark .border-slate-200\/90,
html.dark .border-slate-300,
html.dark .border-slate-300\/80 {
    border-color: #23324C !important;
}

html.dark .text-slate-900,
html.dark .text-slate-800 {
    color: #F8FAFC !important;
}

html.dark .text-slate-700,
html.dark .text-slate-600 {
    color: #CBD5E1 !important;
}

html.dark .text-slate-500,
html.dark .text-slate-400 {
    color: #94A3B8 !important;
}

html.dark .shadow-subtle {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4) !important;
}

html.dark .shadow-soft {
    box-shadow: 0 4px 14px -2px rgba(0, 0, 0, 0.5) !important;
}

html.dark .shadow-floating {
    box-shadow: 0 16px 40px -6px rgba(0, 0, 0, 0.65) !important;
}

html.dark .card-morph {
    background: linear-gradient(180deg, #152037 0%, #0F172A 100%) !important;
    border-color: #243450 !important;
    box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.4) !important;
}

html.dark .modal-morph,
html.dark .modal-morph-no-anim {
    background: linear-gradient(180deg, #18233C 0%, #0F172A 100%) !important;
    border-color: #2C3D60 !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.08),
        inset 0 -2.5px 5px rgba(0, 0, 0, 0.4),
        0 25px 60px -10px rgba(0, 0, 0, 0.8),
        0 10px 20px -5px rgba(0, 0, 0, 0.5) !important;
}

html.dark input[type="text"],
html.dark input[type="number"],
html.dark input[type="time"],
html.dark input[type="date"],
html.dark textarea,
html.dark select {
    background-color: #172238 !important;
    color: #F8FAFC !important;
    border-color: #2B3D5E !important;
}

html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #64748B !important;
}

/* Frameless / Clean Stepper Inputs */
.input-frameless,
html.dark .input-frameless,
.input-frameless:focus,
html.dark .input-frameless:focus {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-width: 0 !important;
    border-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
    appearance: none !important;
}

/* TACTILE BUTTONS IN DARK MODE */
html.dark .btn-tactile-slate,
html.dark .btn-tactile-slate.text-slate-700,
html.dark .btn-tactile-slate.text-slate-600,
html.dark .btn-tactile-slate.text-slate-800 {
    background: linear-gradient(180deg, #1E2D4A 0%, #152038 100%) !important;
    border: 1px solid #2E4064 !important;
    color: #F1F5F9 !important;
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 -1px 1px rgba(0, 0, 0, 0.3),
        0 1.5px 3px rgba(0, 0, 0, 0.3) !important;
}

html.dark .btn-tactile-slate:hover,
html.dark .btn-tactile-slate:hover.text-slate-700,
html.dark .btn-tactile-slate:hover.text-slate-600,
html.dark .btn-tactile-slate:hover.text-slate-800 {
    background: linear-gradient(180deg, #26385C 0%, #1C2B4B 100%) !important;
    border-color: #405885 !important;
    color: #FFFFFF !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.12),
        0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

html.dark .btn-tactile-slate:active,
html.dark .btn-tactile-slate:hover:active {
    background: #111A2E !important;
    border-color: #243555 !important;
    color: #CBD5E1 !important;
    transform: translateY(1px) scale(0.98) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5) !important;
}

html.dark .btn-tactile-indigo {
    background: linear-gradient(180deg, #6494F3 0%, #4B69E1 100%) !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    color: #FFFFFF !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.38),
        inset 0 -1.5px 2px rgba(0, 0, 0, 0.2),
        0 2px 5px rgba(75, 105, 225, 0.22) !important;
}

html.dark .btn-tactile-indigo:hover {
    background: linear-gradient(180deg, #4B69E1 0%, #3B57CE 100%) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 3px 7px rgba(75, 105, 225, 0.32) !important;
}

html.dark .btn-tactile-indigo:active,
html.dark .btn-tactile-indigo:hover:active {
    background: #3730A3 !important;
    transform: translateY(1px) scale(0.98) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

html.dark .btn-tactile-emerald {
    background: linear-gradient(180deg, #10B981 0%, #059669 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.38),
        inset 0 -1.5px 2px rgba(0, 0, 0, 0.2),
        0 2px 5px rgba(16, 185, 129, 0.22) !important;
}

html.dark .btn-tactile-emerald:hover {
    background: linear-gradient(180deg, #059669 0%, #047857 100%) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 3px 7px rgba(16, 185, 129, 0.32) !important;
}

html.dark .btn-tactile-emerald:active,
html.dark .btn-tactile-emerald:hover:active {
    background: #065F46 !important;
    transform: translateY(1px) scale(0.98) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

html.dark .btn-tactile-rose {
    background: linear-gradient(180deg, #F43F5E 0%, #E11D48 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.38),
        inset 0 -1.5px 2px rgba(0, 0, 0, 0.2),
        0 2px 5px rgba(244, 63, 94, 0.22) !important;
}

html.dark .btn-tactile-rose:hover {
    background: linear-gradient(180deg, #E11D48 0%, #BE123C 100%) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 3px 7px rgba(244, 63, 94, 0.32) !important;
}

html.dark .btn-tactile-rose:active,
html.dark .btn-tactile-rose:hover:active {
    background: #9F1239 !important;
    transform: translateY(1px) scale(0.98) !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

/* Header & Utility Buttons in Dark Mode */
html.dark #btn-header-date,
html.dark #btn-header-theme {
    background: #152038 !important;
    border-color: #26385A !important;
    color: #CBD5E1 !important;
}

html.dark #btn-header-date:hover,
html.dark #btn-header-theme:hover {
    background: #1C2B4A !important;
    border-color: #384F78 !important;
    color: #FFFFFF !important;
}

/* Stepper (- / +) buttons in Dark Mode */
html.dark button[onclick*="adjust"],
html.dark button[onmousedown*="startAdjustingTarget"] {
    background: linear-gradient(180deg, #1E2D4A 0%, #152038 100%) !important;
    border: 1px solid #2E4064 !important;
    color: #F1F5F9 !important;
}

html.dark button[onclick*="adjust"]:hover,
html.dark button[onmousedown*="startAdjustingTarget"]:hover {
    background: linear-gradient(180deg, #26385C 0%, #1C2B4B 100%) !important;
    border-color: #405885 !important;
    color: #FFFFFF !important;
}

/* Template, batch and action buttons */
html.dark button[onclick*="openHabitTemplatesModal"],
html.dark button[onclick*="openTodoTemplatesModal"],
html.dark button[onclick*="moveAllOverdueToToday"],
html.dark #btn-batch-cancel {
    background: linear-gradient(180deg, #1E2D4A 0%, #152038 100%) !important;
    border: 1px solid #2E4064 !important;
    color: #F1F5F9 !important;
}

html.dark button[onclick*="openHabitTemplatesModal"]:hover,
html.dark button[onclick*="openTodoTemplatesModal"]:hover,
html.dark button[onclick*="moveAllOverdueToToday"]:hover,
html.dark #btn-batch-cancel:hover {
    background: linear-gradient(180deg, #26385C 0%, #1C2B4B 100%) !important;
    border-color: #405885 !important;
    color: #FFFFFF !important;
}

html.dark button[onclick*="closeModal"],
html.dark button[onclick*="removeCourseChip"],
html.dark button[onclick*="removeRoutineSlot"],
html.dark button[onclick*="removeHabitCategory"] {
    color: #94A3B8 !important;
}

html.dark button[onclick*="closeModal"]:hover {
    color: #F8FAFC !important;
}

html.dark button[onclick*="removeCourseChip"]:hover,
html.dark button[onclick*="removeRoutineSlot"]:hover,
html.dark button[onclick*="removeHabitCategory"]:hover {
    color: #FB7185 !important;
}

/* SIDEBAR NAVIGATION ITEMS IN DARK MODE */
html.dark .nav-item {
    border: 1px solid transparent !important;
    color: #94A3B8 !important;
    box-shadow: none !important;
    background: transparent !important;
}

html.dark .nav-item:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #F8FAFC !important;
    box-shadow: none !important;
}

html.dark .nav-item.active {
    background: linear-gradient(180deg, rgba(100, 148, 243, 0.22) 0%, rgba(75, 105, 225, 0.14) 100%) !important;
    border: 1px solid rgba(129, 140, 248, 0.35) !important;
    color: #818CF8 !important;
    font-weight: 700 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 8px -1px rgba(75, 105, 225, 0.25) !important;
}

html.dark .nav-item.active span {
    color: #818CF8 !important;
}

html.dark .nav-item.active svg {
    color: #818CF8 !important;
    stroke: #818CF8 !important;
}

html.dark .segmented-control {
    background-color: #0E1626 !important;
    border-color: #23324C !important;
}

html.dark .segmented-tab {
    color: #94A3B8 !important;
}

html.dark .segmented-tab:hover {
    color: #F1F5F9 !important;
}

html.dark .segmented-tab.active {
    color: #F8FAFC !important;
}

html.dark .segmented-indicator {
    background: #1E2D4B !important;
    border: 1px solid #304369 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4) !important;
}

html.dark .toggle-switch-track {
    background-color: #23314D !important;
}

html.dark .toggle-switch-knob {
    background-color: #94A3B8 !important;
}

html.dark .peer:checked ~ .toggle-switch-track {
    background-color: #4B69E1 !important;
}

html.dark .peer:checked ~ .toggle-switch-track .toggle-switch-knob {
    background-color: #FFFFFF !important;
}

/* Custom Dropdown Selects */
html.dark .custom-select-trigger,
html.dark [onclick*="toggleCustomSelect"] {
    background: #17243B !important;
    border-color: #2B3D5E !important;
    color: #F8FAFC !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
}

html.dark .custom-select-trigger span,
html.dark [onclick*="toggleCustomSelect"] span {
    color: #F8FAFC !important;
}

html.dark .custom-select-menu {
    background: #152038 !important;
    border-color: #2B3D5E !important;
    box-shadow: 0 16px 40px -6px rgba(0, 0, 0, 0.75) !important;
    color: #F8FAFC !important;
}

html.dark .custom-select-option {
    color: #CBD5E1 !important;
}

html.dark .custom-select-option:hover {
    background-color: #1E2E4E !important;
    color: #FFFFFF !important;
}

html.dark .custom-select-option.selected {
    background-color: rgba(75, 105, 225, 0.3) !important;
    color: #A5B4FC !important;
}

/* Chips & Pills (Presets, Courses, Filters) */
.todo-chip-filter {
    transition: all 0.15s ease;
    border: 1px solid #E2E8F0;
    background: #FFFFFF;
    color: #64748B;
}

.todo-chip-filter:hover {
    border-color: #CBD5E1;
    color: #0F172A;
    background: #F8FAFC;
}

.todo-chip-filter.active {
    background: linear-gradient(180deg, #EEF2FF 0%, #E0E7FF 100%) !important;
    border: 1px solid #C7D2FE !important;
    color: #3B57CE !important;
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 5px -1px rgba(75, 105, 225, 0.15);
}

html.dark .todo-chip-filter {
    background: #17243B !important;
    border-color: #2B3D5E !important;
    color: #94A3B8 !important;
}

html.dark .todo-chip-filter:hover {
    background: #1F3050 !important;
    border-color: #384F78 !important;
    color: #F1F5F9 !important;
}

html.dark .todo-chip-filter.active {
    background: linear-gradient(180deg, #3B57CE 0%, #3730A3 100%) !important;
    border-color: #6494F3 !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(75, 105, 225, 0.4) !important;
}

html.dark .timer-course-pill:not(.selected),
html.dark .wizard-course-pill:not(.selected) {
    background: #17243B !important;
    border-color: #2B3D5E !important;
    color: #CBD5E1 !important;
}

html.dark .timer-course-pill:not(.selected):hover,
html.dark .wizard-course-pill:not(.selected):hover {
    background: #1F3050 !important;
    border-color: #384F78 !important;
    color: #FFFFFF !important;
}

html.dark .timer-course-pill.selected,
html.dark .wizard-course-pill.selected {
    background: #4B69E1 !important;
    border-color: #6494F3 !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(75, 105, 225, 0.4) !important;
}

html.dark .timer-course-pill.selected svg {
    color: #FFFFFF !important;
}

html.dark .preset-chip:not(.active),
html.dark .smart-preset-chip:not(.active),
html.dark #smart-presets-container button:not(.active),
html.dark #timer-courses-pills button:not(.active),
html.dark #home-courses-pills button:not(.active),
html.dark #habits-category-filter-chips button:not(.active) {
    background: #17243B !important;
    border: 1px solid #2B3D5E !important;
    color: #CBD5E1 !important;
}

html.dark .preset-chip:not(.active):hover,
html.dark .smart-preset-chip:not(.active):hover,
html.dark #smart-presets-container button:not(.active):hover,
html.dark #timer-courses-pills button:not(.active):hover,
html.dark #home-courses-pills button:not(.active):hover,
html.dark #habits-category-filter-chips button:not(.active):hover {
    background: rgba(100, 148, 243, 0.18) !important;
    border-color: rgba(100, 148, 243, 0.45) !important;
    color: #C7D2FE !important;
}

html.dark .course-pill.active,
html.dark #timer-courses-pills button.active,
html.dark #home-courses-pills button.active,
html.dark #habits-category-filter-chips button.active {
    background: linear-gradient(180deg, #6494F3 0%, #4B69E1 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(75, 105, 225, 0.4) !important;
}

/* Habit Heatmap Cells */
.heatmap-cell {
    background-color: rgba(241, 245, 249, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.6);
}
.heatmap-cell:hover {
    border-color: #94A3B8;
}
.heatmap-cell.level-1 {
    background-color: #A7F3D0;
    border-color: #6EE7B7;
}
.heatmap-cell.level-2 {
    background-color: #34D399;
    border-color: #10B981;
}
.heatmap-cell.level-3 {
    background-color: #059669;
    border-color: #047857;
}
.heatmap-cell.level-4 {
    background-color: #047857;
    border-color: #065F46;
}

html.dark .heatmap-cell {
    background-color: #172238 !important;
    border-color: #22324C !important;
}
html.dark .heatmap-cell:hover {
    border-color: #475569 !important;
}
html.dark .heatmap-cell.level-1 {
    background-color: #064E3B !important;
    border-color: #047857 !important;
}
html.dark .heatmap-cell.level-2 {
    background-color: #047857 !important;
    border-color: #059669 !important;
}
html.dark .heatmap-cell.level-3 {
    background-color: #059669 !important;
    border-color: #10B981 !important;
}
html.dark .heatmap-cell.level-4 {
    background-color: #10B981 !important;
    border-color: #34D399 !important;
}

html.dark #habits-heatmap-summary > div {
    background-color: #141E34 !important;
    border-color: #22324C !important;
}

/* Timeline & Calendar Day Pills */
html.dark .timeline-day-pill {
    background-color: #17243B !important;
    border-color: #2B3D5E !important;
    color: #94A3B8 !important;
}
html.dark .timeline-day-pill:hover {
    background-color: #1F3050 !important;
    color: #F1F5F9 !important;
}
html.dark .timeline-day-pill.active {
    background: #4B69E1 !important;
    border-color: #6494F3 !important;
    color: #FFFFFF !important;
}

/* History Group Day Headers and Pills */
html.dark #historyList > div {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* Habit & Todo cards & Check buttons in Dark Mode */
html.dark .habit-card,
html.dark .todo-card {
    background: #131E35 !important;
    border: 1px solid #1E2D4A !important;
    color: #F1F5F9 !important;
}
html.dark .habit-card:hover {
    background: #131E35 !important;
    border-color: #1E2D4A !important;
}
html.dark .habit-card.bg-emerald-50\/40,
html.dark .todo-card.bg-emerald-50\/40 {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}
html.dark .habit-check-btn:not(.checked),
html.dark .todo-check-btn:not(.checked) {
    background: #17243B !important;
    border: 1px solid #2D3E60 !important;
    color: transparent !important;
}
html.dark .habit-check-btn:not(.checked):hover,
html.dark .todo-check-btn:not(.checked):hover {
    border-color: #6494F3 !important;
    background: #1F3050 !important;
}
html.dark .habit-check-btn.checked,
html.dark .todo-check-btn.checked {
    background: #10B981 !important;
    border-color: #059669 !important;
    color: #FFFFFF !important;
}

/* Home view widget action buttons in MAIN content only */
html.dark main button[onclick*="switchView('history')"],
html.dark main button[onclick*="switchView('habits')"],
html.dark main button[onclick*="switchView('todos')"] {
    background: rgba(100, 148, 243, 0.15) !important;
    border-color: rgba(100, 148, 243, 0.3) !important;
    color: #C7D2FE !important;
}
html.dark main button[onclick*="switchView('history')"]:hover,
html.dark main button[onclick*="switchView('habits')"]:hover,
html.dark main button[onclick*="switchView('todos')"]:hover {
    background: rgba(100, 148, 243, 0.28) !important;
    border-color: rgba(100, 148, 243, 0.5) !important;
    color: #FFFFFF !important;
}

/* Strictly enforce transparent background and borders on all non-active sidebar nav items */
html.dark #app-sidebar .nav-item:not(.active),
html.dark #app-sidebar button.nav-item:not(.active) {
    background: transparent !important;
    border-color: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    color: #94A3B8 !important;
}

html.dark #app-sidebar .nav-item:not(.active):hover,
html.dark #app-sidebar button.nav-item:not(.active):hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #F8FAFC !important;
}

/* Home quick list cards & empty state */
html.dark #home-quick-todos-list > div,
html.dark #home-quick-habits-list > div.col-span-full {
    background-color: #111A2E !important;
    border-color: #1E2D4A !important;
}

/* Sidebar Badges & Muted Version Footer in Dark Mode */
#sidebar-habits-badge,
#sidebar-todos-badge {
    font-family: inherit !important;
    font-feature-settings: "ss01" 1, "ss02" 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.25rem;
    padding: 0 0.35rem;
    text-align: center;
}

html.dark #sidebar-habits-badge,
html.dark #sidebar-todos-badge {
    background: rgba(100, 148, 243, 0.18) !important;
    border-color: rgba(100, 148, 243, 0.35) !important;
    color: #C7D2FE !important;
}
html.dark aside .bg-slate-50\/70 {
    background-color: rgba(255, 255, 255, 0.02) !important;
    border-color: rgba(255, 255, 255, 0.06) !important;
}
html.dark aside .bg-slate-50\/40 {
    background-color: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #94A3B8 !important;
}

/* Translucent Colored Badges in Dark Mode */
html.dark .bg-indigo-50,
html.dark .bg-indigo-50\/40,
html.dark .bg-indigo-50\/60,
html.dark .bg-indigo-50\/70,
html.dark .bg-indigo-50\/80,
html.dark .bg-indigo-50\/90,
html.dark .bg-indigo-100,
html.dark .bg-indigo-100\/80,
html.dark .bg-indigo-100\/90 {
    background-color: rgba(100, 148, 243, 0.16) !important;
}
html.dark .text-indigo-950,
html.dark .text-indigo-900,
html.dark .text-indigo-800,
html.dark .text-indigo-700,
html.dark .text-indigo-600 {
    color: #A5B4FC !important;
}
html.dark .border-indigo-100,
html.dark .border-indigo-100\/60,
html.dark .border-indigo-100\/80,
html.dark .border-indigo-200 {
    border-color: rgba(100, 148, 243, 0.3) !important;
}

html.dark .bg-blue-50,
html.dark .bg-blue-50\/40,
html.dark .bg-blue-50\/60,
html.dark .bg-blue-50\/70,
html.dark .bg-blue-50\/80,
html.dark .bg-blue-50\/90,
html.dark .bg-blue-100,
html.dark .bg-blue-100\/80 {
    background-color: rgba(59, 130, 246, 0.16) !important;
}
html.dark .text-blue-950,
html.dark .text-blue-900,
html.dark .text-blue-800,
html.dark .text-blue-700,
html.dark .text-blue-600 {
    color: #93C5FD !important;
}
html.dark .border-blue-100,
html.dark .border-blue-200,
html.dark .border-blue-200\/80 {
    border-color: rgba(59, 130, 246, 0.3) !important;
}

html.dark .bg-orange-50,
html.dark .bg-orange-50\/40,
html.dark .bg-orange-50\/60,
html.dark .bg-orange-50\/70,
html.dark .bg-orange-50\/80,
html.dark .bg-orange-50\/90,
html.dark .bg-orange-100,
html.dark .bg-orange-100\/80 {
    background-color: rgba(249, 115, 22, 0.16) !important;
}
html.dark .text-orange-950,
html.dark .text-orange-900,
html.dark .text-orange-800,
html.dark .text-orange-700,
html.dark .text-orange-600 {
    color: #FDBA74 !important;
}
html.dark .border-orange-100,
html.dark .border-orange-200,
html.dark .border-orange-200\/80 {
    border-color: rgba(249, 115, 22, 0.3) !important;
}

html.dark .bg-emerald-50,
html.dark .bg-emerald-50\/40,
html.dark .bg-emerald-50\/60,
html.dark .bg-emerald-50\/70,
html.dark .bg-emerald-50\/80,
html.dark .bg-emerald-50\/90,
html.dark .bg-emerald-100,
html.dark .bg-emerald-100\/80 {
    background-color: rgba(16, 185, 129, 0.16) !important;
}
html.dark .text-emerald-950,
html.dark .text-emerald-900,
html.dark .text-emerald-800,
html.dark .text-emerald-700,
html.dark .text-emerald-600 {
    color: #6EE7B7 !important;
}
html.dark .border-emerald-100,
html.dark .border-emerald-100\/80,
html.dark .border-emerald-200,
html.dark .border-emerald-300\/80 {
    border-color: rgba(16, 185, 129, 0.3) !important;
}

html.dark .bg-amber-50,
html.dark .bg-amber-50\/40,
html.dark .bg-amber-50\/60,
html.dark .bg-amber-50\/70,
html.dark .bg-amber-50\/80,
html.dark .bg-amber-100,
html.dark .bg-amber-100\/80 {
    background-color: rgba(245, 158, 11, 0.16) !important;
}
html.dark .text-amber-950,
html.dark .text-amber-900,
html.dark .text-amber-800,
html.dark .text-amber-700,
html.dark .text-amber-600 {
    color: #FDE68A !important;
}
html.dark .border-amber-100,
html.dark .border-amber-200 {
    border-color: rgba(245, 158, 11, 0.3) !important;
}

html.dark .bg-rose-50,
html.dark .bg-rose-50\/40,
html.dark .bg-rose-50\/60,
html.dark .bg-rose-50\/70,
html.dark .bg-rose-50\/80,
html.dark .bg-rose-100,
html.dark .bg-rose-100\/80 {
    background-color: rgba(244, 63, 94, 0.16) !important;
}
html.dark .text-rose-950,
html.dark .text-rose-900,
html.dark .text-rose-800,
html.dark .text-rose-700,
html.dark .text-rose-600 {
    color: #FDA4AF !important;
}
html.dark .border-rose-100,
html.dark .border-rose-200 {
    border-color: rgba(244, 63, 94, 0.3) !important;
}

html.dark .bg-purple-50,
html.dark .bg-purple-50\/40,
html.dark .bg-purple-50\/60,
html.dark .bg-purple-50\/70,
html.dark .bg-purple-50\/80,
html.dark .bg-purple-100,
html.dark .bg-purple-100\/80 {
    background-color: rgba(168, 85, 247, 0.16) !important;
}
html.dark .text-purple-950,
html.dark .text-purple-900,
html.dark .text-purple-800,
html.dark .text-purple-700,
html.dark .text-purple-600 {
    color: #D8B4FE !important;
}
html.dark .border-purple-100,
html.dark .border-purple-200 {
    border-color: rgba(168, 85, 247, 0.3) !important;
}

html.dark .bg-sky-50,
html.dark .bg-sky-50\/40,
html.dark .bg-sky-50\/60,
html.dark .bg-sky-50\/70,
html.dark .bg-sky-50\/80,
html.dark .bg-sky-100,
html.dark .bg-sky-100\/80 {
    background-color: rgba(14, 165, 233, 0.16) !important;
}
html.dark .text-sky-950,
html.dark .text-sky-900,
html.dark .text-sky-800,
html.dark .text-sky-700,
html.dark .text-sky-600 {
    color: #7DD3FC !important;
}
html.dark .border-sky-100,
html.dark .border-sky-200 {
    border-color: rgba(14, 165, 233, 0.3) !important;
}

/* Subtle section divider lines in Dark Mode */
html.dark .border-slate-100,
html.dark .border-slate-100\/90,
html.dark .border-slate-100\/80,
html.dark .border-slate-100\/60 {
    border-color: rgba(255, 255, 255, 0.07) !important;
}

/* Subtasks Progress Bar & Checklist */
html.dark .subtask-item {
    background-color: #17243B !important;
    border-color: #28364F !important;
}
html.dark .subtask-item:hover {
    background-color: #1E2D4A !important;
}

/* Progress ring background circle & text in Dark Mode */
html.dark svg path.text-slate-100,
html.dark svg circle.text-slate-100,
html.dark svg circle[stroke="#E2E8F0"],
html.dark svg circle[stroke="#f1f5f9"],
html.dark svg circle[stroke="#F1F5F9"] {
    stroke: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.08) !important;
}

html.dark #home-habits-percent-text,
html.dark #home-todos-percent-text,
html.dark [id$="-percent-text"] {
    color: #F8FAFC !important;
}

html.dark ::-webkit-scrollbar-thumb { 
    background: #2E3E5C !important; 
}

html.dark ::-webkit-scrollbar-thumb:hover { 
    background: #3D5075 !important; 
}

/* ==========================================
   MODAL CONTROLS & PICKERS IN DARK MODE
   ========================================== */

/* Habit, Todo & Routine Slot Icon Picker Grid */
html.dark #habit-icon-picker,
html.dark #todo-icon-picker,
html.dark #routine-slot-icon-picker {
    background-color: #111A2E !important;
    border-color: #1E2D4A !important;
}

html.dark .habit-icon-btn:not(.active),
html.dark .todo-icon-btn:not(.active),
html.dark .routine-slot-icon-btn:not(.active) {
    background-color: #17243B !important;
    border-color: #263858 !important;
    color: #94A3B8 !important;
}

html.dark .habit-icon-btn:not(.active):hover,
html.dark .todo-icon-btn:not(.active):hover,
html.dark .routine-slot-icon-btn:not(.active):hover {
    background-color: rgba(100, 148, 243, 0.22) !important;
    border-color: rgba(100, 148, 243, 0.5) !important;
    color: #FFFFFF !important;
}

html.dark .habit-icon-btn.active,
html.dark .todo-icon-btn.active,
html.dark .routine-slot-icon-btn.active {
    background: linear-gradient(180deg, #6494F3 0%, #4B69E1 100%) !important;
    border-color: #6494F3 !important;
    color: #FFFFFF !important;
    box-shadow: 0 0 0 2px rgba(100, 148, 243, 0.4), 0 2px 8px rgba(75, 105, 225, 0.45) !important;
}

/* Habit & Todo Modal Category Pills */
html.dark .habit-category-pill:not(.active),
html.dark .todo-category-pill:not(.active) {
    background-color: #17243B !important;
    border-color: #2B3D5E !important;
    color: #CBD5E1 !important;
}

html.dark .habit-category-pill:not(.active):hover,
html.dark .todo-category-pill:not(.active):hover {
    background-color: rgba(100, 148, 243, 0.18) !important;
    border-color: rgba(100, 148, 243, 0.45) !important;
    color: #FFFFFF !important;
}

html.dark .habit-category-pill.active,
html.dark .todo-category-pill.active {
    background: linear-gradient(180deg, #6494F3 0%, #4B69E1 100%) !important;
    border-color: #6494F3 !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(75, 105, 225, 0.35) !important;
}

html.dark .habit-category-add-chip,
html.dark .todo-category-add-chip {
    background-color: rgba(100, 148, 243, 0.12) !important;
    border-color: rgba(100, 148, 243, 0.35) !important;
    color: #C7D2FE !important;
}

html.dark .habit-category-add-chip:hover,
html.dark .todo-category-add-chip:hover {
    background-color: rgba(100, 148, 243, 0.25) !important;
    border-color: rgba(100, 148, 243, 0.6) !important;
    color: #FFFFFF !important;
}

/* Routine Time Slot Buttons in Modal */
html.dark .habit-time-btn:not(.active) {
    background-color: #17243B !important;
    border-color: #283958 !important;
    color: #CBD5E1 !important;
}

html.dark .habit-time-btn:not(.active):hover {
    background-color: rgba(100, 148, 243, 0.18) !important;
    border-color: rgba(100, 148, 243, 0.45) !important;
    color: #FFFFFF !important;
}

html.dark .habit-time-btn.active {
    background: linear-gradient(180deg, #6494F3 0%, #4B69E1 100%) !important;
    border-color: #6494F3 !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(75, 105, 225, 0.35) !important;
}

html.dark .habit-time-btn.active svg {
    color: #FFFFFF !important;
    stroke: #FFFFFF !important;
}

/* Modal Color Picker Swatches */
html.dark #habit-color-picker,
html.dark #todo-color-picker,
html.dark #routine-slot-color-picker {
    background-color: #111A2E !important;
    border-color: #1E2D4A !important;
}

html.dark .habit-color-btn.active,
html.dark .todo-color-btn.active,
html.dark .routine-slot-color-btn.active {
    box-shadow: 0 0 0 2px #0F172A, 0 0 0 4px #818CF8 !important;
}

/* Modal Preview Cards */
html.dark #habit-modal .md\:col-span-5,
html.dark #todo-modal .md\:col-span-5 {
    background-color: #111A2E !important;
    border-color: #1E2D4A !important;
}

html.dark #habit-modal .bg-white.border-slate-200\/90,
html.dark #todo-modal .bg-white.border-slate-200\/90 {
    background-color: #152038 !important;
    border-color: #233352 !important;
}

/* Settings: Routine Slots & Categories */
html.dark #settings-routine-slots-count {
    background: rgba(100, 148, 243, 0.18) !important;
    border-color: rgba(100, 148, 243, 0.35) !important;
    color: #C7D2FE !important;
}

html.dark .routine-slot-card {
    background-color: #131E35 !important;
    border: 1px solid #1E2D4A !important;
    color: #F1F5F9 !important;
}

html.dark .routine-slot-card .bg-white.border-slate-200\/70 {
    background-color: #0E1626 !important;
    border-color: #1B2943 !important;
    color: #CBD5E1 !important;
}

html.dark .routine-slot-card button:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark #settings-habit-categories-chips > div {
    background-color: #17243B !important;
    border-color: #283958 !important;
    color: #CBD5E1 !important;
}

html.dark #settings-habit-categories-chips .bg-indigo-100 {
    background-color: rgba(100, 148, 243, 0.3) !important;
    color: #E0E7FF !important;
}

html.dark button[onclick*="restoreDefaultRoutineSlots"],
html.dark button[onclick*="restoreDefaultHabitCategories"] {
    background-color: #17243B !important;
    border-color: #283958 !important;
    color: #94A3B8 !important;
}

html.dark button[onclick*="restoreDefaultRoutineSlots"]:hover,
html.dark button[onclick*="restoreDefaultHabitCategories"]:hover {
    background-color: #1F3050 !important;
    border-color: #3D5480 !important;
    color: #FFFFFF !important;
}

/* History View & Day Groups in Dark Mode */
html.dark .history-day-header {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    color: #F1F5F9 !important;
    box-shadow: none !important;
}

html.dark .history-day-header .font-extrabold {
    color: #F1F5F9 !important;
}

html.dark .history-day-duration-badge {
    background-color: rgba(100, 148, 243, 0.15) !important;
    border: 1px solid rgba(100, 148, 243, 0.35) !important;
    color: #C7D2FE !important;
}

html.dark .history-day-tests-badge {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border: 1px solid rgba(16, 185, 129, 0.35) !important;
    color: #6EE7B7 !important;
}

html.dark .history-item {
    background: transparent !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #F1F5F9 !important;
    box-shadow: none !important;
}

html.dark .history-item:hover {
    background: rgba(255, 255, 255, 0.03) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

html.dark .history-item .text-slate-800 {
    color: #F1F5F9 !important;
}

html.dark .history-item .text-slate-500 {
    color: #94A3B8 !important;
}

html.dark .history-item .bg-indigo-50 {
    background-color: rgba(100, 148, 243, 0.15) !important;
    border-color: rgba(100, 148, 243, 0.3) !important;
    color: #A5B4FC !important;
}

/* History Item Delete Button */
.history-delete-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #94A3B8;
    transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.history-delete-btn:hover {
    background-color: #FFE4E6 !important; /* rose-100 */
    color: #E11D48 !important; /* rose-600 */
    transform: scale(1.1);
}

.history-delete-btn:active {
    transform: scale(0.92);
}

html.dark .history-delete-btn {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #64748B !important;
}

html.dark .history-delete-btn:hover {
    background-color: rgba(244, 63, 94, 0.18) !important;
    color: #FB7185 !important;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.25) !important;
    transform: scale(1.1);
}

html.dark .history-delete-btn:active {
    transform: scale(0.92);
}

html.dark .history-item .bg-emerald-50 {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    color: #6EE7B7 !important;
}


/* Custom Select Dropdowns in Dark Mode */
html.dark .select-trigger {
    background-color: #17243B !important;
    border-color: #283958 !important;
    color: #F1F5F9 !important;
}

html.dark .select-trigger:hover {
    background-color: #1E2D4A !important;
    border-color: #3D5480 !important;
    color: #FFFFFF !important;
}

html.dark .custom-select.open .select-trigger {
    border-color: #6494F3 !important;
    box-shadow: 0 0 0 3px rgba(100, 148, 243, 0.25) !important;
}

html.dark .select-dropdown {
    background: #131E35 !important;
    border: 1px solid #283958 !important;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7), 0 4px 16px rgba(0, 0, 0, 0.5) !important;
}

html.dark .select-search-box {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

html.dark .select-search-input {
    background-color: #0E1626 !important;
    border-color: #233352 !important;
    color: #F1F5F9 !important;
}

html.dark .select-search-input:focus {
    background-color: #111A2E !important;
    border-color: #6494F3 !important;
}

html.dark .select-options-list {
    scrollbar-color: #2E3E5C transparent !important;
}

/* ==========================================================================
   CUSTOM TACTILE CHECKBOX COMPONENT (Spring & Pop Animation)
   ========================================================================== */
.custom-checkbox-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.custom-checkbox-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.custom-checkbox-box {
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 0.45rem;
    border: 1.5px solid #CBD5E1;
    background-color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                box-shadow 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.custom-checkbox-wrap:hover .custom-checkbox-box {
    border-color: #818CF8;
    background-color: #EEF2FF;
    transform: scale(1.08);
}

.custom-checkbox-wrap:active .custom-checkbox-box {
    transform: scale(0.9);
}

.custom-checkbox-input:checked + .custom-checkbox-box {
    background: linear-gradient(135deg, #6494F3 0%, #4B69E1 100%);
    border-color: #4B69E1;
    box-shadow: 0 2px 8px rgba(75, 105, 225, 0.4);
    animation: checkbox-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-checkbox-icon {
    width: 0.8rem;
    height: 0.8rem;
    color: #FFFFFF;
    stroke-width: 3;
    opacity: 0;
    transform: scale(0.3) rotate(-20deg);
    transition: opacity 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
}

.custom-checkbox-input:checked + .custom-checkbox-box .custom-checkbox-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    animation: checkmark-draw 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.05s;
}

@keyframes checkbox-pop {
    0% { transform: scale(0.85); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes checkmark-draw {
    0% {
        stroke-dashoffset: 24;
        transform: scale(0.5) rotate(-15deg);
    }
    100% {
        stroke-dashoffset: 0;
        transform: scale(1) rotate(0deg);
    }
}

/* Ripple wave effect on checkbox */
.custom-checkbox-box::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 0.6rem;
    background: rgba(100, 148, 243, 0.3);
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-checkbox-input:checked + .custom-checkbox-box::after {
    opacity: 0;
    transform: scale(1.3);
    animation: checkbox-ripple 0.4s ease-out;
}

@keyframes checkbox-ripple {
    0% { opacity: 0.8; transform: scale(0.8); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* Custom Checkbox Dark Mode */
html.dark .custom-checkbox-box {
    border-color: #334155;
    background-color: #162033;
    box-shadow: none;
}

html.dark .custom-checkbox-wrap:hover .custom-checkbox-box {
    border-color: #818CF8;
    background-color: rgba(100, 148, 243, 0.18);
}

html.dark .custom-checkbox-input:checked + .custom-checkbox-box {
    background: linear-gradient(135deg, #6494F3 0%, #4B69E1 100%);
    border-color: #818CF8;
    box-shadow: 0 0 14px rgba(100, 148, 243, 0.6);
}

/* Custom Checkbox - Todo Task Circular Variant */
.custom-checkbox-wrap.custom-checkbox-todo .custom-checkbox-box {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 9999px;
    border: 1.5px solid #CBD5E1;
    background-color: #F8FAFC;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.custom-checkbox-wrap.custom-checkbox-todo:hover .custom-checkbox-box {
    border-color: #10B981;
    background-color: rgba(16, 185, 129, 0.08);
    transform: scale(1.06);
}

.custom-checkbox-wrap.custom-checkbox-todo:active .custom-checkbox-box {
    transform: scale(0.92);
}

.custom-checkbox-wrap.custom-checkbox-todo .custom-checkbox-input:checked + .custom-checkbox-box {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
    border-color: #059669 !important;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.45) !important;
}

.custom-checkbox-wrap.custom-checkbox-todo .custom-checkbox-icon {
    width: 0.95rem;
    height: 0.95rem;
}

.custom-checkbox-wrap.custom-checkbox-todo .custom-checkbox-box::after {
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.35);
}

/* Dark Mode - Todo Checkbox */
html.dark .custom-checkbox-wrap.custom-checkbox-todo .custom-checkbox-box {
    border-color: #2D3E60;
    background-color: rgba(255, 255, 255, 0.04);
}

html.dark .custom-checkbox-wrap.custom-checkbox-todo:hover .custom-checkbox-box {
    border-color: #34D399;
    background-color: rgba(16, 185, 129, 0.16);
}

html.dark .custom-checkbox-wrap.custom-checkbox-todo .custom-checkbox-input:checked + .custom-checkbox-box {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
    border-color: #34D399 !important;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.55) !important;
}

/* Custom Checkbox - Subtask Mini Variant */
.custom-checkbox-wrap.custom-checkbox-subtask .custom-checkbox-box {
    width: 1.15rem;
    height: 1.15rem;
    border-radius: 0.35rem;
    border: 1.5px solid #CBD5E1;
    background-color: #FFFFFF;
}

.custom-checkbox-wrap.custom-checkbox-subtask .custom-checkbox-input:checked + .custom-checkbox-box {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
    border-color: #059669 !important;
    box-shadow: 0 1px 6px rgba(16, 185, 129, 0.35) !important;
}

.custom-checkbox-wrap.custom-checkbox-subtask .custom-checkbox-icon {
    width: 0.75rem;
    height: 0.75rem;
}

html.dark .custom-checkbox-wrap.custom-checkbox-subtask .custom-checkbox-box {
    border-color: #2D3E60;
    background-color: rgba(255, 255, 255, 0.04);
}

html.dark .custom-checkbox-wrap.custom-checkbox-subtask .custom-checkbox-input:checked + .custom-checkbox-box {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
    border-color: #34D399 !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.45) !important;
}

/* History Pagination Controls Dark Mode */
html.dark #history-pagination-container button {
    background-color: #17243B !important;
    border-color: #283958 !important;
    color: #CBD5E1 !important;
}

html.dark #history-pagination-container button:hover {
    background-color: #1E2D4A !important;
    border-color: #3D5480 !important;
    color: #FFFFFF !important;
}

html.dark #history-pagination-container button.bg-indigo-600 {
    background: linear-gradient(135deg, #6494F3 0%, #4B69E1 100%) !important;
    border-color: #6494F3 !important;
    color: #FFFFFF !important;
    box-shadow: 0 0 12px rgba(100, 148, 243, 0.4) !important;
}

html.dark #history-pagination-container select {
    background-color: #17243B !important;
    border-color: #283958 !important;
    color: #F1F5F9 !important;
}



html.dark .select-options-list::-webkit-scrollbar-thumb {
    background: #2E3E5C !important;
}

html.dark .select-option {
    color: #CBD5E1 !important;
}

html.dark .select-option:hover {
    background-color: rgba(100, 148, 243, 0.18) !important;
    color: #FFFFFF !important;
}

html.dark .select-option.selected {
    background: linear-gradient(180deg, #6494F3 0%, #4B69E1 100%) !important;
    color: #FFFFFF !important;
}

html.dark .select-option-check {
    color: #FFFFFF !important;
}

/* Timer Focus Overlay & Stats Pill in Dark Mode */
html.dark #focus-overlay-card {
    background: linear-gradient(180deg, #18233C 0%, #0F172A 100%) !important;
    border-color: #2C3D60 !important;
}

html.dark #focus-top-bar button {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #CBD5E1 !important;
}

html.dark #focus-top-bar button:hover {
    background: rgba(255, 255, 255, 0.16) !important;
    color: #FFFFFF !important;
}

html.dark #focus-stats-grid {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 12px rgba(0, 0, 0, 0.35) !important;
}

html.dark #focus-stats-grid .text-slate-400 {
    color: #94A3B8 !important;
}

html.dark #live-active-time {
    color: #818CF8 !important;
}

html.dark #live-paused-time {
    color: #CBD5E1 !important;
}

html.dark #focus-stats-grid .bg-slate-300 {
    background-color: rgba(255, 255, 255, 0.25) !important;
}

html.dark #focus-cancel-bar button {
    color: #94A3B8 !important;
}

html.dark #focus-cancel-bar button:hover {
    color: #FB7185 !important;
    background-color: rgba(244, 63, 94, 0.12) !important;
    border-color: rgba(244, 63, 94, 0.25) !important;
}

/* Fullscreen Focus Overlay in Dark Mode */
html.dark #focus-overlay.is-focus-fullscreen {
    background-color: #0B1120 !important;
}

/* Mini Timer Floating Capsule in Dark Mode */
html.dark .mini-timer-capsule {
    background: linear-gradient(180deg, #18233C 0%, #0F172A 100%) !important;
    border: 1px solid #2C3D60 !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.12),
        0 20px 45px -8px rgba(0, 0, 0, 0.75),
        0 4px 20px rgba(100, 148, 243, 0.25) !important;
}

html.dark .mini-timer-capsule:hover {
    border-color: #6494F3 !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        0 24px 50px -8px rgba(0, 0, 0, 0.85),
        0 6px 28px rgba(100, 148, 243, 0.4) !important;
}

html.dark .mini-timer-capsule.break-mode {
    border-color: #059669 !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.12),
        0 20px 45px -8px rgba(0, 0, 0, 0.75),
        0 4px 20px rgba(16, 185, 129, 0.25) !important;
}

html.dark .mini-timer-capsule.break-mode:hover {
    border-color: #34D399 !important;
    box-shadow: 
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        0 24px 50px -8px rgba(0, 0, 0, 0.85),
        0 6px 28px rgba(16, 185, 129, 0.4) !important;
}

html.dark #mini-timer-widget .bg-slate-100 {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #CBD5E1 !important;
}

html.dark #mini-timer-widget .bg-slate-100:hover {
    background-color: rgba(255, 255, 255, 0.16) !important;
    color: #FFFFFF !important;
}

html.dark #mini-course-badge {
    background-color: rgba(100, 148, 243, 0.2) !important;
    border-color: rgba(100, 148, 243, 0.4) !important;
    color: #C7D2FE !important;
}

html.dark #mini-timer-clock {
    color: #F8FAFC !important;
}

html.dark #focus-overlay.is-focus-fullscreen #focus-stats-grid {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Todos & Study Tasks Dark Mode Custom Polish */
html.dark .todo-card {
    background-color: #131E35 !important;
    border: 1px solid #1E2D4A !important;
    color: #F1F5F9 !important;
    box-shadow: none !important;
}

html.dark .todo-card.bg-emerald-50\/40 {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

html.dark .todo-check-btn:not(.checked) {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.16) !important;
    color: transparent !important;
}

html.dark .todo-check-btn:not(.checked):hover {
    border-color: #818CF8 !important;
    background-color: rgba(100, 148, 243, 0.18) !important;
}

html.dark .todo-check-btn.checked {
    background-color: #10B981 !important;
    border-color: #059669 !important;
    color: #FFFFFF !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.35) !important;
}

html.dark .subtask-item:not(.checked) {
    background-color: #15223C !important;
    border-color: #223456 !important;
    color: #E2E8F0 !important;
}

html.dark .subtask-item:hover {
    background-color: #1A2A48 !important;
    border-color: #2D4470 !important;
}

html.dark #todo-modal .bg-slate-50\/80,
html.dark #todo-modal .bg-slate-50\/70 {
    background-color: #111A2E !important;
    border-color: #1E2D4A !important;
}

html.dark .todo-prio-btn:not(.active),
html.dark .todo-date-btn:not(.active),
html.dark .todo-course-pill:not(.active) {
    background-color: #17243B !important;
    border-color: #263857 !important;
    color: #94A3B8 !important;
}

html.dark .todo-prio-btn:not(.active):hover,
html.dark .todo-date-btn:not(.active):hover,
html.dark .todo-course-pill:not(.active):hover {
    background-color: #1F3050 !important;
    border-color: #384F78 !important;
    color: #F1F5F9 !important;
}

html.dark #todo-templates-list > div {
    background-color: #131E35 !important;
    border-color: #1E2D4A !important;
}

html.dark #todo-templates-list > div:hover {
    background-color: #16233D !important;
    border-color: #2B3F68 !important;
}

/* Todo Card & Dropdown Stacking Context */
/* ==========================================================================
   UNIVERSAL MODULAR DROPDOWN SYSTEM (High Z-Index, Smart Placement & Animation)
   ========================================================================== */

.modular-dropdown-container,
.planner-item-menu-container,
.todo-dropdown-container,
.habit-dropdown-container {
    position: relative;
}

.modular-dropdown-container.is-active,
.planner-item-menu-container.is-active,
.todo-dropdown-container.is-active,
.habit-dropdown-container.is-active,
.todo-card:has(.modular-dropdown-menu:not(.hidden)),
.habit-card:has(.modular-dropdown-menu:not(.hidden)),
.planner-block-card:has(.modular-dropdown-menu:not(.hidden)),
.planner-table-cell-card:has(.modular-dropdown-menu:not(.hidden)),
.todo-card.menu-active,
.habit-card.menu-active,
.planner-block-card.menu-active,
.planner-table-cell-card.menu-active,
.menu-active {
    z-index: 1000 !important;
    position: relative !important;
}

.modular-dropdown-menu,
[id^="todo-menu-dropdown-"],
[id^="habit-menu-dropdown-"],
[id^="planner-item-menu-"] {
    position: absolute;
    z-index: 9999 !important;
    min-width: 11.5rem;
    padding: 0.4rem;
    border-radius: 1.25rem;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    box-shadow: 0 15px 35px -5px rgba(15, 23, 42, 0.18), 0 5px 15px -3px rgba(15, 23, 42, 0.08);
    transition: opacity 0.16s cubic-bezier(0.16, 1, 0.3, 1), transform 0.16s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top left;
    will-change: transform, opacity;
}

html.dark .modular-dropdown-menu,
html.dark [id^="todo-menu-dropdown-"],
html.dark [id^="habit-menu-dropdown-"],
html.dark [id^="planner-item-menu-"] {
    background: linear-gradient(180deg, #18253e 0%, #0F172A 100%) !important;
    border: 1px solid #283C60 !important;
    box-shadow: 0 20px 45px -5px rgba(0, 0, 0, 0.85), 0 8px 20px -3px rgba(0, 0, 0, 0.5) !important;
}

/* Animations: Entering / Opening */
.modular-dropdown-menu.anim-enter,
[id^="todo-menu-dropdown-"].anim-enter,
[id^="habit-menu-dropdown-"].anim-enter,
[id^="planner-item-menu-"].anim-enter {
    opacity: 0;
    transform: scale(0.92) translateY(-6px);
    pointer-events: none;
}

.modular-dropdown-menu.anim-enter-active,
[id^="todo-menu-dropdown-"].anim-enter-active,
[id^="habit-menu-dropdown-"].anim-enter-active,
[id^="planner-item-menu-"].anim-enter-active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Upward Placement variant (when near screen bottom) */
.modular-dropdown-menu.placement-top,
[id^="todo-menu-dropdown-"].placement-top,
[id^="habit-menu-dropdown-"].placement-top,
[id^="planner-item-menu-"].placement-top {
    bottom: calc(100% + 6px);
    top: auto;
    transform-origin: bottom left;
}

.modular-dropdown-menu.placement-top.anim-enter,
[id^="todo-menu-dropdown-"].placement-top.anim-enter,
[id^="habit-menu-dropdown-"].placement-top.anim-enter,
[id^="planner-item-menu-"].placement-top.anim-enter {
    transform: scale(0.92) translateY(6px);
}

.modular-dropdown-menu.placement-top.anim-enter-active,
[id^="todo-menu-dropdown-"].placement-top.anim-enter-active,
[id^="habit-menu-dropdown-"].placement-top.anim-enter-active,
[id^="planner-item-menu-"].placement-top.anim-enter-active {
    transform: scale(1) translateY(0);
}

/* Downward Placement variant (default) */
.modular-dropdown-menu.placement-bottom,
[id^="todo-menu-dropdown-"].placement-bottom,
[id^="habit-menu-dropdown-"].placement-bottom,
[id^="planner-item-menu-"].placement-bottom {
    top: calc(100% + 6px);
    bottom: auto;
    transform-origin: top left;
}

/* Alignment variants */
.modular-dropdown-menu.expand-right,
.modular-dropdown-menu.align-left,
[id^="todo-menu-dropdown-"].expand-right,
[id^="todo-menu-dropdown-"].align-left,
[id^="habit-menu-dropdown-"].expand-right,
[id^="habit-menu-dropdown-"].align-left,
[id^="planner-item-menu-"].expand-right,
[id^="planner-item-menu-"].align-left {
    left: 0 !important;
    right: auto !important;
    transform-origin: top left;
}

.modular-dropdown-menu.placement-top.expand-right,
.modular-dropdown-menu.placement-top.align-left,
[id^="todo-menu-dropdown-"].placement-top.expand-right,
[id^="todo-menu-dropdown-"].placement-top.align-left,
[id^="habit-menu-dropdown-"].placement-top.expand-right,
[id^="habit-menu-dropdown-"].placement-top.align-left,
[id^="planner-item-menu-"].placement-top.expand-right,
[id^="planner-item-menu-"].placement-top.align-left {
    transform-origin: bottom left;
}

.modular-dropdown-menu.expand-left,
.modular-dropdown-menu.align-right,
[id^="todo-menu-dropdown-"].expand-left,
[id^="todo-menu-dropdown-"].align-right,
[id^="habit-menu-dropdown-"].expand-left,
[id^="habit-menu-dropdown-"].align-right,
[id^="planner-item-menu-"].expand-left,
[id^="planner-item-menu-"].align-right {
    right: 0 !important;
    left: auto !important;
    transform-origin: top right;
}

.modular-dropdown-menu.placement-top.expand-left,
.modular-dropdown-menu.placement-top.align-right,
[id^="todo-menu-dropdown-"].placement-top.expand-left,
[id^="todo-menu-dropdown-"].placement-top.align-right,
[id^="habit-menu-dropdown-"].placement-top.expand-left,
[id^="habit-menu-dropdown-"].placement-top.align-right,
[id^="planner-item-menu-"].placement-top.expand-left,
[id^="planner-item-menu-"].placement-top.align-right {
    transform-origin: bottom right;
}

/* Dropdown Menu Item Buttons */
.modular-dropdown-menu button:not(.segmented-tab):not(.dropdown-exempt-btn),
.modular-dropdown-menu a,
[id^="todo-menu-dropdown-"] button,
[id^="habit-menu-dropdown-"] button,
[id^="planner-item-menu-"] button {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    text-align: right;
    padding: 0.45rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 0.875rem;
    color: #334155;
    transition: background-color 0.12s ease, color 0.12s ease;
    cursor: pointer;
    border: none;
    background: transparent;
}

.modular-dropdown-menu button:not(.segmented-tab):not(.dropdown-exempt-btn):hover,
.modular-dropdown-menu a:hover,
[id^="todo-menu-dropdown-"] button:hover,
[id^="habit-menu-dropdown-"] button:hover,
[id^="planner-item-menu-"] button:hover {
    background-color: #F1F5F9;
    color: #0F172A;
}

html.dark .modular-dropdown-menu button:not(.segmented-tab):not(.dropdown-exempt-btn),
html.dark .modular-dropdown-menu a,
html.dark [id^="todo-menu-dropdown-"] button,
html.dark [id^="habit-menu-dropdown-"] button,
html.dark [id^="planner-item-menu-"] button {
    color: #CBD5E1 !important;
}

html.dark .modular-dropdown-menu button:not(.segmented-tab):not(.dropdown-exempt-btn):hover,
html.dark .modular-dropdown-menu a:hover,
html.dark [id^="todo-menu-dropdown-"] button:hover,
html.dark [id^="habit-menu-dropdown-"] button:hover,
html.dark [id^="planner-item-menu-"] button:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #FFFFFF !important;
}

/* Ensure Segmented Control tabs inside dropdowns stay completely vanilla, untouched and clean */
.modular-dropdown-menu .segmented-tab,
.modular-dropdown-menu .segmented-tab:hover,
html.dark .modular-dropdown-menu .segmented-tab,
html.dark .modular-dropdown-menu .segmented-tab:hover {
    width: auto !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

.modular-dropdown-divider {
    height: 1px;
    background-color: #E2E8F0;
    margin: 0.25rem 0;
}

html.dark .modular-dropdown-divider {
    background-color: #243450;
}

/* Planner Card Uniform Action Buttons (Checkbox & Timer) */
.planner-card-action-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    border-radius: 9999px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer !important;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.planner-card-action-btn:hover {
    transform: scale(1.1) !important;
}

.planner-card-action-btn:active {
    transform: scale(0.95) !important;
}

/* Planner Table Custom Scrollbar & Interactive Smooth Surface */
#planner-table-scroll-wrap {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

#planner-table-scroll-wrap::-webkit-scrollbar {
    height: 7px;
}

#planner-table-scroll-wrap::-webkit-scrollbar-track {
    background: rgba(241, 245, 249, 0.9);
    border-radius: 9999px;
    margin: 0 6px;
}

html.dark #planner-table-scroll-wrap::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.75);
}

#planner-table-scroll-wrap::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.6);
    border-radius: 9999px;
    transition: background-color 0.2s ease;
}

#planner-table-scroll-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.85);
}

html.dark #planner-table-scroll-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(129, 140, 248, 0.9);
}

/* Planner Table Sticky Day Column (100% Solid Opaque & Zero Bleed) */
.planner-day-sticky-header {
    position: sticky !important;
    right: 0 !important;
    z-index: 30 !important;
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    background-color: #F8FAFC !important; /* solid slate-50 */
    border-left: 1px solid #E2E8F0 !important;
    color: #1E293B !important;
}

html.dark .planner-day-sticky-header {
    background-color: #172236 !important; /* solid 100% opaque slate-850 */
    border-left: 1px solid #1E293B !important;
    color: #E2E8F0 !important;
}

.planner-day-sticky-header.is-today-sticky {
    background-color: #EEF2FF !important; /* solid 100% opaque indigo-50 */
    border-left: 1.5px solid #818CF8 !important;
    color: #4338CA !important;
}

html.dark .planner-day-sticky-header.is-today-sticky {
    background-color: #171B36 !important; /* solid 100% opaque dark indigo */
    border-left: 1.5px solid #6366F1 !important;
    color: #A5B4FC !important;
}

.planner-day-sticky-th {
    position: sticky !important;
    right: 0 !important;
    z-index: 40 !important;
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    background-color: #F1F5F9 !important; /* solid slate-100 */
    border-left: 1px solid #CBD5E1 !important;
    color: #334155 !important;
}

html.dark .planner-day-sticky-th {
    background-color: #1E293B !important; /* solid slate-800 */
    border-left: 1px solid #334155 !important;
    color: #E2E8F0 !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN SYSTEM & MOBILE TOUCH OPTIMIZATIONS (ChandSaat v0.5+)
   ========================================================================== */

/* 1. Mobile Bottom Navigation System */
#mobile-bottom-nav {
    height: var(--mobile-nav-height, 3.85rem);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-top: 1px solid rgba(226, 232, 240, 0.85);
    box-shadow: 0 -4px 20px -2px rgba(15, 23, 42, 0.06);
}

html.dark #mobile-bottom-nav {
    background: rgba(15, 23, 42, 0.92) !important;
    border-top-color: rgba(51, 65, 85, 0.7) !important;
    box-shadow: 0 -8px 24px -2px rgba(0, 0, 0, 0.45) !important;
}

.mobile-nav-item {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.15rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    color: #64748B;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 0.875rem;
    position: relative;
}

html.dark .mobile-nav-item {
    color: #94A3B8;
}

.mobile-nav-item svg {
    width: 1.25rem;
    height: 1.25rem;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
    stroke-width: 2.15;
}

.mobile-nav-item span {
    font-size: clamp(9px, 2.25vw, 11px);
    line-height: 1.1;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: color 0.2s ease;
}

.mobile-nav-item.active {
    color: #4B69E1 !important;
    background: rgba(238, 242, 255, 0.85);
}

html.dark .mobile-nav-item.active {
    color: #818CF8 !important;
    background: rgba(100, 148, 243, 0.16) !important;
}

.mobile-nav-item.active svg {
    transform: translateY(-1.5px) scale(1.1);
    color: #4B69E1 !important;
    stroke: #4B69E1 !important;
}

html.dark .mobile-nav-item.active svg {
    color: #818CF8 !important;
    stroke: #818CF8 !important;
}

.mobile-nav-item.active span {
    font-weight: 800;
    color: #4B69E1 !important;
}

html.dark .mobile-nav-item.active span {
    color: #818CF8 !important;
}

/* 2. Responsive Modal Bottom Sheet on Mobile (< 640px) */
@media (max-width: 639px) {
    .modal-responsive-wrap {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    .modal-responsive-wrap > .modal-morph,
    .modal-responsive-wrap > .modal-morph-no-anim {
        border-bottom-left-radius: 0 !important;
        border-bottom-right-radius: 0 !important;
        border-top-left-radius: 2rem !important;
        border-top-right-radius: 2rem !important;
        max-height: 88dvh !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding-bottom: max(1.5rem, calc(1.25rem + env(safe-area-inset-bottom, 0px))) !important;
        animation: modalSheetSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
        overflow-y: auto !important;
    }
}

@keyframes modalSheetSlideUp {
    0% { opacity: 0; transform: translateY(100%); }
    100% { opacity: 1; transform: translateY(0); }
}

/* 3. Horizontal Scroll Chipbars with Zero Clutter */
.scroll-x-touch {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scroll-x-touch::-webkit-scrollbar {
    display: none;
}

.scroll-x-touch > * {
    scroll-snap-align: start;
    flex-shrink: 0;
}

/* 4. Yearly Activity Heatmap Responsive Wrappers */
.heatmap-scroll-wrap {
    position: relative;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.heatmap-scroll-wrap::-webkit-scrollbar {
    height: 4px;
}

.heatmap-scroll-wrap::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 99px;
}

html.dark .heatmap-scroll-wrap::-webkit-scrollbar-thumb {
    background: #334155;
}

/* 5. 7-Day Habit Timeline Responsive Sizing */
.habit-day-bubble {
    width: clamp(1.75rem, 4vw, 2.25rem);
    height: clamp(1.75rem, 4vw, 2.25rem);
    min-width: 1.75rem;
    min-height: 1.75rem;
    font-size: clamp(9px, 2vw, 11px);
    transition: all 0.15s ease;
}

/* 6. Fluid Typography Utility Classes */
.fluid-stat-num {
    font-size: clamp(1.5rem, 3.5vw, 2.25rem);
    line-height: 1.1;
}

.fluid-header-title {
    font-size: clamp(0.875rem, 2vw, 1.125rem);
    line-height: 1.25;
}

.fluid-card-title {
    font-size: clamp(0.75rem, 1.6vw, 0.875rem);
}

/* 7. Container Query Utilities */
.cq-container {
    container-type: inline-size;
}

@container (min-width: 480px) {
    .cq-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@container (min-width: 720px) {
    .cq-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* 8. Adaptive Floating Toolbar Position */
@media (max-width: 767px) {
    #history-batch-toolbar {
        bottom: calc(var(--mobile-nav-height, 3.85rem) + 0.75rem) !important;
        right: 0.75rem !important;
        left: 0.75rem !important;
        width: auto !important;
    }
}

/* ========================================== */
/* WEEKLY STUDY PLANNER ENHANCED STYLES       */
/* ========================================== */

.planner-scroll-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.planner-matrix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    width: 100%;
}

.planner-day-col {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 480px;
}

.dark .planner-day-col {
    background: #0f172a;
    border-color: rgba(30, 41, 59, 0.8);
}

.planner-day-col.is-today {
    border-color: rgba(75, 105, 225, 0.4);
    box-shadow: 0 0 0 1px rgba(75, 105, 225, 0.2), 0 8px 24px -4px rgba(75, 105, 225, 0.08);
}

.dark .planner-day-col.is-today {
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3), 0 8px 24px -4px rgba(99, 102, 241, 0.15);
}

.planner-block-card {
    position: relative;
    border-radius: 1rem;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    box-shadow: none !important;
}

.planner-block-card:hover {
    border-color: var(--card-course-color, #94a3b8) !important;
    box-shadow: none !important;
}

html.dark .planner-block-card {
    box-shadow: none !important;
}

html.dark .planner-block-card:hover {
    border-color: var(--card-course-color, #94a3b8) !important;
    box-shadow: none !important;
}

.planner-block-card.is-completed {
    box-shadow: none !important;
}

html.dark .planner-block-card.is-completed {
    box-shadow: none !important;
}

.planner-block-card.is-completed .planner-item-title {
    text-decoration: line-through;
    color: #94a3b8;
}

.planner-slot-badge {
    font-size: 0.625rem;
    font-weight: 800;
    padding: 0.15rem 0.45rem;
    border-radius: 0.5rem;
    letter-spacing: -0.01em;
}

.planner-activity-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.625rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: 0.625rem;
}

.planner-quick-chip {
    transition: all 0.15s ease-out;
}
.planner-quick-chip:active {
    transform: scale(0.94);
}

/* ==========================================
   PLANNER DRAG & DROP STUDIO STYLES
   ========================================== */
.draggable-course-card,
.draggable-topic-pill,
.draggable-planner-card {
    cursor: grab;
    user-select: none;
    touch-action: pan-y;
    transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.draggable-course-card:active,
.draggable-topic-pill:active,
.draggable-planner-card:active {
    cursor: grabbing;
}

.is-dragging {
    opacity: 0.45 !important;
    transform: scale(0.96) !important;
}

/* Dropzone styling */
.planner-slot-dropzone {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 52px;
    border-radius: 1.25rem;
}

.planner-slot-dropzone.is-drag-over {
    border-color: #6366F1 !important;
    background-color: rgba(99, 102, 241, 0.08) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25) !important;
}

html.dark .planner-slot-dropzone.is-drag-over {
    border-color: #818CF8 !important;
    background-color: rgba(99, 102, 241, 0.16) !important;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.3) !important;
}

.dropzone-indicator {
    display: none;
    border: 2px dashed #CBD5E1;
    border-radius: 1.25rem;
    padding: 0.85rem;
    text-align: center;
    color: #64748B;
    font-size: 0.75rem;
    font-weight: 700;
}

html.dark .dropzone-indicator {
    border-color: #334155;
    color: #94A3B8;
}

.planner-slot-dropzone.is-drag-over .dropzone-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-color: #6366F1;
    color: #4F46E5;
    background: rgba(99, 102, 241, 0.05);
}

html.dark .planner-slot-dropzone.is-drag-over .dropzone-indicator {
    border-color: #818CF8;
    color: #A5B4FC;
    background: rgba(99, 102, 241, 0.1);
}

/* Planner Right-Click Context Menu (High-End Raycast & macOS Aesthetic) */
#planner-item-context-menu {
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.06);
    will-change: transform, opacity;
}

html.dark #planner-item-context-menu {
    background: rgba(15, 23, 42, 0.94) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 24px 48px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
}

.planner-ctx-pop {
    animation: contextMenuPop 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes contextMenuPop {
    0% {
        opacity: 0;
        transform: scale(0.85);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* CLASSIC TIMETABLE MATRIX TABLE */
.planner-timetable-matrix,
#planner-timetable-matrix {
    border-spacing: 0;
    width: 100%;
}

#planner-timetable-matrix tbody tr {
    height: 1px;
}

#planner-timetable-matrix th,
#planner-timetable-matrix td,
.planner-timetable-matrix th,
.planner-timetable-matrix td {
    height: inherit;
    vertical-align: stretch;
}

#planner-timetable-matrix td > div,
#planner-timetable-matrix td > button {
    height: 100% !important;
    min-height: 100% !important;
    box-sizing: border-box !important;
}

#planner-timetable-matrix .planner-block-card {
    height: 100% !important;
    min-height: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
}

.planner-table-cell-card {
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.planner-table-cell-card:hover {
    box-shadow: 0 2px 8px -1px rgba(0, 0, 0, 0.06);
}

.dark .planner-table-cell-card:hover {
    box-shadow: 0 2px 10px -1px rgba(0, 0, 0, 0.35);
}

/* iOS WHEEL DRUM TIME PICKER */
.no-scrollbar::-webkit-scrollbar {
    display: none !important;
}
.no-scrollbar {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

.snap-y {
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
}

.snap-center {
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

.wheel-item {
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

/* WEEKLY PLANNER COMPACT DAY SELECTOR STRIP */
.planner-day-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 0;
    width: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
    box-shadow: 0 4px 14px -2px rgba(79, 70, 229, 0.35), 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1), width 0.25s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.2s ease;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
}

html.dark .planner-day-indicator {
    background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
    box-shadow: 0 4px 16px -2px rgba(79, 70, 229, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.planner-day-tab {
    position: relative;
    z-index: 2;
    transition: color 0.2s ease,
                background-color 0.2s ease,
                border-color 0.2s ease,
                transform 0.12s ease-out;
}

.planner-day-tab:active {
    transform: scale(0.95);
}

@keyframes plannerDaySwitch {
    0% {
        opacity: 0.55;
        transform: translateY(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-day-switch {
    animation: plannerDaySwitch 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==========================================
   COLLAPSIBLE SIDEBAR FLUID TRANSITION ENGINE
   ========================================== */
#app-sidebar {
    width: 256px !important;
    min-width: 256px !important;
    max-width: 256px !important;
    padding: 0.875rem !important;
    overflow-x: hidden !important;
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                min-width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                max-width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                padding 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.2s ease !important;
    will-change: width, min-width, max-width;
}

#app-sidebar.is-collapsed {
    width: 76px !important;
    min-width: 76px !important;
    max-width: 76px !important;
    padding: 0.875rem 0.5rem !important;
}

/* Fluid dissolution for labels, section titles, badges, and expanded cards */
.sidebar-nav-text,
.sidebar-section-title,
.sidebar-badge,
.sidebar-expanded-only {
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
    opacity: 1;
    transform: translateX(0);
    white-space: nowrap;
}

#app-sidebar.is-collapsed .sidebar-expanded-only,
#app-sidebar.is-collapsed .sidebar-section-title,
#app-sidebar.is-collapsed .sidebar-nav-text,
#app-sidebar.is-collapsed .sidebar-badge,
#app-sidebar.is-collapsed span[id^="sidebar-"],
#app-sidebar.is-collapsed #sidebar-planner-badge,
#app-sidebar.is-collapsed #sidebar-todos-badge,
#app-sidebar.is-collapsed #sidebar-habits-badge,
#app-sidebar.is-collapsed #sidebar-pro-pill,
#app-sidebar.is-collapsed #sidebar-update-badge,
#app-sidebar.is-collapsed .nav-item > span,
#app-sidebar.is-collapsed .nav-item > div > span {
    opacity: 0 !important;
    transform: translateX(8px) !important;
    max-width: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
    display: none !important;
}

/* Nav Item Layout Fluid Transitions */
#app-sidebar .nav-item {
    transition: background-color 0.15s ease,
                color 0.15s ease,
                padding 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.15s ease,
                box-shadow 0.15s ease !important;
}

#app-sidebar.is-collapsed .nav-item {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 0.65rem 0 !important;
    width: 100% !important;
}

#app-sidebar.is-collapsed .nav-item > div {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 !important;
    width: 100% !important;
}

/* Collapsed Mini Ring Widget */
#app-sidebar:not(.is-collapsed) .sidebar-collapsed-only {
    display: none !important;
    opacity: 0 !important;
    transform: scale(0.85);
}

#app-sidebar.is-collapsed .sidebar-collapsed-only {
    display: flex !important;
    opacity: 1 !important;
    transform: scale(1);
    animation: popInMiniWidget 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes popInMiniWidget {
    from {
        opacity: 0;
        transform: scale(0.75);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Header Toggle Button Active Animation */
#header-sidebar-toggle-btn {
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

#header-sidebar-toggle-btn #header-sidebar-icon {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), stroke 0.2s ease !important;
}

#header-sidebar-toggle-btn.bg-indigo-50 #header-sidebar-icon,
#app-sidebar.is-collapsed ~ * #header-sidebar-icon {
    transform: scaleX(-1);
}

/* ==========================================
   GLOBAL BESPOKE TOOLTIP SYSTEM
   ========================================== */
#app-global-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    filter: drop-shadow(0 4px 14px rgba(15, 23, 42, 0.28));
}

#app-global-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
}

#app-global-tooltip .tooltip-inner {
    background: #0F172A;
    color: #F8FAFC;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    direction: rtl;
    text-align: right;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

html.dark #app-global-tooltip .tooltip-inner {
    background: #1E293B;
    color: #F1F5F9;
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

#app-global-tooltip .tooltip-kbd {
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 9.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 700;
    color: #E2E8F0;
    direction: ltr;
    line-height: 1.2;
}

html.dark #app-global-tooltip .tooltip-kbd {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    color: #CBD5E1;
}

/* Tooltip Micro Arrow */
#app-global-tooltip .tooltip-arrow {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #0F172A;
    border: 1px solid rgba(255, 255, 255, 0.14);
    transform: rotate(45deg);
    pointer-events: none;
}

html.dark #app-global-tooltip .tooltip-arrow {
    background: #1E293B;
    border-color: rgba(255, 255, 255, 0.16);
}

/* Arrow Placement Modifiers */
#app-global-tooltip.pos-top .tooltip-arrow {
    bottom: -4px;
    border-top: none;
    border-left: none;
}

#app-global-tooltip.pos-bottom .tooltip-arrow {
    top: -4px;
    border-bottom: none;
    border-right: none;
}

#app-global-tooltip.pos-left .tooltip-arrow {
    right: -4px;
    border-left: none;
    border-bottom: none;
}

#app-global-tooltip.pos-right .tooltip-arrow {
    left: -4px;
    border-top: none;
    border-right: none;
}

/* ==========================================
   SIDEBAR SLIDING ACTIVE PILL INDICATOR
   ========================================== */
.sidebar-nav-sliding-indicator {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 1rem;
    background: linear-gradient(180deg, #EEF2FF 0%, #E0E7FF 100%);
    border: 1px solid #C7D2FE;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 2px 8px -1px rgba(75, 105, 225, 0.14);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.2s ease !important;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    will-change: transform, width, height;
}

html.dark .sidebar-nav-sliding-indicator {
    background: linear-gradient(180deg, rgba(100, 148, 243, 0.22) 0%, rgba(75, 105, 225, 0.14) 100%);
    border: 1px solid rgba(129, 140, 248, 0.35);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 2px 10px -1px rgba(75, 105, 225, 0.25);
}

#app-sidebar .nav-item {
    position: relative;
    z-index: 1;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

#app-sidebar .nav-item:hover:not(.active) {
    background: rgba(241, 245, 249, 0.6) !important;
}

html.dark #app-sidebar .nav-item:hover:not(.active) {
    background: rgba(255, 255, 255, 0.04) !important;
}

#app-sidebar .nav-item.active {
    color: #3B57CE !important;
    font-weight: 700 !important;
}

html.dark #app-sidebar .nav-item.active {
    color: #818CF8 !important;
}

/* Sidebar Keyboard Shortcut KBD Badge Animation */
.sidebar-kbd {
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s ease;
    transform: translateX(0);
}

.nav-item:hover .sidebar-kbd {
    opacity: 0.9 !important;
}

#app-sidebar.is-collapsed .sidebar-kbd {
    display: none !important;
}





