/* ============================================================
   Execution Mind - Modern Futuristic Glow Design (with Dark Mode)
   ============================================================ */

/* 1. المتغيرات الأساسية (CSS Variables) - سر التبديل بين الأوضاع */
:root {
    /* وضع الليل الجذاب (الاقتراضي) - Dark Mode */
    --bg-body: #0a0e17;
    /* خلفية سبيس داكنة جداً */
    --bg-card: rgba(20, 26, 38, 0.8);
    /* تأثير زجاجي شبه شفاف للصناديق */
    --bg-kanban-col: #111622;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);

    /* الألوان التأثيرية (Glow Colors) */
    --primary: #4f46e5;
    /* أزرق نيون */
    --primary-glow: rgba(79, 70, 229, 0.4);
    --success: #22c55e;
    /* أخضر نيون */
    --success-glow: rgba(34, 197, 94, 0.4);
    --danger: #ef4444;
    /* أحمر نيون */

    /* تأثيرات عامة */
    --glass-blur: blur(12px);
    --transition-fast: all 0.2s ease;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Side Nav */
    --bg-nav: rgba(15, 23, 42, 0.97);
    --nav-hover-bg: rgba(255, 255, 255, 0.05);
    --brand-mind-accent: #7c3aed;
}

/* 2. إعدادات الوضع الفاتح (Light Mode) */
body.light-mode {
    --bg-body: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-kanban-col: #e2e8f0;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.08);
    --primary-glow: rgba(79, 70, 229, 0.15);
    --bg-nav: rgba(248, 250, 252, 0.98);
    --nav-hover-bg: rgba(0, 0, 0, 0.05);
}

/* 3. الإعدادات الأساسية (Reset) */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: var(--transition-smooth);
    min-height: 100vh;
}

/* 4. الأزرار والحقول (Inputs & Buttons) - تصميم تقني */
input[type="text"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 15px;
    background-color: rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 15px;
    transition: var(--transition-fast);
}

body.light-mode input[type="text"],
body.light-mode textarea,
body.light-mode select {
    background-color: rgba(255, 255, 255, 0.5);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    overflow: hidden;
}

