:root {
    /* Color Palette - Soft, warm, cozy tones suitable for pets */
    --primary-bg: #f8f1eb;
    --card-bg: rgba(255, 255, 255, 0.65);
    --card-border: rgba(255, 255, 255, 0.4);
    --text-main: #4a4036;
    --text-muted: #8b7d72;
    --accent-color: #fca311;
    --accent-hover: #ffb703;
    --accent-light: rgba(252, 163, 17, 0.15);

    /* Cats colors */
    --datou-color: #6a994e;
    --dongdong-color: #bc4749;
    --niuniu-color: #e5989b;
    --shared-color: #386641;

    /* Status colors */
    --success-color: #2b9348;
    --warning-color: #ff9f1c;

    /* UI Variables */
    --border-radius: 20px;
    --input-radius: 12px;
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(252, 163, 17, 0.2);

    /* Dark mode support */
    --input-bg: white;
    --modal-bg: white;
    --day-box-bg: #fcfcfc;
    --day-box-border: #eee;
    --checkbox-bg: white;
    --checkbox-border: #ddd;

    /* Background animation */
    --blob-color-1: rgba(252, 163, 17, 0.12);
    --blob-color-2: rgba(229, 152, 155, 0.1);
    --bg-gradient-start: #fdfbfb;
    --bg-gradient-end: #f5ede4;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    background-color: var(--primary-bg);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    transition: background-color 0.5s ease;
}

/* ========== Theme Color Definitions (Light) ========== */
body[data-theme="1"] {
    --accent-color: #e5989b;
    --accent-hover: #f2acb0;
    --accent-light: rgba(229, 152, 155, 0.15);
    --shadow-glow: 0 0 20px rgba(229, 152, 155, 0.2);
    --primary-bg: #faf0f2;
    --card-bg: rgba(255, 248, 249, 0.7);
    --card-border: rgba(255, 220, 225, 0.5);
    --blob-color-1: rgba(229, 152, 155, 0.14);
    --blob-color-2: rgba(200, 130, 180, 0.1);
    --bg-gradient-start: #fdf6f7;
    --bg-gradient-end: #f5e8eb;
}

body[data-theme="2"] {
    --accent-color: #6a994e;
    --accent-hover: #7bb563;
    --accent-light: rgba(106, 153, 78, 0.15);
    --shadow-glow: 0 0 20px rgba(106, 153, 78, 0.2);
    --primary-bg: #f0f5ed;
    --card-bg: rgba(245, 252, 242, 0.7);
    --card-border: rgba(200, 230, 190, 0.5);
    --blob-color-1: rgba(106, 153, 78, 0.12);
    --blob-color-2: rgba(150, 200, 100, 0.08);
    --bg-gradient-start: #f5f9f3;
    --bg-gradient-end: #e8f0e4;
}

body[data-theme="3"] {
    --accent-color: #4895ef;
    --accent-hover: #5aa5f5;
    --accent-light: rgba(72, 149, 239, 0.15);
    --shadow-glow: 0 0 20px rgba(72, 149, 239, 0.2);
    --primary-bg: #edf3fb;
    --card-bg: rgba(242, 248, 255, 0.7);
    --card-border: rgba(190, 215, 250, 0.5);
    --blob-color-1: rgba(72, 149, 239, 0.12);
    --blob-color-2: rgba(100, 200, 240, 0.08);
    --bg-gradient-start: #f2f7fd;
    --bg-gradient-end: #e4edf8;
}

body[data-theme="4"] {
    --accent-color: #7b2cbf;
    --accent-hover: #9146d4;
    --accent-light: rgba(123, 44, 191, 0.15);
    --shadow-glow: 0 0 20px rgba(123, 44, 191, 0.2);
    --primary-bg: #f3eef8;
    --card-bg: rgba(248, 243, 255, 0.7);
    --card-border: rgba(210, 190, 240, 0.5);
    --blob-color-1: rgba(123, 44, 191, 0.1);
    --blob-color-2: rgba(180, 100, 220, 0.08);
    --bg-gradient-start: #f7f3fb;
    --bg-gradient-end: #ece4f5;
}

