:root {
    /* Spacing System (8px base unit) */
    --space-xs: 0.5rem;   /* 8px */
    --space-sm: 1rem;     /* 16px */
    --space-md: 1.5rem;   /* 24px */
    --space-lg: 2rem;     /* 32px */
    --space-xl: 3rem;     /* 48px */
    --space-2xl: 4rem;    /* 64px */

    /* Typography Scale */
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-md: 1.125rem;   /* 18px */
    --font-size-lg: 1.5rem;     /* 24px */
    --font-size-xl: 2rem;       /* 32px */
    --font-size-2xl: 2.5rem;    /* 40px */

    /* Border Radius */
    --radius-sm: 0.5rem;   /* 8px */
    --radius-md: 1rem;     /* 16px */
    --radius-lg: 1.25rem;  /* 20px */
    --radius-xl: 1.5rem;   /* 24px */

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.15);

    /* Light theme colors - Purple/Indigo Design */
    --bg-gradient-start: #E5E7EB;
    --bg-gradient-end: #F3F4F6;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-accent: #6366F1;
    --bg-card: #FFFFFF;
    --bg-section: #F9FAFB;
    --border-color: #E5E7EB;
    --border-hover: #6366F1;
    --success-color: #10B981;
    --success-bg: #D1FAE5;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --shadow-card: 0 1px 3px rgba(99, 102, 241, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 10px 25px rgba(99, 102, 241, 0.15), 0 4px 6px rgba(0, 0, 0, 0.05);

    /* Interactive States */
    --color-focus: #6366F1;
    --color-focus-ring: rgba(99, 102, 241, 0.5);
    --color-interactive-hover: rgba(99, 102, 241, 0.08);
}

[data-theme="dark"] {
    color-scheme: dark;

    /* Shadows for dark theme */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 12px 24px rgba(0, 0, 0, 0.4);

    /* Dark theme colors - Improved contrast */
    --bg-gradient-start: #1a1a1a;
    --bg-gradient-end: #0f0f0f;
    --text-primary: #cccccc;
    --text-secondary: #aaaaaa;
    --text-accent: #ffffff;
    --bg-card: rgba(26, 26, 26, 0.95);
    --bg-section: #2a2a2a;
    --border-color: #444444;
    --border-hover: #7c94ff;
    --success-color: #4ade80;
    --success-bg: rgba(74, 222, 128, 0.2);
    --warning-color: #fbbf24;
    --danger-color: #f87171;
    --shadow-card: var(--shadow-md);
    --shadow-hover: var(--shadow-lg);

    /* Interactive States for dark theme */
    --color-focus: #7c94ff;
    --color-focus-ring: rgba(124, 148, 255, 0.5);
    --color-interactive-hover: rgba(102, 126, 234, 0.15);
}

/* ============================================
   SYNTHWAVE THEME (Retro 80s)
   ============================================ */

[data-style="synthwave"] {
    /* Synthwave Gradients */
    --bg-gradient-start: #1a0033;
    --bg-gradient-end: #2d004d;

    /* Text Colors */
    --text-primary: #ff006e;
    --text-secondary: #c77dff;
    --text-accent: #00f5ff;

    /* Backgrounds */
    --bg-card: rgba(26, 0, 51, 0.95);
    --bg-section: rgba(45, 0, 77, 0.6);

    /* Borders & Accents */
    --border-color: #7209b7;
    --border-hover: #ff006e;

    /* Status Colors */
    --success-color: #00f5ff;
    --success-bg: rgba(0, 245, 255, 0.2);
    --warning-color: #ffbe0b;
    --danger-color: #ff006e;

    /* Interactive States */
    --color-focus: #ff006e;
    --color-focus-ring: rgba(255, 0, 110, 0.5);
    --color-interactive-hover: rgba(255, 0, 110, 0.2);
}

[data-style="synthwave"][data-theme="dark"] {
    --bg-gradient-start: #0a001a;
    --bg-gradient-end: #1a0033;
    --bg-card: rgba(10, 0, 26, 0.98);
    --bg-section: rgba(26, 0, 51, 0.7);
    --text-primary: #ff66f6;
    --text-secondary: #c199ff;
    --border-color: #551a8b;
}

