@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

/* ===== Dark Theme ===== */
:root,
[data-theme="dark"] {
    --bg-primary: #060913;
    --bg-secondary: #0d1229;
    --bg-tertiary: #151d42;
    --bg-card: rgba(16, 22, 54, 0.72);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-input: rgba(255, 255, 255, 0.04);
    --border-glass: rgba(130, 150, 220, 0.12);
    --border-hover: rgba(130, 150, 220, 0.28);
    
    /* Status colors - vivid */
    --c-todo: #ef4444;
    --c-todo-glow: rgba(239, 68, 68, 0.3);
    --c-todo-soft: rgba(239, 68, 68, 0.12);
    --c-progress: #f59e0b;
    --c-progress-glow: rgba(245, 158, 11, 0.3);
    --c-progress-soft: rgba(245, 158, 11, 0.12);
    --c-done: #22c55e;
    --c-done-glow: rgba(34, 197, 94, 0.3);
    --c-done-soft: rgba(34, 197, 94, 0.12);
    
    /* Priority colors */
    --p-low: #22c55e;
    --p-med: #f59e0b;
    --p-high: #ef4444;
    
    /* Accent */
    --accent-primary: #f59e0b;
    --accent-warm: #fbbf24;
    --accent-hot: #f97316;
    --accent-glow: rgba(245, 158, 11, 0.35);
    --accent-glow-soft: rgba(245, 158, 11, 0.1);
    
    --text-primary: #f1f3fa;
    --text-secondary: #9ca3c0;
    --text-muted: #5c6390;
    
    --success: #22c55e;
    --success-glow: rgba(34, 197, 94, 0.25);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.25);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.25);
    
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-elevated: 0 16px 56px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 50px rgba(245, 158, 11, 0.1);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    --transition-fast: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    --modal-bg: linear-gradient(180deg, #131a3d 0%, #0d1229 100%);
    --overlay-bg: rgba(3, 5, 14, 0.88);
    --btn-primary-text: #0a0e27;
    --orb-1: rgba(239, 68, 68, 0.07);
    --orb-2: rgba(245, 158, 11, 0.06);
    --orb-3: rgba(34, 197, 94, 0.04);
    --orb-4: rgba(99, 102, 241, 0.05);
    --noise-opacity: 0.5;
    --grid-opacity: 0.03;
}

/* ===== Light Theme ===== */
[data-theme="light"] {
    --bg-primary: #f5f7fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef1f8;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-glass: rgba(0, 0, 0, 0.025);
    --bg-input: rgba(0, 0, 0, 0.03);
    --border-glass: rgba(0, 0, 0, 0.09);
    --border-hover: rgba(0, 0, 0, 0.18);
    
    --c-todo: #dc2626;
    --c-todo-glow: rgba(220, 38, 38, 0.2);
    --c-todo-soft: rgba(220, 38, 38, 0.08);
    --c-progress: #d97706;
    --c-progress-glow: rgba(217, 119, 6, 0.2);
    --c-progress-soft: rgba(217, 119, 6, 0.08);
    --c-done: #16a34a;
    --c-done-glow: rgba(22, 163, 74, 0.2);
    --c-done-soft: rgba(22, 163, 74, 0.08);
    
    --p-low: #16a34a;
    --p-med: #d97706;
    --p-high: #dc2626;
    
    --accent-primary: #d97706;
    --accent-warm: #f59e0b;
    --accent-hot: #ea580c;
    --accent-glow: rgba(217, 119, 6, 0.2);
    --accent-glow-soft: rgba(217, 119, 6, 0.08);
    
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    
    --success: #16a34a;
    --success-glow: rgba(22, 163, 74, 0.15);
    --warning: #d97706;
    --warning-glow: rgba(217, 119, 6, 0.15);
    --danger: #dc2626;
    --danger-glow: rgba(220, 38, 38, 0.15);
    
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-elevated: 0 16px 48px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 40px rgba(217, 119, 6, 0.06);
    --modal-bg: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    --overlay-bg: rgba(0, 0, 0, 0.45);
    --btn-primary-text: #ffffff;
    --orb-1: rgba(220, 38, 38, 0.05);
    --orb-2: rgba(217, 119, 6, 0.05);
    --orb-3: rgba(22, 163, 74, 0.04);
    --orb-4: rgba(99, 102, 241, 0.04);
    --noise-opacity: 0.12;
    --grid-opacity: 0.04;
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Vazirmatn', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    transition: background 0.5s ease, color 0.3s ease;
}