button:hover {
    box-shadow: 0 0 15px var(--primary-glow);
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

/* 5. الداشبورد (Dashboard Content) */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.header h1 {
    font-size: 28px;
    background: linear-gradient(135deg, #fff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: 0 0 15px var(--primary-glow);
}

body.light-mode .header h1 {
    background: linear-gradient(135deg, var(--text-main), var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: none;
}

.header-brand-link {
    font-size: 28px;
    font-weight: 700;
    text-decoration: none;
    color: var(--text-main);
    background: none;
    -webkit-text-fill-color: unset;
    -webkit-background-clip: unset;
    background-clip: unset;
    text-shadow: none;
    line-height: 1.2;
}

.header-brand-link:hover,
.header-brand-link:visited,
.header-brand-link:active,
.header-brand-link:focus {
    color: var(--text-main);
    text-decoration: none;
}

.header-brand-link .brand-mind {
    color: var(--brand-mind-accent);
}

.quota-box {
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
}

body.light-mode .quota-box {
    background: rgba(0, 0, 0, 0.04);
}

.quota-box span {
    color: var(--primary);
    font-weight: bold;
    font-size: 15px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

#themeToggleBtn,
#feedbackBtn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

#themeToggleBtn:hover,
#feedbackBtn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

.btn-logout {
    background-color: var(--text-muted);
    color: var(--bg-body);
}

.btn-logout:hover {
    background-color: #cbd5e1;
    box-shadow: none;
}

/* 6. تقسيم الصفحة (Grid Layout) */
.grid-layout {
    display: grid;
    grid-template-columns: 2.5fr 1fr;
    gap: 30px;
}

/* 7. الصناديق الزجاجية (Cards) — قاعدة مشتركة */
.tasks-section,
.focus-box,
.log-box,
.stats-box,
.level-bar-container {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.5s ease-out forwards;
}

.tasks-section,
.focus-box,
.log-box,
.stats-box {
    padding: 25px;
    transition: var(--transition-smooth);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tasks-section h2,
.focus-box h2,
.log-box h2,
.stats-box h2 {
    margin-top: 0;
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

/* 8. لوحة المهام (Kanban Board) */
.kanban-column-labels {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.kanban-column-labels h3 {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.kanban-col {
    background-color: var(--bg-kanban-col);
    padding: 15px;
    border-radius: 10px;
    min-height: 400px;
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.kanban-col:hover {
    border-color: var(--border-color);
}

.kanban-col h3 {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.task-item {
    background-color: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    cursor: grab;
    transition: var(--transition-fast);
}

/* Dashboard task card structure (no inner scroll; relies on Show More modal) */
.task-item__header-row {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.task-item__title {
    text-align: center;
    font-size: 15px;
    font-weight: bold;
    color: var(--text-main);
    margin: 0 0 12px 0;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.task-item__status-select {
    font-size: 12px;
    padding: 6px;
    margin-top: 15px;
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    cursor: pointer;
}

body.light-mode .task-item__status-select {
    background: rgba(0, 0, 0, 0.05);
}

/* Smart line-clamp: 3 clean lines, no mid-character cuts */
.task-desc-wrapper--clamp {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    max-height: none;       /* remove fixed-pixel cut */
    margin-bottom: 4px;     /* consistent gap before Show More btn */
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: normal;    /* required for -webkit-line-clamp */
}

.task-desc-wrapper--clamp * {
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: normal;    /* keeps -webkit-line-clamp working on children */
}

/* Checklist tasks (AI): line-clamp fails on flex children — use max-height clip */
.task-desc-wrapper--clamp.task-desc-wrapper--checklist {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    -webkit-box-orient: unset;
    max-height: 4.8em;
    overflow: hidden;
}

.task-desc-wrapper--clamp.task-desc-wrapper--checklist .check-item {
    display: flex;
}

.task-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
    transform: scale(1.02);
}

/* 9. المؤقت المستقبلي (Timer) */
#timerDisplay {
    font-size: 60px;
    font-weight: 900;
    text-align: center;
    margin: 20px 0;
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary-glow);
    font-family: 'Courier New', Courier, monospace;
}

.timer-buttons {
    display: flex;
    gap: 10px;
}

.timer-buttons button {
    width: 100%;
}

#stopTimerBtn {
    background-color: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
}

#stopTimerBtn:hover {
    background-color: var(--danger);
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

/* 10. اليوميات (Daily Log) */
textarea {
    height: 120px;
    resize: none;
    font-family: inherit;
    line-height: 1.6;
}

/* 11. صندوق الإحصائيات (Stats Box) */
.stats-box {
    margin-bottom: 20px;
}

.stats-grid {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.stat-item {
    background: rgba(0, 0, 0, 0.1);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    flex: 1;
    border: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

body.light-mode .stat-item {
    background: rgba(255, 255, 255, 0.4);
}

.stat-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.stat-item span {
    display: block;
    font-size: 32px;
    font-weight: 900;
    color: var(--primary);
    text-shadow: 0 0 15px var(--primary-glow);
}

.stat-item p {
    margin: 5px 0 0;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ============================================================
   صفحة تسجيل الدخول (Login Page) - تصميم مستقبلي
   ============================================================ */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-body);
}

.login-box {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    padding: 32px 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    text-align: center;
    width: 100%;
    max-width: 420px;
}

.login-box.box-enter {
    animation: fadeIn 0.35s ease-out forwards;
}

.login-box h1 {
    font-size: 36px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: 0 0 15px var(--primary-glow);
}

.login-box p {
    color: var(--text-muted);
    margin-bottom: 35px;
    font-size: 16px;
    letter-spacing: 1px;
}

.login-box input[type="text"],
.login-box input[type="email"],
.login-box input[type="password"] {
    width: 100%;
    padding: 16px;
    margin-bottom: 25px;
    font-size: 18px;
    text-align: center;
    letter-spacing: 2px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    outline: none;
    transition: var(--transition-fast);
}

.login-box input[type="text"]:focus,
.login-box input[type="email"]:focus,
.login-box input[type="password"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.login-box button {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================================
   شريط المستوى (Level & EXP Bar) وتأثير الصعود
   ============================================================ */

.level-bar-container {
    padding: 20px 30px;
    margin-bottom: 30px;
}

.level-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 800;
    font-size: 18px;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
    letter-spacing: 1px;
}

.progress-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    height: 18px;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #a855f7);
    width: 0%;
    border-radius: 15px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 20px var(--primary-glow);
}

body.light-mode .progress-track {
    background: rgba(0, 0, 0, 0.1);
}

/* تأثير الشاشة عند الصعود لمستوى جديد */
.level-up-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    animation: popIn 0.5s ease-out forwards;
}

.level-up-overlay h1 {
    font-size: 70px;
    color: #f59e0b;
    text-shadow: 0 0 40px rgba(245, 158, 11, 0.8);
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.level-up-overlay p {
    font-size: 26px;
    color: white;
    font-weight: bold;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.switch-form {
    margin-top: 20px;
    color: var(--primary);
    font-size: 14px;
    cursor: pointer;
    font-weight: bold;
    transition: var(--transition-fast);
}

.switch-form:hover {
    color: white;
    text-shadow: 0 0 10px var(--primary-glow);
}

/* ============================================================
   تصميم النوافذ المنبثقة (Modals) والملف الشخصي
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out forwards;
}

.profile-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 30px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    position: relative;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.profile-box h2 {
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 26px;
    color: var(--text-main);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: 0.3s;
}

.close-btn:hover {
    color: #ef4444;
}

.done-edit-blocked-footer {
    margin-top: 20px;
}

.done-edit-ok-btn {
    width: 100%;
    display: block;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.done-edit-ok-btn:hover {
    background: var(--primary, #4f46e5);
    box-shadow: 0 8px 25px var(--primary-glow);
    transform: translateY(-1px);
}

.profile-confirm-footer {
    margin-top: 20px;
}

.profile-confirm-ok-btn {
    width: 100%;
    display: block;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.profile-confirm-ok-btn:hover {
    background: var(--primary, #4f46e5);
    box-shadow: 0 8px 25px var(--primary-glow);
    transform: translateY(-1px);
}

/* ── Task Modal: flex-column layout (no overflow, no overlap) ── */

/* ①  Outer box: flex column capped at 85 vh — never exits viewport */
#taskModalContent {
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    overflow: hidden;           /* body child handles its own scroll  */
    overflow-x: hidden;
    max-width: 100%;
    padding: 20px 25px 25px;
    position: relative;
}

/* ②  Row 1 — X button bar: stands fully alone at the top */
.task-modal-top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
    margin-bottom: 12px;
}

/* ②b  Close button: in-flow (static), touch-friendly size */
#dynamicTaskModal .task-modal-close-btn {
    position: static;           /* override .close-btn's absolute   */
    transform: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    min-width: 38px;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    z-index: 2;
}

#dynamicTaskModal .task-modal-close-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    box-shadow: none;
    transform: none;
}

/* ③  Row 2 — Title: full width, centred, wraps any long string */
#dynamicTaskModal .task-modal-header {
    flex-shrink: 0;
    margin-bottom: 18px;
    overflow-x: hidden;
}

#dynamicTaskModal .task-modal-title-wrap {
    width: 100%;
    text-align: center;
    overflow-x: hidden;
    word-break: break-all;
    overflow-wrap: break-word;
    white-space: normal;
}

#dynamicTaskModal .task-modal-title-scroll {
    margin: 0;
    display: block;
    width: 100%;
    max-width: 100%;
    font-size: 22px;
    color: var(--text-main);
    text-align: center;
    line-height: 1.4;
    word-break: break-all;
    overflow-wrap: break-word;
    white-space: normal;
}

/* ④  Row 3 — Scrollable body: takes all remaining height */
.task-modal-body {
    flex: 1;
    min-height: 0;              /* critical: allows flex child to shrink+scroll */
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.task-modal-body::-webkit-scrollbar { width: 4px; }
.task-modal-body::-webkit-scrollbar-track { background: transparent; }
.task-modal-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.28);
    border-radius: 6px;
}

/* ⑤  View-mode content: no hard height cap — parent body scrolls */
#taskModalViewContent {
    word-break: break-all;
    overflow-wrap: break-word;
    overflow-x: hidden;
    max-width: 100%;
    white-space: pre-wrap;
}

.profile-pic-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
}

.profile-pic-container img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.edit-pic-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.profile-form label {
    display: block;
    text-align: left;
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 14px;
    font-weight: bold;
}

.profile-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 16px;
}

.profile-form input[readonly] {
    color: var(--text-muted);
    outline: none;
}

.focus-setup-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.focus-setup-container input {
    width: 70px;
    height: 50px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--primary);
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    outline: none;
    transition: var(--transition-fast);
}

.focus-setup-container input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.time-colon {
    font-size: 30px;
    color: var(--text-main);
    font-weight: bold;
}

/* ============================================================
   شريط التمرير المخصص (Custom Scrollbar) للإشعارات وغيرها
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a855f7;
}


/* ============================================================
   تنسيق الأزرار الخطرة (Danger Buttons)
   ============================================================ */
.btn-danger {
    background-color: var(--danger);
    color: white;
    border: none;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
    border-radius: 8px;
    transition: var(--transition-fast);
}

.btn-danger:hover {
    background-color: #f87171;
    /* لون خطر أفتح قليلاً للخطر */
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.6);
    transform: translateY(-1px);
}


/* ==========================================
   نظام كشف وإخفاء كلمة المرور (التصحيح النهائي)
   ========================================== */

/* 1. إخفاء عين المتصفح الافتراضية المزعجة لمنع تكرار العينين */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input::-webkit-contacts-auto-fill-button,
input::-webkit-credentials-auto-fill-button {
    display: none !important;
}