/* ========== Dark Mode (base) ========== */
body.dark-mode {
    --text-main: #e8ddd0;
    --text-muted: #a89888;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.3);
    --input-bg: rgba(40, 34, 28, 0.9);
    --modal-bg: #2d261f;
    --day-box-bg: rgba(45, 38, 32, 0.8);
    --day-box-border: rgba(70, 60, 50, 0.4);
    --checkbox-bg: rgba(40, 34, 28, 0.9);
    --checkbox-border: rgba(100, 90, 78, 0.5);
    /* Default dark theme (orange) */
    --primary-bg: #1e1a17;
    --card-bg: rgba(45, 38, 32, 0.85);
    --card-border: rgba(70, 60, 50, 0.5);
    --blob-color-1: rgba(252, 163, 17, 0.06);
    --blob-color-2: rgba(229, 152, 155, 0.05);
    --bg-gradient-start: #1a1614;
    --bg-gradient-end: #252019;
}

/* Dark + Pink */
body.dark-mode[data-theme="1"] {
    --primary-bg: #221a1c;
    --card-bg: rgba(50, 38, 42, 0.85);
    --card-border: rgba(80, 58, 65, 0.5);
    --blob-color-1: rgba(229, 152, 155, 0.07);
    --blob-color-2: rgba(200, 130, 180, 0.05);
    --bg-gradient-start: #1e1618;
    --bg-gradient-end: #2a2024;
}

/* Dark + Green */
body.dark-mode[data-theme="2"] {
    --primary-bg: #1a2118;
    --card-bg: rgba(38, 50, 35, 0.85);
    --card-border: rgba(58, 78, 52, 0.5);
    --blob-color-1: rgba(106, 153, 78, 0.07);
    --blob-color-2: rgba(150, 200, 100, 0.04);
    --bg-gradient-start: #161e14;
    --bg-gradient-end: #222a20;
}

/* Dark + Blue */
body.dark-mode[data-theme="3"] {
    --primary-bg: #181d24;
    --card-bg: rgba(35, 42, 55, 0.85);
    --card-border: rgba(50, 65, 85, 0.5);
    --blob-color-1: rgba(72, 149, 239, 0.07);
    --blob-color-2: rgba(100, 200, 240, 0.04);
    --bg-gradient-start: #141a22;
    --bg-gradient-end: #1e2530;
}

/* Dark + Purple */
body.dark-mode[data-theme="4"] {
    --primary-bg: #1e1822;
    --card-bg: rgba(45, 35, 55, 0.85);
    --card-border: rgba(68, 52, 82, 0.5);
    --blob-color-1: rgba(123, 44, 191, 0.06);
    --blob-color-2: rgba(180, 100, 220, 0.04);
    --bg-gradient-start: #1a1520;
    --bg-gradient-end: #26202e;
}

body.dark-mode .date-navigator {
    background: rgba(45, 38, 32, 0.95);
}

body.dark-mode .task-item {
    background: rgba(55, 48, 40, 0.8);
}

body.dark-mode .icon-btn {
    background: rgba(45, 38, 32, 0.9);
    border-color: rgba(80, 70, 58, 0.5);
    color: var(--text-muted);
}

body.dark-mode .icon-btn.active-btn {
    color: var(--text-main);
    border-color: var(--accent-color);
}

body.dark-mode .modal-content {
    background: var(--modal-bg);
}

body.dark-mode .crop-container {
    background: #1a1614 !important;
}

body.dark-mode .cal-day-box.today {
    background: var(--accent-color);
    color: #1e1a17;
}

body.dark-mode .notes-section textarea {
    background: rgba(35, 30, 25, 0.8);
    color: var(--text-main);
    border-color: rgba(80, 70, 58, 0.4);
}

body.dark-mode .stats-tab {
    background: rgba(40, 34, 28, 0.8);
    color: var(--text-muted);
}

body.dark-mode .stats-tab.active {
    background: var(--accent-color);
    color: #1e1a17;
}

body.dark-mode .stat-card {
    background: rgba(40, 34, 28, 0.6);
}

body.dark-mode .ranking-bar-bg,
body.dark-mode .comparison-bar-bg {
    background: rgba(40, 34, 28, 0.6);
}