/* Synthwave Special Effects */
[data-style="synthwave"] body {
    background: linear-gradient(180deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
}

[data-style="synthwave"] .tab-button.active,
[data-style="synthwave"] .nav-button.active {
    background: linear-gradient(45deg, #ff006e, #7209b7);
    box-shadow: 0 0 20px rgba(255, 0, 110, 0.5);
}

[data-style="synthwave"] button:hover {
    text-shadow: 0 0 10px currentColor;
}

[data-style="synthwave"] h1,
[data-style="synthwave"] h2,
[data-style="synthwave"] h3 {
    text-shadow: 0 0 10px var(--text-accent);
}

/* ============================================
   GAME BOY THEME (Classic Green)
   ============================================ */

[data-style="gameboy"] {
    /* Game Boy Green Palette */
    --bg-gradient-start: #9bbc0f;
    --bg-gradient-end: #8bac0f;

    /* Text Colors - Dark greens */
    --text-primary: #0f380f;
    --text-secondary: #306230;
    --text-accent: #0f380f;

    /* Backgrounds */
    --bg-card: rgba(155, 188, 15, 0.95);
    --bg-section: #8bac0f;

    /* Borders */
    --border-color: #306230;
    --border-hover: #0f380f;

    /* Status Colors */
    --success-color: #0f380f;
    --success-bg: rgba(15, 56, 15, 0.2);
    --warning-color: #306230;
    --danger-color: #0f380f;

    /* Interactive States */
    --color-focus: #0f380f;
    --color-focus-ring: rgba(15, 56, 15, 0.4);
    --color-interactive-hover: rgba(15, 56, 15, 0.1);

    /* Shadows - subtle for retro look */
    --shadow-sm: 2px 2px 0 rgba(15, 56, 15, 0.2);
    --shadow-md: 4px 4px 0 rgba(15, 56, 15, 0.2);
    --shadow-lg: 6px 6px 0 rgba(15, 56, 15, 0.2);
    --shadow-xl: 8px 8px 0 rgba(15, 56, 15, 0.3);
}

[data-style="gameboy"][data-theme="dark"] {
    --bg-gradient-start: #0a2a0a;
    --bg-gradient-end: #0a2a0a;
    --bg-card: rgba(15, 56, 15, 0.95);
    --bg-section: #1a4a1a;
    --text-primary: #9bbc0f;
    --text-secondary: #8bac0f;
    --text-accent: #c4dc0f;
    --border-color: #5a7a2f;
}

/* Game Boy Special Effects */
[data-style="gameboy"] body {
    background: var(--bg-gradient-start);
    font-family: 'Courier New', monospace;
}

[data-style="gameboy"] * {
    border-radius: 2px !important;
}

[data-style="gameboy"] .tab-button.active,
[data-style="gameboy"] .nav-button.active {
    background: var(--text-accent);
    color: var(--bg-card);
}

[data-style="gameboy"] button {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

[data-style="gameboy"] h1,
[data-style="gameboy"] h2,
[data-style="gameboy"] h3 {
    font-weight: 900;
    letter-spacing: 2px;
}

/* Game Boy - Sprite Sheet Icons (512x512px, 16x16 grid, 32px per icon) */
[data-style="gameboy"] .nav-icon {
    font-size: 0 !important;
    display: inline-block;
    width: 28px;
    height: 28px;
    background-image: url('./Game Boy Icons/Without/GB_without-otline_part-1.png');
    background-size: 512px 512px;
    background-repeat: no-repeat;
    vertical-align: middle;
    image-rendering: pixelated;
}

[data-style="gameboy"] .stat-icon {
    font-size: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background-image: url('./Game Boy Icons/Without/GB_without-otline_part-1.png');
    background-size: 512px 512px;
    background-repeat: no-repeat;
    image-rendering: pixelated;
}

/* Game Boy Dark Mode - Adjust icon brightness */
[data-style="gameboy"][data-theme="dark"] .nav-icon,
[data-style="gameboy"][data-theme="dark"] .stat-icon {
    filter: brightness(1.2) contrast(1.1);
}

/* Nav Icons - Specific positions (each icon is 32px in sprite) */
[data-style="gameboy"] .nav-button:nth-child(1) .nav-icon {
    /* ✅ Checkmark - Row 0, Col 4 */
    background-position: -128px -0px;
}

[data-style="gameboy"] .nav-button:nth-child(2) .nav-icon {
    /* 📝 Document/Note - Row 2, Col 10 */
    background-position: -320px -64px;
}

[data-style="gameboy"] .nav-button:nth-child(3) .nav-icon {
    /* ⛰️ Mountain/Goals - Row 4, Col 3 */
    background-position: -96px -128px;
}

[data-style="gameboy"] .nav-button:nth-child(4) .nav-icon {
    /* 👥 People - Row 1, Col 0 */
    background-position: -0px -32px;
}

[data-style="gameboy"] #system-settings-btn .nav-icon {
    /* ⚙️ Gear/Settings - Row 5, Col 2 */
    background-position: -64px -160px;
}

/* Stat Icons - Larger versions */
[data-style="gameboy"] .stat-card:nth-child(1) .stat-icon {
    /* 🎯 Target - Row 0, Col 12 */
    background-position: -384px -0px;
}

[data-style="gameboy"] .stat-card:nth-child(2) .stat-icon {
    /* 🔥 Fire/Flame - Row 3, Col 4 */
    background-position: -128px -96px;
}

[data-style="gameboy"] .stat-card:nth-child(3) .stat-icon {
    /* 📈 Chart/Graph - Row 6, Col 6 */
    background-position: -192px -192px;
}

/* Game Boy - Month Cards */
[data-style="gameboy"] .month-card {
    background: var(--bg-card);
    border: 3px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

[data-style="gameboy"] .month-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

[data-style="gameboy"] .month-card.past {
    opacity: 0.5;
    background: var(--bg-section);
}

[data-style="gameboy"] .month-card.current {
    border-color: var(--text-accent);
    border-width: 4px;
    box-shadow: var(--shadow-lg);
}

[data-style="gameboy"] .month-header {
    background: var(--text-primary);
    color: var(--bg-card);
}

[data-style="gameboy"][data-theme="dark"] .month-header {
    background: var(--text-accent);
    color: var(--bg-gradient-start);
}

/* Game Boy - Hide emojis in text content */
[data-style="gameboy"] .tab-button,
[data-style="gameboy"] h2,
[data-style="gameboy"] h3,
[data-style="gameboy"] h4,
[data-style="gameboy"] .empty-history::before {
    filter: grayscale(100%) brightness(0.3) contrast(2);
}

/* Game Boy - Stat Cards */
[data-style="gameboy"] .stat-card {
    background: var(--bg-card);
    border: 3px solid var(--border-color);
}

[data-style="gameboy"] .stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

[data-style="gameboy"] .stat-icon {
    background-color: transparent !important;
    border: none !important;
    border-radius: 2px !important;
}

[data-style="gameboy"][data-theme="dark"] .stat-icon {
    background-color: transparent !important;
}

/* Game Boy - Month Stats */
[data-style="gameboy"] .month-stats {
    background: var(--bg-card);
    color: var(--text-primary);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    font-size: var(--font-size-base);
    line-height: 1.6;
    transition: all 0.3s ease;
    overflow-x: hidden;
}

/* ============================================
   LINKS
   ============================================ */
a {
    color: #1e8ad6;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #3ba0e6;
}

[data-theme="dark"] a {
    color: #4a9ede;
}

[data-theme="dark"] a:hover {
    color: #6bb5ff;
}

/* Dark mode enhancements */
[data-theme="dark"] hr {
    background-color: var(--border-color);
    opacity: 0.8;
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background-color: #2a2a2a;
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    background-color: #333333;
    border-color: var(--border-hover);
}

/* ============================================
   BUTTON SYSTEM
   ============================================ */

/* Base button styles - all buttons inherit these */
button {
    font-family: inherit;
    font-size: var(--font-size-base);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

button:focus-visible {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
}

/* Primary Buttons - Main actions */
.btn-primary,
.checkin-button,
.save-btn {
    background: var(--border-hover);
    color: white;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.checkin-button:hover,
.save-btn:hover {
    background: #4F46E5;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active,
.checkin-button:active,
.save-btn:active {
    transform: translateY(0);
}

/* Secondary Buttons - Supporting actions */
.btn-secondary,
.cancel-btn {
    background: var(--bg-section);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
}

.btn-secondary:hover,
.cancel-btn:hover {
    background: var(--bg-card);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Ghost Buttons - Minimal styling */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
}

.btn-ghost:hover {
    background: var(--color-interactive-hover);
    color: var(--text-primary);
}

/* Danger Buttons - Destructive actions */
.btn-danger,
.delete-btn,
.history-delete-btn,
.delete-quarter-btn,
.delete-year-btn,
.delete-goal-btn,
.delete-habit-btn {
    background: var(--danger-color);
    color: white;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.btn-danger:hover,
.delete-btn:hover,
.history-delete-btn:hover,
.delete-quarter-btn:hover,
.delete-year-btn:hover,
.delete-goal-btn:hover,
.delete-habit-btn:hover {
    background: #c82333;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Button Sizes */
.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-md);
}

/* Icon Buttons */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* Add Button Style */
.add-button,
.edit-button {
    background: var(--border-hover);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.add-button:hover,
.edit-button:hover {
    background: #5569d6;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* Action Buttons (View, Edit) */
.view-quarter-btn,
.view-year-btn,
.edit-goal-btn,
.edit-habit-btn,
.history-view-btn {
    background: var(--border-hover);
    color: white;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

.view-quarter-btn:hover,
.view-year-btn:hover,
.edit-goal-btn:hover,
.edit-habit-btn:hover,
.history-view-btn:hover {
    background: #5569d6;
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

/* Navigation Buttons */
.back-button,
.today-btn {
    background: var(--bg-card);
    color: var(--text-accent);
    border: 2px solid var(--border-color);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.back-button:hover,
.today-btn:hover {
    background: var(--bg-section);
    border-color: var(--border-hover);
}

/* Circular Navigation Arrows (Daily/Weekly/Monthly views) */
.nav-btn {
    background: #6366F1;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #4F46E5;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.nav-btn:active {
    transform: scale(1.05);
}

/* ============================================
   FOCUS STATES & ACCESSIBILITY
   ============================================ */

/* Input Focus States */
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
    border-color: var(--color-focus);
}

/* Link Focus States */
a:focus-visible {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Checkbox Focus States */
input[type="checkbox"]:focus-visible {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
}

/* Remove default outline, rely on focus-visible */
*:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   LOADING & FEEDBACK STATES
   ============================================ */

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--border-hover);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading Button State */
button.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

button.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Success Toast/Notification */
.toast {
    position: fixed;
    top: var(--space-lg);
    right: var(--space-lg);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-width: 300px;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s;
    border-left: 4px solid var(--success-color);
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.info {
    border-left-color: var(--border-hover);
}

.toast-icon {
    font-size: var(--font-size-lg);
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-weight: 500;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Success Checkmark Animation */
.success-checkmark {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    border-radius: 50%;
    display: block;
    stroke-width: 3;
    stroke: var(--success-color);
    stroke-miterlimit: 10;
    box-shadow: inset 0 0 0 var(--success-color);
    animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.success-checkmark circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--success-color);
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.success-checkmark path {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes fill {
    100% {
        box-shadow: inset 0 0 0 30px var(--success-color);
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: var(--bg-card);
    padding: var(--space-xl);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    box-shadow: var(--shadow-xl);
}

.loading-text {
    color: var(--text-primary);
    font-weight: 500;
}

/* Skeleton Loading States */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-section) 25%,
        var(--border-color) 50%,
        var(--bg-section) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 16px;
    margin-bottom: var(--space-xs);
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: var(--space-sm);
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-md);
}

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

/* ============================================
   TYPOGRAPHY SYSTEM
   ============================================ */

h1 {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--space-md);
}

h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--space-sm);
}

h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--space-sm);
}

h4 {
    font-size: var(--font-size-md);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--space-xs);
}

h5 {
    font-size: var(--font-size-base);
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: var(--space-xs);
}

p {
    font-size: var(--font-size-base);
    line-height: 1.6;
    margin-bottom: var(--space-sm);
}

small {
    font-size: var(--font-size-sm);
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Side Navigation */
.side-nav {
    width: 110px;
    background: var(--bg-card);
    border-right: 2px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Remove collapsed/pinned states - always show compact nav */
.side-nav.collapsed,
.side-nav.pinned {
    width: 110px;
}

/* App Logo */
.app-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: var(--space-xs);
}

.logo-icon {
    width: 48px;
    height: 48px;
    stroke: var(--text-accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.logo-text {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.side-nav .nav-header {
    padding: var(--space-sm) 0;
    justify-content: center;
    align-items: center;
    display: flex;
    border-bottom: 2px solid var(--border-color);
}

.side-nav .nav-menu {
    display: flex;
    flex-direction: column;
    padding: var(--space-sm) 0;
    gap: var(--space-xs);
}

.nav-toggle {
    display: none; /* Hide toggle button - no longer needed */
}
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.nav-toggle:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
}

.nav-toggle-icon {
    font-family: monospace;
    font-weight: bold;
    font-size: 1.4em;
    line-height: 1;
    letter-spacing: -1px;
}

.nav-header h1 {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-accent);
    margin: 0;
    transition: opacity 0.3s ease;
}

.nav-menu {
    list-style: none;
    padding: 20px 0;
    margin: 0;
    flex: 1;
}

.nav-item {
    margin: 0;
}

.nav-button {
    width: calc(100% - 24px);
    margin: 0 12px;
    padding: var(--space-sm) var(--space-xs);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 1em;
    text-align: center;
    min-height: 60px;
    border-radius: var(--radius-sm);
}

.nav-button:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
}

.nav-button.active {
    background: var(--border-hover);
    color: white;
}

.nav-icon {
    font-size: var(--font-size-lg);
    width: auto;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-label {
    font-weight: 500;
    font-size: 10px;
    line-height: 1.1;
    max-width: 100%;
    word-wrap: break-word;
}

.nav-arrow {
    display: none; /* No longer needed - nav doesn't expand */
}

/* Nav Footer */
.nav-footer {
    margin-top: auto;
    padding: var(--space-sm) 0;
    border-top: 2px solid var(--border-color);
}

.nav-footer .nav-button {
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    min-height: 60px;
}

.nav-footer .nav-button:hover {
    background: var(--color-interactive-hover);
}

.nav-footer .nav-button.active {
    background: var(--bg-section);
    color: var(--text-accent);
}

/* Subnav - Hidden (not used in simplified nav) */
.subnav {
    display: none;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 110px;
    padding: 0;
    background: transparent;
}

.section {
    display: none;
    padding: var(--space-lg);
    max-width: 1400px;
    margin: 0 auto;
}

.section.active {
    display: block;
}

.section-header {
    margin-bottom: var(--space-xl);
}

.section-header h2 {
    font-size: var(--font-size-xl);
    color: var(--text-accent);
    margin-bottom: var(--space-sm);
}

.section-description {
    color: var(--text-secondary);
    font-size: var(--font-size-md);
    margin: 0;
}

/* Habit Tracker Adjustments */
.habit-header {
    margin-bottom: var(--space-lg);
}

.habit-header .header-top h2 {
    font-size: var(--font-size-xl);
    color: var(--text-accent);
    margin: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-lg);
}

header {
    background: var(--bg-card);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    text-align: center;
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

header h1 {
    font-size: var(--font-size-2xl);
    background: linear-gradient(45deg, var(--bg-gradient-start), var(--bg-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


.stats {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.stats span {
    background: var(--bg-section);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-weight: 500;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.tabs {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.tab-button {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 500;
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

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

.tab-button.active {
    background: linear-gradient(45deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: white;
    border-color: transparent;
}

.settings-tab {
    background: var(--bg-section);
    border: 2px solid var(--border-color);
}

.settings-tab.active {
    background: var(--text-secondary);
    color: white;
    border-color: transparent;
}

.tab-content {
    display: none;
    background: var(--bg-card);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px var(--shadow-card);
    min-height: 600px;
    transition: all 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* View Headers */
.view-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

/* Nav button styles moved to Button System section above for consistency */

.daily-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.daily-nav-row,
.date-nav-row {
    display: flex;
    align-items: center;
    gap: 40px;
}

.day-date-wrapper,
.date-label-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 180px;
}

.weekly-header-center,
.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.today-btn {
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
    border: 2px solid rgba(102, 126, 234, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.today-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-1px);
}

.today-btn:active {
    transform: translateY(0);
}

.today-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

.view-header h2 {
    font-size: 1.8em;
    color: #2c3e50;
    min-width: 200px;
    text-align: center;
    margin: 0;
}

.daily-header-center h2,
#weekly-date,
#monthly-date,
#quarterly-date,
#yearly-date {
    margin: 0;
    line-height: 1.2;
    font-size: 1.4em;
    font-weight: 700;
}

.weekly-quarter-label {
    font-size: 0.9em;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: -5px;
}

.current-date {
    font-size: 0.9em;
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
}

/* Daily View */
.daily-container {
    display: grid;
    gap: 30px;
}

.habits-section,
.weekly-section {
    background: var(--bg-section);
    padding: 25px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.habits-section h3,
.weekly-section h3 {
    color: var(--text-accent);
    margin-bottom: 20px;
    font-size: 1.3em;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.daily-habits,
.weekly-habits {
    display: grid;
    gap: 15px;
}

.habit-item {
    background: var(--bg-card);
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.habit-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 10px var(--shadow-hover);
}

.habit-item.completed {
    background: var(--success-bg);
    border-color: var(--success-color);
}

.habit-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.habit-checkbox.checked {
    background: #28a745;
    border-color: #28a745;
}

.habit-checkbox.checked::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: bold;
}

.habit-info {
    flex: 1;
}

.habit-name {
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 5px;
}

.habit-description {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.habit-frequency-label {
    color: var(--accent-primary);
    font-size: 0.85em;
    font-weight: 600;
    margin-top: 4px;
    display: inline-block;
    padding: 2px 8px;
    background: rgba(107, 94, 205, 0.1);
    border-radius: 4px;
}

.habit-streak {
    color: var(--success-color);
    font-weight: 600;
    font-size: 0.9em;
}

/* Irrelevant habits (for days when they don't apply, e.g., weekdays-only on weekends) */
.habit-item.irrelevant {
    opacity: 0.5;
    background: var(--bg-section);
    border-color: var(--border-color);
}

.habit-item.irrelevant .habit-name {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.habit-item.irrelevant .habit-description {
    color: var(--text-secondary);
    opacity: 0.7;
}

.habit-item.irrelevant .habit-checkbox {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--text-secondary);
}

.habit-item.irrelevant .habit-checkbox.disabled {
    background: var(--bg-section);
    border-color: var(--text-secondary);
    cursor: not-allowed;
}

/* Previous Quarter Habits (rollover candidates) */
.previous-quarter-habit {
    border: 2px dashed var(--border-color) !important;
    opacity: 0.7;
    background: rgba(107, 94, 205, 0.05);
}

.previous-quarter-label {
    color: var(--text-secondary);
    font-size: 0.8em;
    font-style: italic;
    margin-top: 4px;
}

.habit-actions-vertical {
    flex-direction: column !important;
    align-items: stretch !important;
}

.keep-habit-btn {
    background: #6B5ECD !important;
    color: white !important;
    border: 2px solid #6B5ECD !important;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.keep-habit-btn:hover {
    background: #8B5CF6 !important;
    border-color: #8B5CF6 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(107, 94, 205, 0.3);
}

.discard-habit-btn {
    background: #FFF !important;
    color: #DC2626 !important;
    border: 2px solid #DC2626 !important;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.discard-habit-btn:hover {
    background: #DC2626 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* Weight Tracking Section in Stats */
.weight-tracking-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.weight-tracking-section h3 {
    color: var(--text-accent);
    margin-bottom: 25px;
    font-size: 1.5em;
}

.weight-tracking-section h4 {
    color: var(--text-accent);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.weight-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.weight-stat {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.weight-stat:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 15px var(--shadow-hover);
}

.weight-stat-label {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 8px;
    font-weight: 500;
}

.weight-stat-value {
    color: var(--text-accent);
    font-size: 1.8em;
    font-weight: 700;
}

.weight-chart-container {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
    margin-bottom: 40px;
    box-shadow: 0 4px 15px var(--shadow-card);
    position: relative;
}

.weight-chart-container canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 400px;
    cursor: crosshair;
}

.weight-tooltip {
    position: absolute;
    background: var(--bg-card);
    border: 2px solid var(--border-hover);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.9em;
    color: var(--text-primary);
    box-shadow: 0 4px 15px var(--shadow-hover);
    pointer-events: none;
    z-index: 1000;
    display: none;
    white-space: nowrap;
}

.weight-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-hover);
}

.weight-tooltip.tooltip-below::after {
    top: -12px;
    border-top-color: transparent;
    border-bottom-color: var(--border-hover);
}

.weight-data-section h3 {
    color: var(--text-accent);
    margin-bottom: 20px;
    font-size: 1.4em;
}

.weight-entries {
    display: grid;
    gap: 10px;
}

.weight-entry {
    background: var(--bg-card);
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.weight-entry:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 8px var(--shadow-hover);
}

.weight-entry-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.weight-entry-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.weight-entry:hover .weight-entry-actions {
    opacity: 1;
}

/* Check-ins Section */
.checkins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.checkin-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px var(--shadow-card);
    transition: all 0.3s ease;
}

.checkin-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-hover);
    border-color: var(--border-hover);
}

.checkin-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.checkin-header h3 {
    color: var(--text-accent);
    margin: 0;
    font-size: 1.3em;
}

.checkin-frequency {
    background: var(--success-bg);
    color: var(--success-color);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
}

.checkin-description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.checkin-button {
    background: var(--border-hover);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    margin-bottom: 15px;
}

.checkin-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.last-completed {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* Check-in Navigation */
.checkins-nav {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    background: var(--bg-section);
    border-radius: 12px;
    padding: 4px;
}

.checkin-nav-button {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 500;
    white-space: nowrap;
}

.checkin-nav-button:hover {
    color: var(--text-primary);
}

.checkin-nav-button.active {
    background: var(--border-hover);
    color: white;
}

/* Planning Views */
.planning-view {
    display: none;
}

.planning-view.active {
    display: block;
}

.checkin-journal {
    display: none;
}

.checkin-journal.active {
    display: block;
}

/* History Tables */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.history-header h3 {
    color: var(--text-accent);
    margin: 0;
    font-size: 1.8em;
}

.years-table-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.years-table-container #new-year-btn {
    align-self: center;
    margin-top: var(--space-md);
}

.history-table-container {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow-card);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.history-table thead th {
    background: var(--bg-section);
    color: var(--text-accent);
    font-weight: 600;
    padding: 20px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

.history-table tbody td {
    padding: 18px 20px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.history-table tbody tr:hover {
    background: var(--bg-section);
}

.history-table tbody tr:last-child td {
    border-bottom: none;
}

.history-date {
    font-weight: 500;
    color: var(--text-accent);
}

.history-period {
    color: var(--text-secondary);
    font-style: italic;
}

.history-actions {
    display: flex;
    gap: 10px;
}

.history-view-btn, .history-delete-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.history-view-btn {
    background: var(--border-hover);
    color: white;
}

.history-view-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(102, 126, 234, 0.3);
}

.history-delete-btn {
    background: var(--danger-color);
    color: white;
}

.history-delete-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(220, 53, 69, 0.3);
}

.empty-history {
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg-section);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
}

.empty-history::before {
    content: '📭';
    display: block;
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.6;
    animation: float 3s ease-in-out infinite;
}

.empty-history p {
    margin: var(--space-sm) 0;
    line-height: 1.6;
    font-size: var(--font-size-base);
}

.empty-history p:first-of-type {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Check-in Content Display */
.checkin-date-display {
    color: var(--text-secondary);
    font-size: 1.1em;
    margin-bottom: 25px;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.checkin-content-display {
    max-height: 60vh;
    overflow-y: auto;
}

.checkin-response {
    margin-bottom: 30px;
    background: var(--bg-section);
    border-radius: 12px;
    padding: 20px;
}

.checkin-response-question {
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 12px;
    font-size: 1.1em;
    line-height: 1.4;
}

.checkin-response-answer {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Journal Entry Layout */
.journal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.back-button {
    background: var(--bg-section);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-button:hover {
    background: var(--border-hover);
    color: white;
    border-color: var(--border-hover);
}

.journal-header h2 {
    color: var(--text-accent);
    margin: 0;
    font-size: 2.2em;
    text-align: center;
    flex: 1;
}

.journal-date {
    color: var(--text-secondary);
    font-size: 1em;
    text-align: right;
    min-width: 120px;
}

.journal-form {
    max-width: 900px;
    margin: 0 auto;
}

.journal-questions {
    display: flex;
    flex-direction: column;
    gap: 35px;
    margin-bottom: 50px;
}

.journal-question {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px var(--shadow-card);
    transition: all 0.3s ease;
}

.journal-question:focus-within {
    border-color: var(--border-hover);
    box-shadow: 0 4px 15px var(--shadow-hover);
}

.journal-question label {
    display: block;
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 15px;
    font-size: 1.2em;
    line-height: 1.4;
}

.journal-question textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-section);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1em;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
}

.journal-question textarea:focus {
    outline: none;
    border-color: var(--border-hover);
    background: var(--bg-card);
}

.journal-question textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.journal-question input[type="text"] {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-section);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1em;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.journal-question input[type="text"]:focus {
    outline: none;
    border-color: var(--border-hover);
    background: var(--bg-card);
}

.journal-question input[type="text"]::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.journal-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 30px 0;
    border-top: 2px solid var(--border-color);
}

.journal-actions .cancel-btn {
    background: var(--bg-section);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 1em;
}

.journal-actions .cancel-btn:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.journal-actions .save-btn {
    background: var(--success-color);
    color: white;
    border: 2px solid var(--success-color);
    padding: 12px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 1em;
}

.journal-actions .save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Success Toast Animation */
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Quarterly Planning Section */
.quarters-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 25px;
}

.quarter-list-item {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px var(--shadow-card);
    transition: all 0.3s ease;
}

.quarter-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-hover);
    border-color: var(--border-hover);
}

.quarter-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.quarter-list-header h4 {
    color: var(--text-accent);
    margin: 0;
    font-size: 1.4em;
}

.quarter-list-stats {
    display: flex;
    gap: 15px;
    align-items: center;
}

.quarter-list-stats span {
    background: var(--bg-section);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 500;
}

.quarter-list-stats .has-review {
    background: var(--success-bg);
    color: var(--success-color);
}

.quarter-list-stats .no-review {
    background: var(--bg-section);
    color: var(--text-secondary);
    opacity: 0.6;
}

/* ====================================================================
   QUARTER NAVIGATION BUTTONS - NEEDS WORK
   Year-to-quarter navigation in Planning section.
   Currently under development/refinement.
   ==================================================================== */

/* Quarter Navigation Buttons */
.quarter-nav-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.quarter-nav-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-hover);
    background: white;
    color: var(--border-hover);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.3s ease;
    min-width: 50px;
}

.quarter-nav-btn:hover:not(.disabled) {
    background: var(--border-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.quarter-nav-btn.disabled {
    border-color: var(--border-color);
    color: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
}

.quarter-nav-btn.create-quarter {
    border: 2px dashed var(--border-color);
    background: var(--bg-section);
    color: var(--text-secondary);
    opacity: 0.7;
    cursor: pointer;
}

.quarter-nav-btn.create-quarter:hover {
    border-color: var(--border-hover);
    background: rgba(102, 126, 234, 0.1);
    color: var(--border-hover);
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.review-btn {
    padding: 8px 16px;
    border: 2px solid #10B981;
    background: white;
    color: #10B981;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.3s ease;
    min-width: 70px;
}

.review-btn:hover {
    background: #10B981;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.quarter-list-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.view-quarter-btn, .delete-quarter-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.95em;
}

.view-quarter-btn {
    background: var(--border-hover);
    color: white;
    flex: 1;
}

.view-quarter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.delete-quarter-btn {
    background: var(--danger-color);
    color: white;
}

.delete-quarter-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.quarter-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.quarter-detail-header h3 {
    color: var(--text-accent);
    margin: 0;
    font-size: 2.2em;
}

.quarter-detail-content {
    display: flex;
    flex-direction: column;
    gap: 35px;
}

.quarter-section {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 15px var(--shadow-card);
}

.quarter-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.quarter-section .section-header h4 {
    color: var(--text-accent);
    margin: 0;
    font-size: 1.4em;
}

.quarter-section .add-button,
.quarter-section .edit-button {
    background: var(--border-hover);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.95em;
}

.quarter-section .add-button:hover,
.quarter-section .edit-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.goals-list, .habits-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.goal-item, .habit-item {
    background: var(--bg-section);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    transition: all 0.3s ease;
}

.goal-item:hover, .habit-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 8px var(--shadow-card);
}

.goal-item.completed {
    opacity: 0.7;
}

.goal-item.completed .goal-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.goal-checkbox {
    display: flex;
    align-items: center;
}

.goal-checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--success-color);
}

.goal-content, .habit-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.goal-text, .habit-name {
    color: var(--text-accent);
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 6px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 6px;
}

.goal-description, .habit-description {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.5;
    margin-top: 6px;
}

.goal-actions, .habit-actions {
    display: flex;
    gap: 8px;
    opacity: 1 !important;
}

.edit-goal-btn, .delete-goal-btn,
.edit-habit-btn, .delete-habit-btn,
.keep-habit-btn, .discard-habit-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.edit-goal-btn, .edit-habit-btn {
    background: #667eea !important;
    color: white !important;
    border: 2px solid #667eea !important;
}

.edit-goal-btn:hover, .edit-habit-btn:hover {
    background: #5569d6 !important;
    color: white !important;
    border-color: #5569d6 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.delete-goal-btn, .delete-habit-btn {
    background: var(--bg-card);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    padding: 4px 8px;
    font-size: 0.75em;
    font-weight: 500;
}

.delete-goal-btn:hover, .delete-habit-btn:hover {
    background: var(--danger-color);
    color: white;
}

/* Quarterly goals edit button with icon */
.quarter-edit-btn {
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: 2px solid #A5B4FC !important;
    font-size: 0.9em;
}

.quarter-edit-btn svg {
    transition: stroke 0.3s ease;
    pointer-events: none;
}

.quarter-edit-btn:hover {
    background: #6366F1 !important;
    border-color: #6366F1 !important;
    transform: scale(1.05);
}

.quarter-edit-btn:hover svg {
    stroke: white;
}

/* Quarterly goals delete button with icon */
.quarter-delete-btn {
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: 2px solid #FCA5A5 !important;
    font-size: 0.9em;
}

.quarter-delete-btn svg {
    transition: stroke 0.3s ease;
    pointer-events: none;
}

.quarter-delete-btn:hover {
    background: #DC2626 !important;
    border-color: #DC2626 !important;
    transform: scale(1.05);
}

.quarter-delete-btn:hover svg {
    stroke: white;
}

.empty-list {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
    font-style: italic;
}

.review-content {
    color: var(--text-primary);
}

.review-placeholder {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-style: italic;
}

.review-section {
    background: var(--bg-section);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.review-section h5 {
    color: var(--text-accent);
    margin: 0 0 12px 0;
    font-size: 1.1em;
}

.review-section p {
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
    margin: 0;
}

.review-date {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* Review Section Headers */
.review-section-header {
    margin: 30px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-primary);
}

.review-section-header h4 {
    color: var(--accent-primary);
    font-size: 1.3em;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.review-section-header:first-child {
    margin-top: 10px;
}

/* Start Stop Keep Container */
.start-stop-keep-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 15px;
}

.ssk-section {
    background: var(--bg-section);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.ssk-section label {
    display: block;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 8px;
    font-size: 1em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ssk-section textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95em;
    resize: vertical;
}

.ssk-section textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(107, 94, 205, 0.1);
}

/* Start Stop Keep Display */
.start-stop-keep-display {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 10px;
}

.ssk-display-item {
    background: var(--bg-section);
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid var(--accent-primary);
}

.ssk-display-item strong {
    display: block;
    color: var(--accent-primary);
    margin-bottom: 6px;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ssk-display-item p {
    margin: 0;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Numbered List Input Styles */
.numbered-list-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.numbered-input-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.number-label {
    font-weight: 700;
    color: var(--accent-primary);
    font-size: 1em;
    min-width: 24px;
    text-align: right;
}

.numbered-input-item input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-section);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95em;
    transition: all 0.3s ease;
}

.numbered-input-item input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(107, 94, 205, 0.1);
}

.numbered-input-item input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Review Numbered List Display */
.review-numbered-list {
    margin: 0;
    padding-left: 24px;
    color: var(--text-primary);
    line-height: 1.8;
}

.review-numbered-list li {
    margin-bottom: 8px;
    padding-left: 8px;
}

.review-numbered-list li::marker {
    color: var(--accent-primary);
    font-weight: 700;
}

/* Workout Routine Styles */
.workout-week-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.workout-day-card {
    background: linear-gradient(135deg, var(--bg-section), #f8f7fc);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 80px;
}

.workout-day-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 94, 205, 0.15);
    border-color: var(--accent-primary);
}

.workout-day-card.empty {
    opacity: 0.6;
    background: linear-gradient(135deg, #f8f7fc, #e8e7f0);
}

.workout-day-name {
    font-weight: 700;
    color: var(--accent-primary);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.workout-day-activity {
    color: var(--text-primary);
    font-size: 0.95em;
    line-height: 1.4;
    font-weight: 500;
}

.workout-day-card.empty .workout-day-activity {
    color: var(--text-secondary);
    font-style: italic;
}

/* Workout Modal Styles */
.workout-week-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.workout-day-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.workout-day-input label {
    font-weight: 600;
    color: var(--text-accent);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.workout-day-input input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-section);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95em;
    transition: all 0.3s ease;
}

.workout-day-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(107, 94, 205, 0.1);
}

.workout-day-input input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 8px;
    font-size: 1em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-section);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--border-hover);
    background: var(--bg-card);
}

/* Relationships Section */
.relationships-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    background: var(--bg-section);
    border-radius: 12px;
    padding: 4px;
}

.relationship-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 500;
}

.relationship-tab:hover {
    color: var(--text-primary);
}

.relationship-tab.active {
    background: var(--border-hover);
    color: white;
}

.relationship-bucket {
    display: none;
}

.relationship-bucket.active {
    display: block;
}

.bucket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.bucket-header h3 {
    color: var(--text-accent);
    margin: 0;
    font-size: 1.5em;
}

.add-person-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.add-person-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.people-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    min-height: 100px;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.people-list.drop-zone-active {
    background: rgba(99, 102, 241, 0.1);
    border: 2px dashed #6366F1;
}

.person-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px var(--shadow-card);
    transition: all 0.3s ease;
    cursor: move;
}