/* 2. غلاف حقل الباسوورد */
.password-wrapper {
    position: relative;
    width: 100%;
    display: block;
    /* نقلنا المسافة السفلية هنا حتى الزر الأزرق ما يلزق بالحقل */
    margin-bottom: 15px;
}

/* 3. حقل الإدخال (توسيط النص بدقة 100%) */
.password-wrapper input {
    /* السر في التوسيط: مساحة متساوية تماماً من اليمين للعين ومن اليسار للتوازن */
    padding-right: 45px !important;
    padding-left: 45px !important;
    text-align: center !important;
    /* السر هنا: صفرنا المسافة السفلية للحقل حتى الغلاف يطابق حجمه بالضبط وتتوسط العين */
    margin-bottom: 0 !important;
}

/* 4. ضبط العين في المنتصف عمودياً بدقة */
.eye-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted, #6b7280);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    z-index: 10;
}

/* لون الأيقونة في الوضع الليلي */
body:not(.light-mode) .eye-icon {
    color: #9ca3af;
}

/* لون الأيقونة عند تمرير الماوس */
.eye-icon:hover {
    color: var(--primary, #4f46e5);
}

/* ==========================================
   توحيد لون خلفية اليوزرنيم والباسوورد في (اللايت مود) فقط
   بدون المساس بالدارك مود أو أي أكواد أخرى
   ========================================== */

body.light-mode .login-box input[type="text"],
body.light-mode .login-box input[type="email"],
body.light-mode .login-box input[type="password"] {
    /* لون موحد وداكن قليلاً (رمادي أنيق) يطابق الخانتين باللايت مود */
    background-color: rgba(0, 0, 0, 0.06) !important;
}

/* حل مشكلة الملء التلقائي (Autofill) للمتصفح اللي يغير لون الحقل للأبيض/الأصفر */
body.light-mode .login-box input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 50px #f3f4f6 inset !important;
    -webkit-text-fill-color: #333 !important;
}


/* =========================================================
   نظام التجربة المجانية والباقات (Trial & Pricing)
========================================================= */

/* 1. العداد الجانبي (مهم جداً للوقت) */
.trial-timer-container {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin: 15px;
    text-align: center;
    color: #ef4444;
}

.trial-header {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.trial-countdown {
    font-family: monospace;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 2px;
}

.pulse-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

body.light-mode .trial-timer-container {
    background: rgba(220, 38, 38, 0.05);
    border-color: rgba(220, 38, 38, 0.2);
    color: #dc2626;
}

/* 2. نافذة انتهاء التجربة (حظر كامل) */
.modal-overlay,
.force-upgrade-overlay,
.plans-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    backdrop-filter: blur(8px);
    background: rgba(0, 0, 0, 0.85);
    z-index: 999999 !important;
    align-items: center;
    justify-content: center;
}

/* Lock modal icon (emoji displayed large above the modal title) */
.lock-icon-display {
    font-size: 52px;
    margin-bottom: 16px;
    line-height: 1;
}

.warning-icon {
    font-size: 50px;
    margin-bottom: 10px;
    animation: shake 2s infinite ease-in-out;
}

/* 3. تصميم نافذة الباقات في الداشبورد (مطابق لصفحة الهبوط 100%) */
:root {
    --elite: #d946ef;
    --elite-hover: #c026d3;
    --elite-glow: rgba(217, 70, 239, 0.25);
}

.plans-overlay {
    z-index: 100000;
}

.plans-container {
    width: 95%;
    max-width: 900px;
    padding: 40px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 24px;
}

/* Billing Toggle */
.dashboard-billing-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(255, 255, 255, 0.03);
    padding: 12px 24px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 40px;
}

.toggle-label {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: 0.3s;
}

.toggle-label.active {
    color: #e2e8f0;
    font-weight: 700;
}

.switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 30px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: 0.3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: var(--primary);
    transition: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 50%;
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.badge {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid #10b981;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Grid & Cards */
.modal-pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    align-items: stretch;
}

.pricing-card {
    background: rgba(22, 14, 42, 0.4);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 24px;
    padding: 48px 32px;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    text-align: left;
    position: relative;
}

.price {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 16px;
    display: flex;
    align-items: baseline;
    color: #fff;
    letter-spacing: -1px;
}

.currency {
    font-size: 1.8rem;
    margin-right: 4px;
    font-weight: 600;
    color: var(--text-muted);
}

.period {
    font-size: 1.05rem;
    color: var(--text-muted);
    margin-left: 8px;
    font-weight: 400;
}

.tagline {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 1.05rem;
    line-height: 1.6;
}

.features {
    list-style: none;
    flex-grow: 1;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0;
}

.features li {
    display: flex;
    align-items: flex-start;
    font-size: 1rem;
    color: #cbd5e1;
    line-height: 1.5;
}

.icon {
    margin-right: 14px;
    font-size: 1.2rem;
    line-height: 1.2;
}

/* Buttons */
.cta-btn {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.fup-modal-ok-btn {
    margin-top: 1.25rem;
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 10px;
}

.fup-modal-ok-btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-elite {
    background: linear-gradient(135deg, var(--elite), var(--primary));
    color: #fff;
}

.btn-elite:hover {
    box-shadow: 0 8px 25px var(--elite-glow);
}

/* Pro Card Special Styling */
.popular {
    border: 2px solid var(--primary);
    background: rgba(30, 20, 60, 0.6);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.popular-badge {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, var(--primary), var(--elite));
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .plans-container { padding: 30px 20px; }
    .price { font-size: 3rem; }
    .pricing-card { padding: 40px 24px; }
}


/* تنسيقات القائمة الجانبية المخفية (Sidebar) */
.side-nav {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background-color: var(--bg-nav);
    backdrop-filter: blur(14px);
    border-left: 1px solid var(--border-color);
    padding: 30px 20px 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10002;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.4);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #7c3aed rgba(0, 0, 0, 0.2);
}

.side-nav.side-nav--free {
    overflow-y: auto;
}

.side-nav.side-nav--paid {
    overflow-y: auto;
}

/* Sidebar scrollbar — thin purple thumb */
.side-nav::-webkit-scrollbar {
    width: 6px;
}

.side-nav::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.side-nav::-webkit-scrollbar-thumb {
    background: #7c3aed;
    border-radius: 10px;
    transition: 0.3s;
}

.side-nav::-webkit-scrollbar-thumb:hover {
    background: #6d28d9;
}

.side-nav.open {
    right: 0;
}