/* ===== Animated Background ===== */
.bg-scene {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    animation: orbDrift 25s ease-in-out infinite;
}
.orb-1 {
    width: 600px; height: 600px;
    background: var(--orb-1);
    top: -15%; right: -10%;
    animation-delay: 0s;
}
.orb-2 {
    width: 500px; height: 500px;
    background: var(--orb-2);
    bottom: -10%; left: -10%;
    animation-delay: -8s;
    animation-duration: 30s;
}
.orb-3 {
    width: 400px; height: 400px;
    background: var(--orb-3);
    top: 40%; left: 30%;
    animation-delay: -15s;
    animation-duration: 35s;
}
.orb-4 {
    width: 350px; height: 350px;
    background: var(--orb-4);
    top: 10%; left: -5%;
    animation-delay: -20s;
    animation-duration: 28s;
}
@keyframes orbDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(50px, -40px) scale(1.1); }
    50% { transform: translate(-30px, 30px) scale(0.95); }
    75% { transform: translate(20px, 50px) scale(1.05); }
}
.bg-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--border-glass) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-glass) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: var(--grid-opacity);
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

/* Noise */
.bg-scene::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='512' height='512' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    background-size: 200px 200px;
    opacity: var(--noise-opacity);
    mix-blend-mode: overlay;
}

/* ===== App Container ===== */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 28px;
    position: relative;
    z-index: 2;
}

/* ===== Header ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 14px;
}
.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon {
    width: 46px; height: 46px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hot) 100%);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2);
    animation: logoBreath 4s ease-in-out infinite;
    position: relative; overflow: hidden; flex-shrink: 0;
}
.logo-icon.large { width: 68px; height: 68px; border-radius: 18px; }
.logo-icon.large svg { width: 34px; height: 34px; }
.logo-icon::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, transparent 50%);
    border-radius: inherit;
}
@keyframes logoBreath {
    0%, 100% { box-shadow: 0 4px 20px var(--accent-glow); transform: scale(1); }
    50% { box-shadow: 0 4px 32px var(--accent-glow); transform: scale(1.03); }
}
.logo-icon svg { width: 24px; height: 24px; color: var(--btn-primary-text); position: relative; z-index: 1; }
.logo h1 { font-size: 22px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; line-height: 1.2; }
.logo h1 span {
    background: linear-gradient(135deg, var(--accent-warm) 0%, var(--accent-hot) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
    font-weight: 600;
}
.header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.search-box { position: relative; display: flex; align-items: center; }
.search-box svg {
    position: absolute; right: 13px; width: 16px; height: 16px;
    color: var(--text-muted); pointer-events: none; transition: var(--transition);
}
[dir="ltr"] .search-box svg { right: auto; left: 13px; }
.search-box input {
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 11px 38px 11px 14px;
    color: var(--text-primary);
    font-family: inherit; font-size: 13px; font-weight: 400;
    width: 200px;
    transition: var(--transition);
    backdrop-filter: blur(12px);
}
[dir="ltr"] .search-box input { padding: 11px 14px 11px 38px; }
.search-box input::placeholder { color: var(--text-muted); font-weight: 300; }
.search-box input:focus {
    outline: none; border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow-soft);
    width: 260px; background: var(--bg-glass);
}
.search-box:has(input:focus) svg { color: var(--accent-primary); }

/* ===== Buttons ===== */
.btn-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: var(--transition);
    backdrop-filter: blur(12px);
    position: relative; overflow: hidden;
    font-family: inherit;
}
.btn-icon:hover {
    background: var(--accent-glow-soft);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-1px);
}
.btn-icon svg { width: 19px; height: 19px; position: absolute; transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Language toggle */
.lang-toggle .lang-text {
    font-size: 13px; font-weight: 700;
    color: var(--text-secondary);
    transition: var(--transition);
}
.lang-toggle:hover .lang-text { color: var(--accent-primary); }

/* Theme toggle */
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0); }
.theme-toggle .icon-moon { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; transform: rotate(0) scale(1); }
[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0); }