.person-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px var(--shadow-hover);
    border-color: var(--border-hover);
}

.person-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    cursor: grabbing;
}

.person-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.person-name {
    font-weight: bold;
    color: var(--text-accent);
    font-size: 1.1em;
    margin: 0;
}

.person-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.person-card:hover .person-actions {
    opacity: 1;
}

.person-edit-btn, .person-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.9em;
}

.person-edit-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.person-delete-btn:hover {
    background: rgba(220, 53, 69, 0.1);
}

.person-notes {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.4;
    margin: 0;
}

/* Review Modal - Full screen for long form content */
.review-modal-content {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto;
    border-radius: 0;
    margin: 0 !important;
    padding: var(--space-xl) var(--space-xxl);
    box-sizing: border-box;
    position: absolute;
    top: 0;
    left: 0;
}

.checkin-question {
    margin-bottom: 25px;
}

.checkin-question label {
    display: block;
    font-weight: 500;
    color: var(--text-accent);
    margin-bottom: 8px;
    font-size: 1.1em;
}

.checkin-question textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-section);
    color: var(--text-primary);
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.checkin-question textarea:focus {
    outline: none;
    border-color: var(--border-hover);
}

.weight-edit-btn,
.weight-delete-btn {
    background: var(--bg-section);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.weight-edit-btn:hover {
    background: var(--border-hover);
    color: white;
}

.weight-delete-btn:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

.weight-entry-date {
    color: var(--text-accent);
    font-weight: 600;
}

.weight-entry-value {
    color: var(--text-secondary);
    font-size: 1.1em;
}

.weight-entry-change {
    font-size: 0.9em;
    font-weight: 600;
}

.weight-entry-change.positive {
    color: #dc3545;
}

.weight-entry-change.negative {
    color: #28a745;
}

.weight-entry-change.neutral {
    color: var(--text-secondary);
}

/* Weight Input Modal */
.weight-input-section {
    margin-bottom: 20px;
}

.weight-input-section label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-accent);
    font-weight: 600;
}

.weight-input-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.weight-input-container input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-section);
    color: var(--text-primary);
    font-size: 1.1em;
}

.weight-input-container select {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-section);
    color: var(--text-primary);
    font-size: 1.1em;
    min-width: 80px;
}

.weight-input-container input:focus,
.weight-input-container select:focus {
    outline: none;
    border-color: var(--border-hover);
}

/* Weight link in weekly tasks */
.weight-trends-link {
    color: var(--border-hover);
    text-decoration: none;
    font-size: 0.85em;
    margin-left: 8px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.weight-trends-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ============================================
   SYSTEM SETTINGS MODAL
   ============================================ */

.settings-modal-content {
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: var(--space-xl);
}

.settings-section h4 {
    color: var(--text-accent);
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-md);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: var(--space-sm);
}

.setting-option {
    margin-bottom: var(--space-md);
}

.setting-option label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-base);
}

/* Toggle Group */
.toggle-group {
    display: flex;
    gap: var(--space-sm);
    background: var(--bg-section);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
}

.toggle-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    background: var(--color-interactive-hover);
    color: var(--text-primary);
}

.toggle-btn.active {
    background: var(--border-hover);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Theme Grid */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.theme-card {
    background: var(--bg-section);
    border: 3px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.theme-card.active {
    border-color: var(--border-hover);
    box-shadow: 0 0 0 2px var(--color-focus-ring);
}

/* Theme Previews */
.theme-preview {
    width: 100%;
    height: 80px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
    position: relative;
    overflow: hidden;
}

/* Modern Preview */
.modern-preview {
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
}

.modern-preview .preview-bar {
    height: 20px;
    background: rgba(255, 255, 255, 0.95);
    margin-bottom: 4px;
}

.modern-preview .preview-content {
    padding: 8px;
}

.modern-preview .preview-line {
    height: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    margin-bottom: 4px;
}

.modern-preview .preview-line.short {
    width: 60%;
}

/* Synthwave Preview */
.synthwave-preview {
    background: linear-gradient(180deg, #1a0033 0%, #2d004d 50%, #ff006e 100%);
    position: relative;
}

.synthwave-preview .preview-grid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60%;
    background:
        linear-gradient(0deg, transparent 49%, #ff006e 50%, transparent 51%) 0 0 / 100% 8px,
        linear-gradient(90deg, transparent 49%, #ff006e 50%, transparent 51%) 0 0 / 8px 100%;
    opacity: 0.5;
}

.synthwave-preview .preview-sun {
    position: absolute;
    top: 25%;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #ff006e;
    box-shadow: 0 0 20px #ff006e;
}

/* Game Boy Preview */
.gameboy-preview {
    background: #9bbc0f;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gameboy-preview .preview-screen {
    background: #8bac0f;
    padding: 8px;
    border-radius: 2px;
    display: flex;
    gap: 4px;
}

.gameboy-preview .preview-pixel {
    width: 12px;
    height: 12px;
    background: #306230;
    border-radius: 1px;
}

/* Theme Info */
.theme-info h5 {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: var(--space-xs);
}

.theme-info p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0;
}

/* Data Management Section */
.settings-section .settings-description {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.data-buttons {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.data-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--bg-section);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.data-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.data-btn .btn-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.data-btn .btn-text {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 4px;
}

.data-btn .btn-text strong {
    color: var(--text-accent);
    font-size: var(--font-size-base);
    display: block;
}

.data-btn .btn-text small {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    display: block;
}

.export-btn:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1));
    border-color: #10B981;
}

.export-btn:hover .btn-text strong {
    color: #10B981;
}

.import-btn:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border-color: #6366F1;
}

.import-btn:hover .btn-text strong {
    color: #6366F1;
}

.data-warning {
    padding: var(--space-sm) var(--space-md);
    background: rgba(251, 191, 36, 0.1);
    border-left: 4px solid #F59E0B;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

/* Cloud Sync ID Section */
.sync-id-display,
.sync-id-input {
    margin-bottom: var(--space-md);
}

.sync-id-display label,
.sync-id-input label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
    font-size: var(--font-size-sm);
}

.sync-id-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.sync-id-row input[type="text"] {
    flex: 1;
    padding: var(--space-sm);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    background: var(--bg-section);
    color: var(--text-primary);
    font-family: monospace;
}

.sync-id-row input[type="text"]:focus {
    outline: none;
    border-color: var(--color-focus);
}

.sync-id-row input[type="text"][readonly] {
    background: var(--bg-card);
    cursor: default;
}

.copy-id-btn,
.apply-id-btn {
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-section);
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 600;
    font-size: var(--font-size-sm);
    white-space: nowrap;
    transition: all 0.2s ease;
}

.copy-id-btn:hover {
    background: #10B981;
    border-color: #10B981;
    color: white;
    transform: translateY(-1px);
}

.apply-id-btn:hover {
    background: #6366F1;
    border-color: #6366F1;
    color: white;
    transform: translateY(-1px);
}

.sync-help {
    display: block;
    margin-top: var(--space-xs);
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    line-height: 1.4;
}

/* Settings Footer */
.settings-footer {
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 2px solid var(--border-color);
    text-align: center;
}

.settings-note {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-style: italic;
    margin: 0;
}

/* Weekly View */
.weekly-container {
    overflow-x: auto;
}

.weekly-intention-section {
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.3);
}

.weekly-intention-section h3 {
    color: white !important;
    margin-bottom: 15px;
    font-size: 1.3em;
    text-align: center;
}

.intention-input-container {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

#weekly-intention {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1em;
    resize: vertical;
    min-height: 60px;
    transition: all 0.3s ease;
}

#weekly-intention::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

#weekly-intention:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

.save-intention-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.save-intention-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

