/* ===========================
   Okuzen — Zen Task Manager
   Redesigned: Sidebar + Cards
   =========================== */

:root {
    --bg: #F6F3EF;
    --bg-warm: #FAF8F5;
    --surface: #FFFFFF;
    --surface-elevated: #FFFFFF;
    --surface-hover: #FBF9F6;
    --sidebar-bg: #FEFDFB;
    --border: #EDE9E3;
    --border-light: #F2EFEB;
    --text: #2C2825;
    --text-secondary: #7A7269;
    --text-tertiary: #B0A89E;
    --accent: #C4A882;
    --accent-light: rgba(196, 168, 130, 0.12);
    --accent-hover: #B89B72;
    --priority-high: #D4836A;
    --priority-high-bg: rgba(212, 131, 106, 0.1);
    --priority-medium: #D4B06A;
    --priority-medium-bg: rgba(212, 176, 106, 0.1);
    --priority-low: #8AB89E;
    --priority-low-bg: rgba(138, 184, 158, 0.1);
    --shadow-xs: 0 1px 2px rgba(44, 40, 37, 0.03);
    --shadow-sm: 0 1px 4px rgba(44, 40, 37, 0.05), 0 1px 2px rgba(44, 40, 37, 0.03);
    --shadow-md: 0 4px 16px rgba(44, 40, 37, 0.07), 0 1px 4px rgba(44, 40, 37, 0.04);
    --shadow-lg: 0 8px 32px rgba(44, 40, 37, 0.1), 0 2px 8px rgba(44, 40, 37, 0.05);
    --shadow-xl: 0 16px 48px rgba(44, 40, 37, 0.12), 0 4px 12px rgba(44, 40, 37, 0.06);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    --sidebar-width: 260px;
}

/* ===========================
   Dark Mode Variables
   =========================== */
[data-theme="dark"] {
    --bg: #16100D;
    --bg-warm: #1B1410;
    --surface: #211812;
    --surface-elevated: #271D16;
    --surface-hover: #2D2119;
    --sidebar-bg: #1C1410;
    --border: #3A2A22;
    --border-light: #2E2119;
    --text: #EDE4D8;
    --text-secondary: #A8967F;
    --text-tertiary: #67584A;
    --accent: #C4A882;
    --accent-light: rgba(196, 168, 130, 0.15);
    --accent-hover: #D4B892;
    --priority-high: #E8907A;
    --priority-high-bg: rgba(232, 144, 122, 0.13);
    --priority-medium: #E2BB78;
    --priority-medium-bg: rgba(226, 187, 120, 0.13);
    --priority-low: #88BAA0;
    --priority-low-bg: rgba(136, 186, 160, 0.13);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.55), 0 1px 4px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.75), 0 4px 12px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .modal-overlay {
    background: rgba(8, 5, 3, 0.65);
}

[data-theme="dark"] .brand h1,
[data-theme="dark"] .auth-brand span {
    background: linear-gradient(135deg, var(--text) 0%, #9A8A78 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .content-header {
    background: rgba(30, 27, 24, 0.5);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] body {
    background:
        radial-gradient(ellipse 65% 55% at 12% 0%, rgba(196, 168, 130, 0.18) 0%, transparent 70%),
        radial-gradient(ellipse 45% 35% at 88% 100%, rgba(212, 131, 106, 0.22) 0%, transparent 70%),
        var(--bg);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(ellipse 65% 55% at 12% 0%, rgba(196, 168, 130, 0.35) 0%, transparent 70%),
        radial-gradient(ellipse 45% 35% at 88% 100%, rgba(212, 131, 106, 0.22) 0%, transparent 70%),
        var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Noise grain overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 9999;
}

/* ===========================
   Layout: Sidebar + Content
   =========================== */
.app {
    display: flex;
    min-height: 100vh;
}

/* ===========================
   Sidebar
   =========================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    z-index: 50;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: 28px 22px 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand h1 {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text) 0%, #5A524A 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 0 12px;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    padding: 0 10px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.add-category-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.add-category-btn:hover {
    color: var(--accent);
    background: var(--accent-light);
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 450;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.nav-item:hover {
    background: var(--accent-light);
    color: var(--text);
}

.nav-item.active {
    background: var(--accent-light);
    color: var(--text);
    font-weight: 500;
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.6;
}

.nav-item.active svg {
    opacity: 1;
}

.nav-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg);
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.nav-item.active .nav-count {
    background: rgba(196, 168, 130, 0.2);
    color: var(--accent-hover);
}

/* Priority indicators in sidebar */
.priority-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.priority-indicator.high { background: var(--priority-high); }
.priority-indicator.medium { background: var(--priority-medium); }
.priority-indicator.low { background: var(--priority-low); }

/* Category items in sidebar */
.category-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 450;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
    text-align: left;
}