.btn-primary, .btn-secondary, .btn-danger {
    padding: 11px 18px;
    border-radius: 12px;
    font-family: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex; align-items: center; gap: 8px;
    border: none;
    letter-spacing: 0.01em;
    position: relative; overflow: hidden;
    white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hot) 100%);
    color: var(--btn-primary-text);
    box-shadow: 0 4px 16px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, transparent 50%);
    opacity: 0; transition: var(--transition);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px var(--accent-glow); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }
.btn-primary svg, .btn-secondary svg, .btn-danger svg { width: 15px; height: 15px; }
.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(12px);
}
.btn-secondary:hover {
    background: var(--border-glass);
    border-color: var(--border-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}
.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%);
    color: white;
    box-shadow: 0 4px 16px var(--danger-glow);
}
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--danger-glow); }
.btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 14px; }
.btn-manage {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}
.btn-manage:hover { box-shadow: 0 8px 28px rgba(99, 102, 241, 0.4); }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ===== Stats Bar ===== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}
.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 18px;
    backdrop-filter: blur(16px);
    transition: var(--transition);
    display: flex; align-items: center; gap: 14px;
    position: relative; overflow: hidden;
    animation: statReveal 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.stat-item:nth-child(1) { animation-delay: 0.05s; }
.stat-item:nth-child(2) { animation-delay: 0.1s; }
.stat-item:nth-child(3) { animation-delay: 0.15s; }
.stat-item:nth-child(4) { animation-delay: 0.2s; }
@keyframes statReveal {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.stat-item::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    opacity: 0; transition: var(--transition);
}
.stat-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-glow); }
.stat-item:hover::before { opacity: 0.6; }
.stat-total::before { background: linear-gradient(90deg, transparent, var(--accent-primary), transparent); }
.stat-todo::before { background: linear-gradient(90deg, transparent, var(--c-todo), transparent); }
.stat-progress::before { background: linear-gradient(90deg, transparent, var(--c-progress), transparent); }
.stat-done::before { background: linear-gradient(90deg, transparent, var(--c-done), transparent); }

.stat-icon {
    width: 46px; height: 46px;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}
.stat-item:hover .stat-icon { transform: scale(1.1) rotate(-3deg); }
.stat-icon svg { width: 21px; height: 21px; }
.stat-total .stat-icon { background: var(--accent-glow-soft); color: var(--accent-primary); }
.stat-todo .stat-icon { background: var(--c-todo-soft); color: var(--c-todo); }
.stat-progress .stat-icon { background: var(--c-progress-soft); color: var(--c-progress); }
.stat-done .stat-icon { background: var(--c-done-soft); color: var(--c-done); }

.stat-content { display: flex; flex-direction: column; gap: 3px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 400; letter-spacing: 0.02em; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--text-primary); }
.stat-value.todo { color: var(--c-todo); }
.stat-value.progress { color: var(--c-progress); }
.stat-value.done { color: var(--c-done); }

