/* ========================
   Root Variables & Reset
   ======================== */
:root {
    --primary-color: #3b82f6;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-bg: #1f2937;
    --light-bg: #f3f4f6;
    --card-bg: #ffffff;
    --text-dark: #111827;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --priority-high: #ef4444;
    --priority-medium: #f59e0b;
    --priority-low: #10b981;
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--light-bg);
    color: var(--text-dark);
}

/* ========================
   Layout
   ======================== */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #2563eb 100%);
    color: white;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-content h1 {
    font-size: 1.875rem;
    font-weight: 700;
}

.header-stats {
    display: flex;
    gap: 2rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.8;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Date Navigator */
.date-navigator {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.date-nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.6rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}

.date-nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.08);
}

.date-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
}

.date-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    min-width: 240px;
    justify-content: center;
    text-align: center;
}

#selectedDateDisplay {
    white-space: nowrap;
}

.today-btn {
    background: white;
    color: var(--primary-color);
    border: none;
    border-radius: 1rem;
    padding: 0.2rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    white-space: nowrap;
    flex-shrink: 0;
}

.today-btn:hover {
    opacity: 0.85;
    transform: scale(1.04);
}

/* Hamburger Menu */
.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 2.5rem;
    height: 2.5rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1001;
    box-shadow: var(--shadow);
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background: var(--text-dark);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(0.5rem, 0.5rem);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(0.5rem, -0.5rem);
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: white;
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    box-shadow: var(--shadow);
}

.nav-tab {
    flex: 1;
    padding: 1rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-light);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    white-space: nowrap;
}

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

.nav-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

/* ========================
   Cards
   ======================== */
.card {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* ========================
   Dashboard
   ======================== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    min-height: 200px;
}

.dashboard-card.full-width {
    grid-column: 1 / -1;
}

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

.overview-item {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 0.375rem;
    text-align: center;
}

.overview-item .label {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.overview-item .value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-color);
}

.overview-item .value.overdue {
    color: var(--danger-color);
}

.overview-item-clickable {
    cursor: pointer;
}

.overview-item-clickable:hover {
    background: var(--border-color);
}

.points-breakdown {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--light-bg);
    border-radius: 0.375rem;
}

.breakdown-item .label {
    color: var(--text-light);
}

.breakdown-item .value {
    font-weight: 700;
    color: var(--primary-color);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    padding: 1rem;
    background: var(--light-bg);
    border-left: 3px solid var(--primary-color);
    border-radius: 0.25rem;
}

.activity-item .time {
    font-size: 0.875rem;
    color: var(--text-light);
}

.projects-summary {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-progress {
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 0.375rem;
}

.project-progress .name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* ========================
   Tasks
   ======================== */
.tasks-container {
    max-width: 900px;
    margin: 0 auto;
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tasks-header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.tasks-header h2 {
    font-size: 1.875rem;
}

.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-select,
.filter-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: white;
    font-size: 0.875rem;
}

.filter-input {
    flex: 1;
    min-width: 200px;
}

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

.task-section-header {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin: 0.5rem 0 0;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-color); 
}

.task-list .task-description,
.task-list .task-meta,
.task-list .task-status {
    display: none;
}

.task-list.expanded .task-description,
.task-list.expanded .task-status {
    display: block;
}

.task-list.expanded .task-meta {
    display: flex;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

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

.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-title {
    text-decoration: line-through;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.task-content {
    flex: 1;
}

.task-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.task-description {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.task-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
}

.task-meta-item {
    padding: 0.25rem 0.5rem;
    background: var(--light-bg);
    border-radius: 0.25rem;
    color: var(--text-light);
}

.task-priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.25rem;
}

.task-priority.high {
    background: var(--priority-high);
}

.task-priority.medium {
    background: var(--priority-medium);
}

.task-priority.low {
    background: var(--priority-low);
}

.task-status {
    min-width: 80px;
    text-align: right;
}

.task-status.pending {
    color: var(--text-light);
}

.task-status.completed {
    color: var(--secondary-color);
    font-weight: 600;
}

.task-status.overdue {
    color: var(--danger-color);
    font-weight: 600;
}

.task-due-badge {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-color);
    color: white;
}

.task-list.expanded .task-due-badge {
    display: none;
}

/* ========================
   Projects
   ======================== */