.category-item:hover {
    background: var(--accent-light);
    color: var(--text);
}

.category-item.active {
    background: var(--accent-light);
    color: var(--text);
    font-weight: 500;
}

.category-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.category-item .nav-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--bg);
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.category-item.active .nav-count {
    background: rgba(196, 168, 130, 0.2);
    color: var(--accent-hover);
}

/* Sidebar — Week Chart */
.week-chart {
    padding: 0 22px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.week-chart-bars {
    display: flex;
    gap: 4px;
    align-items: flex-end;
}

.week-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
}

.week-bar-label {
    font-size: 9px;
    font-family: var(--font-ui, 'Inter', sans-serif);
    color: var(--text-tertiary);
    height: 13px;
    line-height: 13px;
    font-variant-numeric: tabular-nums;
}

.week-bar-track {
    width: 100%;
    height: 44px;
    background: var(--border-light);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.week-bar-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--accent);
    opacity: 0.45;
    border-radius: 4px;
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.week-bar-col.today .week-bar-fill {
    opacity: 0.85;
}

.week-bar-day {
    font-size: 9px;
    font-family: var(--font-ui, 'Inter', sans-serif);
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.02em;
}

.week-bar-col.today .week-bar-day {
    color: var(--accent);
    font-weight: 600;
}

.week-bar-col.today .week-bar-label {
    color: var(--accent);
}

/* Sidebar Footer — Progress Bar */
.sidebar-footer {
    padding: 16px 22px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-bar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.progress-label {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.3;
}

.progress-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.progress-bar-track {
    width: 100%;
    height: 5px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--priority-low) 100%);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===========================
   Main Content
   =========================== */
.content {
    flex: 1;
    margin-left: calc(var(--sidebar-width) + 24px);
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.content-header {
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 24px;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 16px;
    margin: 20px 32px 0;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.content-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.content-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.app-tagline {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    margin: 0;
}

.auth-brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auth-tagline {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    margin: 0;
}

/* Header Controls (sort + settings) */
.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all var(--transition);
    flex-shrink: 0;
}

.settings-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

/* Sort Controls */
.sort-controls {
    display: flex;
    gap: 3px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3px;
    box-shadow: var(--shadow-xs);
}

.sort-btn {
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: none;
    border: none;
    padding: 5px 14px;
    border-radius: 16px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.sort-btn:hover {
    color: var(--text-secondary);
}

.sort-btn.active {
    background: var(--text);
    color: var(--surface);
    box-shadow: var(--shadow-sm);
}

/* Task Container */
.task-container {
    flex: 1;
    padding: 24px 40px 100px;
}

/* Task List */
.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===========================
   Task Card
   =========================== */
.task-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-left: 3px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    animation: taskEnter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.task-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.task-item:hover .task-actions {
    opacity: 1;
}

.task-item.completed {
    opacity: 0.55;
    box-shadow: var(--shadow-xs);
}

.task-item.completed:hover {
    opacity: 0.7;
}

.task-item.completed .task-title {
    text-decoration: line-through;
    color: var(--text-tertiary);
}

.task-item.removing {
    animation: taskExit 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.task-item.completing {
    animation: taskComplete 2.3s ease forwards;
    overflow: hidden;
    pointer-events: none;
}

/* Drag Handle */
.task-drag-handle {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 2px 2px;
    margin-top: 1px;
    color: var(--text-tertiary);
    opacity: 0;
    cursor: grab;
    transition: opacity var(--transition), color var(--transition);
    touch-action: none;
}

.task-item:hover .task-drag-handle {
    opacity: 1;
}

.task-drag-handle:hover {
    color: var(--accent);
}

.task-drag-handle:active {
    cursor: grabbing;
}

/* Drag states */
.task-item.dragging {
    opacity: 0.4;
    transform: scale(0.98);
}

.task-item.drag-over-top {
    border-top: 2px solid var(--accent);
}

.task-item.drag-over-bottom {
    border-bottom: 2px solid var(--accent);
}

/* Checkbox */
.task-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition);
    padding: 0;
    margin-top: 1px;
}

.task-checkbox:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: scale(1.1);
}