.close-nav-btn {
    position: absolute;
    top: 30px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    transition: 0.2s;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.close-nav-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

.side-nav h2 {
    color: var(--text-main);
    text-align: left;
    padding-left: 4px;
    font-size: 22px;
    margin-bottom: 20px;
    line-height: 35px;
    flex-shrink: 0;
}

.side-nav h2 span {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.side-nav-brand {
    color: var(--text-main);
    text-align: left;
    padding-left: 4px;
    font-size: 22px;
    margin-bottom: 20px;
    line-height: 35px;
    flex-shrink: 0;
    text-decoration: none;
    display: block;
    font-weight: 700;
}

.side-nav-brand:hover,
.side-nav-brand:visited,
.side-nav-brand:active,
.side-nav-brand:focus {
    color: var(--text-main);
    text-decoration: none;
}

.brand-mind {
    color: var(--brand-mind-accent);
}

body:not(.light-mode) .side-nav-brand .brand-mind,
body:not(.light-mode) .header-brand-link .brand-mind {
    text-shadow: 0 0 10px rgba(124, 58, 237, 0.35);
}

.nav-item {
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 8px;
    transition: 0.3s;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.nav-item:hover {
    background-color: var(--nav-hover-bg);
    color: var(--text-main);
    border-color: var(--border-color);
}

.nav-item.active {
    background-color: rgba(79, 70, 229, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: bold;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.2);
}

.nav-item + .nav-item {
    border-top-color: rgba(255, 255, 255, 0.06);
}

body.light-mode .nav-item + .nav-item {
    border-top-color: rgba(0, 0, 0, 0.07);
}

/* ==========================================
           Advanced Task Card & Checklist Styles
           ========================================== */
.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.task-card-title {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    word-break: break-word;
}

.task-actions-mini {
    display: flex;
    gap: 5px;
}

.task-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    transition: 0.2s;
    padding: 2px;
}

.task-action-btn:hover {
    color: var(--primary);
}

.task-action-btn.del-btn:hover {
    color: var(--danger);
}

/* Checklist Styles */
.checklist-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.check-item input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--primary);
    cursor: pointer;
}

.check-item label {
    flex: 1;
    cursor: pointer;
    line-height: 1.4;
    word-break: break-word;
    transition: 0.2s;
}

/* تأثير التشطيب عند تحديد المربع */
.check-item input[type="checkbox"]:checked+label {
    text-decoration: line-through;
    color: rgba(161, 161, 170, 0.5);
}

/* .task-desc-wrapper: base shared with --clamp modifier (same element in JS) */
.task-desc-wrapper {
    position: relative;
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    /* max-height removed — line-clamp in --clamp handles truncation cleanly */
}

/* Children: consistent wrapping, no pre-wrap so line-clamp works */
.task-desc-wrapper p,
.task-desc-wrapper .check-item label,
.task-desc-wrapper .task-content-wrapper {
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
}

/* Show More button: clean spacing after clamped content */
.show-more-btn {
    display: block;
    width: 100%;
    text-align: center;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 4px;
    padding: 4px 0;
}

.show-more-btn:hover {
    text-decoration: underline;
}

/* حقول النافذة: منع التمدد الأفقي */
#taskModalTitleInput,
#taskModalDescInput {
    max-width: 100%;
    overflow-x: hidden;
    word-break: break-all;
    overflow-wrap: break-word;
}

/* توافق حقول النافذة المنبثقة مع الوضع الفاتح */
body.light-mode #taskModalTitleInput,
body.light-mode #taskModalDescInput,
body.light-mode #taskModalViewContent {
    background-color: rgba(0, 0, 0, 0.03) !important;
}

/* ============================================================
   AI Assistant — compact task suggestion cards (chat)
   ============================================================ */
.ai-task-suggestions-wrap {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: linear-gradient(165deg, rgba(79, 70, 229, 0.07), rgba(15, 23, 42, 0.35));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22);
}

.ai-task-suggestions-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.ai-task-suggestions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

@media (min-width: 560px) {
    .ai-task-suggestions-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.ai-task-card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 10px 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    min-width: 0;
}

.ai-task-card__main {
    flex: 1;
    min-width: 0;
}

.ai-task-card__title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.35;
    margin-bottom: 6px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ai-task-card__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.45;
    max-height: 120px;
    overflow-y: auto;
}

.ai-task-card__step {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ai-task-card__step:last-child {
    margin-bottom: 0;
}

.ai-task-card__chk-icon {
    flex-shrink: 0;
    width: 12px;
    height: 12px;
    margin-top: 2px;
    border-radius: 3px;
    border: 1.5px solid rgba(148, 163, 184, 0.55);
    background: rgba(0, 0, 0, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ai-task-card__chk-icon--done {
    border-color: rgba(16, 185, 129, 0.65);
    background: rgba(16, 185, 129, 0.28);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.2);
}

body.light-mode .ai-task-card__chk-icon {
    background: rgba(0, 0, 0, 0.04);
}

.ai-task-card__step-text {
    font-family: inherit;
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.45;
    white-space: pre-wrap;
}

.ai-task-card__step-text--plain {
    display: block;
    width: 100%;
}

.ai-task-card__add {
    flex-shrink: 0;
    align-self: center;
    padding: 5px 11px;
    border-radius: 8px;
    border: 1px solid rgba(79, 70, 229, 0.45);
    background: rgba(79, 70, 229, 0.18);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.ai-task-card__add:hover:not(:disabled) {
    background: rgba(79, 70, 229, 0.32);
    box-shadow: 0 0 12px var(--primary-glow);
}

.ai-task-card__add:disabled {
    opacity: 0.9;
    cursor: default;
}

.ai-task-card__add--added {
    background: #10b981 !important;
    border-color: rgba(16, 185, 129, 0.55) !important;
    color: #ffffff !important;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.22);
    opacity: 1 !important;
    cursor: default !important;
}

body.light-mode .ai-task-suggestions-wrap {
    background: linear-gradient(165deg, rgba(79, 70, 229, 0.06), rgba(241, 245, 249, 0.95));
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}

body.light-mode .ai-task-card {
    background: rgba(255, 255, 255, 0.92);
}

body.light-mode .ai-task-card__add {
    border-color: rgba(79, 70, 229, 0.35);
    background: rgba(79, 70, 229, 0.12);
}

body.light-mode .ai-task-card__chk-icon--done {
    background: rgba(16, 185, 129, 0.2);
}


/* ============================================================
   Responsive Design — Media Queries
   ============================================================ */

/* ── Tablet (≤ 1024px) ────────────────────────────────────── */
@media (max-width: 1024px) {
    /* Stack sidebar below main on tablets */
    .grid-layout {
        grid-template-columns: 1fr;
    }

    /* 2-column Kanban instead of 4 */
    .kanban-column-labels {
        grid-template-columns: repeat(2, 1fr);
    }

    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }

    .kanban-col {
        min-height: 250px;
    }

    .dashboard-container {
        padding: 20px;
    }
}

/* ── Mobile (≤ 640px) ─────────────────────────────────────── */
@media (max-width: 640px) {
    .dashboard-container {
        padding: 12px;
    }

    /* Header wraps so title stays full-width on its own row */
    .header {
        flex-wrap: wrap;
        gap: 10px;
        padding-bottom: 12px;
        margin-bottom: 16px;
    }

    .header h1 {
        font-size: 20px;
        width: 100%;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
        gap: 6px;
    }

    /* Header icon buttons — touch-friendly 44px min */
    .header-actions button,
    #themeToggleBtn,
    #notifBtn,
    #feedbackBtn,
    #menuToggleBtn {
        min-width: 40px;
        min-height: 40px;
        padding: 5px 8px;
        font-size: 16px;
    }

    #miniStreak.execution-streak {
        padding: 5px 5px 5px 7px;
    }

    /* Level bar */
    .level-bar-container {
        padding: 12px 16px;
        margin-bottom: 16px;
    }

    .level-info {
        font-size: 15px;
    }

    /* Kanban: single column on phones */
    .kanban-column-labels {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .kanban-board {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .kanban-col {
        min-height: 120px;
    }

    /* Stats: stack vertically */
    .stats-grid {
        flex-direction: column;
    }

    .stat-item span {
        font-size: 26px;
    }

    /* Timer */
    #timerDisplay {
        font-size: 46px;
        margin: 12px 0;
    }

    .timer-buttons {
        flex-wrap: wrap;
        gap: 8px;
    }

    .timer-buttons button {
        min-height: 44px;
        flex: 1 1 calc(50% - 4px);
    }

    /* Focus time inputs */
    .focus-setup-container {
        gap: 10px;
    }

    .focus-setup-container input {
        width: 58px;
        height: 46px;
        font-size: 20px;
    }

    /* Add-task button */
    #openAddTaskModalBtn {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px;
    }

    /* Side nav narrower on small screens */
    .side-nav {
        width: 260px;
        right: -268px;
    }

    .side-nav.open {
        right: 0;
    }

    /* Modals */
    .profile-box {
        padding: 20px 16px;
        margin: 0 12px;
    }

    /* Login */
    .login-box {
        padding: 30px 20px;
        margin: 0 12px;
    }

    .login-box h1 {
        font-size: 28px;
    }

    /* Pricing modal */
    .modal-pricing-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .plans-container {
        padding: 20px 14px;
    }

    .price {
        font-size: 2.5rem;
    }

    .pricing-card {
        padding: 32px 20px;
    }
}