/* ===== Board ===== */
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    align-items: start;
}
.column {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 18px;
    min-height: 480px;
    backdrop-filter: blur(16px);
    transition: var(--transition);
    position: relative; overflow: hidden;
    animation: colReveal 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.column:nth-child(1) { animation-delay: 0.1s; }
.column:nth-child(2) { animation-delay: 0.15s; }
.column:nth-child(3) { animation-delay: 0.2s; }
@keyframes colReveal {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}
.column::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
    transition: var(--transition);
    opacity: 0.6;
}
.col-todo::before { background: linear-gradient(90deg, var(--c-todo), #f87171); }
.col-progress::before { background: linear-gradient(90deg, var(--c-progress), #fbbf24); }
.col-done::before { background: linear-gradient(90deg, var(--c-done), #4ade80); }

.column.drag-over {
    background: var(--accent-glow-soft);
    border-color: var(--accent-primary);
    box-shadow: inset 0 0 40px var(--accent-glow-soft);
}
.column.drag-over::before { opacity: 1; }

.column-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px; padding-bottom: 14px;
    border-bottom: 1px solid var(--border-glass);
}
.column-title { display: flex; align-items: center; gap: 10px; }
.column-title h2 { font-size: 14px; font-weight: 700; letter-spacing: 0.02em; color: var(--text-primary); }
.column-icon { width: 17px; height: 17px; color: var(--text-muted); }
.col-todo .column-icon { color: var(--c-todo); }
.col-progress .column-icon { color: var(--c-progress); }
.col-done .column-icon { color: var(--c-done); }

.status-dot { width: 10px; height: 10px; border-radius: 50%; position: relative; }
.status-dot::before {
    content: '';
    position: absolute; inset: -3px;
    border-radius: 50%;
    animation: dotPulse 2.5s ease-in-out infinite;
}
.status-dot.todo { background: var(--c-todo); box-shadow: 0 0 8px var(--c-todo-glow); }
.status-dot.todo::before { background: var(--c-todo-glow); }
.status-dot.progress { background: var(--c-progress); box-shadow: 0 0 8px var(--c-progress-glow); }
.status-dot.progress::before { background: var(--c-progress-glow); }
.status-dot.done { background: var(--c-done); box-shadow: 0 0 8px var(--c-done-glow); }
.status-dot.done::before { background: var(--c-done-glow); }
@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.8); opacity: 0; }
}
.column-count {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px; font-weight: 700;
    color: var(--text-secondary);
    min-width: 30px; text-align: center;
}
.tasks-container { display: flex; flex-direction: column; gap: 10px; min-height: 100px; }

/* ===== Task Card ===== */
.task-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 0;
    cursor: grab;
    transition: var(--transition);
    position: relative; overflow: hidden;
    animation: cardReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.task-card:nth-child(1) { animation-delay: 0.05s; }
.task-card:nth-child(2) { animation-delay: 0.1s; }
.task-card:nth-child(3) { animation-delay: 0.15s; }
.task-card:nth-child(4) { animation-delay: 0.2s; }
.task-card:nth-child(5) { animation-delay: 0.25s; }
@keyframes cardReveal {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.task-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-elevated);
}
.task-card.dragging { opacity: 0.4; cursor: grabbing; transform: rotate(2deg) scale(1.02); }

.task-priority-bar { height: 3px; background: var(--bg-glass); position: relative; overflow: hidden; }
.task-priority-fill { height: 100%; border-radius: 0 3px 3px 0; transition: width 0.5s ease; }
[dir="ltr"] .task-priority-fill { border-radius: 3px 0 0 3px; }

.task-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 10px; padding: 14px 14px 0 14px;
}
.task-title { font-size: 14px; font-weight: 600; color: var(--text-primary); flex: 1; line-height: 1.7; }
.task-actions {
    display: flex; gap: 4px;
    opacity: 0; transform: translateY(4px);
    transition: var(--transition);
}
.task-card:hover .task-actions { opacity: 1; transform: translateY(0); }
.task-action-btn {
    width: 30px; height: 30px;
    border: none;
    background: var(--bg-glass);
    border-radius: 8px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: var(--transition-fast);
}
.task-action-btn:hover { background: var(--accent-primary); color: var(--btn-primary-text); transform: scale(1.1); }
.task-action-btn.delete:hover { background: var(--danger); color: white; }
.task-action-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.task-action-btn:disabled:hover { background: var(--bg-glass); color: var(--text-muted); transform: none; }
.task-action-btn svg { width: 14px; height: 14px; }
.task-description {
    font-size: 13px; color: var(--text-muted);
    margin: 8px 14px; line-height: 1.8;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; font-weight: 300;
}
.task-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 11px 14px;
    font-size: 11px; color: var(--text-muted);
    border-top: 1px solid var(--border-glass);
    margin-top: 10px;
    gap: 8px; flex-wrap: wrap;
}
.priority-badge {
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 11px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 4px;
}
.priority-badge.high { background: var(--c-todo-soft); color: var(--c-todo); border: 1px solid var(--c-todo-glow); }
.priority-badge.medium { background: var(--c-progress-soft); color: var(--c-progress); border: 1px solid var(--c-progress-glow); }
.priority-badge.low { background: var(--c-done-soft); color: var(--c-done); border: 1px solid var(--c-done-glow); }
.task-meta { display: inline-flex; align-items: center; gap: 4px; }
.meta-sep { opacity: 0.4; }