.task-checkbox svg {
    opacity: 0;
    transform: scale(0.5);
    transition: all var(--transition);
    color: white;
}

.task-item.completed .task-checkbox {
    border-color: var(--accent);
    background: var(--accent);
}

.task-item.completed .task-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

/* Task Content */
.task-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-title {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text);
    transition: all var(--transition);
    line-height: 1.4;
}

.task-title::first-letter {
    text-transform: uppercase;
}

.task-notes {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Category Pill */
.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 10px 2px 7px;
    border-radius: 12px;
    line-height: 1.6;
}

.category-pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.category-pill--uncategorized {
    background: rgba(176, 168, 158, 0.12);
    color: #B0A89E;
}

.category-pill--uncategorized .category-pill-dot {
    background: #B0A89E;
}

/* Date badge */
.task-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 450;
    color: var(--text-tertiary);
}

.task-date svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.task-date.overdue {
    color: var(--priority-high);
    font-weight: 500;
}

.task-date.today {
    color: var(--accent-hover);
    font-weight: 500;
}

/* Checkbox column — stacks checkbox + priority dot */
.task-checkbox-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

/* Priority Dot — sits below the checkbox */
.priority-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.priority-dot.high { background: var(--priority-high); }
.priority-dot.medium { background: var(--priority-medium); }
.priority-dot.low { background: var(--priority-low); }

/* Pin Button */
.task-pin-btn {
    opacity: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
    transition: all var(--transition);
}

.task-item:hover .task-pin-btn {
    opacity: 1;
}

.task-pin-btn:hover {
    color: var(--accent);
    background: var(--accent-light);
    transform: scale(1.1);
}

.task-pin-btn.pinned {
    opacity: 1;
    color: var(--accent);
}

/* Pinned task divider */
.pin-divider {
    list-style: none;
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0 12px;
    height: 0;
    pointer-events: none;
}

/* ===========================
   Floating Action Button
   =========================== */
.fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--accent) 0%, var(--priority-high) 100%);
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-lg), 0 0 0 0 rgba(196, 168, 130, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 40;
}

.fab:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-xl), 0 0 0 8px rgba(196, 168, 130, 0.12);
}

.fab:active {
    transform: scale(0.95);
}

/* ===========================
   Empty State
   =========================== */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-tertiary);
    text-align: center;
    gap: 12px;
}

.empty-state svg {
    margin-bottom: 4px;
}

.empty-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
}

.empty-subtitle {
    font-size: 13px;
}

.empty-state.visible {
    display: flex;
    animation: fadeIn 0.5s ease both;
}

/* ===========================
   Modals
   =========================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 40, 37, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal {
    background: var(--surface);
    border-radius: 18px;
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    transform: translateY(12px) scale(0.97);
    transition: transform var(--transition-slow);
    overflow: hidden;
}

.modal-sm {
    max-width: 380px;
}

.modal-overlay.open .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.modal-close {
    font-size: 24px;
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color var(--transition);
    font-family: inherit;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 20px 26px;
}

.field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.field-row {
    display: flex;
    gap: 14px;
}

.field-col {
    flex: 1;
}

.modal-input {
    width: 100%;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 10px 14px;
    outline: none;
    transition: all var(--transition);
    margin-bottom: 16px;
}

#modalTitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 16px;
}

.modal-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(196, 168, 130, 0.12);
}

.modal-textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 160px;
    line-height: 1.5;
}

.modal-select {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23B0A89E' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* Priority Picker */
.priority-picker {
    display: flex;
    gap: 6px;
}