/* ── Extra small (≤ 400px) ───────────────────────────────── */
@media (max-width: 400px) {
    .header h1 {
        font-size: 18px;
    }

    #timerDisplay {
        font-size: 36px;
    }

    .kanban-col h3,
    .kanban-column-labels h3 {
        font-size: 12px;
    }

    .task-item {
        padding: 10px;
    }

    .header-actions button,
    #themeToggleBtn,
    #notifBtn,
    #feedbackBtn,
    #menuToggleBtn {
        padding: 4px 6px;
        font-size: 14px;
    }

    #miniStreak.execution-streak {
        padding: 4px 5px 4px 6px;
    }
}

/* ── Tracking stat cards (Tasks, Sessions, Daily Score) ───── */
.tracking-stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-height: 160px;
    text-align: center;
}

.tracking-stat-card h3 {
    font-size: clamp(14px, 2vw, 17px);
    margin: 0;
    font-weight: 600;
}

.tracking-stat-card--tasks h3 {
    color: var(--success);
}

.tracking-stat-card--focus h3 {
    color: var(--primary);
}

.tracking-stat-card--score h3 {
    color: #a855f7;
}

.tracking-stat-card .tracking-stat-value {
    font-size: clamp(2rem, 4.5vw, 2.5rem);
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-main);
}

.tracking-stat-card--tasks .tracking-stat-value {
    text-shadow: 0 0 15px var(--success-glow);
}

.tracking-stat-card--focus .tracking-stat-value {
    text-shadow: 0 0 15px var(--primary-glow);
}

.tracking-stat-card--score .tracking-stat-value {
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.55);
}

.tracking-stat-card .tracking-stat-suffix {
    font-size: clamp(0.95rem, 2vw, 1.1rem);
    font-weight: 600;
    color: var(--text-muted);
    text-shadow: none;
}

.tracking-stat-card .tracking-stat-sub {
    font-size: clamp(12px, 1.8vw, 14px);
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* ── Streak Flame tiers (Dashboard + Tracking) ─────────────── */
.execution-streak {
    --streak-color: #94a3b8;
    --streak-glow: rgba(148, 163, 184, 0.25);
    --streak-border: rgba(148, 163, 184, 0.35);
    transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

.execution-streak.streak-tier-none {
    --streak-color: #94a3b8;
    --streak-glow: transparent;
    --streak-border: var(--border-color);
}

.execution-streak.streak-tier-beginner {
    --streak-color: #fbbf24;
    --streak-glow: rgba(251, 191, 36, 0.45);
    --streak-border: rgba(245, 158, 11, 0.45);
}

.execution-streak.streak-tier-ignited {
    --streak-color: #38bdf8;
    --streak-glow: rgba(56, 189, 248, 0.55);
    --streak-border: rgba(14, 165, 233, 0.5);
}

.execution-streak.streak-tier-dominant {
    --streak-color: #c084fc;
    --streak-glow: rgba(192, 132, 252, 0.5);
    --streak-border: rgba(239, 68, 68, 0.45);
}

.execution-streak.streak-tier-legendary {
    --streak-color: #fcd34d;
    --streak-glow: rgba(252, 211, 77, 0.65);
    --streak-border: rgba(234, 179, 8, 0.55);
}

.execution-streak.streak-tier-awakened {
    --streak-color: #f8fafc;
    --streak-glow: rgba(248, 250, 252, 0.75);
    --streak-border: rgba(56, 189, 248, 0.55);
}

#miniStreak.execution-streak {
    background: color-mix(in srgb, var(--text-main) 4%, transparent);
    border: 1px solid var(--border-color);
    box-shadow: none;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2.2px;
    padding: 6px 6px 6px 8px;
    width: fit-content;
    height: auto;
    min-height: unset;
}

#streakStatCard.execution-streak,
#streakStatCard.streak-hero-card {
    box-shadow: none;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

#streakStatCard.flame-card-orange {
    border-color: rgba(249, 115, 22, 0.45);
    box-shadow: inset 0 0 18px rgba(249, 115, 22, 0.2), 0 0 14px rgba(249, 115, 22, 0.35);
}

#streakStatCard.flame-card-blue {
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: inset 0 0 18px rgba(56, 189, 248, 0.2), 0 0 14px rgba(56, 189, 248, 0.4);
}

#streakStatCard.flame-card-purple {
    border-color: rgba(192, 132, 252, 0.5);
    box-shadow: inset 0 0 18px rgba(192, 132, 252, 0.2), 0 0 14px rgba(192, 132, 252, 0.4);
}

#streakStatCard.flame-card-green {
    border-color: rgba(74, 222, 128, 0.5);
    box-shadow: inset 0 0 20px rgba(74, 222, 128, 0.22), 0 0 16px rgba(74, 222, 128, 0.45);
}

#streakStatCard.flame-card-gold {
    border-color: rgba(252, 211, 77, 0.55);
    box-shadow: inset 0 0 20px rgba(252, 211, 77, 0.25), 0 0 18px rgba(252, 211, 77, 0.5);
}

