/* ===== CSS Variables ===== */
:root {
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --bg-hover: #f0f2f5;
    --text: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --accent: #6366f1;
    --accent-light: #eef2ff;
    --accent-hover: #4f46e5;
    --green: #10b981;
    --green-light: #ecfdf5;
    --red: #ef4444;
    --red-light: #fef2f2;
    --orange: #f59e0b;
    --orange-light: #fffbeb;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    --blue: #3b82f6;
    --blue-light: #eff6ff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.1);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* ===== Animations ===== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes bounceIn { 0% { transform: scale(0); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes fadeOut { to { opacity: 0; transform: translateX(30px); } }

.animate-in { animation: fadeInUp 0.5s ease-out both; }

/* ===== FIXED HEADER ===== */
.fixed-header {
    flex-shrink: 0;
    background: var(--bg);
    padding: 0 16px;
    z-index: 50;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 4px;
    gap: 8px;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.header-logo svg { animation: bounceIn 0.6s ease-out; flex-shrink: 0; }

.header-title {
    font-size: 16px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.settings-btn {
    width: 36px;
    height: 36px;
    background: var(--bg-card) !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

/* ===== Unified Date Navigation Bar ===== */
.date-nav {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 4px;
    overflow: hidden;
}

.date-nav-arrow {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.date-nav-arrow:active { background: var(--bg-hover); }

.date-nav-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 8px;
    background: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    gap: 0;
}
.date-nav-center:active { background: var(--bg-hover); }

.date-nav-day {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1.1;
}

.date-nav-monthyear {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* Sync status bar */
.sync-status {
    text-align: center;
    font-size: 11px;
    padding: 0;
    transition: all 0.3s ease;
    min-height: 0;
}
.sync-status:not(:empty) { padding: 2px 0; min-height: 14px; }
.sync-info { color: var(--text-muted); }
.sync-success { color: var(--green); }
.sync-error { color: var(--red); }

/* ===== SCROLLABLE CONTENT AREA ===== */
.content-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 16px;
}

/* ===== Buttons ===== */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 10px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--accent); }
.icon-btn:active { transform: scale(0.9); }

/* ===== BOTTOM TABS ===== */
.bottom-tabs {
    flex-shrink: 0;
    display: flex;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 50;
}

.bottom-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    transition: var(--transition);
}

.bottom-tab svg { width: 22px; height: 22px; transition: var(--transition); }
.bottom-tab:active { transform: scale(0.95); }
.bottom-tab.active { color: var(--accent); font-weight: 600; }
.bottom-tab.active svg { transform: scale(1.1); }

/* ===== Tab Content ===== */
.tab-content { display: none; animation: fadeIn 0.3s ease-out; }
.tab-content.active { display: block; }

/* ===== Summary Cards ===== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.summary-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px 8px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.summary-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    opacity: 0;
    transition: var(--transition);
}
.summary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.summary-card:hover::before { opacity: 1; }

.summary-icon { margin-bottom: 4px; }

.summary-value {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    word-break: break-all;
}

.summary-label {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===== Finance Balance Card (big) ===== */
.balance-card-big {
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-md);
    margin-bottom: 10px;
    color: #fff;
    position: relative;
}

.balance-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.balance-card-title {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balance-card-big .edit-balance-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: #fff;
    transition: var(--transition);
}
.balance-card-big .edit-balance-btn:hover { background: rgba(255,255,255,0.35); }

.balance-amounts {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.balance-amount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
}

.balance-amount-row.main {
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    margin-bottom: 2px;
}

.balance-currency-label {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.7;
}

.balance-amount {
    font-size: 16px;
    font-weight: 700;
}

.balance-amount-row.main .balance-amount {
    font-size: 24px;
    font-weight: 800;
}

.balance-amount-row.main .balance-currency-label {
    font-size: 14px;
    opacity: 0.85;
}

/* ===== Finance Summary Row (income/expense) ===== */
.finance-summary-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.finance-summary-item {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 10px;
}

.finance-summary-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.finance-summary-icon.income { background: var(--green-light); color: var(--green); }
.finance-summary-icon.expense { background: var(--red-light); color: var(--red); }

.finance-summary-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.finance-summary-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

/* ===== Finance Analytics ===== */
.finance-analytics {
    margin-bottom: 12px;
}

.analytics-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
}

.analytics-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.analytics-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.analytics-bar-label {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analytics-bar-track {
    flex: 1;
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}

.analytics-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.analytics-bar-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    min-width: 55px;
    text-align: right;
}

.analytics-tip {
    padding: 10px 12px;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--accent);
    margin-top: 6px;
    line-height: 1.4;
}