body.dark-mode .chart-bar-wrapper {
    background: rgba(40, 34, 28, 0.5);
}

body.dark-mode .modal-overlay {
    background: rgba(10, 8, 6, 0.6);
}

/* ========== Dynamic Animated Background ========== */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: linear-gradient(120deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    overflow: hidden;
    transition: background 0.6s ease;
}

.background-animation::before,
.background-animation::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: float 20s infinite alternate ease-in-out;
}

.background-animation::before {
    width: 400px;
    height: 400px;
    background: var(--blob-color-1);
    top: 10%;
    left: 10%;
    transition: background 0.6s ease;
}

.background-animation::after {
    width: 500px;
    height: 500px;
    background: var(--blob-color-2);
    bottom: 10%;
    right: 5%;
    animation-delay: -10s;
    transition: background 0.6s ease;
}

@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(100px, 50px) rotate(45deg);
    }
}

/* ========== Main Container ========== */
.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
}

/* ========== Glassmorphism Panel ========== */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-soft);
    padding: 1.5rem;
    margin-bottom: 2rem;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color 0.5s ease, border-color 0.5s ease;
}

.glass-panel:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08), var(--shadow-glow);
    transform: translateY(-2px);
}

/* ========== Header ========== */
header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: relative;
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

h1 i {
    color: var(--accent-color);
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Header action buttons */
.header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.header-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    backdrop-filter: blur(8px);
    transition: all var(--transition-fast);
}

.header-icon-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: scale(1.1);
}

.header-icon-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* ========== Date Navigator ========== */
.date-navigator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
    background: var(--input-bg);
    padding: 1rem 2rem;
    border-radius: 50px;
    box-shadow: var(--shadow-soft);
    transition: background-color 0.5s ease, box-shadow 0.5s ease;
}

.current-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 140px;
}

#date-text {
    font-size: 1.25rem;
    font-weight: 700;
}