.streak-flame-count {
    color: var(--streak-color) !important;
    text-shadow: 0 0 14px var(--streak-glow);
}

/* ── Tracking hero flame (PNG assets + drop-shadow glow) ─── */
.streak-hero-card {
    min-height: 160px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#streakStatCard .streak-flame-stage {
    position: relative;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    filter: none;
}

#streakStatCard .streak-flame-count-number {
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 800;
    line-height: 1;
    margin-bottom: 10px;
    color: var(--text-main);
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.35),
        0 0 12px color-mix(in srgb, var(--text-main) 25%, transparent);
    pointer-events: none;
    order: 1;
}

#streakStatCard .streak-hero-label {
    color: var(--text-muted);
    font-size: clamp(12px, 1.8vw, 14px);
    margin-top: 14px;
    margin-bottom: 0;
    text-align: center;
}

#streakStatCard .streak-flame-img-wrap {
    order: 2;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    transform-origin: center bottom;
    animation: streakFlameFloat 3.2s ease-in-out infinite;
}

#streakStatCard .streak-sparks-layer {
    position: absolute;
    inset: -8% -12%;
    pointer-events: none;
    overflow: visible;
    z-index: 3;
}

#streakStatCard .streak-spark {
    position: absolute;
    bottom: 22%;
    border-radius: 50%;
    background: var(--spark-color, #f97316);
    box-shadow: 0 0 8px var(--spark-color, #f97316), 0 0 14px var(--spark-color, #f97316);
    opacity: 0;
    animation-name: streakSparkRise;
    animation-timing-function: ease-out;
    animation-iteration-count: infinite;
}

#streakStatCard .streak-flame-img {
    display: block;
    position: relative;
    z-index: 2;
    width: clamp(180px, 42vw, 225px);
    height: auto;
    max-height: none;
    object-fit: contain;
    pointer-events: none;
}

@keyframes streakSparkRise {
    0% {
        opacity: 0;
        transform: translateY(0) translateX(0) scale(0.6);
    }
    15% {
        opacity: 0.95;
    }
    100% {
        opacity: 0;
        transform: translateY(-75px) translateX(calc(var(--spark-drift, 0) * 1px)) scale(0.2);
    }
}

#streakStatCard .streak-flame-img-wrap.streak-flame-img--idle .streak-flame-img {
    opacity: 0.45;
}

#streakStatCard .streak-flame-img-wrap.glow-orange {
    filter:
        drop-shadow(0 0 6px rgba(249, 115, 22, 0.65))
        drop-shadow(0 0 14px rgba(249, 115, 22, 0.5))
        drop-shadow(0 4px 20px rgba(249, 115, 22, 0.35));
}

#streakStatCard .streak-flame-img-wrap.glow-blue {
    filter:
        drop-shadow(0 0 6px rgba(56, 189, 248, 0.7))
        drop-shadow(0 0 16px rgba(56, 189, 248, 0.55))
        drop-shadow(0 4px 22px rgba(14, 165, 233, 0.4));
}

#streakStatCard .streak-flame-img-wrap.glow-purple {
    filter:
        drop-shadow(0 0 6px rgba(192, 132, 252, 0.7))
        drop-shadow(0 0 16px rgba(192, 132, 252, 0.55))
        drop-shadow(0 4px 22px rgba(124, 58, 237, 0.4));
}

#streakStatCard .streak-flame-img-wrap.glow-green {
    filter:
        drop-shadow(0 0 8px rgba(74, 222, 128, 0.75))
        drop-shadow(0 0 18px rgba(74, 222, 128, 0.55))
        drop-shadow(0 4px 24px rgba(34, 197, 94, 0.45));
}

#streakStatCard .streak-flame-img-wrap.glow-gold {
    filter:
        drop-shadow(0 0 8px rgba(252, 211, 77, 0.8))
        drop-shadow(0 0 20px rgba(252, 211, 77, 0.6))
        drop-shadow(0 4px 26px rgba(234, 179, 8, 0.5));
}

#streakStatCard .streak-flame-img-wrap.streak-flame-img--pulse {
    animation: streakFlameFloat 3.2s ease-in-out infinite, streakGlowFilterPulseGreen 2.4s ease-in-out infinite;
}

#streakStatCard .streak-flame-img-wrap.glow-gold.streak-flame-img--pulse {
    animation: streakFlameFloat 3.2s ease-in-out infinite, streakGlowFilterPulseGold 2.4s ease-in-out infinite;
}

@keyframes streakFlameFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes streakGlowFilterPulseGreen {
    0%, 100% {
        filter:
            drop-shadow(0 0 8px rgba(74, 222, 128, 0.75))
            drop-shadow(0 0 18px rgba(74, 222, 128, 0.55))
            drop-shadow(0 4px 24px rgba(34, 197, 94, 0.45));
    }
    50% {
        filter:
            drop-shadow(0 0 12px rgba(74, 222, 128, 0.95))
            drop-shadow(0 0 26px rgba(74, 222, 128, 0.75))
            drop-shadow(0 4px 32px rgba(34, 197, 94, 0.65));
    }
}

@keyframes streakGlowFilterPulseGold {
    0%, 100% {
        filter:
            drop-shadow(0 0 8px rgba(252, 211, 77, 0.8))
            drop-shadow(0 0 20px rgba(252, 211, 77, 0.6))
            drop-shadow(0 4px 26px rgba(234, 179, 8, 0.5));
    }
    50% {
        filter:
            drop-shadow(0 0 14px rgba(252, 211, 77, 1))
            drop-shadow(0 0 28px rgba(252, 211, 77, 0.85))
            drop-shadow(0 4px 36px rgba(234, 179, 8, 0.7));
    }
}

/* ── Dashboard mini streak (PNG) ─────────────────────────── */
.mini-streak-pill {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 2.2px;
    padding: 6px 6px 6px 8px;
    width: fit-content;
    max-width: none;
    flex-shrink: 0;
    box-sizing: border-box;
    height: auto;
    min-height: unset;
    border-radius: 8px;
    cursor: default;
}

.mini-streak-count {
    order: 1;
    flex-shrink: 0;
    font-weight: 800;
    font-size: 15px;
    color: var(--text-main);
    line-height: 1;
}

.mini-streak-flame-wrap {
    order: 2;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    width: 34px;
    height: 28px;
    overflow: visible;
    margin-left: 0;
}

.mini-streak-flame-img {
    height: 28px;
    width: auto;
    object-fit: contain;
    display: block;
    margin-left: -2px;
}

.mini-streak-flame-wrap.mini-streak-flame--idle .mini-streak-flame-img {
    opacity: 0.45;
}

#miniStreak .mini-streak-flame-wrap:not(.mini-streak-flame--idle) .mini-streak-flame-img {
    transform-origin: center bottom;
    animation: miniStreakFlamePulse 2.6s ease-in-out infinite;
}

#miniStreak.flame-card-orange {
    border-color: rgba(249, 115, 22, 0.45);
    box-shadow: inset 0 0 10px rgba(249, 115, 22, 0.15), 0 0 8px rgba(249, 115, 22, 0.3);
}