/* ===== Custom Select ===== */
.custom-select { position: relative; user-select: none; }
.select-selected {
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 11px 14px;
    color: var(--text-primary);
    font-family: inherit; font-size: 13px; font-weight: 400;
    cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    transition: var(--transition);
}
.select-selected:hover { border-color: var(--border-hover); }
.custom-select.open .select-selected { border-color: var(--accent-primary); box-shadow: 0 0 0 3px var(--accent-glow-soft); }
.select-arrow { width: 15px; height: 15px; margin-inline-start: auto; color: var(--text-muted); transition: transform 0.3s ease; flex-shrink: 0; }
.custom-select.open .select-arrow { transform: rotate(180deg); }
.select-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.select-dot.todo { background: var(--c-todo); }
.select-dot.progress { background: var(--c-progress); }
.select-dot.done { background: var(--c-done); }

.select-items {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 6px;
    z-index: 100;
    box-shadow: var(--shadow-elevated);
    opacity: 0; visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.custom-select.open .select-items { opacity: 1; visibility: visible; transform: translateY(0); }
.select-item {
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--text-secondary);
    transition: var(--transition-fast);
}
.select-item:hover { background: var(--accent-glow-soft); color: var(--text-primary); }

/* ===== Priority Slider (FIXED) ===== */
.priority-slider-wrapper { position: relative; padding: 6px 0; }
.priority-slider-wrapper input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--bg-glass);
    outline: none;
    cursor: pointer;
    position: relative;
    z-index: 2;
    margin: 0;
}
.priority-slider-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hot));
    cursor: pointer;
    box-shadow: 0 2px 10px var(--accent-glow);
    border: 3px solid var(--bg-secondary);
    transition: transform 0.2s ease, background 0.3s ease;
}
.priority-slider-wrapper input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
.priority-slider-wrapper input[type="range"]::-moz-range-thumb {
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hot));
    cursor: pointer;
    box-shadow: 0 2px 10px var(--accent-glow);
    border: 3px solid var(--bg-secondary);
}
.priority-track-fill {
    position: absolute;
    top: 6px;
    height: 8px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1;
    transition: width 0.15s ease, background 0.3s ease;
}
[dir="rtl"] .priority-track-fill { right: 0; }
[dir="ltr"] .priority-track-fill { left: 0; }

.priority-percent-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    color: white;
    margin-inline-start: 6px;
    transition: background 0.3s ease;
}

.priority-labels-row {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 11px;
    font-weight: 600;
}
.p-label {
    padding: 3px 10px;
    border-radius: 6px;
    transition: var(--transition-fast);
}
.p-low { color: var(--p-low); background: var(--c-done-soft); }
.p-med { color: var(--p-med); background: var(--c-progress-soft); }
.p-high { color: var(--p-high); background: var(--c-todo-soft); }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; inset: 0;
    background: var(--overlay-bg);
    backdrop-filter: blur(16px);
    display: none;
    align-items: center; justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: overlayIn 0.25s ease-out;
}
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay.active { display: flex; }
.modal {
    background: var(--modal-bg);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 28px;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-elevated);
    animation: modalIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative; overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
}
.modal::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
    opacity: 0.5;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.modal-header h3 {
    font-size: 17px; font-weight: 700;
    display: flex; align-items: center; gap: 10px;
    color: var(--accent-primary);
}
.modal-header h3 svg { width: 19px; height: 19px; stroke: var(--accent-primary); }
.modal-close {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    transition: var(--transition);
}
.modal-close:hover {
    background: var(--danger-glow);
    border-color: var(--danger);
    color: var(--danger);
    transform: rotate(90deg);
}