#day-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ========== Buttons ========== */
button {
    cursor: pointer;
    border: none;
    outline: none;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.nav-btn:hover {
    background: var(--text-main);
    color: white;
    transform: scale(1.1);
}

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

.action-btn {
    background: var(--accent-light);
    color: var(--accent-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

.action-btn:hover {
    background: var(--accent-color);
    color: white;
}

.global-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.icon-btn {
    background: var(--input-bg);
    color: var(--text-muted);
    padding: 10px 20px;
    border-radius: var(--input-radius);
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid #e0d8d0;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn.active-btn {
    color: var(--text-main);
    border-color: var(--accent-color);
    box-shadow: 0 4px 15px rgba(252, 163, 17, 0.15);
}

.icon-btn:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

/* ========== File Status ========== */
.file-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.file-status.warning {
    color: var(--warning-color);
    background: rgba(255, 159, 28, 0.1);
}

.file-status.success {
    color: var(--success-color);
    background: rgba(43, 147, 72, 0.1);
}

/* ========== Daily Summary Bar ========== */
.daily-summary {
    display: flex;
    align-items: center;
    justify-content: space-around;
    gap: 1.5rem;
    padding: 1.2rem 2rem;
    margin-bottom: 2rem;
}

.summary-progress {
    flex-shrink: 0;
}

.progress-ring {
    width: 90px;
    height: 90px;
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--day-box-border);
    stroke-width: 8;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--accent-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 264;
    stroke-dashoffset: 264;
    transition: stroke-dashoffset 0.6s ease, stroke 0.3s ease;
}

.progress-text {
    fill: var(--text-main);
    font-size: 1.4rem;
    font-weight: 800;
    text-anchor: middle;
    dominant-baseline: middle;
    transform: rotate(90deg);
    transform-origin: 50% 50%;
}

.summary-info {
    text-align: center;
}

.score-count {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.score-label {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 4px;
    transition: color 0.3s;
}

.summary-streak {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.streak-item {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.streak-item i {
    margin-right: 4px;
}

.streak-item .fa-fire {
    color: #ff6b35;
}

.streak-item .fa-crown {
    color: #ffd700;
}

/* ========== Cat Badge ========== */
.cat-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--accent-light);
    color: var(--accent-color);
    margin-left: 8px;
    vertical-align: middle;
}

.cat-badge.complete {
    background: rgba(43, 147, 72, 0.15);
    color: var(--success-color);
}

/* ========== Tasks Sections ========== */
.section-header,
.cat-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px dashed var(--accent-light);
}

.cat-header h2,
.section-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.cat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.datou-avatar {
    background: var(--datou-color);
}

.dongdong-avatar {
    background: var(--dongdong-color);
}

.niuniu-avatar {
    background: var(--niuniu-color);
}

/* ========== Task Items ========== */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.task-list {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: var(--input-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1 1 calc(33.333% - 1rem);
    min-width: 160px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    border: 1px solid transparent;
}

body.dark-mode .task-item {
    background: rgba(55, 48, 40, 0.8);
}

.task-item:hover {
    background: var(--input-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

/* ========== Custom Checkbox ========== */
.task-item input[type="checkbox"] {
    display: none;
}

.custom-checkbox {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 2px solid var(--checkbox-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all var(--transition-smooth);
    background: var(--checkbox-bg);
    flex-shrink: 0;
}

.task-item input:checked+.custom-checkbox {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: scale(1.1) rotate(5deg);
}

.task-item input:checked~.task-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.task-item input:checked~.task-icon {
    color: var(--accent-light);
}

.task-name {
    font-weight: 500;
    font-size: 1.05rem;
    transition: color 0.2s;
}

/* Cat-specific checkbox colors */
.cat-card[data-cat="datou"] .task-item input:checked+.custom-checkbox {
    background: var(--datou-color);
    border-color: var(--datou-color);
}

.cat-card[data-cat="dongdong"] .task-item input:checked+.custom-checkbox {
    background: var(--dongdong-color);
    border-color: var(--dongdong-color);
}

.cat-card[data-cat="niuniu"] .task-item input:checked+.custom-checkbox {
    background: var(--niuniu-color);
    border-color: var(--niuniu-color);
}

/* ========== Notes Section ========== */
.notes-section {
    padding: 1rem 1.5rem;
}

.notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.notes-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
}

.notes-header h3 i {
    margin-right: 8px;
    color: var(--accent-color);
}

.notes-chevron {
    color: var(--text-muted);
    transition: transform 0.3s ease;
    font-size: 0.9rem;
}

.notes-chevron.open {
    transform: rotate(180deg);
}

.notes-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, margin-top 0.3s ease;
}

.notes-body.open {
    max-height: 400px;
    margin-top: 12px;
}

.notes-section textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 16px;
    border: 1px solid var(--day-box-border);
    border-radius: var(--input-radius);
    background: var(--input-bg);
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.notes-section textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Notes action buttons */
.notes-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-end;
}

.notes-btn {
    padding: 8px 20px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.notes-btn-save {
    background: var(--accent-color);
    color: white;
}

.notes-btn-save:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.notes-btn-cancel {
    background: var(--primary-bg);
    color: var(--text-muted);
}

.notes-btn-cancel:hover:not(:disabled) {
    color: var(--text-main);
}

.notes-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-main);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 3000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ========== Modal Overlay ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--modal-bg);
    padding: 2rem;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

.modal-content h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.modal-btn-primary {
    background: var(--accent-color);
    color: white;
    padding: 12px 24px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 10px;
}

.modal-btn-primary:hover {
    background: var(--accent-hover);
}

.modal-btn-secondary {
    background: transparent;
    color: var(--text-muted);
    padding: 10px;
    font-size: 0.9rem;
}

.modal-btn-secondary:hover {
    color: var(--text-main);
    text-decoration: underline;
}

/* ========== Stats Modal ========== */
.stats-modal-content {
    max-width: 600px;
    text-align: left;
}

.stats-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 1.5rem;
}

.stats-tab {
    flex: 1;
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--primary-bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    transition: all var(--transition-fast);
}

.stats-tab.active {
    background: var(--accent-color);
    color: white;
}

.stats-tab:hover:not(.active) {
    background: var(--accent-light);
    color: var(--accent-color);
}

/* Stats overview grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--primary-bg);
    border-radius: var(--input-radius);
    padding: 12px;
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-color);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Weekly bar chart */
.weekly-chart {
    margin-bottom: 1.5rem;
}

.weekly-chart h4,
.task-ranking h4,
.cat-comparison h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 120px;
}