.analytics-comparison {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.analytics-comparison-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.analytics-comparison-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.analytics-comparison-value {
    font-size: 15px;
    font-weight: 700;
}

/* ===== Main Buttons ===== */
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
    margin-bottom: 12px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4); }
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1.5px solid var(--border);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.btn-success {
    background: linear-gradient(135deg, var(--green), #059669);
    color: white; border: none;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    flex: 1;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
.btn-success:hover { transform: translateY(-1px); }

.btn-danger {
    background: linear-gradient(135deg, var(--red), #dc2626);
    color: white; border: none;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    flex: 1;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { transform: translateY(-1px); }

.btn-warning {
    background: linear-gradient(135deg, var(--orange), #d97706);
    color: white; border: none;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    flex: 1;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}
.btn-warning:hover { transform: translateY(-1px); }

.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }

/* ===== Finance & Calorie Actions ===== */
.finance-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.calorie-actions { display: flex; gap: 10px; margin-bottom: 12px; }
.calorie-actions .btn-primary { margin-bottom: 0; flex: 2; }
.calorie-actions .btn-secondary { flex: 1; white-space: nowrap; }

/* ===== Currency Display ===== */
.currency-display { text-align: center; margin-bottom: 10px; }

.currency-rate {
    display: inline-block;
    padding: 5px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    font-size: 11px;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    font-weight: 500;
}

/* ===== Entries List ===== */
.entries-list { display: flex; flex-direction: column; gap: 8px; }

.entry-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    animation: fadeInUp 0.3s ease-out both;
    position: relative;
    overflow: hidden;
}
.entry-card:hover { box-shadow: var(--shadow-md); }

.entry-card .entry-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.entry-card .entry-type { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.entry-card .entry-type-icon { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.entry-card .entry-type-name { font-weight: 600; font-size: 13px; }
.entry-card .entry-date { font-size: 11px; color: var(--text-muted); }
.entry-card .entry-details { display: flex; gap: 8px; font-size: 11px; color: var(--text-secondary); margin-top: 3px; flex-wrap: wrap; }
.entry-card .entry-detail { display: flex; align-items: center; gap: 3px; }
.entry-card .entry-calories { font-weight: 700; color: var(--orange); font-size: 13px; }
.entry-card .entry-comment { font-size: 11px; color: var(--text-muted); margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border-light); font-style: italic; }
.entry-card .entry-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.entry-card .delete-btn { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: 6px; transition: var(--transition); }
.entry-card .delete-btn:hover { color: var(--red); background: var(--red-light); }

/* Entry type colors */
.entry-type-icon.swimming { background: var(--blue-light); color: var(--blue); }
.entry-type-icon.pushups { background: var(--red-light); color: var(--red); }
.entry-type-icon.tennis { background: var(--green-light); color: var(--green); }
.entry-type-icon.walking { background: var(--purple-light); color: var(--purple); }
.entry-type-icon.abs { background: var(--orange-light); color: var(--orange); }
.entry-type-icon.fatburn { background: var(--red-light); color: var(--red); }
.entry-type-icon.income { background: var(--green-light); color: var(--green); }
.entry-type-icon.expense { background: var(--red-light); color: var(--red); }
.entry-type-icon.debt { background: var(--orange-light); color: var(--orange); }
.entry-type-icon.weight-icon { background: var(--accent-light); color: var(--accent); }
.entry-type-icon.calorie-icon { background: var(--orange-light); color: var(--orange); }

/* Finance amount colors */
.amount-positive { color: var(--green) !important; font-weight: 700; }
.amount-negative { color: var(--red) !important; font-weight: 700; }
.amount-warning { color: var(--orange) !important; font-weight: 700; }

/* ===== Calorie Dashboard ===== */
.calorie-dashboard {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px 14px;
    box-shadow: var(--shadow-md);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 14px;
    animation: fadeInUp 0.5s ease-out;
}

.calorie-ring-container { position: relative; flex-shrink: 0; width: 120px; height: 120px; }
.calorie-ring-container canvas { width: 120px; height: 120px; }

.calorie-ring-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}
.calorie-remaining { display: block; font-size: 22px; font-weight: 800; color: var(--text); line-height: 1; }
.calorie-remaining-label { display: block; font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.calorie-stats { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.calorie-stat { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }
.calorie-stat:not(:last-child) { border-bottom: 1px solid var(--border-light); }
.calorie-stat.net { padding-top: 5px; border-top: 2px solid var(--border); }
.calorie-stat-label { font-size: 12px; color: var(--text-secondary); }
.calorie-stat-value { font-size: 14px; font-weight: 700; }

/* ===== Chart ===== */
.chart-container { background: var(--bg-card); border-radius: var(--radius-lg); padding: 12px; box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.finance-chart-container { background: var(--bg-card); border-radius: var(--radius-lg); padding: 12px; box-shadow: var(--shadow-sm); margin-bottom: 12px; }

/* ===== MODAL (outside #app, full screen overlay) ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 10px;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 1;
}

.modal-header h3 {
    font-size: 17px;
    font-weight: 700;
}

.modal-close {
    background: var(--bg-hover);
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    color: var(--text-secondary);
    transition: var(--transition);
    flex-shrink: 0;
}
.modal-close:hover { background: var(--red-light); color: var(--red); }

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

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 10px 20px 16px;
    border-top: 1px solid var(--border-light);
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
}
.modal-footer .btn-secondary { flex: 1; }
.modal-footer .btn-primary { flex: 2; margin-bottom: 0; }

/* ===== Form Elements ===== */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; }

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    color: var(--text);
    background: var(--bg);
    transition: var(--transition);
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.form-group textarea { resize: vertical; min-height: 44px; }
.form-group select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}

.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* Workout type selector */
.workout-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 12px; }

.workout-type-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 10px 4px;
    background: var(--bg); border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer; transition: var(--transition);
    font-size: 10px; font-weight: 500; color: var(--text-secondary);
}
.workout-type-btn:hover { border-color: var(--accent); background: var(--accent-light); }
.workout-type-btn.selected { border-color: var(--accent); background: var(--accent-light); color: var(--accent); font-weight: 600; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }
.workout-type-btn svg { width: 24px; height: 24px; }

/* Debt type badges */
.debt-type-selector { display: flex; gap: 8px; margin-bottom: 12px; }
.debt-type-btn {
    flex: 1; padding: 10px;
    border: 2px solid var(--border); border-radius: var(--radius-md);
    background: var(--bg); cursor: pointer; text-align: center;
    font-size: 13px; font-weight: 500; transition: var(--transition); color: var(--text-secondary);
}
.debt-type-btn.selected { border-color: var(--orange); background: var(--orange-light); color: var(--orange); }

/* ===== Toast ===== */
.toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 16px; background: var(--bg-card); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500; animation: slideInRight 0.3s ease-out; display: flex; align-items: center; gap: 6px; max-width: 320px; }
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.fade-out { animation: fadeOut 0.3s ease-out forwards; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 24px 16px; color: var(--text-muted); }
.empty-state svg { margin-bottom: 8px; opacity: 0.4; }
.empty-state p { font-size: 13px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== iOS Safe Areas ===== */
@supports (padding: env(safe-area-inset-top)) {
    .fixed-header { padding-top: env(safe-area-inset-top); }
    #app {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    .bottom-tabs { padding-bottom: env(safe-area-inset-bottom); }
    .modal-footer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
    .toast-container { top: calc(20px + env(safe-area-inset-top)); }
}

/* iOS standalone mode */
@media (display-mode: standalone) {
    body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior-y: contain; }
    input, textarea, select { -webkit-user-select: text; user-select: text; }
}

/* ===== Settings items ===== */
.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
}
.settings-item:last-child { border-bottom: none; }
.settings-item-left { display: flex; align-items: center; gap: 12px; }
.settings-item-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.settings-item-label { font-size: 14px; font-weight: 500; }
.settings-item-desc { font-size: 12px; color: var(--text-muted); }
.settings-item-arrow { color: var(--text-muted); }

/* ===== Donut chart legend ===== */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    padding: 8px 0 0;
}
.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}
.chart-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ===== Financial Goals ===== */
.finance-goals {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.goal-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.goal-card:hover { box-shadow: var(--shadow-md); }

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

.goal-info {
    flex: 1;
    min-width: 0;
}

.goal-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
}

.goal-where {
    font-size: 11px;
    color: var(--text-muted);
}

.goal-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}

.goal-add-btn {
    background: var(--green-light);
    border: none;
    cursor: pointer;
    color: var(--green);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    transition: var(--transition);
}
.goal-add-btn:hover { background: var(--green); color: #fff; }

.goal-progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border-light);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 6px;
}

.goal-progress-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    transition: width 0.5s ease;
}

.goal-progress-fill.complete {
    background: linear-gradient(90deg, var(--green), #059669);
}

.goal-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.goal-amount {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.goal-percent {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
}

.goal-percent.complete {
    color: var(--green);
}

/* ===== Sync code input ===== */
.sync-code-input {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 12px 0;
}
.sync-code-input input {
    width: 42px;
    height: 50px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    transition: var(--transition);
}
.sync-code-input input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    outline: none;
}