/* ===== Login Modal ===== */
.login-modal { max-width: 400px; text-align: center; }
.login-brand { margin-bottom: 24px; }
.login-brand .logo-icon { margin: 0 auto 14px; }
.login-brand h2 { font-size: 21px; font-weight: 800; color: var(--text-primary); margin-bottom: 5px; }
.login-brand p { color: var(--text-muted); font-size: 13px; }
.login-modal .form-group { text-align: right; }
[dir="ltr"] .login-modal .form-group { text-align: left; }

/* ===== Delete Modal ===== */
.delete-modal {
    max-width: 380px;
    text-align: center;
    animation: deleteModalIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes deleteModalIn {
    from { opacity: 0; transform: scale(0.8) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.delete-icon-wrapper {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: var(--danger-glow);
    border: 2px solid var(--danger);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 18px;
    animation: deleteIconPulse 2s ease-in-out infinite;
}
@keyframes deleteIconPulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--danger-glow); }
    50% { box-shadow: 0 0 0 12px transparent; }
}
.delete-icon-wrapper svg { width: 32px; height: 32px; color: var(--danger); }
.delete-modal h3 { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.delete-modal p { font-size: 13px; color: var(--text-muted); line-height: 1.8; margin-bottom: 4px; }
.delete-actions { justify-content: center; }
.delete-actions .btn-secondary,
.delete-actions .btn-danger { min-width: 100px; justify-content: center; }

/* ===== Form ===== */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group label {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-secondary);
    margin-bottom: 8px; font-weight: 500;
}
.form-group label svg { width: 14px; height: 14px; color: var(--text-muted); }
.required { color: var(--danger); }
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 11px 14px;
    color: var(--text-primary);
    font-family: inherit; font-size: 13px; font-weight: 400;
    transition: var(--transition);
}
.form-group textarea { resize: vertical; min-height: 75px; line-height: 1.7; }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); font-weight: 300; }
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow-soft);
    background: var(--bg-glass);
}
.form-group small { display: block; margin-top: 5px; font-size: 11px; color: var(--text-muted); }

.input-with-icon { position: relative; }
.input-with-icon input { padding-inline-end: 42px; }
.input-icon-btn {
    position: absolute;
    inset-inline-end: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: var(--text-muted);
    transition: var(--transition-fast);
    display: flex; align-items: center; justify-content: center;
}
.input-icon-btn:hover { color: var(--accent-primary); background: var(--accent-glow-soft); }
.input-icon-btn svg { width: 17px; height: 17px; }
.input-icon-btn .icon-eye-off { display: none; }
.input-icon-btn.visible .icon-eye { display: none; }
.input-icon-btn.visible .icon-eye-off { display: block; }

.captcha-row { display: flex; gap: 8px; align-items: center; }
.captcha-question {
    background: linear-gradient(135deg, var(--accent-glow-soft), var(--bg-glass));
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 11px 16px;
    font-size: 15px; font-weight: 700;
    color: var(--accent-primary);
    white-space: nowrap;
    letter-spacing: 0.05em;
    font-family: 'Courier New', monospace;
    min-width: 85px; text-align: center;
}
.captcha-row input { flex: 1; }
.captcha-refresh {
    width: 42px; height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: var(--bg-glass);
    color: var(--text-muted);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.captcha-refresh:hover { color: var(--accent-primary); border-color: var(--accent-primary); transform: rotate(180deg); }
.captcha-refresh svg { width: 17px; height: 17px; }

.modal-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    margin-top: 20px; padding-top: 18px;
    border-top: 1px solid var(--border-glass);
}