.current-intention {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.intention-text {
    flex: 1;
    font-size: 1.1em;
    line-height: 1.4;
    font-style: italic;
}

.edit-intention-btn {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-left: 15px;
}

.edit-intention-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.weekly-sections {
    display: grid;
    gap: 30px;
}

.weekly-daily-section,
.weekly-tasks-section {
    background: var(--bg-section);
    padding: 25px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

/* Weekly Habits Table */
.weekly-table-container {
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-top: 15px;
    overflow: visible;
}

.weekly-habits-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.weekly-table-header {
    background: var(--bg-section);
}

.weekly-table-header th {
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

.habit-name-column {
    text-align: left !important;
    min-width: 150px;
    max-width: 200px;
    padding-left: 15px !important;
}

.day-column {
    width: 50px;
    min-width: 50px;
}

.weekly-habit-table-row {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.weekly-habit-table-row:hover {
    background: rgba(102, 126, 234, 0.05);
}

.weekly-habit-name-cell {
    padding: 15px;
    text-align: left;
    vertical-align: middle;
    border-right: 1px solid var(--border-color);
}

.weekly-habit-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.weekly-habit-description {
    font-size: 0.85em;
    color: var(--text-secondary);
    line-height: 1.3;
}

.weekly-day-cell {
    padding: 15px 8px;
    text-align: center;
    vertical-align: middle;
    border-right: 1px solid var(--border-color);
}

.weekly-day-cell:last-child {
    border-right: none;
}

.weekly-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    margin: 0 auto;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.weekly-checkbox:hover {
    border-color: var(--border-hover);
    transform: scale(1.1);
}

.weekly-checkbox.checked {
    background: var(--success-color);
    border-color: var(--success-color);
}

.weekly-checkbox.checked::after {
    content: '✓';
    font-weight: bold;
}

.weekly-checkbox.disabled {
    background: var(--bg-section);
    border-color: var(--border-color);
    opacity: 0.4;
    cursor: not-allowed;
}

.weekly-checkbox.disabled::after {
    content: '×';
    color: var(--text-secondary);
    font-weight: bold;
}

.weekly-day-cell.disabled {
    opacity: 0.4;
    background: var(--bg-section);
}

.weekly-daily-section h3,
.weekly-tasks-section h3 {
    color: var(--text-accent);
    margin-bottom: 20px;
    font-size: 1.3em;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.weekly-daily-grid {
    display: grid;
    gap: 20px;
    min-width: 800px;
}

.weekly-habit-row {
    background: var(--bg-card);
    border-radius: 10px;
    border: 2px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.weekly-habit-header {
    background: var(--bg-section);
    padding: 15px 20px;
    border-bottom: 2px solid var(--border-color);
}

.weekly-habit-name {
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 5px;
}

.weekly-habit-description {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.weekly-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.weekly-day {
    padding: 15px;
    text-align: center;
    border-right: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.weekly-day:last-child {
    border-right: none;
}

.weekly-day:hover {
    background: #f8f9fa;
}

.weekly-day-name {
    font-size: 0.8em;
    color: #6c757d;
    margin-bottom: 10px;
    font-weight: 500;
}

.weekly-day-date {
    font-size: 0.9em;
    color: #495057;
    margin-bottom: 10px;
}

.weekly-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    margin: 0 auto;
    display: block;
}

.weekly-checkbox.checked {
    background: #28a745;
    border-color: #28a745;
}

.weekly-checkbox.checked::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
}

/* Weekly Tasks List */
.weekly-tasks-list {
    display: grid;
    gap: 15px;
}

.weekly-task-item {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.weekly-task-item:hover {
    border-color: var(--border-hover);
    box-shadow: 0 2px 10px var(--shadow-hover);
}

.weekly-task-item.completed {
    background: var(--success-bg);
    border-color: var(--success-color);
}

.weekly-task-checkbox {
    width: 28px;
    height: 28px;
    border: 2px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.weekly-task-checkbox.checked {
    background: #28a745;
    border-color: #28a745;
}

.weekly-task-checkbox.checked::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 16px;
    font-weight: bold;
}

.weekly-task-info {
    flex: 1;
}

.weekly-task-name {
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 5px;
    font-size: 1.1em;
}

.weekly-task-description {
    color: var(--text-secondary);
    font-size: 0.9em;
}

.weekly-task-status {
    color: var(--success-color);
    font-weight: 600;
    font-size: 0.9em;
    margin-top: 5px;
}

/* Monthly View */
.monthly-container {
    overflow-x: auto;
}

.months-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    min-width: 600px;
}

.month-card {
    background: white;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    overflow: hidden;
    transition: all 0.3s ease;
}

.month-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.month-card.past {
    opacity: 0.6;
    background: #f8f9fa;
}

.month-card.current {
    border-color: #6366F1;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.month-header {
    background: linear-gradient(45deg, #6366F1, #8B5CF6);
    color: white;
    padding: 20px;
    text-align: center;
}

.month-name {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 5px;
}

.month-year {
    opacity: 0.9;
    font-size: 0.9em;
}

.month-stats {
    padding: 20px;
}

.progress-section {
    margin-bottom: 15px;
}

.progress-label {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #495057;
}

.progress-percentage {
    font-weight: 600;
    color: #2c3e50;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #28a745, #20c997);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-fill.low {
    background: linear-gradient(45deg, #dc3545, #e74c3c);
}

.progress-fill.medium {
    background: linear-gradient(45deg, #ffc107, #ff9800);
}

/* Quarterly View */
.quarterly-container {
    overflow-x: auto;
}

.quarters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.quarter-card {
    background: white;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    overflow: hidden;
    transition: all 0.3s ease;
}

.quarter-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.quarter-card.past {
    opacity: 0.6;
    background: #f8f9fa;
}

.quarter-card.current {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.quarter-header {
    background: linear-gradient(45deg, #6f42c1, #e83e8c);
    color: white;
    padding: 20px;
    text-align: center;
}

.quarter-name {
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 5px;
}

.quarter-period {
    opacity: 0.9;
    font-size: 0.9em;
}

.quarter-stats {
    padding: 20px;
}

/* Yearly View */
.yearly-container {
    overflow-x: auto;
}

.years-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.year-card {
    background: white;
    border-radius: 15px;
    border: 2px solid #e9ecef;
    overflow: hidden;
    transition: all 0.3s ease;
}

.year-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.year-card.past {
    opacity: 0.6;
    background: #f8f9fa;
}

.year-card.current {
    border-color: #667eea;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.year-header {
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    color: white;
    padding: 25px;
    text-align: center;
}

.year-name {
    font-size: 2em;
    font-weight: 600;
}

.year-stats {
    padding: 25px;
}

/* Settings Styles */
.settings-description {
    color: #6c757d;
    margin-bottom: 25px;
    font-size: 1.1em;
    text-align: center;
}

.general-settings {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    margin-bottom: 30px;
}

.general-settings h3 {
    color: var(--text-accent);
    margin-bottom: 20px;
    font-size: 1.3em;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-accent);
    font-weight: 600;
}

.setting-item select {
    width: 100%;
    max-width: 200px;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-section);
    color: var(--text-primary);
    font-size: 1em;
}

.setting-item select:focus {
    outline: none;
    border-color: var(--border-hover);
}

.setting-description {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-top: 5px;
    margin-bottom: 0;
}

.settings-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.settings-tab-button {
    background: rgba(255, 255, 255, 0.7);
    border: 2px solid #e9ecef;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    color: #495057;
}

.settings-tab-button:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: #667eea;
    transform: translateY(-1px);
}

.settings-tab-button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.settings-content {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 25px;
    border: 2px solid #e9ecef;
}

.settings-period {
    display: none;
}

.settings-period.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.section-header h3 {
    font-size: var(--font-size-xl);
    color: var(--text-accent);
}

.add-button {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.add-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.settings-items {
    display: grid;
    gap: 15px;
}

.settings-item {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s ease;
}

.settings-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.settings-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.settings-item-name {
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
}

.settings-item-actions {
    display: flex;
    gap: 8px;
}

.settings-item-description {
    color: #6c757d;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.btn {
    border: none;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    transition: all 0.3s ease;
}

.edit-btn {
    background: #ffc107;
    color: #212529;
}

.edit-btn:hover {
    background: #e0a800;
    transform: translateY(-1px);
}

.delete-btn {
    background: #dc3545;
    color: white;
}

.delete-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--bg-card);
    margin: 15% auto;
    padding: var(--space-xl);
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-xl);
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: var(--font-size-xl);
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

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

.close:focus-visible {
    outline: 3px solid var(--color-focus-ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

.modal h3 {
    margin-bottom: var(--space-md);
    color: var(--text-accent);
    font-size: var(--font-size-lg);
}

/* Quarter checkboxes styling */
.quarters-checkboxes {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-sm);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    transition: background-color 0.2s ease;
}

.checkbox-label:hover {
    background-color: var(--bg-section);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.checkbox-label span {
    font-weight: 500;
    color: var(--text-primary);
}

#item-name,
#item-description,
#goal-title,
#goal-text,
#goal-description,
#quarter-goal-text,
#quarter-goal-description,
#quarter-habit-name,
#quarter-habit-description {
    width: 100%;
    padding: var(--space-sm);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    margin-bottom: var(--space-md);
    background: var(--bg-section);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

#item-name:focus,
#item-description:focus,
#goal-title:focus,
#goal-text:focus,
#goal-description:focus,
#quarter-goal-text:focus,
#quarter-goal-description:focus,
#quarter-habit-name:focus,
#quarter-habit-description:focus {
    border-color: var(--color-focus);
    background: var(--bg-card);
}

#item-description,
#goal-description,
#quarter-goal-description,
#quarter-habit-description {
    resize: vertical;
    min-height: 80px;
}

.frequency-section {
    margin: var(--space-md) 0;
}

.frequency-section label {
    display: block;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.frequency-section select {
    width: 100%;
    padding: var(--space-sm);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-section);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    transition: all 0.2s ease;
}

.frequency-section select:focus {
    border-color: var(--color-focus);
    background: var(--bg-card);
}

.custom-days-section {
    margin-top: var(--space-md);
}

.custom-days-section > label {
    margin-bottom: var(--space-sm);
    display: block;
}

.day-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.day-checkbox {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0 !important;
    background: var(--bg-section);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    transition: all 0.3s ease;
    min-width: 50px;
}

.day-checkbox:hover {
    border-color: var(--border-hover);
}

.day-checkbox input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

.day-checkbox input[type="checkbox"]:checked + span {
    color: var(--text-accent);
    font-weight: bold;
}

.day-checkbox input[type="checkbox"]:checked {
    background: rgba(102, 126, 234, 0.1);
}

.day-checkbox:has(input[type="checkbox"]:checked) {
    background: rgba(102, 126, 234, 0.1);
    border-color: var(--text-accent);
}

.day-checkbox span {
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.form-buttons {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 20px;
}

.cancel-btn,
.save-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.cancel-btn {
    background: #6c757d;
    color: white;
}

.cancel-btn:hover {
    background: #5a6268;
}

.save-btn {
    background: linear-gradient(45deg, #6366F1, #8B5CF6);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Drinks Tracking */
.drinks-tracking {
    background: var(--bg-section);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
}

.drinks-counter {
    margin-top: 15px;
}

.drinks-dots {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.drink-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drink-dot:hover {
    border-color: var(--border-hover);
    transform: scale(1.1);
}

.drink-dot.active {
    background: #e74c3c;
    border-color: #c0392b;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.drink-dot.active:hover {
    background: #c0392b;
}

.drinks-count {
    font-size: 0.9em;
    color: var(--text-secondary);
    text-align: center;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    background: var(--bg-section);
    border-radius: var(--radius-md);
    border: 2px dashed var(--border-color);
    margin: var(--space-lg) 0;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.6;
    display: block;
    animation: float 3s ease-in-out infinite;
}

.empty-state-text {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.empty-state-subtext {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Empty state with action button */
.empty-state-action {
    margin-top: var(--space-md);
}

.empty-state-action .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

/* Statistics Dashboard */
.stats-dashboard {
    display: grid;
    gap: 30px;
}

.stats-dashboard h2 {
    color: var(--text-accent);
    text-align: center;
    margin-bottom: 30px;
    font-size: 2em;
}

.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-card);
}

.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-hover);
}

.stat-icon {
    font-size: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    border-radius: 50%;
    color: white;
}

.stat-icon svg {
    stroke: white;
    fill: none;
}

/* Modern style - cleaner stat icons */
[data-style="modern"] .stat-icon {
    background: #6366F1;
}

/* Section heading icons */
.section-icon {
    vertical-align: middle;
    margin-right: 8px;
    stroke: var(--accent-primary);
    fill: none;
}

/* Tab icons */
.tab-icon {
    vertical-align: middle;
    margin-right: 4px;
    stroke: currentColor;
    fill: none;
}

/* General SVG icon styling */
svg {
    stroke: var(--accent-primary);
}

/* Inline SVG icons in text */
.streak-info svg,
.habit-streak svg,
.weekly-task-status svg,
.habit-status svg,
.quarter-list-stats svg {
    vertical-align: middle;
    margin-right: 4px;
}

/* Action button icons */
.weight-edit-btn svg,
.weight-delete-btn svg,
.person-edit-btn svg,
.person-delete-btn svg,
.goal-edit-btn svg,
.goal-delete-btn svg,
.goal-toggle-btn svg {
    display: inline-block;
}

/* Empty state icons */
.empty-state-icon svg {
    display: block;
    margin: 0 auto;
}

/* Modern style - enhanced cards */
[data-style="modern"] .stat-card,
[data-style="modern"] .month-card,
[data-style="modern"] .habit-item,
[data-style="modern"] .modal-content {
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-style="modern"] .stat-card:hover,
[data-style="modern"] .month-card:hover {
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.12), 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Modern style - cleaner buttons */
[data-style="modern"] .btn-primary,
[data-style="modern"] .checkin-button,
[data-style="modern"] .save-btn {
    background: #6366F1;
    border-radius: var(--radius-md);
    font-weight: 500;
}

[data-style="modern"] .btn-primary:hover,
[data-style="modern"] .checkin-button:hover,
[data-style="modern"] .save-btn:hover {
    background: #4F46E5;
}

/* Modern style - quarter navigation buttons */
[data-style="modern"] .quarter-nav-btn {
    border-color: #6366F1;
    color: #6366F1;
    background: white;
}

[data-style="modern"] .quarter-nav-btn:hover:not(.disabled) {
    background: #6366F1;
    color: white;
}

[data-style="modern"] .quarter-nav-btn.disabled {
    border-color: #E5E7EB;
    color: #9CA3AF;
}

[data-style="modern"] .quarter-nav-btn.create-quarter {
    border: 2px dashed #E5E7EB;
    background: #F9FAFB;
    color: #9CA3AF;
    opacity: 0.7;
}

[data-style="modern"] .quarter-nav-btn.create-quarter:hover {
    border-color: #6366F1;
    background: rgba(99, 102, 241, 0.1);
    color: #6366F1;
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

[data-style="modern"] .review-btn {
    border-color: #10B981;
    color: #10B981;
    background: white;
}

[data-style="modern"] .review-btn:hover {
    background: #10B981;
    color: white;
}

/* Modern style - navigation and tabs */
[data-style="modern"] .tab-button.active,
[data-style="modern"] .nav-button.active {
    background: #6366F1;
    color: white;
}

[data-style="modern"] .nav-button:hover {
    background: rgba(99, 102, 241, 0.1);
}

[data-style="modern"] .tab-button:hover:not(.active) {
    background: rgba(99, 102, 241, 0.05);
}

/* Modern style - clean background */
[data-style="modern"] body {
    background: linear-gradient(180deg, #F9FAFB 0%, #F3F4F6 100%);
}

/* Modern style - side navigation */
[data-style="modern"] .side-nav {
    background: rgba(255, 255, 255, 0.98);
    border-right: 1px solid #E5E7EB;
    width: 110px;
}

/* Modern style - logo */
[data-style="modern"] .logo-icon {
    stroke: #6366F1;
}

[data-style="modern"] .logo-text {
    color: #6366F1;
}

/* ============================================
   MODERN THEME - SVG ICON SYSTEM
   ============================================ */

/* Modern theme SVG icons - Base styles */
[data-style="modern"] .icon-svg {
    width: 20px;
    height: 20px;
    stroke: #6366F1;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: all 0.3s ease;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Ensure SVG icons are visible */
[data-style="modern"] .icon-svg * {
    vector-effect: non-scaling-stroke;
}

/* Icon sizes for Modern theme */
[data-style="modern"] .icon-svg.icon-sm {
    width: 18px;
    height: 18px;
}

[data-style="modern"] .icon-svg.icon-md {
    width: 22px;
    height: 22px;
}

[data-style="modern"] .icon-svg.icon-lg {
    width: 40px;
    height: 40px;
}

/* Hide emojis in Modern theme and prepare for SVG icons */
[data-style="modern"] .nav-icon {
    font-size: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

[data-style="modern"] .stat-icon {
    font-size: 0 !important;
}

/* Nav icons with SVG */
[data-style="modern"] .nav-icon .icon-svg {
    stroke: #6B7280;
}

[data-style="modern"] .nav-button.active .nav-icon .icon-svg {
    stroke: white !important;
}

[data-style="modern"] .nav-button:hover:not(.active) .nav-icon .icon-svg {
    stroke: #6366F1;
    transform: scale(1.1);
}

[data-style="modern"] #system-settings-btn .nav-icon .icon-svg {
    stroke: #6B7280;
}

[data-style="modern"] #system-settings-btn:hover .nav-icon .icon-svg {
    stroke: #6366F1;
}

/* Stat icons in Modern theme */
[data-style="modern"] .stat-icon {
    background: #6366F1 !important;
    border-radius: 50% !important;
    width: 70px;
    height: 70px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0;
}

[data-style="modern"] .stat-icon .icon-svg {
    stroke: white;
    width: 36px;
    height: 36px;
}

/* Tab buttons in Modern theme */
[data-style="modern"] .tab-button {
    font-size: 0;
}

[data-style="modern"] .tab-button::after {
    content: attr(data-tab);
    font-size: 1rem;
    text-transform: capitalize;
}

[data-style="modern"] .tab-button[data-tab="stats"]::after {
    content: "Stats";
}

/* Modern theme - cleaner headings without emojis */
[data-style="modern"] h2,
[data-style="modern"] h3,
[data-style="modern"] h4 {
    color: var(--text-primary);
    font-weight: 600;
}

/* Modern theme - section headers should be purple */
[data-style="modern"] .section-header h2,
[data-style="modern"] .section-header h3,
[data-style="modern"] .habit-header h2 {
    color: #6366F1;
    font-size: var(--font-size-xl);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--text-accent);
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 1.1em;
    font-weight: 500;
}

.performance-section,
.weekly-performance-section,
.recent-activity-section {
    background: var(--bg-section);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s ease;
}

.performance-section h3,
.weekly-performance-section h3,
.recent-activity-section h3 {
    color: var(--text-accent);
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.performance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.performance-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.performance-card h4 {
    color: var(--text-accent);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.habit-list {
    display: grid;
    gap: 12px;
}

.habit-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-section);
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.habit-stat-item:hover {
    border-color: var(--border-hover);
}

.habit-stat-name {
    font-weight: 600;
    color: var(--text-accent);
}

.habit-stat-value {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9em;
}

.habit-stat-value.high {
    background: var(--success-bg);
    color: var(--success-color);
}

.habit-stat-value.medium {
    background: rgba(255, 193, 7, 0.2);
    color: var(--warning-color);
}

.habit-stat-value.low {
    background: rgba(220, 53, 69, 0.2);
    color: var(--danger-color);
}

.weekday-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.weekday-stat {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.weekday-stat:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.weekday-name {
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.weekday-percentage {
    font-size: 2em;
    font-weight: bold;
    color: var(--text-accent);
    margin-bottom: 5px;
}

.weekday-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
}

.weekday-fill {
    height: 100%;
    background: linear-gradient(45deg, var(--bg-gradient-start), var(--bg-gradient-end));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.activity-summary {
    display: grid;
    gap: 15px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-card);
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.activity-item:hover {
    border-color: var(--border-hover);
}

.activity-icon {
    font-size: 1.5em;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-section);
    border-radius: 50%;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--text-accent);
    margin-bottom: 3px;
}

.activity-description {
    color: var(--text-secondary);
    font-size: 0.9em;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    /* Side navigation stays at 110px on mobile */
    .side-nav {
        width: 110px;
    }

    .main-content {
        margin-left: 110px;
    }

    /* Add overlay background when nav is open */
    .side-nav.pinned::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
    }

    /* Adjust main content to not shift when nav opens */
    .main-content {
        margin-left: 0 !important;
        width: 100%;
    }

    /* Hamburger menu always visible on mobile */
    .nav-toggle {
        position: fixed;
        top: var(--space-sm);
        left: var(--space-sm);
        z-index: 1000;
        background: var(--bg-card);
        box-shadow: var(--shadow-md);
    }

    .container {
        padding: var(--space-md);
    }

    .section {
        padding: var(--space-md);
    }

    header {
        padding: var(--space-md);
        margin-top: var(--space-2xl);
    }

    header h1 {
        font-size: var(--font-size-xl);
    }

    .stats {
        gap: var(--space-sm);
        flex-direction: column;
    }

    .tabs {
        gap: var(--space-xs);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: var(--space-xs);
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-button {
        padding: var(--space-sm) var(--space-md);
        font-size: var(--font-size-sm);
        white-space: nowrap;
    }

    .view-header {
        gap: 10px;
        flex-wrap: wrap;
    }

    .view-header h2 {
        font-size: 1.5em;
        min-width: 120px;
    }

    .daily-header-center h2,
    #weekly-date,
    #monthly-date,
    #quarterly-date,
    #yearly-date {
        font-size: 1.3em;
    }

    .daily-header-center {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .daily-nav-row,
    .date-nav-row {
        gap: 25px;
    }

    .day-date-wrapper,
    .date-label-wrapper {
        min-width: 150px;
    }

    .progress-ring {
        width: 70px;
        height: 70px;
    }

    .progress-text {
        font-size: 10px;
    }

    .weekly-header-center,
    .header-center {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        max-width: 40px;
        max-height: 40px;
        font-size: 18px;
        line-height: 1;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .daily-container {
        gap: 20px;
    }

    .habits-section,
    .weekly-section {
        padding: 20px;
    }

    .weekly-table-container {
        overflow: visible;
    }

    .weekly-habits-table {
        font-size: 0.9em;
    }

    .habit-name-column {
        min-width: 120px;
        max-width: 150px;
    }

    .day-column {
        width: 40px;
        min-width: 40px;
    }

    .weekly-table-header th {
        padding: 8px 4px;
        font-size: 0.8em;
    }

    .weekly-habit-name-cell {
        padding: 10px;
    }

    .weekly-day-cell {
        padding: 10px 4px;
    }

    .weekly-checkbox {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }

    .months-grid,
    .quarters-grid,
    .years-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 10% auto;
        padding: 20px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .settings-nav {
        gap: 5px;
    }

    .settings-tab-button {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    .settings-content {
        padding: 15px;
    }

    .settings-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Celebration Animations */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.celebration-overlay.active {
    opacity: 1;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confetti-fall 3s linear infinite;
}

.confetti:nth-child(odd) {
    background: linear-gradient(45deg, #6366F1, #8B5CF6);
    border-radius: 50%;
}

.confetti:nth-child(even) {
    background: linear-gradient(45deg, #28a745, #20c997);
    transform: rotate(45deg);
}

.confetti:nth-child(3n) {
    background: linear-gradient(45deg, #ffc107, #fd7e14);
    border-radius: 3px;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

.celebration-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px var(--shadow-hover);
    text-align: center;
    z-index: 10000;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.celebration-message.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.celebration-media {
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.celebration-emoji {
    font-size: 4em;
    animation: bounce 0.6s ease-in-out;
}

.celebration-gif {
    max-width: 180px;
    max-height: 180px;
    border-radius: 10px;
    animation: bounce 0.6s ease-in-out;
}

.celebration-title {
    font-size: 1.8em;
    font-weight: bold;
    color: var(--text-accent);
    margin-bottom: 10px;
}

.celebration-subtitle {
    font-size: 1.1em;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.celebration-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.celebration-stat {
    text-align: center;
}

.celebration-stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--success-color);
}

.celebration-stat-label {
    font-size: 0.9em;
    color: var(--text-secondary);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

/* Pulse animation for completed habits */
.habit-item.completed .habit-checkbox {
    animation: completion-pulse 0.6s ease-out;
}

@keyframes completion-pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Daily completion progress indicator */
.daily-progress-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.progress-ring {
    width: 80px;
    height: 80px;
    transform: rotate(-90deg);
}

.progress-ring-circle {
    stroke: var(--border-color);
    stroke-width: 4;
    fill: transparent;
    transition: stroke-dasharray 0.3s ease;
}

.progress-ring-circle.progress {
    stroke: var(--success-color);
    stroke-linecap: round;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    pointer-events: none;
}

/* Very narrow screens */
/* Small mobile (480px and below) */
@media (max-width: 480px) {
    .view-header {
        gap: var(--space-xs);
        margin-bottom: var(--space-md);
    }

    .view-header h2 {
        font-size: var(--font-size-lg);
        min-width: 100px;
    }

    .daily-header-center h2,
    #weekly-date,
    #monthly-date,
    #quarterly-date,
    #yearly-date {
        font-size: 1.2em;
    }

    .daily-header-center {
        gap: 10px;
        flex-direction: column;
        align-items: center;
    }

    .daily-nav-row,
    .date-nav-row {
        gap: 20px;
    }

    .day-date-wrapper,
    .date-label-wrapper {
        min-width: 140px;
    }

    .progress-ring {
        width: 70px;
        height: 70px;
    }

    .progress-text {
        font-size: 10px;
    }

    .weekly-header-center,
    .header-center {
        gap: var(--space-xs);
        flex-direction: column;
        align-items: center;
    }

    .nav-btn {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        max-width: 44px;
        max-height: 44px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        line-height: 1;
    }

    .today-btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--font-size-sm);
    }

    /* Side nav takes full width on small mobile */
    .side-nav {
        width: 280px;
        max-width: 85vw;
    }

    .section-header h2 {
        font-size: var(--font-size-xl);
    }

    /* Make modals fullscreen on small mobile */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: var(--space-lg);
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Stack form buttons vertically on mobile */
    .form-buttons {
        flex-direction: column-reverse;
        gap: var(--space-sm);
    }

    .form-buttons button {
        width: 100%;
    }

    /* Better toast positioning on mobile */
    .toast {
        left: var(--space-sm);
        right: var(--space-sm);
        top: var(--space-sm);
        min-width: auto;
    }

    /* Improve touch targets */
    button {
        min-height: 44px;
    }

    /* Quarter cards stack on mobile */
    .quarters-list,
    .years-list {
        gap: var(--space-md);
    }

    .quarter-list-stats {
        flex-wrap: wrap;
        gap: var(--space-xs);
    }

    .quarter-list-actions {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .quarter-list-actions button {
        width: 100%;
    }

    .side-nav.collapsed .nav-button {
        padding: var(--space-sm) 0;
        min-height: 40px;
        flex-direction: column;
        gap: 0;
    }

    .side-nav.collapsed .nav-icon {
        font-size: 1.3em;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }


    .side-nav.pinned {
        width: 240px !important;
    }

    .main-content {
        margin-left: 240px;
    }

    .side-nav.collapsed + .main-content {
        margin-left: 60px;
    }

    .side-nav.pinned + .main-content {
        margin-left: 240px;
    }
}

/* ===========================
   Goals Section
   =========================== */

.goals-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.goals-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    bottom: -2px;
}

.goals-tab:hover {
    color: var(--text-accent);
    background: rgba(107, 94, 205, 0.05);
}

.goals-tab.active {
    color: var(--text-accent);
    border-bottom-color: var(--text-accent);
}

.goals-content {
    position: relative;
}

.goals-view {
    display: none;
}

.goals-view.active {
    display: block;
}

.goals-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.goals-header h3 {
    color: var(--text-accent);
    margin: 0;
    font-size: 1.5em;
}

.goals-description {
    color: var(--text-secondary);
    font-size: 0.95em;
    margin: 0;
}

.goals-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.goal-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px var(--shadow-card);
    transition: all 0.3s ease;
    position: relative;
}

.goal-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-hover);
    border-color: var(--border-hover);
}

.goal-card.completed {
    border-color: #10B981;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.05));
    animation: goalComplete 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes goalComplete {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.goal-header {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 12px;
}

.goal-checkbox-wrapper {
    flex-shrink: 0;
}

.goal-mountain-checkbox {
    width: 45px;
    height: 45px;
    border: 3px solid #6B5ECD;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    background: white;
}

.goal-mountain-checkbox:hover {
    transform: scale(1.1);
    border-color: #8B5CF6;
    box-shadow: 0 4px 12px rgba(107, 94, 205, 0.2);
}

.goal-mountain-checkbox.checked {
    border-color: #10B981;
    background: linear-gradient(135deg, #D1FAE5, #A7F3D0);
    animation: checkboxBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkboxBounce {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

.goal-mountain-checkbox.checked:hover {
    border-color: #059669;
    transform: scale(1.1);
}

.goal-mountain-icon {
    transition: all 0.3s ease;
    pointer-events: none;
}

/* Goal content in Goals section (life/annual) uses row layout for actions */
#life-goals-list .goal-content,
#annual-goals-list .goal-content,
#quarterly-goals-list .goal-content {
    flex: 1;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.goal-title {
    font-weight: 600;
    color: var(--text-accent);
    font-size: 1.1em;
    margin: 0;
    word-break: break-word;
    flex: 1;
}

.goal-card.completed .goal-title {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.goal-actions {
    display: flex;
    gap: 6px;
    opacity: 1;
    transition: opacity 0.3s ease;
    align-self: flex-start;
}

.goal-toggle-btn,
.goal-edit-btn,
.goal-delete-btn {
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 0.9em;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 2px solid;
}

.goal-edit-btn svg,
.goal-delete-btn svg {
    transition: stroke 0.3s ease;
    pointer-events: none;
}

.goal-toggle-btn {
    font-size: 1.2em;
    border-color: #10B981;
}

.goal-toggle-btn:hover {
    background: #10B981;
    transform: scale(1.05);
}

.goal-edit-btn {
    border-color: #A5B4FC;
}

.goal-edit-btn:hover {
    background: #6366F1;
    border-color: #6366F1;
    transform: scale(1.05);
}

.goal-edit-btn:hover svg {
    stroke: white;
}

.goal-delete-btn {
    border-color: #FCA5A5;
}

.goal-delete-btn:hover {
    background: #DC2626;
    border-color: #DC2626;
    transform: scale(1.05);
}

.goal-delete-btn:hover svg {
    stroke: white;
}

.goal-description {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.5;
    margin-bottom: 12px;
}

.goal-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.goal-year-label,
.goal-quarter-label,
.goal-date-label {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(107, 94, 205, 0.1);
    color: var(--text-accent);
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.goal-quarter-label {
    background: rgba(99, 102, 241, 0.1);
    color: #6366F1;
}

.goal-date-label {
    background: rgba(156, 163, 175, 0.1);
    color: var(--text-secondary);
}

.goal-completed-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--success-color);
    color: white;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

/* Year Groups for Quarterly Summary */
.year-goals-group {
    margin-bottom: 35px;
}

.year-goals-group h4 {
    color: var(--text-accent);
    font-size: 1.3em;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.year-goals-group .goals-list {
    margin-top: 20px;
}

/* Empty State */
.goals-list:empty::after {
    content: 'No goals yet. Click "+ Add" to create your first goal.';
    display: block;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-style: italic;
    grid-column: 1 / -1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .goals-list {
        grid-template-columns: 1fr;
    }

    .goals-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .goals-header button {
        width: 100%;
    }

    .goals-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .goals-tab {
        white-space: nowrap;
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .goal-card {
        padding: 15px;
    }

    .goal-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .goal-actions {
        opacity: 1;
        margin-left: 0;
    }

    .goal-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===================================
   Authentication Screen
   =================================== */

.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.auth-container {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .auth-container {
    background: var(--card-bg);
    color: var(--text-primary);
}

.auth-title {
    text-align: center;
    font-size: 32px;
    margin: 0 0 8px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .auth-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    text-align: center;
    color: #666;
    margin: 0 0 32px 0;
    font-size: 14px;
}

[data-theme="dark"] .auth-subtitle {
    color: var(--text-secondary);
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 4px;
}

[data-theme="dark"] .auth-tabs {
    background: var(--bg-secondary);
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}

[data-theme="dark"] .auth-tab {
    color: var(--text-secondary);
}

.auth-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .auth-tab.active {
    background: var(--card-bg);
    color: #667eea;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    font-size: 14px;
    color: #374151;
}

[data-theme="dark"] .form-group label {
    color: var(--text-primary);
}

.form-group input {
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

[data-theme="dark"] .form-group input {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.auth-btn {
    margin-top: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-error {
    color: #ef4444;
    font-size: 14px;
    text-align: center;
    margin: 8px 0 0 0;
    min-height: 20px;
}

@media (max-width: 480px) {
    .auth-container {
        padding: 24px;
    }

    .auth-title {
        font-size: 28px;
    }
}

/* ============================================
   SKETCH THEME (Hand-drawn paper wireframe)
   ============================================ */

[data-style="sketch"] {
    --sketch-paper: #F8F1E3;
    --sketch-paper-dark: #EFE6D2;
    --sketch-surface: #FFFFFF;
    --sketch-surface-hover: #FAFAFA;
    --sketch-ink: #1F2440;
    --sketch-ink-soft: #3F4A6B;
    --sketch-violet: #6366F1;
    --sketch-violet-soft: #B4B7F5;
    --sketch-mint: #10B981;
    --sketch-amber: #FCD34D;
    --sketch-pink: #FBCFE8;
    --sketch-yellow-note: #FFF6CB;
    --sketch-lavender-note: #E8E6FF;

    --font-display: 'Caveat', 'Patrick Hand', cursive;
    --font-hand: 'Patrick Hand', 'Kalam', 'Caveat', cursive;
}

/* NOTE: data-style="sketch" is set on the <body> element itself, not on
   an ancestor. So the descendant selector `[data-style="sketch"] body`
   never matched — `body` can't be a descendant of itself. Use a
   compound selector instead. */
body[data-style="sketch"] {
    font-family: var(--font-hand);
    color: var(--sketch-ink);
    background-color: var(--sketch-paper);
    background-image:
        radial-gradient(circle, rgba(31, 36, 64, 0.08) 1px, transparent 1.2px);
    background-size: 22px 22px;
    background-attachment: fixed;
    font-size: 1.0625rem;
    line-height: 1.55;
}

/* Headings — Caveat display */
[data-style="sketch"] h1,
[data-style="sketch"] h2,
[data-style="sketch"] h3,
[data-style="sketch"] h4,
[data-style="sketch"] h5 {
    font-family: var(--font-display);
    color: var(--sketch-ink);
    font-weight: 700;
    letter-spacing: 0.2px;
}

[data-style="sketch"] h1 { font-size: 2.75rem; line-height: 1.1; }
[data-style="sketch"] h2 { font-size: 2.125rem; line-height: 1.15; }
[data-style="sketch"] h3 { font-size: 1.625rem; line-height: 1.2; }

/* Page-level h2 headings (Habits, Planning, Goals, Relationships, Stats):
   20% bigger than the base h2 size */
[data-style="sketch"] .habit-header h2,
[data-style="sketch"] #stats-tab > h2,
[data-style="sketch"] .section > h2,
[data-style="sketch"] .section-header h2 {
    font-size: 2.55rem;
    line-height: 1.15;
}

/* Page-level h2 headings: black ink with violet wavy underline */
[data-style="sketch"] .habit-header h2,
[data-style="sketch"] #stats-tab > h2,
[data-style="sketch"] .section > h2,
[data-style="sketch"] .section-header h2 {
    color: #000000;
    font-family: var(--font-display);
}

[data-style="sketch"] .section-header {
    background: transparent;
    margin-bottom: 24px;
}

/* Let the content fill the available width (no max-width cap) while
   staying centered, with a 35px gap to the side nav on the left and a
   matching 35px gutter on the right. */
[data-style="sketch"] .section {
    max-width: none;
    margin: 0 auto;
    padding-left: 35px;
    padding-right: 35px;
}

[data-style="sketch"] .section-header .section-description {
    font-family: var(--font-hand);
    color: var(--sketch-ink-soft);
    font-size: 0.95rem;
    margin-top: 8px;
}

/* H1 / page-level H2 underline accent — wavy violet */
[data-style="sketch"] h1::after,
[data-style="sketch"] .habit-header h2::after,
[data-style="sketch"] #stats-tab > h2::after,
[data-style="sketch"] .section > h2::after,
[data-style="sketch"] .section-header h2::after {
    content: "";
    display: block;
    width: 4.8ch;
    height: 7.2px;
    margin-top: 5px;
    background: var(--sketch-violet);
    filter: url(#sketch-wobble-strong);
    border-radius: 4px;
}

/* Section/feature cards — wobbly hand-drawn border on white surface */
[data-style="sketch"] .stat-card,
[data-style="sketch"] .month-card,
[data-style="sketch"] .modal-content,
[data-style="sketch"] .habits-section,
[data-style="sketch"] .weekly-section,
[data-style="sketch"] .daily-habits,
[data-style="sketch"] .weekly-habits,
[data-style="sketch"] .goals-list,
[data-style="sketch"] .relationships-content,
[data-style="sketch"] .check-in-form-container {
    background: var(--sketch-surface);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 14px;
    box-shadow: none;
    filter: url(#sketch-wobble);
    padding: var(--space-md);
}

/* Habit/goal rows — flat with dashed dividers */
[data-style="sketch"] .habit-item,
[data-style="sketch"] .goal-item {
    background: transparent;
    border: none;
    border-bottom: 1.5px dashed rgba(31, 36, 64, 0.35);
    border-radius: 0;
    padding: 12px 4px;
    transition: background 0.15s ease;
}

[data-style="sketch"] .habit-item:last-child,
[data-style="sketch"] .goal-item:last-child {
    border-bottom: none;
}

[data-style="sketch"] .habit-item:hover,
[data-style="sketch"] .goal-item:hover {
    background: rgba(31, 36, 64, 0.04);
}

[data-style="sketch"] .habit-item.completed .habit-name {
    text-decoration: line-through;
    text-decoration-style: solid;
    text-decoration-thickness: 3px;
    text-decoration-color: var(--sketch-ink);
    text-decoration-skip-ink: none;
    color: var(--sketch-ink-soft);
}

/* Buttons — wobbly outline */
[data-style="sketch"] button,
[data-style="sketch"] .btn-primary,
[data-style="sketch"] .add-button,
[data-style="sketch"] .nav-btn {
    font-family: var(--font-hand);
    background: var(--sketch-surface);
    color: var(--sketch-ink);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 999px;
    padding: 8px 16px;
    box-shadow: none;
    filter: url(#sketch-wobble);
    transition: background 0.15s ease, transform 0.15s ease;
}

[data-style="sketch"] button:hover,
[data-style="sketch"] .btn-primary:hover,
[data-style="sketch"] .add-button:hover {
    background: var(--sketch-surface-hover);
    transform: translateY(-1px);
}

[data-style="sketch"] .btn-primary,
[data-style="sketch"] .save-btn {
    background: var(--sketch-violet);
    color: #fff;
    border-color: var(--sketch-ink);
}

/* Tabs — sticky-note feel */
[data-style="sketch"] .tab-button {
    font-family: var(--font-hand);
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--sketch-ink-soft);
    padding: 6px 14px;
}

[data-style="sketch"] .tab-button.active {
    background: var(--sketch-paper);
    border-color: var(--sketch-ink);
    color: var(--sketch-violet);
    filter: url(#sketch-wobble);
}

/* Sidenav — clean paper column with dashed dividers */
[data-style="sketch"] .side-nav {
    background: var(--sketch-paper);
    border-right: 1.5px dashed rgba(31, 36, 64, 0.35);
    filter: none;
}

[data-style="sketch"] .nav-header {
    border-bottom: 1.5px dashed rgba(31, 36, 64, 0.35);
    padding-bottom: 12px;
    margin-bottom: 8px;
}

[data-style="sketch"] .nav-header .nav-toggle {
    display: none;
}

[data-style="sketch"] .logo-icon {
    width: 36px;
    height: 36px;
    stroke: var(--sketch-ink);
    stroke-width: 2;
}

[data-style="sketch"] .logo-text {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--sketch-ink);
    text-transform: none;
    letter-spacing: 0;
}

[data-style="sketch"] .nav-button {
    font-family: var(--font-hand);
    color: var(--sketch-ink);
    background: transparent;
    border: none;
    border-radius: 0;
    filter: none;
    gap: 6px;
}

/* Override the base .nav-button:hover translucent-blue tile —
   in the sketch theme the button background stays transparent. */
[data-style="sketch"] .nav-button:hover {
    background: transparent;
    color: var(--sketch-ink);
}

[data-style="sketch"] .nav-button.active {
    background: transparent;
    color: var(--sketch-violet);
    border: none;
    filter: none;
}

[data-style="sketch"] .nav-button.active:hover {
    background: transparent;
    color: var(--sketch-violet);
}

/* Each nav-icon is a hand-drawn rounded square containing the glyph */
[data-style="sketch"] .nav-button .nav-icon {
    width: 52px;
    height: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--sketch-paper);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 14px;
    color: var(--sketch-ink);
    filter: url(#sketch-wobble);
    transition: transform 0.18s ease;
}

/* Hover: keep the same paper background — no color shift, just a small
   lift so the icon feels responsive without breaking the drawn aesthetic. */
[data-style="sketch"] .nav-button:hover .nav-icon {
    transform: translateY(-3px);
}

[data-style="sketch"] .nav-button.active .nav-icon {
    background: var(--sketch-lavender-note);
    border-color: var(--sketch-violet);
    color: var(--sketch-violet);
}

[data-style="sketch"] .nav-button .nav-icon .icon-svg,
[data-style="sketch"] .nav-button .nav-icon svg {
    width: 26px;
    height: 26px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* Default: emoji shown, sketch SVG hidden. Sketch theme flips it. */
.nav-icon .sketch-glyph { display: none; }
[data-style="sketch"] .nav-icon .sketch-glyph { display: inline-block; }
[data-style="sketch"] .nav-icon .emoji-glyph { display: none; }

[data-style="sketch"] .nav-button .nav-label {
    font-size: 0.78rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 86px;
    text-align: center;
}

/* Streak / status chips — sticky note pills */
[data-style="sketch"] .habit-streak {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--sketch-amber);
    border: 2px solid var(--sketch-ink);
    border-radius: 999px;
    padding: 2px 10px;
    font-family: var(--font-hand);
    color: var(--sketch-ink);
    filter: url(#sketch-wobble);
}

/* Inputs — notebook line */
[data-style="sketch"] input,
[data-style="sketch"] textarea,
[data-style="sketch"] select {
    font-family: var(--font-hand);
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--sketch-ink);
    border-radius: 0;
    color: var(--sketch-ink);
    font-size: 1.0625rem;
    padding: 6px 4px;
}

[data-style="sketch"] input:focus,
[data-style="sketch"] textarea:focus,
[data-style="sketch"] select:focus {
    outline: none;
    border-bottom-color: var(--sketch-violet);
    background: rgba(99, 102, 241, 0.04);
}

/* ----------------------------------------------------------------
   Hand-drawn redesign — habits homepage
   Layout: header (title + at-a-glance chips) -> tabs -> date hero ->
   two-column Daily/Weekly habit lists with dashed-extension section
   titles, round hand-drawn checkboxes and dashed frequency badges.
   ---------------------------------------------------------------- */

/* Force the cream paper to reach the whole canvas, including wrapper containers
   that default to the white --bg-card. Also raise specificity to beat the default. */
html[data-style="sketch"],
html[data-style="sketch"] body,
body[data-style="sketch"] {
    background-color: var(--sketch-paper) !important;
    background-image: radial-gradient(circle, rgba(31, 36, 64, 0.08) 1px, transparent 1.2px);
    background-size: 22px 22px;
    background-attachment: fixed;
}

[data-style="sketch"] .tab-content,
[data-style="sketch"] header.habit-header,
[data-style="sketch"] header.section-header {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    min-height: 0;
    padding: 0;
}

/* Page header: title left, at-a-glance chips right */
[data-style="sketch"] .habit-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 0;
}

[data-style="sketch"] .habit-header .header-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

[data-style="sketch"] .habit-header .stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* (Legacy `.habit-header .stats span` pill + ::before dot rules removed —
   header chips are now styled by the .header-chip rules at the bottom of
   this file, which include real SVG icons rather than colored dots.) */

/* Tab bar: white surface card containing all tabs; only active tab gets an inset pill */
[data-style="sketch"] .tabs {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    background: var(--sketch-surface);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 14px;
    padding: 8px 16px;
    filter: url(#sketch-wobble);
    flex-wrap: wrap;
}

[data-style="sketch"] .tabs .settings-tab {
    margin-left: auto;
    color: var(--sketch-ink-soft);
    opacity: 0.7;
}

[data-style="sketch"] .tab-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    vertical-align: -4px;
    margin-right: 6px;
}

/* Inactive tabs: plain text, no pill */
[data-style="sketch"] .tab-button {
    background: transparent;
    border: 2px solid transparent;
    color: var(--sketch-ink);
    padding: 6px 14px;
    font-family: var(--font-hand);
    font-size: 1rem;
    filter: none;
    display: inline-flex;
    align-items: center;
}

/* Active tab: inset paper-white pill with violet text and hand-drawn outline */
[data-style="sketch"] .tab-button.active {
    background: #FFFFFF;
    border: 2px solid var(--sketch-ink);
    border-radius: 10px;
    color: var(--sketch-violet);
    filter: url(#sketch-wobble);
}

/* Date hero: wraps prev/next, big "Today", date subtitle, progress ring */
[data-style="sketch"] .view-header {
    position: relative;
    background: var(--sketch-surface);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 16px;
    padding: 12px 28px;
    filter: url(#sketch-wobble);
    margin-bottom: 32px;
}

[data-style="sketch"] .daily-header-center,
[data-style="sketch"] .weekly-header-center,
[data-style="sketch"] .header-center {
    position: relative;
    width: 100%;
    gap: 0;
}

/* Spread prev/next to the edges; keep date + progress ring snug in the middle */
[data-style="sketch"] .daily-nav-row,
[data-style="sketch"] .date-nav-row {
    display: grid;
    grid-template-columns: 1fr auto auto 1fr;
    align-items: center;
    width: 100%;
    column-gap: 24px;
}

[data-style="sketch"] .daily-nav-row > .nav-btn:first-child,
[data-style="sketch"] .date-nav-row > .nav-btn:first-child {
    justify-self: start;
}

[data-style="sketch"] .daily-nav-row > .nav-btn:last-child,
[data-style="sketch"] .date-nav-row > .nav-btn:last-child {
    justify-self: end;
}

/* Date-nav-rows in non-daily tabs only have 3 children (prev, label, next) — adjust */
[data-style="sketch"] .date-nav-row {
    grid-template-columns: 1fr auto 1fr;
}

/* Collapse the Today button when it's hidden (e.g. when already on today) */
[data-style="sketch"] .today-btn.hidden {
    display: none;
}

/* Today button: floats inline with the nav arrows (same vertical level).
   Slide-IN uses a keyframe animation so it ALWAYS starts at its explicit
   start position (under the hovered arrow), regardless of where the chip
   currently is mid-flight. Slide-OUT uses a transition so it smoothly
   retraces back the way it came. The .from-right class is toggled by JS
   so the chip stays anchored to the correct side after the trigger ends. */
[data-style="sketch"] .daily-header-center > .today-btn,
[data-style="sketch"] .weekly-header-center > .today-btn,
[data-style="sketch"] .header-center > .today-btn {
    position: absolute;
    top: 50%;
    left: 60px;
    right: auto;
    margin: 0;
    /* Hidden default: tucked back under the LEFT nav arrow */
    transform: translate(-56px, -50%);
    opacity: 0;
    visibility: hidden;
    /* Keep pointer-events: auto always — visibility:hidden alone gates
       hit-testing. This way the chip stays clickable during the hide-delay
       (giving you time to drag the cursor onto it). */
    pointer-events: auto;
    z-index: 1; /* sits behind the nav arrows so it appears to emerge from under them */
    white-space: nowrap;
    /* Slide-OUT transition (delayed). When a trigger rule stops applying,
       the chip transitions from animation-end back to this hidden state. */
    transition: opacity 0.2s ease 0.25s,
                visibility 0s linear 0.45s,
                transform 0.28s ease 0.25s;
}

/* Right-side variant: tucked back under the RIGHT nav arrow */
[data-style="sketch"] .daily-header-center > .today-btn.from-right,
[data-style="sketch"] .weekly-header-center > .today-btn.from-right,
[data-style="sketch"] .header-center > .today-btn.from-right {
    left: auto;
    right: 60px;
    transform: translate(56px, -50%);
}

/* Invisible hover-bridge so the cursor never loses :hover when moving
   from the arrow to the chip. Inherits visibility from the chip — only
   hit-testable while the chip is visible — so it can't summon the chip
   on its own. Default (left side) bridge extends LEFT toward prev arrow. */
[data-style="sketch"] .daily-header-center > .today-btn::before,
[data-style="sketch"] .weekly-header-center > .today-btn::before,
[data-style="sketch"] .header-center > .today-btn::before {
    content: "";
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: -64px;
    right: 0;
    /* Sits behind the chip's content so it doesn't interfere with click target */
    z-index: -1;
}

[data-style="sketch"] .daily-header-center > .today-btn.from-right::before,
[data-style="sketch"] .weekly-header-center > .today-btn.from-right::before,
[data-style="sketch"] .header-center > .today-btn.from-right::before {
    left: 0;
    right: -64px;
}

/* Slide-IN animations — always start at their 0% keyframe regardless of
   the chip's current mid-flight position. This is what marries the
   slide-direction to the specific arrow being hovered. */
@keyframes sketch-today-slide-from-left {
    0% {
        opacity: 0;
        transform: translate(-56px, -50%);
    }
    100% {
        opacity: 1;
        transform: translate(0, -50%);
    }
}

@keyframes sketch-today-slide-from-right {
    0% {
        opacity: 0;
        transform: translate(56px, -50%);
    }
    100% {
        opacity: 1;
        transform: translate(0, -50%);
    }
}

/* Reveal — slide in from the LEFT when the back (prev) arrow is hovered */
[data-style="sketch"] .daily-header-center:has(.daily-nav-row > .nav-btn:first-child:hover) > .today-btn,
[data-style="sketch"] .weekly-header-center:has(.date-nav-row > .nav-btn:first-child:hover) > .today-btn,
[data-style="sketch"] .header-center:has(.date-nav-row > .nav-btn:first-child:hover) > .today-btn {
    visibility: visible;
    pointer-events: auto;
    left: 60px;
    right: auto;
    transition: none;
    animation: sketch-today-slide-from-left 0.28s ease forwards;
}

/* Reveal — slide in from the RIGHT when the forward (next) arrow is hovered */
[data-style="sketch"] .daily-header-center:has(.daily-nav-row > .nav-btn:last-child:hover) > .today-btn,
[data-style="sketch"] .weekly-header-center:has(.date-nav-row > .nav-btn:last-child:hover) > .today-btn,
[data-style="sketch"] .header-center:has(.date-nav-row > .nav-btn:last-child:hover) > .today-btn {
    visibility: visible;
    pointer-events: auto;
    left: auto;
    right: 60px;
    transition: none;
    animation: sketch-today-slide-from-right 0.28s ease forwards;
}

/* Stay visible (no animation) while hovering the chip itself. */
[data-style="sketch"] .daily-header-center > .today-btn:hover,
[data-style="sketch"] .weekly-header-center > .today-btn:hover,
[data-style="sketch"] .header-center > .today-btn:hover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(0, -50%);
    animation: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

[data-style="sketch"] .nav-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: 2.5px solid var(--sketch-ink);
    background: var(--sketch-surface);
    font-size: 1.25rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    filter: url(#sketch-wobble);
    position: relative;
    z-index: 2; /* sits above the today chip so it emerges from behind */
}

[data-style="sketch"] .today-btn {
    font-family: var(--font-hand);
    background: var(--sketch-surface);
    color: var(--sketch-ink);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 999px;
    padding: 6px 18px;
    filter: url(#sketch-wobble);
}

[data-style="sketch"] .today-btn:hover {
    background: var(--sketch-surface-hover);
}

[data-style="sketch"] .current-date {
    font-family: var(--font-hand);
    color: var(--sketch-ink-soft);
    font-size: 0.95rem;
}

/* Progress ring — bold violet on light track, big % inside */
[data-style="sketch"] .daily-progress-ring {
    width: 110px;
    height: 110px;
    position: relative;
    flex-shrink: 0;
}

[data-style="sketch"] .progress-ring {
    width: 110px;
    height: 110px;
}

[data-style="sketch"] .progress-ring-circle {
    stroke: #E5E7EB;
    stroke-width: 7;
    stroke-linecap: round;
}

[data-style="sketch"] .progress-ring-circle.progress {
    stroke: var(--sketch-violet);
    stroke-width: 7;
    stroke-linecap: round;
}

[data-style="sketch"] .progress-percent {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -85%);
    font-family: var(--font-display);
    color: var(--sketch-violet);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}

[data-style="sketch"] .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, 30%);
    color: var(--sketch-ink);
    font-family: var(--font-hand);
    font-size: 0.85rem;
    font-weight: 400;
    pointer-events: none;
}

/* Two-column Daily/Weekly habit lists at desktop widths */
[data-style="sketch"] .daily-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 900px) {
    [data-style="sketch"] .daily-container {
        grid-template-columns: 1fr 1fr;
    }
}

[data-style="sketch"] .habits-section,
[data-style="sketch"] .weekly-section {
    padding: 22px 24px;
}

/* Section titles: script font + dashed extension line */
[data-style="sketch"] .habits-section h3,
[data-style="sketch"] .weekly-section h3 {
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 16px;
    font-family: var(--font-display);
    color: var(--sketch-ink);
    font-size: 1.6rem;
}

[data-style="sketch"] .habits-section h3::after,
[data-style="sketch"] .weekly-section h3::after {
    content: "";
    flex: 1;
    height: 0;
    border-top: 1.5px dashed rgba(31, 36, 64, 0.4);
}

/* Habit row: checkbox · name · frequency badge · streak chip */
[data-style="sketch"] .habit-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 4px;
}

[data-style="sketch"] .habit-item.completed {
    background: transparent;
    border-color: transparent;
    border-bottom: 1.5px dashed rgba(31, 36, 64, 0.35);
}

/* Habit info: grid so name+description stack on the left,
   frequency badge and streak/status anchor to the right */
[data-style="sketch"] .habit-info {
    flex: 1;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
}

[data-style="sketch"] .habit-name {
    font-family: var(--font-hand);
    color: var(--sketch-ink);
    font-size: 1.0625rem;
    font-weight: 400;
    margin: 0;
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

[data-style="sketch"] .habit-description {
    grid-column: 1;
    grid-row: 2;
    font-family: var(--font-hand);
    color: var(--sketch-ink-soft);
    font-size: 0.85rem;
    margin: 0;
    overflow-wrap: break-word;
}

[data-style="sketch"] .habit-frequency-label {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
    white-space: nowrap;
}

[data-style="sketch"] .habit-streak,
[data-style="sketch"] .habit-status {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
    margin: 0;
    white-space: nowrap;
}

[data-style="sketch"] .habit-status {
    font-family: var(--font-hand);
    color: var(--sketch-ink-soft);
    font-size: 0.85rem;
}

/* Constrain habit row so nothing overflows the card */
[data-style="sketch"] .habit-item {
    overflow: hidden;
}

/* Round, hand-drawn checkbox */
[data-style="sketch"] .habit-checkbox {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--sketch-ink);
    border-radius: 50%;
    background: var(--sketch-surface);
    filter: url(#sketch-wobble);
    transition: background 0.15s ease, transform 0.15s ease;
}

[data-style="sketch"] .habit-checkbox:hover {
    background: var(--sketch-surface-hover);
    transform: scale(1.05);
}

[data-style="sketch"] .habit-checkbox.checked {
    background: var(--sketch-mint);
    border-color: var(--sketch-ink);
}

[data-style="sketch"] .habit-checkbox.checked::after {
    content: '\2713';
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-hand);
}

/* DAILY / WEEKLY frequency badge — dashed border pill */
[data-style="sketch"] .habit-frequency-label {
    background: transparent;
    color: var(--sketch-ink-soft);
    border: 1.5px dashed var(--sketch-ink-soft);
    border-radius: 999px;
    padding: 2px 10px;
    font-family: var(--font-hand);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0;
}

/* Theme card preview swatch for the Sketch option in System Settings */
.sketch-preview {
    background: #F8F1E3 !important;
    background-image: radial-gradient(circle, rgba(31, 36, 64, 0.18) 1px, transparent 1.2px) !important;
    background-size: 8px 8px !important;
    border: 2px solid #1F2440 !important;
}

.sketch-preview .preview-bar {
    background: #6366F1 !important;
}

.sketch-preview .preview-line {
    background: #1F2440 !important;
}

/* ===========================
   Sketch theme — Habits page polish
   =========================== */

/* --- Top-right header chips (completed today / current streak) ---
   Single hand-drawn pill with a small colored dot before the text. */
[data-style="sketch"] .habit-header .stats {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* The base stylesheet has `.stats span { border, padding, bg }` which
   applies to BOTH the outer .header-chip and the inner .chip-text span,
   producing a double pill. Reset every span inside .stats first; only
   .header-chip itself should carry the pill styling. */
[data-style="sketch"] .habit-header .stats span {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    color: inherit;
}

[data-style="sketch"] .header-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--sketch-surface);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 999px;
    padding: 6px 14px;
    font-family: var(--font-hand);
    font-size: 0.95rem;
    color: var(--sketch-ink);
    filter: url(#sketch-wobble);
}

/* Status icon before each chip's text. Rendered via background-image
   inline SVG so we don't have to add markup to the HTML — the existing
   :: before pseudo-element just changes its background. */
[data-style="sketch"] .header-chip::before {
    content: "";
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

/* Completed-today chip: a static "checked" radio button — mint fill,
   ink ring, white tick (mirrors the live habit-checkbox visual). */
[data-style="sketch"] .header-chip-check::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='10' fill='%2310B981' stroke='%231F2440' stroke-width='2'/><polyline points='7 12.5 11 16 17 9' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}

/* Streak chip: a small pink flame matching the per-row streak chip. */
[data-style="sketch"] .header-chip-streak::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z' fill='%23EC4899'/></svg>");
}

/* --- Active tab: keep icon ink-colored to match the violet text --- */
[data-style="sketch"] .tab-button.active .tab-icon {
    color: var(--sketch-violet);
}

/* --- Settings tab: smaller, dimmer (still part of the bar) --- */
[data-style="sketch"] .tabs .settings-tab .tab-icon { color: var(--sketch-ink-soft); }

/* --- Strikethrough animation: a hand-drawn sharpie line that draws in
       left-to-right when a habit is checked off. The line lives on a
       <span class="habit-name-text"> wrapper inside .habit-name so it
       only spans the actual text width, not the full grid cell. --- */
[data-style="sketch"] .habit-item .habit-name {
    /* Override the static text-decoration — we draw our own animated one */
    text-decoration: none !important;
}

[data-style="sketch"] .habit-item .habit-name-text {
    position: relative;
    display: inline-block;
}

[data-style="sketch"] .habit-item .habit-name-text::after {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 3px;
    background: var(--sketch-ink);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left center;
    pointer-events: none;
}

[data-style="sketch"] .habit-item.completed .habit-name {
    color: var(--sketch-ink-soft);
}

@keyframes sketch-strikethrough-draw {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* All completed habits show a static strikethrough by default — the
   habit list HTML rebuilds on every checkbox click, so we can't rely
   on a CSS animation here without re-animating every completed item
   on every render. */
[data-style="sketch"] .habit-item.completed .habit-name-text::after {
    transform: scaleX(1);
}

/* Only the habit the user just toggled gets .just-completed (set by JS
   for one render, then cleared) — that's the single element where the
   draw-in animation should play. The animation's `forwards` keyframe
   leaves the line at scaleX(1), matching the static rule above. */
[data-style="sketch"] .habit-item.completed.just-completed .habit-name-text::after {
    animation: sketch-strikethrough-draw 0.45s cubic-bezier(0.55, 0.06, 0.32, 1) forwards;
}

/* Effects-off: skip the draw-in animation entirely. The static
   strikethrough rule above still shows the line instantly. */
[data-style="sketch"][data-effects-enabled="false"] .habit-item.completed.just-completed .habit-name-text::after {
    animation: none;
}

/* --- All-set celebration when every daily habit is checked off --- */
[data-style="sketch"] .all-set-message {
    margin-top: 18px;
    padding: 14px 16px;
    text-align: center;
    border-top: 1.5px dashed rgba(31, 36, 64, 0.35);
}

[data-style="sketch"] .all-set-headline {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--sketch-violet);
    line-height: 1.2;
}

[data-style="sketch"] .all-set-subtext {
    font-family: var(--font-hand);
    color: var(--sketch-ink-soft);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* --- Compress the Daily Habits panel to fit content (don't match
       Weekly Habits height when there are fewer items). --- */
[data-style="sketch"] .daily-container {
    align-items: start;
}

/* --- Typography sweep ---
   The base modern stylesheet sets explicit `font-family: -apple-system,
   …` on a long list of classes (stat-value, weekly-habit-name,
   month-name, settings-description, etc.), which breaks the otherwise-
   automatic inheritance of var(--font-hand) from <body>. Pull every
   one of those classes back to the sketch hand font, plus form
   controls (which don't inherit font-family by default in any browser).
   We deliberately exclude headings — h1..h5 are styled as Caveat
   display elsewhere in this file. */
[data-style="sketch"] input,
[data-style="sketch"] textarea,
[data-style="sketch"] select,
[data-style="sketch"] button,
[data-style="sketch"] label,
[data-style="sketch"] th,
[data-style="sketch"] td,
[data-style="sketch"] .weekly-quarter-label,
[data-style="sketch"] .weekly-habit-name,
[data-style="sketch"] .weekly-task-name,
[data-style="sketch"] .weekly-task-description,
[data-style="sketch"] .month-name,
[data-style="sketch"] .month-year,
[data-style="sketch"] .progress-percentage,
[data-style="sketch"] .quarter-name,
[data-style="sketch"] .quarter-period,
[data-style="sketch"] .year-name,
[data-style="sketch"] .stat-value,
[data-style="sketch"] .stat-label,
[data-style="sketch"] .empty-text,
[data-style="sketch"] .empty-subtext,
[data-style="sketch"] .weekday-name,
[data-style="sketch"] .weekday-percentage,
[data-style="sketch"] .activity-label,
[data-style="sketch"] .activity-value,
[data-style="sketch"] .activity-subtitle,
[data-style="sketch"] .weight-stat-label,
[data-style="sketch"] .weight-stat-value,
[data-style="sketch"] .weight-entry-date,
[data-style="sketch"] .weight-entry-value,
[data-style="sketch"] .weight-entry-change,
[data-style="sketch"] .settings-description,
[data-style="sketch"] .setting-description,
[data-style="sketch"] .goal-description,
[data-style="sketch"] .goals-description,
[data-style="sketch"] .goal-year-label,
[data-style="sketch"] .goal-quarter-label,
[data-style="sketch"] .number-label,
[data-style="sketch"] .data-warning,
[data-style="sketch"] .settings-note,
[data-style="sketch"] .review-placeholder,
[data-style="sketch"] .theme-info p,
[data-style="sketch"] .theme-info h5 {
    font-family: var(--font-hand);
}

/* The big numeric stats (stat-value, weight-stat-value, big quarter/
   year/month titles) read better in the Caveat display font. */
[data-style="sketch"] .stat-value,
[data-style="sketch"] .weight-stat-value,
[data-style="sketch"] .month-name,
[data-style="sketch"] .quarter-name,
[data-style="sketch"] .year-name {
    font-family: var(--font-display);
}

/* Pull these classes' colors back to sketch ink/soft-ink — the modern
   stylesheet uses gray-500/700 directly, which clashes with the warm
   ink palette. */
[data-style="sketch"] .stat-label,
[data-style="sketch"] .empty-text,
[data-style="sketch"] .empty-subtext,
[data-style="sketch"] .weekday-name,
[data-style="sketch"] .activity-label,
[data-style="sketch"] .activity-subtitle,
[data-style="sketch"] .settings-description,
[data-style="sketch"] .setting-description,
[data-style="sketch"] .goal-description,
[data-style="sketch"] .goals-description,
[data-style="sketch"] .data-warning,
[data-style="sketch"] .settings-note,
[data-style="sketch"] .theme-info p {
    color: var(--sketch-ink-soft);
}

[data-style="sketch"] .stat-value,
[data-style="sketch"] .weekly-habit-name,
[data-style="sketch"] .weekly-task-name,
[data-style="sketch"] .weekday-percentage,
[data-style="sketch"] .activity-value,
[data-style="sketch"] .progress-percentage,
[data-style="sketch"] th,
[data-style="sketch"] label,
[data-style="sketch"] .theme-info h5 {
    color: var(--sketch-ink);
}

/* ===========================================================
   #1 — Tile banners (Monthly / Quarterly / Yearly)
   Replace the violet/coral gradient banners with cream paper
   tiles + ink border + wobble. The big title goes Caveat, the
   subtitle goes Patrick Hand. Progress bars become a single ink
   pen-stroke sitting in a soft paper track.
   =========================================================== */
[data-style="sketch"] .month-card,
[data-style="sketch"] .quarter-card,
[data-style="sketch"] .year-card {
    background: var(--sketch-surface);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 14px;
    box-shadow: none;
    overflow: visible;        /* let the wobble filter spill out */
    filter: url(#sketch-wobble);
    transition: transform 0.18s ease;
}

[data-style="sketch"] .month-card:hover,
[data-style="sketch"] .quarter-card:hover,
[data-style="sketch"] .year-card:hover {
    transform: translateY(-2px);
    box-shadow: none;
}

/* Past tiles: faded paper, no extra colour shift */
[data-style="sketch"] .month-card.past,
[data-style="sketch"] .quarter-card.past,
[data-style="sketch"] .year-card.past {
    background: var(--sketch-surface);
    opacity: 0.55;
}

/* "Current" tile: violet ink ring + small lavender note tint */
[data-style="sketch"] .month-card.current,
[data-style="sketch"] .quarter-card.current,
[data-style="sketch"] .year-card.current {
    background: var(--sketch-lavender-note);
    border-color: var(--sketch-violet);
    box-shadow: none;
}

/* Strip the gradient banner colour and centre the title. */
[data-style="sketch"] .month-header,
[data-style="sketch"] .quarter-header,
[data-style="sketch"] .year-header {
    background: transparent;
    color: var(--sketch-ink);
    padding: 18px 18px 8px;
    text-align: center;
    border-bottom: 1.5px dashed rgba(31, 36, 64, 0.35);
}

[data-style="sketch"] .month-name,
[data-style="sketch"] .quarter-name,
[data-style="sketch"] .year-name {
    font-family: var(--font-display);
    color: var(--sketch-ink);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 2px;
}

[data-style="sketch"] .month-year,
[data-style="sketch"] .quarter-period {
    font-family: var(--font-hand);
    color: var(--sketch-ink-soft);
    font-size: 0.95rem;
    opacity: 1;
}

/* Body of the tile */
[data-style="sketch"] .month-stats,
[data-style="sketch"] .quarter-stats,
[data-style="sketch"] .year-stats {
    padding: 16px 18px 18px;
}

/* Progress label row */
[data-style="sketch"] .progress-label {
    color: var(--sketch-ink-soft);
    justify-content: space-between;   /* the base CSS had a typo: "between" */
}

[data-style="sketch"] .progress-percentage {
    color: var(--sketch-ink);
    font-weight: 700;
}

/* Progress bar — paper track with a single pen-stroke fill */
[data-style="sketch"] .progress-bar {
    height: 6px;
    background: var(--sketch-paper-dark);
    border-radius: 999px;
    overflow: hidden;
}

[data-style="sketch"] .progress-fill {
    background: var(--sketch-ink);
    border-radius: 999px;
    transition: width 0.3s ease;
}

[data-style="sketch"] .progress-fill.low    { background: #DC2626; }   /* warm red */
[data-style="sketch"] .progress-fill.medium { background: var(--sketch-amber); }
[data-style="sketch"] .progress-fill.high   { background: var(--sketch-mint); }

/* ===========================================================
   #2 — Active sub-tab pills
   Replace the modern solid-violet "active" fill with the same
   inset paper-white pill we use on the period selector. Covers
   .toggle-btn, .relationship-tab, .goals-tab.
   =========================================================== */
/* The Goals page tabs container has a base-theme border-bottom that
   reads as a violet rule under the tabs. Sketch doesn't want it. */
[data-style="sketch"] .goals-tabs {
    border-bottom: none;
    padding-bottom: 0;
}

/* The Relationships sub-tabs sit inside a wrapper that has a white
   `--bg-section` background + 4px padding by default. In the sketch
   theme that wrapper reads as a stray white block behind the pills.
   Make the wrapper transparent and let the cream paper show through;
   add some breathing room between the pills since they're no longer
   sharing a tinted container. */
[data-style="sketch"] .relationships-tabs {
    background: transparent;
    border-radius: 0;
    padding: 0;
    gap: 12px;
}

[data-style="sketch"] .toggle-btn,
[data-style="sketch"] .relationship-tab,
[data-style="sketch"] .goals-tab {
    background: transparent;
    color: var(--sketch-ink);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 999px;
    padding: 8px 18px;
    font-family: var(--font-hand);
    filter: url(#sketch-wobble);
    cursor: pointer;
    transition: background 0.15s ease;
}

[data-style="sketch"] .toggle-btn:hover,
[data-style="sketch"] .relationship-tab:hover,
[data-style="sketch"] .goals-tab:hover {
    background: var(--sketch-paper-dark);
}

[data-style="sketch"] .toggle-btn.active,
[data-style="sketch"] .relationship-tab.active,
[data-style="sketch"] .goals-tab.active {
    background: var(--sketch-lavender-note);
    color: var(--sketch-violet);
    border-color: var(--sketch-violet);
}

/* ===========================================================
   #3 — Weekly Intention panel
   Replace the violet/purple gradient with a cream paper card;
   the textarea + buttons get sketch outline treatment.
   =========================================================== */
[data-style="sketch"] .weekly-intention-section {
    background: var(--sketch-surface);
    color: var(--sketch-ink);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 14px;
    box-shadow: none;
    filter: url(#sketch-wobble);
    padding: 20px 24px;
}

[data-style="sketch"] .weekly-intention-section h3 {
    color: var(--sketch-ink) !important;   /* base rule has !important */
    font-family: var(--font-display);
    text-align: left;
    margin-bottom: 12px;
    font-size: 1.5rem;
}

[data-style="sketch"] #weekly-intention {
    background: var(--sketch-surface);
    color: var(--sketch-ink);
    border: 2px dashed var(--sketch-ink-soft);
    border-radius: 10px;
    font-family: var(--font-hand);
    font-size: 1rem;
    padding: 12px 14px;
}

[data-style="sketch"] #weekly-intention::placeholder {
    color: var(--sketch-ink-soft);
    opacity: 0.7;
}

[data-style="sketch"] #weekly-intention:focus {
    border-color: var(--sketch-violet);
    background: var(--sketch-surface);
    outline: none;
}

[data-style="sketch"] .save-intention-btn,
[data-style="sketch"] .edit-intention-btn {
    background: var(--sketch-surface);
    color: var(--sketch-ink);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 999px;
    padding: 10px 18px;
    font-family: var(--font-hand);
    filter: url(#sketch-wobble);
}

[data-style="sketch"] .save-intention-btn:hover,
[data-style="sketch"] .edit-intention-btn:hover {
    background: var(--sketch-paper-dark);
    border-color: var(--sketch-ink);
    transform: none;
}

[data-style="sketch"] .current-intention {
    background: var(--sketch-yellow-note);
    border: 2px solid var(--sketch-ink);
    border-radius: 10px;
    color: var(--sketch-ink);
    padding: 14px 18px;
    filter: url(#sketch-wobble);
}

[data-style="sketch"] .intention-text {
    color: var(--sketch-ink);
    font-style: normal;     /* base rule had italic; reads odd in Patrick Hand */
}

/* ===========================================================
   #4 — Stats card icon badges
   Round violet-gradient discs become a sketch outline tile —
   paper square with ink stroke and the icon in ink.
   =========================================================== */
[data-style="sketch"] .stat-card {
    background: var(--sketch-surface);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 14px;
    box-shadow: none;
    filter: url(#sketch-wobble);
    padding: 20px;
}

[data-style="sketch"] .stat-card:hover {
    border-color: var(--sketch-ink);
    box-shadow: none;
    transform: translateY(-2px);
}

[data-style="sketch"] .stat-icon {
    width: 56px;
    height: 56px;
    background: var(--sketch-paper);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 14px;
    color: var(--sketch-ink);
    filter: url(#sketch-wobble);
    flex-shrink: 0;
}

[data-style="sketch"] .stat-icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--sketch-ink);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===========================================================
   #5 — Weekly grid checkboxes
   Replace the modern square + flat-green ✓ with the round mint
   sketch checkbox we use on the daily list.
   =========================================================== */
[data-style="sketch"] .weekly-checkbox {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--sketch-ink);
    border-radius: 50%;
    background: var(--sketch-surface);
    margin: 0 auto;
    cursor: pointer;
    filter: url(#sketch-wobble);
    transition: background 0.15s ease, transform 0.15s ease;
    color: #fff;
    font-family: var(--font-hand);
}

[data-style="sketch"] .weekly-checkbox:hover {
    background: var(--sketch-surface-hover);
    transform: scale(1.06);
    border-color: var(--sketch-ink);
}

[data-style="sketch"] .weekly-checkbox.checked {
    background: var(--sketch-mint);
    border-color: var(--sketch-ink);
}

[data-style="sketch"] .weekly-checkbox.checked::after {
    content: '\2713';
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

[data-style="sketch"] .weekly-checkbox.disabled {
    background: var(--sketch-paper-dark);
    border-color: var(--sketch-ink-soft);
    opacity: 0.55;
    cursor: not-allowed;
}

[data-style="sketch"] .weekly-checkbox.disabled::after {
    content: '';
}

[data-style="sketch"] .weekly-day-cell.disabled {
    background: transparent;
    opacity: 1;
}

/* --- Goal card edit/delete buttons ---
   Base styles set very-pale pastel icon strokes that disappear against
   the white card. In sketch mode, give them visible ink-stroke icons
   inside an outlined sketch button; hover paints in the action colour. */
[data-style="sketch"] .goal-edit-btn,
[data-style="sketch"] .goal-delete-btn,
[data-style="sketch"] .goal-toggle-btn {
    width: 30px;
    height: 30px;
    background: var(--sketch-surface);
    border: 2px solid var(--sketch-ink);
    border-radius: 50%;
    padding: 0;
    filter: url(#sketch-wobble);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

[data-style="sketch"] .goal-edit-btn svg,
[data-style="sketch"] .goal-delete-btn svg,
[data-style="sketch"] .goal-toggle-btn svg {
    width: 14px;
    height: 14px;
    stroke: var(--sketch-ink);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.15s ease;
}

[data-style="sketch"] .goal-edit-btn:hover {
    background: var(--sketch-lavender-note);
    border-color: var(--sketch-violet);
    transform: none;
}

[data-style="sketch"] .goal-edit-btn:hover svg {
    stroke: var(--sketch-violet);
}

[data-style="sketch"] .goal-delete-btn:hover {
    background: #FEE2E2;     /* light red note */
    border-color: #DC2626;
    transform: none;
}

[data-style="sketch"] .goal-delete-btn:hover svg {
    stroke: #DC2626;
}

/* ===========================================================
   Planning page — compact one-row-per-year layout (Option A).
   Year label, period buttons, and stats all sit on a single
   horizontal row. The current year gets a "now" pen-tag and
   subtle lavender row tint so the eye lands there first.
   =========================================================== */
/* "Life" pinned row — sticky-note tinted so it reads as a special,
   non-yearly entry. Sits above the year strips. */
[data-style="sketch"] .life-row {
    display: grid;
    grid-template-columns: max-content 1fr max-content;
    align-items: center;
    column-gap: 24px;
    padding: 12px 18px;
    margin-bottom: 14px;
    background: var(--sketch-yellow-note);
    border: 2px solid var(--sketch-ink);
    border-radius: 14px;
    cursor: pointer;
    filter: url(#sketch-wobble);
    transition: transform 0.15s ease, background 0.15s ease;
}

[data-style="sketch"] .life-row:hover {
    transform: translateY(-1px);
    background: #FFF0BF;
}

[data-style="sketch"] .life-row-label {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

[data-style="sketch"] .life-row-label h4 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--sketch-ink);
    margin: 0;
    line-height: 1;
}

[data-style="sketch"] .life-row-subtitle {
    font-family: var(--font-hand);
    color: var(--sketch-ink-soft);
    font-size: 0.95rem;
    font-style: italic;
}

[data-style="sketch"] .life-row-stats {
    justify-self: end;
}

[data-style="sketch"] .life-count-chip {
    display: inline-flex;
    align-items: center;
    background: var(--sketch-surface);
    border: 1.5px solid var(--sketch-ink);
    border-radius: 999px;
    padding: 3px 12px;
    font-family: var(--font-hand);
    font-size: 0.85rem;
    color: var(--sketch-ink);
}

/* ===========================================================
   System Settings modal — open higher in the viewport, swap
   modern emoji icons for sketch SVG strokes.
   =========================================================== */
.settings-modal-content {
    /* Was 15% top margin (centered/lower); pull it up so the modal
       opens near the top of the viewport. */
    margin-top: 5vh !important;
    margin-bottom: 5vh;
}

/* Style the data-btn icon slot for SVG instead of emoji */
[data-style="sketch"] .data-btn .btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    color: var(--sketch-ink);
}

[data-style="sketch"] .data-btn .btn-icon svg {
    stroke: currentColor;
    fill: none;
}

/* Remove the leftover yellow ⚠️ block coloring since we dropped the
   emoji — keep the message but make the box quieter. */
[data-style="sketch"] .data-warning {
    background: var(--sketch-yellow-note);
    border: 1.5px dashed var(--sketch-ink);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--sketch-ink);
    font-family: var(--font-hand);
}

[data-style="sketch"] #years-planning-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

[data-style="sketch"] .year-item.quarter-list-item {
    display: grid;
    grid-template-columns: minmax(110px, max-content) 1fr max-content;
    align-items: center;
    column-gap: 24px;
    padding: 10px 18px;
    background: var(--sketch-surface);
    border: 2px solid var(--sketch-ink);
    border-radius: 14px;
    box-shadow: none;
    filter: url(#sketch-wobble);
    transition: background 0.15s ease;
}

[data-style="sketch"] .year-item.quarter-list-item:hover {
    background: var(--sketch-surface-hover);
}

/* Current year: faint lavender wash + violet ink on the year label */
[data-style="sketch"] .year-item.is-current-year {
    background: var(--sketch-lavender-note);
    border-color: var(--sketch-violet);
}

[data-style="sketch"] .year-item.is-current-year:hover {
    background: var(--sketch-lavender-note);
}

[data-style="sketch"] .year-row-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-style="sketch"] .year-row-label h4 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--sketch-ink);
    margin: 0;
    line-height: 1;
}

[data-style="sketch"] .year-item.is-current-year .year-row-label h4 {
    color: var(--sketch-violet);
}

/* "now" pen-tag on the current year — small lavender pill, slight tilt */
[data-style="sketch"] .now-tag {
    display: inline-block;
    font-family: var(--font-hand);
    font-size: 0.72rem;
    color: var(--sketch-violet);
    background: var(--sketch-surface);
    border: 1.5px solid var(--sketch-violet);
    border-radius: 999px;
    padding: 2px 9px;
    line-height: 1;
    transform: rotate(-3deg);
    letter-spacing: 0.05em;
}

/* Period buttons sit inline on the row */
[data-style="sketch"] .year-item .quarter-nav-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
}

[data-style="sketch"] .year-item .quarter-nav-btn,
[data-style="sketch"] .year-item .review-btn {
    background: var(--sketch-surface);
    color: var(--sketch-ink);
    border: 2px solid var(--sketch-ink);
    border-radius: 999px;
    padding: 5px 14px;
    font-family: var(--font-hand);
    font-size: 0.95rem;
    cursor: pointer;
    filter: url(#sketch-wobble);
    transition: background 0.15s ease, color 0.15s ease;
}

[data-style="sketch"] .year-item .quarter-nav-btn:hover,
[data-style="sketch"] .year-item .review-btn:hover {
    background: var(--sketch-paper-dark);
}

/* Empty quarters (not yet created) — dashed outline, soft ink */
[data-style="sketch"] .year-item .quarter-nav-btn.create-quarter {
    border-style: dashed;
    color: var(--sketch-ink-soft);
}

[data-style="sketch"] .year-item .quarter-nav-btn.create-quarter:hover {
    color: var(--sketch-ink);
    border-style: solid;
    background: var(--sketch-paper);
}

/* Mid Year / Annual review buttons — subtly distinct (italic) so they
   don't read as quarters */
[data-style="sketch"] .year-item .review-btn {
    font-style: italic;
}

/* Counters on the right end of the row */
[data-style="sketch"] .year-item .quarter-list-stats {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--font-hand);
    font-size: 0.85rem;
    color: var(--sketch-ink-soft);
    white-space: nowrap;
}

[data-style="sketch"] .year-item.is-current-year .quarter-list-stats {
    color: var(--sketch-ink);
}

[data-style="sketch"] .year-item .quarter-list-stats svg {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* "Add another year" button — small, subtle, not a giant dashed bar */
[data-style="sketch"] #new-year-btn {
    background: transparent;
    border: 1.5px dashed var(--sketch-ink-soft);
    color: var(--sketch-ink-soft);
    border-radius: 999px;
    padding: 6px 16px;
    font-family: var(--font-hand);
    font-size: 0.9rem;
    align-self: flex-start;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

[data-style="sketch"] #new-year-btn:hover {
    color: var(--sketch-ink);
    border-color: var(--sketch-ink);
    border-style: solid;
}

/* The Quarterly Goals view nests `.goals-list` inside `.year-goals-group`.
   The outer .goals-list already gets the sketch paper wrap; suppress the
   nested one so we don't end up with three concentric ink borders. Also
   strip the base-theme border-bottom under the year title (h4). */
[data-style="sketch"] .year-goals-group .goals-list {
    background: transparent;
    border: none;
    border-radius: 0;
    filter: none;
    padding: 0;
    box-shadow: none;
}

[data-style="sketch"] .year-goals-group h4 {
    border-bottom: none;
    color: var(--sketch-ink);
    font-family: var(--font-display);
    font-size: 1.5rem;
    padding-bottom: 0;
    margin-bottom: 12px;
}

/* ===========================================================
   Goal card "⋯ more options" menu
   Replaces the always-visible edit/delete buttons. Click the
   dots to reveal a small popover with Edit and Delete; click
   outside (or pick an action) to close.
   =========================================================== */
.goal-menu {
    position: relative;
    margin-left: auto;
    align-self: flex-start;
}

.goal-menu-toggle {
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--sketch-ink-soft, #6B7280);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.goal-menu-toggle:hover,
.goal-menu.is-open .goal-menu-toggle {
    opacity: 1;
    background: var(--sketch-paper-dark, rgba(0,0,0,0.05));
    color: var(--sketch-ink, #1F2440);
}

/* Popover hidden by default */
.goal-menu-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 132px;
    background: var(--sketch-surface, #FFFFFF);
    border: 2px solid var(--sketch-ink, #1F2440);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 6px 18px rgba(31, 36, 64, 0.12);
    display: none;
    z-index: 10;
    flex-direction: column;
}

[data-style="sketch"] .goal-menu-popover {
    filter: url(#sketch-wobble);
}

.goal-menu.is-open .goal-menu-popover {
    display: flex;
}

/* Menu items: full-width left-aligned rows with icon + label */
.goal-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    font-family: var(--font-hand, inherit);
    font-size: 0.95rem;
    color: var(--sketch-ink, #1F2440);
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

.goal-menu-item:hover {
    background: var(--sketch-paper-dark, #F3F4F6);
}

/* In the popover, the trash item should turn red on hover, not the
   sketch-mint-vs-paper default */
.goal-menu-item.goal-delete-btn:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.goal-menu-item.goal-delete-btn:hover svg {
    stroke: #DC2626;
}

.goal-menu-item svg {
    flex-shrink: 0;
    stroke: currentColor;
}

/* Override the earlier circular sketch styling for goal-edit/delete-btn
   so it doesn't apply when the buttons live INSIDE the menu popover.
   The selectors below have higher specificity than the earlier rules. */
[data-style="sketch"] .goal-menu-popover .goal-edit-btn,
[data-style="sketch"] .goal-menu-popover .goal-delete-btn {
    width: auto;
    height: auto;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    filter: none;
}

[data-style="sketch"] .goal-menu-popover .goal-edit-btn svg,
[data-style="sketch"] .goal-menu-popover .goal-delete-btn svg {
    width: 14px;
    height: 14px;
}

[data-style="sketch"] .goal-menu-popover .goal-edit-btn:hover {
    background: var(--sketch-lavender-note);
    color: var(--sketch-violet);
    border: none;
    transform: none;
}

[data-style="sketch"] .goal-menu-popover .goal-edit-btn:hover svg {
    stroke: var(--sketch-violet);
}

[data-style="sketch"] .goal-menu-popover .goal-delete-btn:hover {
    background: #FEE2E2;
    color: #DC2626;
    border: none;
}

/* Narrow viewport: stack year row contents vertically */
@media (max-width: 760px) {
    [data-style="sketch"] .year-item.quarter-list-item {
        grid-template-columns: 1fr;
        row-gap: 8px;
    }
    [data-style="sketch"] .year-item .quarter-list-stats {
        justify-content: flex-start;
    }
}

/* ===========================================================
   #6 — Login (auth) screen
   Now that sketch is the default, the auth screen renders with
   the sketch theme on first load. Override the modern card and
   button to match.
   =========================================================== */
[data-style="sketch"] .auth-screen {
    background: var(--sketch-paper);
    background-image: radial-gradient(circle, rgba(31, 36, 64, 0.08) 1px, transparent 1.2px);
    background-size: 22px 22px;
    background-attachment: fixed;
}

[data-style="sketch"] .auth-container {
    background: var(--sketch-surface);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 16px;
    box-shadow: none;
    filter: url(#sketch-wobble);
    padding: 32px 36px;
}

[data-style="sketch"] .auth-title {
    font-family: var(--font-display);
    color: var(--sketch-ink);
    font-size: 2.5rem;
    background: none;
    -webkit-background-clip: initial;
    -webkit-text-fill-color: initial;
    background-clip: initial;
    margin-bottom: 4px;
    text-align: center;
}

/* Hide the global wavy violet h1 underline on the auth title — the
   centered card layout doesn't need the extra emphasis and the
   underline misaligns against centered text. */
[data-style="sketch"] .auth-title::after {
    display: none;
}

[data-style="sketch"] .auth-subtitle {
    font-family: var(--font-hand);
    color: var(--sketch-ink-soft);
    font-size: 1rem;
    margin-bottom: 18px;
}

[data-style="sketch"] .auth-tabs {
    background: var(--sketch-paper);
    border: 2px solid var(--sketch-ink);
    border-radius: 999px;
    padding: 4px;
    display: inline-flex;
    gap: 4px;
    filter: url(#sketch-wobble);
}

[data-style="sketch"] .auth-tab {
    background: transparent;
    color: var(--sketch-ink);
    border: none;
    border-radius: 999px;
    padding: 8px 22px;
    font-family: var(--font-hand);
    white-space: nowrap;
    flex: 1;
}

[data-style="sketch"] .auth-tab.active {
    background: var(--sketch-surface);
    color: var(--sketch-violet);
    border: 2px solid var(--sketch-ink);
    filter: url(#sketch-wobble);
}

[data-style="sketch"] .auth-form .form-group {
    margin-bottom: 14px;
}

[data-style="sketch"] .auth-form label {
    color: var(--sketch-ink);
    font-family: var(--font-hand);
    margin-bottom: 6px;
    display: block;
}

[data-style="sketch"] .auth-form input {
    background: var(--sketch-surface);
    color: var(--sketch-ink);
    border: 2px dashed var(--sketch-ink-soft);
    border-radius: 10px;
    padding: 10px 14px;
    font-family: var(--font-hand);
    font-size: 1rem;
    width: 100%;
}

[data-style="sketch"] .auth-form input::placeholder {
    color: var(--sketch-ink-soft);
    opacity: 0.6;
}

[data-style="sketch"] .auth-form input:focus {
    border-color: var(--sketch-violet);
    border-style: solid;
    outline: none;
}

[data-style="sketch"] .auth-btn {
    background: var(--sketch-surface);
    color: var(--sketch-ink);
    border: 2.5px solid var(--sketch-ink);
    border-radius: 999px;
    padding: 12px 20px;
    font-family: var(--font-hand);
    font-size: 1.05rem;
    filter: url(#sketch-wobble);
    cursor: pointer;
    width: 100%;
    transition: background 0.15s ease;
}

[data-style="sketch"] .auth-btn:hover {
    background: var(--sketch-paper-dark);
}

[data-style="sketch"] .auth-error {
    color: #DC2626;
    font-family: var(--font-hand);
    margin-top: 8px;
}


/* ===========================================================
   MOBILE OPTIMIZATIONS — ≤ 768px
   ===========================================================
   Audit found the desktop layout falls apart on phone-sized
   viewports because the side nav stays at 110px wide and main
   content reserves 110px of left margin, leaving every page
   ~280px of usable width inside a 390px viewport — too narrow
   for the date hero, weekly grid, year strips, or stats cards.

   Fix flips the side nav to a fixed-bottom horizontal bar so
   main content gets the full viewport width back, then handles
   per-page overflow + bumps touch targets + makes modals
   full-width.
   =========================================================== */
@media (max-width: 768px) {

    /* ----- 1. Side nav → bottom bar ----- */

    .side-nav {
        position: fixed;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-top: 2px solid var(--sketch-ink, var(--border-color));
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
        overflow-x: auto;
        overflow-y: hidden;
        z-index: 1000;
    }

    /* App logo doesn't fit in a 56px-tall bottom bar — drop it */
    .side-nav .nav-header {
        display: none;
    }

    .side-nav .nav-menu {
        flex-direction: row;
        flex: 1;
        padding: 6px 4px;
        gap: 2px;
        margin: 0;
    }

    .nav-item {
        flex: 1;
        min-width: 0;
    }

    .nav-button {
        width: 100%;
        margin: 0;
        min-height: 56px;
        padding: 4px 2px;
        gap: 2px;
    }

    .nav-footer {
        margin-top: 0;
        padding: 6px 4px;
        border-top: none;
        border-left: 1.5px solid var(--sketch-ink, var(--border-color));
        flex-shrink: 0;
    }

    .nav-footer .nav-button {
        min-height: 56px;
        min-width: 56px;
    }

    /* Sketch-themed nav-icon tiles are 52×52 on desktop — too tall
       for a bottom bar. Trim to 36×36. */
    [data-style="sketch"] .nav-button .nav-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    [data-style="sketch"] .nav-button .nav-icon svg,
    [data-style="sketch"] .nav-button .nav-icon .sketch-glyph {
        width: 20px;
        height: 20px;
    }

    [data-style="sketch"] .nav-button .nav-label {
        font-size: 0.65rem;
        max-width: 100%;
        line-height: 1.05;
    }

    /* Hover-lift effect doesn't make sense on touch — disable */
    [data-style="sketch"] .nav-button:hover .nav-icon {
        transform: none;
    }


    /* ----- 2. Main content reclaim ----- */

    .main-content {
        margin-left: 0;
        /* Leave room for the bottom nav (~70px including border + padding) */
        padding-bottom: 80px;
    }

    [data-style="sketch"] .section {
        padding-left: 14px;
        padding-right: 14px;
    }


    /* ----- 3. Per-page horizontal-overflow handling ----- */

    /* Habits page header — chips wrap below title instead of overlapping */
    [data-style="sketch"] .habit-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    [data-style="sketch"] .habit-header .header-top {
        width: 100%;
    }

    [data-style="sketch"] .habit-header .stats {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        margin-top: 0;
    }

    /* Section description below page heading — wrap and shrink */
    .section-description {
        font-size: 0.9rem;
    }

    /* Tab bar — horizontally scrollable instead of wrapping */
    [data-style="sketch"] .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 6px 12px;
        gap: 8px;
        scrollbar-width: none;
    }
    [data-style="sketch"] .tabs::-webkit-scrollbar { display: none; }

    [data-style="sketch"] .tab-button {
        flex-shrink: 0;
        padding: 6px 10px;
        font-size: 0.95rem;
    }

    [data-style="sketch"] .tab-icon {
        width: 16px;
        height: 16px;
        margin-right: 4px;
    }

    /* Date hero — tighten padding, ensure ring sits next to date */
    [data-style="sketch"] .view-header {
        padding: 12px 16px;
    }

    [data-style="sketch"] .daily-nav-row,
    [data-style="sketch"] .date-nav-row {
        grid-template-columns: auto 1fr auto;
        column-gap: 8px;
    }
    [data-style="sketch"] .date-nav-row {
        grid-template-columns: auto 1fr auto;
    }

    /* Smaller progress ring on mobile to fit alongside date */
    [data-style="sketch"] .daily-progress-ring,
    [data-style="sketch"] .progress-ring {
        width: 80px;
        height: 80px;
    }
    [data-style="sketch"] .progress-percent {
        font-size: 1.2rem;
    }
    [data-style="sketch"] .progress-text {
        font-size: 0.7rem;
    }

    /* Smaller "Today" / day label */
    [data-style="sketch"] .daily-header-center h2,
    [data-style="sketch"] .weekly-header-center h2,
    [data-style="sketch"] .header-center h2 {
        font-size: 1.5rem;
    }
    [data-style="sketch"] .current-date,
    [data-style="sketch"] .weekly-quarter-label {
        font-size: 0.85rem;
    }

    /* Daily / Weekly habit panels — ensure single column */
    [data-style="sketch"] .daily-container {
        grid-template-columns: 1fr !important;
    }

    /* Weekly grid — horizontally scrollable */
    .weekly-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -14px; /* let it bleed to viewport edges for max width */
        padding: 0 14px;
    }
    .weekly-habits-table {
        min-width: 540px;
    }

    /* Stats overview cards — 2×2 grid instead of 4 across */
    .overview-cards {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    /* Stats weekday patterns — horizontally scrollable */
    [data-style="sketch"] #weekday-stats {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 8px;
        padding-bottom: 4px;
    }
    [data-style="sketch"] .weekday-stat {
        flex: 0 0 auto;
        min-width: 64px;
    }

    /* Activity grid (This Week / Last Week / Best Day / Streak Leader) — 2×2 */
    .activity-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }

    /* Year strips on Planning — collapse to vertical layout per year */
    [data-style="sketch"] .year-item.quarter-list-item {
        grid-template-columns: 1fr;
        row-gap: 8px;
        padding: 12px 14px;
    }

    [data-style="sketch"] .year-item .quarter-list-stats {
        justify-content: flex-start;
        font-size: 0.8rem;
    }

    [data-style="sketch"] .year-item .quarter-nav-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Life pinned row */
    [data-style="sketch"] .life-row {
        grid-template-columns: 1fr auto;
        column-gap: 12px;
        padding: 10px 14px;
    }
    [data-style="sketch"] .life-row-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    [data-style="sketch"] .life-row-label h4 {
        font-size: 1.4rem;
    }

    /* Quarterly tile gradient banners (Monthly/Quarterly/Yearly) — 1 col */
    .months-grid,
    .quarters-grid,
    .years-grid {
        grid-template-columns: 1fr !important;
    }

    /* Goals page sub-tabs */
    [data-style="sketch"] .goals-tabs {
        flex-wrap: wrap;
    }
    [data-style="sketch"] .goals-tab {
        flex: 1 1 auto;
        font-size: 0.95rem;
    }

    /* Goals header — stack title and Add button */
    .goals-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Relationships sub-tabs — wrap to 2×2 instead of 1 row */
    [data-style="sketch"] .relationships-tabs {
        flex-wrap: wrap;
    }
    [data-style="sketch"] .relationship-tab {
        flex: 1 1 calc(50% - 6px);
        min-width: 0;
        font-size: 0.9rem;
        padding: 8px 12px;
    }


    /* ----- 4. Touch target bumps ----- */

    [data-style="sketch"] .habit-checkbox {
        width: 36px;
        height: 36px;
    }
    [data-style="sketch"] .habit-checkbox.checked::after {
        font-size: 18px;
    }

    [data-style="sketch"] .weekly-checkbox {
        width: 32px;
        height: 32px;
    }
    [data-style="sketch"] .weekly-checkbox.checked::after {
        font-size: 16px;
    }

    .goal-menu-toggle {
        width: 32px;
        height: 32px;
    }

    .goal-mountain-checkbox {
        width: 32px;
        height: 32px;
    }


    /* ----- 5. Modals — full-width on mobile ----- */

    .modal-content {
        max-width: calc(100% - 24px);
        width: auto;
        margin: 5vh 12px;
        padding: 20px;
    }

    .settings-modal-content {
        margin: 3vh 12px !important;
        max-height: 92vh;
        max-width: calc(100% - 24px);
    }

    /* Auth screen on mobile */
    [data-style="sketch"] .auth-container {
        margin: 5vh 16px;
        padding: 24px 20px;
    }
}