.priority-option {
    flex: 1;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 8px 0;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.priority-option:hover {
    border-color: var(--accent);
}

.priority-option.selected {
    background: var(--text);
    color: var(--surface);
    border-color: var(--text);
}

.priority-option-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border);
}

.priority-option.selected .priority-option-dot {
    background: rgba(255,255,255,0.4);
}

.priority-option-dot.high { background: var(--priority-high); }
.priority-option-dot.medium { background: var(--priority-medium); }
.priority-option-dot.low { background: var(--priority-low); }
.priority-option.selected .priority-option-dot.high { background: var(--priority-high); }
.priority-option.selected .priority-option-dot.medium { background: var(--priority-medium); }
.priority-option.selected .priority-option-dot.low { background: var(--priority-low); }

/* Color Picker */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-xs);
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border-color: var(--text);
    transform: scale(1.15);
    box-shadow: var(--shadow-sm);
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 26px 22px;
    gap: 12px;
}

.modal-footer-right {
    display: flex;
    gap: 8px;
}

.btn-delete {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--priority-high);
    background: var(--priority-high-bg);
    border: none;
    border-radius: var(--radius-xs);
    padding: 8px 16px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-delete:hover {
    background: rgba(212, 131, 106, 0.2);
}

.btn-delete.hidden {
    display: none;
}

.btn-cancel {
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 8px 18px;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-cancel:hover {
    background: var(--surface-hover);
}

.btn-save {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border: none;
    border-radius: var(--radius-xs);
    padding: 8px 22px;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-save:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* ===========================
   Sidebar toggle (mobile)
   =========================== */
.sidebar-toggle {
    display: none;
}

/* ===========================
   Animations
   =========================== */
@keyframes taskEnter {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes taskExit {
    to {
        opacity: 0;
        transform: translateX(30px) scale(0.95);
        height: 0;
        padding: 0 20px;
        margin: 0;
        border-width: 0;
    }
}

@keyframes taskComplete {
    0%   { opacity: 1; max-height: 300px; margin-bottom: 8px; padding-top: 16px; padding-bottom: 16px; border-width: 1px; }
    78%  { opacity: 0; max-height: 300px; margin-bottom: 8px; padding-top: 16px; padding-bottom: 16px; border-width: 1px; }
    100% { opacity: 0; max-height: 0;     margin-bottom: 0;   padding-top: 0;    padding-bottom: 0;    border-width: 0; }
}

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

@keyframes checkPop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.task-item.just-completed .task-checkbox {
    animation: checkPop 0.3s var(--transition-bounce);
}

@keyframes fabPulse {
    0%, 100% { box-shadow: var(--shadow-lg), 0 0 0 0 rgba(196, 168, 130, 0.3); }
    50% { box-shadow: var(--shadow-lg), 0 0 0 12px rgba(196, 168, 130, 0); }
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(calc(-100% - 12px));
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 4px 32px rgba(0, 0, 0, 0.18), 0 1px 4px rgba(0, 0, 0, 0.08);
    }

    .sidebar-toggle {
        display: flex;
    }

    .content {
        margin-left: 0;
    }

    .content-header {
        padding: 14px 16px;
        margin: 12px 12px 0;
        top: 12px;
    }

    .task-container {
        padding: 20px 16px 100px;
    }

    .fab {
        bottom: 24px;
        right: 24px;
    }

    .content-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* Backdrop for mobile sidebar */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.2);
    z-index: 45;
}

.sidebar-backdrop.visible {
    display: block;
}

/* ===========================
   Auth Screen
   =========================== */
.auth-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.auth-screen.visible {
    opacity: 1;
    pointer-events: all;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.auth-brand span {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text) 0%, #5A524A 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 20px;
}

.auth-error {
    font-size: 13px;
    color: var(--priority-high);
    background: var(--priority-high-bg);
    border-radius: var(--radius-xs);
    padding: 10px 14px;
    margin-bottom: 12px;
}

.auth-error.hidden {
    display: none;
}

.auth-submit {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    border-radius: var(--radius-xs);
    margin-bottom: 10px;
}

.auth-google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 10px;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 16px;
}

.auth-google-btn:hover {
    background: var(--surface-hover);
    border-color: var(--text-tertiary);
}