.projects-container {
    max-width: 1000px;
    margin: 0 auto;
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.projects-header h2 {
    font-size: 1.875rem;
}

.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: white;
    border: 1px solid var(--border-color);
    border-top: 4px solid #3b82f6;
    border-radius: 0.5rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.project-card.blue {
    border-top: 4px solid #3b82f6;
}

.project-card.red {
    border-top: 4px solid #ef4444;
}

.project-card.green {
    border-top: 4px solid #10b981;
}

.project-card.yellow {
    border-top: 4px solid #f59e0b;
}

.project-card.purple {
    border-top: 4px solid #a855f7;
}

.project-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.project-description {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.project-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.project-stat {
    display: flex;
    flex-direction: column;
}

.project-stat-label {
    color: var(--text-light);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.project-stat-value {
    font-weight: 700;
    color: var(--primary-color);
}

/* ========================
   Habits
   ======================== */
.habits-container {
    max-width: 900px;
    margin: 0 auto;
}

.habits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.habits-header h2 {
    font-size: 1.875rem;
}

.habits-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.habit-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.habit-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.habit-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.habit-description {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.habit-stats {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: var(--light-bg);
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.habit-stat {
    text-align: center;
}

.habit-stat-label {
    color: var(--text-light);
    font-size: 0.75rem;
}

.habit-stat-value {
    font-weight: 700;
    color: var(--primary-color);
}

.habit-checkbox {
    width: 100%;
    padding: 0.5rem;
    background: var(--light-bg);
    border: 2px solid var(--primary-color);
    border-radius: 0.375rem;
    color: var(--primary-color);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.habit-checkbox:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.habit-checkbox.completed {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.habit-checkbox:disabled {
    background: var(--light-bg);
    border-color: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Days of Week Selector */
.days-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.day-checkbox {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--light-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.day-checkbox:hover {
    background: #e0e7ff;
    border-color: var(--primary-color);
}

.day-checkbox input {
    margin-right: 0.5rem;
    cursor: pointer;
}

.day-checkbox input:checked {
    accent-color: var(--primary-color);
}

/* Repeat Unit Input */
.repeat-unit-input {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.repeat-unit-input input {
    max-width: 80px;
}

.repeat-unit-input span {
    color: var(--text-light);
    font-size: 0.875rem;
    white-space: nowrap;
}

/* ========================
   Finances
   ======================== */
.finances-container {
    max-width: 1000px;
    margin: 0 auto;
}

.finances-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.finances-header h2 {
    font-size: 1.875rem;
}

.finance-buttons {
    display: flex;
    gap: 0.5rem;
}

.finance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    padding: 1.5rem;
    border-radius: 0.5rem;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.summary-card.income {
    background: linear-gradient(135deg, var(--secondary-color), #059669);
}

.summary-card.expense {
    background: linear-gradient(135deg, var(--danger-color), #dc2626);
}

.summary-card.balance {
    background: linear-gradient(135deg, var(--primary-color), #2563eb);
}

.summary-card .label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.summary-card .value {
    font-size: 1.875rem;
    font-weight: 700;
}

.finance-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.finance-tab {
    padding: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

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

.finance-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.finance-content {
    display: none;
}

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

.finance-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.finance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.finance-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.finance-item-left {
    flex: 1;
}

.finance-item-desc {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.finance-item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.finance-item-amount {
    text-align: right;
}

.finance-item-amount .monthly-label {
    font-size: 0.75em;
    font-weight: 400;
    opacity: 0.75;
}

.finance-item-amount.income {
    color: var(--secondary-color);
    font-weight: 700;
}

.finance-item-amount.expense {
    color: var(--danger-color);
    font-weight: 700;
}

/* ========================
   Finance Charts
   ======================== */
.finance-charts {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.chart-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.chart-container {
    width: 100%;
}

.pie-chart-wrap {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
}

.pie-svg {
    width: 200px;
    height: 200px;
    flex-shrink: 0;
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 160px;
}

.pie-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.pie-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pie-legend-label {
    flex: 1;
    color: var(--text-color);
}

.pie-legend-value {
    color: var(--text-light);
    white-space: nowrap;
}

.sankey-svg {
    width: 100%;
    height: auto;
    max-height: 400px;
}

.sankey-label {
    font-size: 11px;
    fill: var(--text-color);
}

/* ========================
   Buttons
   ======================== */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-secondary.active {
    background: var(--primary-color);
    color: white;
}

.btn-secondary.active:hover {
    background: #2563eb;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-success {
    background: var(--secondary-color);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* ========================
   Forms
   ======================== */
.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Emoji Selector */
.emoji-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.emoji-display {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

#habitEmojiBtn {
    flex: 1;
}

/* Emoji Picker Modal */
.emoji-picker-modal {
    max-width: 500px;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}

.emoji-btn {
    padding: 1rem;
    font-size: 2.5rem;
    border: 1px solid var(--border-color);
    background: var(--light-bg);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* ========================
   Modals
   ======================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* ========================
   Settings
   ======================== */
.settings-container {
    max-width: 600px;
    margin: 0 auto;
}

.settings-container h2 {
    margin-bottom: 2rem;
}

.settings-section {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.settings-section h3 {
    margin-bottom: 1rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    font-weight: 600;
}

/* ========================
   Category Management
   ======================== */
.category-manage-group {
    margin-bottom: 1.25rem;
}

.category-manage-group h4 {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-light);
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem 0;
}

.category-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
}

.category-list-item:last-child {
    border-bottom: none;
}

.category-list-item .category-name {
    flex: 1;
    font-size: 0.9rem;
}

.category-list-item .category-edit-input {
    flex: 1;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.category-add-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.category-add-input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
}

/* ========================
   States

   ======================== */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 0.95rem;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ========================
   Responsive
   ======================== */
@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .header-stats {
        width: 100%;
        justify-content: space-around;
    }

    .hamburger-menu {
        display: flex;
    }

    .nav-tabs {
        position: fixed;
        top: 5rem;
        right: 1rem;
        flex-direction: column;
        width: 220px;
        background: white;
        border: 1px solid var(--border-color);
        border-radius: 0.5rem;
        box-shadow: var(--shadow-lg);
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        transition: all 0.3s ease;
        z-index: 1000;
    }

    .nav-tabs.show {
        max-height: 500px;
        opacity: 1;
    }

    .nav-tab {
        flex: none;
        padding: 0.875rem 1rem;
        border-bottom: 1px solid var(--border-color);
        border-left: 3px solid transparent;
        text-align: left;
    }

    .nav-tab:last-child {
        border-bottom: none;
    }

    .nav-tab.active {
        border-bottom-color: var(--border-color);
        border-left-color: var(--primary-color);
        background: var(--light-bg);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .overview-stats {
        grid-template-columns: 2fr 2fr;
    }

    .projects-list {
        grid-template-columns: 1fr;
    }

    .finance-summary {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
    }

    .task-meta {
        flex-direction: column;
    }

    .date-display {
        min-width: 180px;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.25rem;
    }

    .nav-tabs {
        width: 180px;
    }

    .finance-buttons {
        flex-direction: column;
    }

    .finance-buttons .btn {
        width: 100%;
    }
}

/* ========================
   Wish List
   ======================== */
.wishlist-container {
    max-width: 800px;
    margin: 0 auto;
}

.wishlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.wishlist-header-actions {
    display: flex;
    gap: 0.5rem;
}

.wish-list-group {
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    overflow: hidden;
}

.wish-list-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary, #f5f5f5);
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.wish-list-group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wish-list-group-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary, #333);
}

.wish-list-group-counter {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary, #666);
    background: var(--bg-tertiary, #e8e8e8);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.wish-list-collapse-btn {
    background: none;
    border: none;
    padding: 0.15rem 0.35rem;
    cursor: pointer;
    color: var(--text-secondary, #666);
    font-size: 0.75rem;
    line-height: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wish-list-collapse-btn:hover {
    background: var(--border-color, #e0e0e0);
}

.wish-list-group.collapsed .wish-list {
    display: none;
}

.wish-list-group.collapsed .wish-list-group-header {
    border-bottom: none;
}

.wish-list-group-actions {
    display: flex;
    gap: 0.5rem;
}

.wish-list-group .wish-list {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.wish-list-empty {
    margin: 0;
    padding: 0.5rem 0;
}

.wish-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 1rem;
    cursor: default;
    transition: box-shadow 0.2s, opacity 0.2s;
}

.wish-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wish-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.wish-item.drag-over {
    border-color: var(--primary-color, #4CAF50);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

.wish-drag-handle {
    font-size: 1.2rem;
    color: #aaa;
    cursor: grab;
    user-select: none;
    flex-shrink: 0;
}

.wish-item-content {
    flex: 1;
    min-width: 0;
}

.wish-item-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.wish-item-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.875rem;
    color: #666;
}

.wish-item-price {
    color: var(--primary-color, #4CAF50);
    font-weight: 600;
}

.wish-item-url {
    color: #1976D2;
    text-decoration: none;
}

.wish-item-url:hover {
    text-decoration: underline;
}

.wish-item-checkbox {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary-color, #4CAF50);
}

.wish-item.completed .wish-item-title {
    text-decoration: line-through;
    color: #aaa;
}

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

/* ========================
   Notes
   ======================== */
.notes-container {
    max-width: 800px;
    margin: 0 auto;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
}

.note-item {
    background: #fff;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-height: 100px;
}

.note-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.note-item-title {
    font-weight: 600;
    font-size: 1rem;
    word-break: break-word;
}

.note-item-preview {
    font-size: 0.875rem;
    color: #555;
    flex: 1;
    overflow: hidden;
    word-break: break-word;
    white-space: pre-wrap;
}

.note-item-date {
    font-size: 0.75rem;
    color: #999;
    margin-top: auto;
}

#noteContent {
    width: 100%;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
}

/* ========================
   Shopping List
   ======================== */
.shopping-container {
    max-width: 800px;
    margin: 0 auto;
}

.shopping-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.shopping-header-actions {
    display: flex;
    gap: 0.5rem;
}

.shopping-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: #fff;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    transition: box-shadow 0.2s, opacity 0.2s;
}

.shopping-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.shopping-item-checkbox {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary-color, #4CAF50);
}

.shopping-item-content {
    flex: 1;
    min-width: 0;
}

.shopping-item-name {
    font-weight: 600;
    font-size: 1rem;
    word-break: break-word;
}

.shopping-item-quantity {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.1rem;
}

.shopping-item.completed .shopping-item-name {
    text-decoration: line-through;
    color: #aaa;
}

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

@media (max-width: 480px) {
    .shopping-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .shopping-header-actions {
        width: 100%;
    }

    .shopping-header-actions .btn {
        flex: 1;
    }
}