.chart-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.chart-bar-wrapper {
    flex: 1;
    width: 100%;
    background: var(--primary-bg);
    border-radius: 6px 6px 0 0;
    position: relative;
    display: flex;
    align-items: flex-end;
}

.chart-bar {
    width: 100%;
    background: var(--accent-color);
    border-radius: 6px 6px 0 0;
    min-height: 2px;
    transition: height 0.4s ease;
    position: relative;
}

.chart-bar-pct {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.chart-bar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 600;
}

/* Task ranking bars */
.task-ranking,
.cat-comparison {
    margin-bottom: 1.5rem;
}

.ranking-list,
.comparison-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ranking-item,
.comparison-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ranking-name,
.comparison-name {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 80px;
    white-space: nowrap;
    color: var(--text-main);
}

.ranking-bar-bg,
.comparison-bar-bg {
    flex: 1;
    height: 20px;
    background: var(--primary-bg);
    border-radius: 10px;
    overflow: hidden;
}

.ranking-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--accent-hover));
    border-radius: 10px;
    transition: width 0.4s ease;
}

.comparison-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.4s ease;
}

.ranking-pct,
.comparison-pct {
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 36px;
    text-align: right;
    color: var(--text-muted);
}

/* ========== Calendar ========== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.cal-day-header {
    text-align: center;
    font-weight: bold;
    color: var(--text-muted);
    padding-bottom: 5px;
    font-size: 0.9rem;
}

.cal-day-box {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--day-box-bg);
    border-radius: 8px;
    border: 1px solid var(--day-box-border);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 1px;
}

.cal-day-box:hover:not(.other-month) {
    border-color: var(--accent-color);
    transform: scale(1.05);
}

.cal-day-box.today {
    background: var(--text-main);
    color: white;
    font-weight: bold;
    border-color: var(--text-main);
}

.cal-day-box.today.has-completion {
    box-shadow: 0 0 0 3px var(--accent-color);
}

.cal-day-box.selected {
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 10px var(--accent-light);
}

.cal-day-box.other-month {
    color: #ccc;
    background: transparent;
    border-color: transparent;
    cursor: default;
}

.cal-day-pct {
    font-size: 0.55rem;
    font-weight: 500;
    opacity: 0.8;
    line-height: 1;
}

.cal-day-star {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 0.5rem;
    color: #ffd700;
}

.cal-day-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-color);
    position: absolute;
    bottom: 3px;
}

/* Month stats at bottom of calendar */
.cal-month-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.cal-stat-item {
    text-align: center;
}

.cal-stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--accent-color);
}

.cal-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ========== Clickable Avatars ========== */
.avatar-clickable {
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.avatar-clickable::after {
    content: '\f083';
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.2s;
}

.avatar-clickable:hover::after {
    opacity: 1;
}

.avatar-clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.avatar-clickable.has-image i {
    display: none;
}

/* ========== Theme Color Palette ========== */
.theme-btn-wrapper {
    position: relative;
}

.theme-palette {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: var(--modal-bg);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    z-index: 100;
}

.theme-palette.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.theme-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s;
}

.theme-swatch:hover {
    transform: scale(1.2);
}

.theme-swatch.active {
    border-color: var(--text-main);
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
    .header-top {
        flex-direction: column;
        gap: 0.5rem;
    }

    .date-navigator {
        flex-wrap: wrap;
        width: 100%;
        padding: 1rem;
    }

    .task-item {
        flex: 1 1 100%;
    }

    h1 {
        font-size: 2rem;
    }

    .daily-summary {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 1rem;
    }

    .summary-streak {
        flex-direction: row;
        justify-content: center;
        gap: 16px;
    }

    .stats-modal-content {
        max-width: 95vw;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cal-month-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .ranking-name,
    .comparison-name {
        min-width: 60px;
        font-size: 0.75rem;
    }
}