/* ===== User Management ===== */
.users-modal { max-width: 580px; }
.users-search-box { position: relative; margin-bottom: 14px; }
.users-search-box svg {
    position: absolute; inset-inline-end: 13px; top: 50%;
    transform: translateY(-50%);
    width: 15px; height: 15px;
    color: var(--text-muted);
    pointer-events: none;
}
.users-search-box input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 10px 38px 10px 14px;
    color: var(--text-primary);
    font-family: inherit; font-size: 13px;
    transition: var(--transition);
}
.users-search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
.users-list {
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 10px;
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 4px;
}
.user-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 11px;
    border-radius: 10px;
    transition: background 0.2s;
    gap: 12px;
}
.user-row:hover { background: var(--bg-glass); }
.user-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.user-avatar {
    width: 38px; height: 38px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
}
.user-details { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.user-details strong {
    font-size: 13px; font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-username { font-size: 11px; color: var(--text-muted); }
.badge-admin {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hot));
    color: var(--btn-primary-text);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px; font-weight: 700;
    display: inline-flex; align-items: center; gap: 4px;
    white-space: nowrap;
}
.badge-user {
    background: var(--bg-glass);
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px; font-weight: 600;
    border: 1px solid var(--border-glass);
    white-space: nowrap;
}
.user-form { margin-top: 14px; border-top: 1px solid var(--border-glass); padding-top: 18px; }
.form-section-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 14px;
}
.form-section-title svg { width: 17px; height: 17px; color: var(--accent-primary); }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: var(--modal-bg);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    padding: 13px 22px;
    color: var(--text-primary);
    font-size: 13px; font-weight: 500;
    box-shadow: var(--shadow-elevated);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.4s ease;
    z-index: 2000;
    backdrop-filter: blur(16px);
    opacity: 0;
    display: flex; align-items: center; gap: 10px;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast-icon { width: 19px; height: 19px; flex-shrink: 0; display: none; }
.toast.success { border-color: var(--success-glow); }
.toast.success .toast-icon-success { display: block; color: var(--success); }
.toast.error { border-color: var(--danger-glow); }
.toast.error .toast-icon-error { display: block; color: var(--danger); }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--text-muted);
    font-size: 13px; font-weight: 300;
}
.empty-state svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: 0.15; }

/* ===== Responsive ===== */
@media (max-width: 968px) {
    .board { grid-template-columns: 1fr; }
    .stats-bar { grid-template-columns: repeat(2, 1fr); }
    .app-header { flex-direction: column; align-items: stretch; }
    .header-actions { flex-direction: column; width: 100%; }
    .header-actions .search-box { width: 100%; }
    .search-box input, .search-box input:focus { width: 100%; }
    .header-actions .btn-primary,
    .header-actions .btn-secondary { width: 100%; justify-content: center; }
    .btn-icon { width: 100%; height: 40px; border-radius: 10px; }
}
@media (max-width: 480px) {
    .app-container { padding: 14px; }
    .stats-bar { gap: 10px; }
    .stat-item { padding: 14px; gap: 10px; }
    .stat-value { font-size: 20px; }
    .stat-icon { width: 38px; height: 38px; }
    .stat-icon svg { width: 18px; height: 18px; }
    .form-row { grid-template-columns: 1fr; }
    .modal { padding: 20px; border-radius: 16px; }
    .column { padding: 14px; min-height: 300px; }
    .logo h1 { font-size: 18px; }
    .logo-icon { width: 40px; height: 40px; }
    .logo-icon svg { width: 20px; height: 20px; }
    .task-title { font-size: 13px; }
    .task-footer { font-size: 10px; }
    .priority-badge { font-size: 10px; padding: 2px 8px; }
    .captcha-row { flex-wrap: wrap; }
    .captcha-question { min-width: 70px; font-size: 13px; padding: 10px 12px; }
    .users-modal, .login-modal { max-width: 95%; }
    .delete-modal { max-width: 90%; }
    .priority-labels-row { font-size: 10px; }
    .p-label { padding: 2px 6px; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(245, 158, 11, 0.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(245, 158, 11, 0.3); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ===== Selection ===== */
::selection { background: var(--accent-glow-soft); color: var(--text-primary); }

/* ===== Focus Visible ===== */
*:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; border-radius: 4px; }

input:disabled { opacity: 0.5; cursor: not-allowed; }