.auth-forgot {
    background: none;
    border: none;
    font-family: inherit;
    font-size: 12px;
    color: var(--text-tertiary);
    cursor: pointer;
    text-align: right;
    display: block;
    width: 100%;
    margin: -10px 0 14px;
    padding: 0;
    transition: color var(--transition);
}

.auth-forgot:hover {
    color: var(--accent);
}

.auth-success {
    font-size: 13px;
    color: var(--priority-low);
    background: rgba(138, 184, 158, 0.1);
    border-radius: var(--radius-xs);
    padding: 10px 14px;
    margin-bottom: 12px;
}

.auth-success.hidden {
    display: none;
}

.auth-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0 14px;
}

.auth-create-btn {
    width: 100%;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 10px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.auth-create-btn:hover {
    background: var(--surface-hover);
    border-color: var(--text-tertiary);
    color: var(--text);
}

.signup-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    line-height: 1.4;
}

#signupModal,
#resetModal {
    z-index: 600;
}

/* ===========================
   Settings Popup
   =========================== */
.settings-screen {
    position: fixed;
    inset: 0;
    background: rgba(44, 40, 37, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.settings-screen.visible {
    opacity: 1;
    pointer-events: all;
}

.settings-card {
    max-width: 340px;
    transform: translateY(10px) scale(0.97);
    transition: transform var(--transition-slow);
}

.settings-screen.visible .settings-card {
    transform: translateY(0) scale(1);
}

.settings-section {
    margin-bottom: 4px;
}

.settings-section-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.settings-account-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
}

.settings-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.settings-email {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 18px 0;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}

.settings-row-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.settings-signout-btn {
    width: 100%;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--priority-high);
    background: var(--priority-high-bg);
    border: 1px solid transparent;
    border-radius: var(--radius-xs);
    padding: 10px;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.settings-signout-btn:hover {
    border-color: var(--priority-high);
    opacity: 0.85;
}

.settings-delete-btn {
    width: 100%;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: none;
    border: none;
    padding: 8px;
    margin-top: 4px;
    cursor: pointer;
    transition: color var(--transition);
    text-align: center;
}

.settings-delete-btn:hover {
    color: var(--priority-high);
}

.btn-delete-confirm {
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: white;
    background: var(--priority-high);
    border: none;
    border-radius: var(--radius-xs);
    padding: 8px 22px;
    cursor: pointer;
    transition: opacity var(--transition);
}

.btn-delete-confirm:hover {
    opacity: 0.88;
}

.btn-delete-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* User row in sidebar footer */
.sidebar-divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 0 22px 12px;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.user-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.user-email {
    font-size: 11px;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.sign-out-btn {
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    flex-shrink: 0;
}

.sign-out-btn:hover {
    color: var(--priority-high);
    border-color: var(--priority-high);
    background: var(--priority-high-bg);
}

/* ===========================
   Theme Toggle Button
   =========================== */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

/* ===========================
   Progress Bar Glow
   =========================== */
.progress-bar-fill.glowing {
    box-shadow: 0 0 8px rgba(196, 168, 130, 0.55), 0 0 20px rgba(196, 168, 130, 0.2);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.8s ease;
}

/* ===========================
   Skeleton Loading
   =========================== */
.skeleton-loader {
    display: none;
    flex-direction: column;
    gap: 8px;
}

.skeleton-loader.visible {
    display: flex;
}

.skeleton-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

.skeleton-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}

.skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding-top: 3px;
}

.skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}

.skeleton-title { width: 58%; height: 15px; }
.skeleton-sub   { width: 33%; }

.skeleton-item:nth-child(2) .skeleton-checkbox,
.skeleton-item:nth-child(2) .skeleton-line { animation-delay: 0.15s; }
.skeleton-item:nth-child(3) .skeleton-checkbox,
.skeleton-item:nth-child(3) .skeleton-line { animation-delay: 0.3s; }

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

/* ===========================
   Clear Completed Button
   =========================== */
.clear-completed-row {
    list-style: none;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 4px;
}

.clear-completed-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 0.78rem;
    font-family: inherit;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all var(--transition);
}

.clear-completed-btn:hover {
    color: var(--priority-high);
    border-color: var(--priority-high);
    background: var(--priority-high-bg);
}