#miniStreak.flame-card-blue {
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: inset 0 0 10px rgba(56, 189, 248, 0.15), 0 0 8px rgba(56, 189, 248, 0.35);
}

#miniStreak.flame-card-purple {
    border-color: rgba(192, 132, 252, 0.5);
    box-shadow: inset 0 0 10px rgba(192, 132, 252, 0.15), 0 0 8px rgba(192, 132, 252, 0.35);
}

#miniStreak.flame-card-green {
    border-color: rgba(74, 222, 128, 0.5);
    box-shadow: inset 0 0 10px rgba(74, 222, 128, 0.18), 0 0 8px rgba(74, 222, 128, 0.4);
}

#miniStreak.flame-card-gold {
    border-color: rgba(252, 211, 77, 0.55);
    box-shadow: inset 0 0 10px rgba(252, 211, 77, 0.2), 0 0 8px rgba(252, 211, 77, 0.45);
}

#miniStreak .mini-streak-flame-wrap.glow-orange {
    filter:
        drop-shadow(0 0 4px rgba(249, 115, 22, 0.7))
        drop-shadow(0 0 8px rgba(249, 115, 22, 0.45));
}

#miniStreak .mini-streak-flame-wrap.glow-blue {
    filter:
        drop-shadow(0 0 4px rgba(56, 189, 248, 0.75))
        drop-shadow(0 0 8px rgba(56, 189, 248, 0.5));
}

#miniStreak .mini-streak-flame-wrap.glow-purple {
    filter:
        drop-shadow(0 0 4px rgba(192, 132, 252, 0.75))
        drop-shadow(0 0 8px rgba(192, 132, 252, 0.5));
}

#miniStreak .mini-streak-flame-wrap.glow-green {
    filter:
        drop-shadow(0 0 5px rgba(74, 222, 128, 0.8))
        drop-shadow(0 0 10px rgba(74, 222, 128, 0.55));
}

#miniStreak .mini-streak-flame-wrap.glow-gold {
    filter:
        drop-shadow(0 0 5px rgba(252, 211, 77, 0.85))
        drop-shadow(0 0 10px rgba(252, 211, 77, 0.6));
}

.execution-streak.streak-tier-beginner .streak-flame-icon,
.execution-streak.streak-tier-beginner .streak-flame-count {
    animation: streakPulseSoft 2.8s ease-in-out infinite;
}

.execution-streak.streak-tier-ignited .streak-flame-icon,
.execution-streak.streak-tier-ignited .streak-flame-count {
    animation: streakPulseFast 1.6s ease-in-out infinite;
}

.execution-streak.streak-tier-dominant .streak-flame-icon,
.execution-streak.streak-tier-dominant .streak-flame-count {
    animation: streakEmber 1.2s ease-in-out infinite;
}

#miniStreak.execution-streak.streak-tier-dominant::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(circle at 30% 20%, rgba(239, 68, 68, 0.15), transparent 55%),
        radial-gradient(circle at 70% 80%, rgba(192, 132, 252, 0.12), transparent 50%);
}

#streakStatCard.execution-streak,
#streakStatCard.streak-hero-card {
    position: relative;
    overflow: visible;
}

#miniStreak.execution-streak.streak-tier-legendary .streak-flame-icon,
#miniStreak.execution-streak.streak-tier-legendary .streak-flame-count {
    animation: streakGoldGlow 1.1s ease-in-out infinite;
}

#miniStreak.execution-streak.streak-tier-legendary::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fef08a;
    box-shadow: 12px -8px 0 #fde047, -10px 6px 0 #fbbf24;
    top: 18%;
    right: 12%;
    opacity: 0.7;
    animation: streakSpark 2s ease-in-out infinite;
    pointer-events: none;
}

.execution-streak.streak-tier-awakened .streak-flame-icon,
.execution-streak.streak-tier-awakened .streak-flame-count {
    animation: streakDivineFlow 2.4s linear infinite;
    text-shadow: 0 0 8px #fff, 0 0 18px rgba(56, 189, 248, 0.8), 0 0 28px var(--streak-glow);
}

@keyframes streakPulseSoft {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.04); filter: brightness(1.12); }
}

@keyframes streakPulseFast {
    0%, 100% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.07); filter: brightness(1.2); }
}

@keyframes miniStreakFlamePulse {
    0%, 100% {
        transform: scale(1);
        filter: brightness(1);
    }
    50% {
        transform: scale(1.05);
        filter: brightness(1.1);
    }
}

@keyframes streakEmber {
    0%, 100% { transform: scale(1) translateY(0); filter: brightness(1); }
    50% { transform: scale(1.06) translateY(-1px); filter: brightness(1.25); }
}

@keyframes streakGoldGlow {
    0%, 100% { filter: brightness(1) drop-shadow(0 0 6px rgba(252, 211, 77, 0.6)); }
    50% { filter: brightness(1.35) drop-shadow(0 0 14px rgba(252, 211, 77, 0.9)); }
}

@keyframes streakDivineFlow {
    0% { filter: brightness(1.1) hue-rotate(0deg); }
    50% { filter: brightness(1.35) hue-rotate(8deg); }
    100% { filter: brightness(1.1) hue-rotate(0deg); }
}

@keyframes streakSpark {
    0%, 100% { opacity: 0.4; transform: scale(0.9); }
    50% { opacity: 0.9; transform: scale(1.1); }
}

body.light-mode .execution-streak.streak-tier-beginner {
    --streak-color: #d97706;
    --streak-glow: rgba(217, 119, 6, 0.35);
}

body.light-mode .execution-streak.streak-tier-ignited {
    --streak-color: #0284c7;
    --streak-glow: rgba(2, 132, 199, 0.35);
}

body.light-mode .execution-streak.streak-tier-dominant {
    --streak-color: #7c3aed;
    --streak-glow: rgba(124, 58, 237, 0.35);
}

body.light-mode .execution-streak.streak-tier-legendary {
    --streak-color: #ca8a04;
    --streak-glow: rgba(202, 138, 4, 0.4);
}

body.light-mode .execution-streak.streak-tier-awakened {
    --streak-color: #0f172a;
    --streak-glow: rgba(56, 189, 248, 0.45);
}

body.light-mode #miniStreak.execution-streak {
    background: color-mix(in srgb, var(--streak-color) 8%, #fff);
}

body.light-mode #streakStatCard .streak-flame-count-number {
    color: var(--text-main);
    text-shadow:
        0 1px 2px rgba(255, 255, 255, 0.85),
        0 0 10px rgba(15, 23, 42, 0.08);
}

@media (prefers-reduced-motion: reduce) {
    .execution-streak .streak-flame-icon,
    .execution-streak .streak-flame-count,
    #miniStreak.execution-streak.streak-tier-legendary::after,
    #miniStreak .mini-streak-flame-wrap,
    #miniStreak .mini-streak-flame-img,
    #streakStatCard .streak-flame-img-wrap,
    #streakStatCard .streak-spark {
        animation: none !important;
    }
}

/* ── Dashboard feedback (top bar + modal + toast) ── */
#feedbackBtn svg {
    width: 20px;
    height: 20px;
    display: block;
    flex-shrink: 0;
}

body.light-mode #feedbackBtn:hover {
    background-color: rgba(15, 23, 42, 0.05);
}

.feedback-modal-box {
    text-align: center;
    position: relative;
}

#closeFeedbackBtn {
    position: absolute;
    top: 10px;
    right: 10px;
    left: auto;
    z-index: 5;
    margin: 0;
    padding: 4px 6px;
    min-width: 0;
    background: none;
    border: none;
    box-shadow: none;
    transform: none;
    color: var(--text-muted);
    font-size: 24px;
    line-height: 1;
}

#closeFeedbackBtn:hover {
    color: #ef4444;
    background: none;
    box-shadow: none;
    transform: none;
}

.feedback-stars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.feedback-star-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.15s ease;
}

.feedback-star-btn:hover {
    transform: scale(1.08);
}

.feedback-star-btn svg {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 1.75;
    transition: fill 0.15s ease, stroke 0.15s ease;
}

.feedback-star-btn.is-hover svg,
.feedback-star-btn.is-active svg {
    fill: #8b5cf6;
    stroke: #8b5cf6;
}

.feedback-message-wrap {
    text-align: left;
    margin-bottom: 12px;
}

.feedback-message-field {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    outline: none;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.feedback-message-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.feedback-char-hint {
    margin: 6px 0 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
}

.feedback-form-error {
    margin: 0 0 12px;
    font-size: 0.85rem;
    color: #f87171;
    line-height: 1.4;
    text-align: left;
}

.feedback-form-error:not([hidden]) {
    display: block;
}

.dashboard-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 100010;
    max-width: min(90vw, 420px);
    padding: 14px 22px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #ecfdf5;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: 1px solid rgba(16, 185, 129, 0.5);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s ease, opacity 0.35s ease;
}

.dashboard-toast.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.dashboard-toast:not([hidden]) {
    display: block;
}

/* ── Driver.js onboarding tour (theme-compatible) ── */
.driver-popover {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35) !important;
    min-width: 350px !important;
    max-width: 450px !important;
}

.driver-popover-title {
    color: var(--text-main) !important;
    font-weight: 700 !important;
    font-size: 1.05rem !important;
}

.driver-popover-description {
    color: var(--text-muted) !important;
    line-height: 1.6 !important;
}

.driver-popover-progress-text {
    color: var(--text-muted) !important;
}

.driver-popover-footer button {
    border-radius: 8px !important;
    font-weight: 600 !important;
    text-shadow: none !important;
}

.driver-popover-next-btn,
.driver-popover-prev-btn {
    background: #8b5cf6 !important;
    color: #ffffff !important;
    border: none !important;
}

.driver-popover-close-btn {
    color: var(--text-muted) !important;
}

.driver-popover-close-btn:hover {
    color: #ef4444 !important;
}

.driver-active-element {
    outline: 2px solid #8b5cf6 !important;
}

/* ── Mobile + Tablet (≤ 768px) — additive only ── */
@media (max-width: 768px) {
    /* Mobile viewport / touch behavior — zoom and double-tap prevention */
    html,
    body {
        -webkit-text-size-adjust: 100%;
        touch-action: manipulation;
    }

    input,
    textarea,
    button,
    select {
        -webkit-appearance: none;
        touch-action: manipulation;
    }

    .dashboard-container {
        padding: 16px;
    }

    .grid-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .tasks-section {
        padding: 16px;
        overflow: hidden;
    }

    .kanban-scroll-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        padding-bottom: 8px;
    }

    .kanban-column-labels,
    .kanban-board {
        display: flex;
        flex-wrap: nowrap;
        gap: 12px;
        overflow: visible;
        scroll-snap-type: none;
        padding-bottom: 0;
    }

    .kanban-column-labels {
        margin-bottom: 8px;
    }

    .kanban-column-labels h3,
    .kanban-col {
        flex: 0 0 min(78vw, 280px);
        scroll-snap-align: start;
    }

    .kanban-col {
        min-height: unset;
    }

    .kanban-col .task-list {
        max-height: 320px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .level-up-overlay h1 {
        font-size: 2rem;
        line-height: 1.25;
        letter-spacing: 1px;
        text-align: center;
        padding: 0 16px;
        margin-bottom: 12px;
    }

    .level-up-overlay p {
        font-size: 1.05rem;
        line-height: 1.45;
        text-align: center;
        padding: 0 20px;
    }

    .header {
        flex-direction: column;
        align-items: center;
        gap: 14px;
        padding-bottom: 12px;
        margin-bottom: 16px;
    }

    .header h1,
    .header-brand-link {
        font-size: 20px;
        width: 100%;
        text-align: center;
        order: 1;
    }

    .header-actions {
        width: 100%;
        order: 2;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 10px;
    }

    .side-nav {
        width: min(280px, 86vw);
        right: calc(-1 * min(280px, 86vw) - 8px);
        height: 100dvh;
        max-height: 100dvh;
    }

    .side-nav.open {
        right: 0;
    }

    #menuToggleBtn {
        min-width: 44px;
        min-height: 44px;
    }

    .sub-section-title,
    .sub-section-sub {
        text-align: center;
    }

    .sub-card-wrapper > div:first-child {
        text-align: center;
        width: 100%;
    }

    .page-title-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
        margin-top: 12px;
        margin-bottom: 28px;
    }

    .page-title-box h2 {
        font-size: 26px;
    }

    .page-title-box > div p {
        text-align: center;
        margin-top: 8px;
    }

    .page-title-box .add-goal-btn {
        width: 100%;
        max-width: 280px;
        justify-content: center;
        margin-top: 4px;
    }

    .tracking-content {
        margin-top: 56px;
        text-align: center;
    }

    .tracking-content h1,
    .tracking-content > p {
        text-align: center;
    }

    /* AI Assistant — iOS keyboard / overscroll fix (CSS only) */
    html:has(.chat-container),
    body:has(.chat-container) {
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
    }

    .chat-container {
        display: flex !important;
        flex-direction: column;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        min-height: 0;
        overflow: hidden;
        overscroll-behavior: none;
    }

    .chat-header {
        flex-shrink: 0;
    }

    .chat-messages {
        flex: 1 1 auto;
        flex-grow: 1;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .typing-indicator,
    .image-preview-container {
        flex-shrink: 0;
    }

    .chat-input-wrapper {
        flex-shrink: 0;
        margin-top: auto;
        margin-bottom: 0;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .chat-input-container .attach-btn,
    .chat-input-container .mic-btn,
    .chat-input-container .send-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        flex-shrink: 0;
        box-sizing: border-box;
    }

    .chat-input-container .attach-btn svg {
        width: 20px;
        height: 20px;
    }

    .chat-input-container textarea,
    #chatInput {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
    }
}