/* ============= NET WORTH CARD ============= */
.nw-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
    color: white; position: relative; overflow: hidden;
}
.nw-card::after {
    content: ''; position: absolute; top: -40px; right: -40px;
    width: 140px; height: 140px; border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.nw-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.nw-label { font-size: 12px; opacity: 0.8; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.nw-value { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
.eye-btn { background: rgba(255,255,255,0.15); border: none; color: white; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.eye-btn:hover { background: rgba(255,255,255,0.25); }
.nw-row { display: flex; gap: 12px; margin-bottom: 16px; }
.nw-stat { flex: 1; }
.nw-stat-label { display: block; font-size: 11px; opacity: 0.75; margin-bottom: 4px; }
.nw-stat-val { font-size: 16px; font-weight: 700; }
.nw-stat-val.green { color: #6ee7b7; }
.nw-stat-val.red { color: #fca5a5; }
.nw-divider { width: 1px; background: rgba(255,255,255,0.2); }
.cf-row { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.1); border-radius: var(--radius-xs); padding: 10px 12px; }
.cf-item { flex: 1; text-align: center; }
.cf-label { display: block; font-size: 10px; opacity: 0.75; margin-bottom: 2px; text-transform: uppercase; }
.cf-val { font-size: 13px; font-weight: 700; }
.cf-val.green { color: #6ee7b7; }
.cf-val.red { color: #fca5a5; }
.cf-arrow { color: rgba(255,255,255,0.5); font-size: 10px; }

/* ============= QUICK ACTIONS ============= */
.fin-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.fin-action-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 14px 8px; background: var(--card-bg); border: none;
    border-radius: var(--radius-sm); box-shadow: var(--shadow);
    cursor: pointer; color: var(--text); font-size: 11px; font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s;
}
.fin-action-btn i { font-size: 18px; color: var(--primary); }
.fin-action-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.fin-action-btn:active { transform: scale(0.95); }

/* ============= ALGO CARDS ============= */
.algo-card {
    background: var(--card-bg); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.algo-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.algo-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.algo-title { font-size: 14px; font-weight: 700; }
.algo-sub { font-size: 11px; color: var(--text-muted); }
.algo-badge {
    margin-left: auto; padding: 4px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 700; background: var(--bg); color: var(--text-secondary);
    white-space: nowrap;
}
.algo-badge.green { background: var(--green-light); color: var(--green); }
.algo-badge.orange { background: var(--orange-light); color: var(--orange); }
.algo-badge.red { background: var(--red-light); color: var(--red); }
.algo-insight { font-size: 12px; color: var(--text-muted); margin-top: 12px; padding: 10px; background: var(--bg); border-radius: var(--radius-xs); line-height: 1.5; }

/* ── 50/30/20 Budget ── */
.budget-bars { display: flex; flex-direction: column; gap: 10px; }
.budget-row { display: flex; align-items: center; gap: 10px; }
.budget-row-label { font-size: 12px; font-weight: 600; width: 100px; display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.bdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.budget-track { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.budget-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; max-width: 100%; }
.budget-pct { font-size: 12px; font-weight: 700; width: 36px; text-align: right; flex-shrink: 0; }

/* ── FIRE ── */
.fire-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.fire-stat { background: var(--bg); border-radius: var(--radius-xs); padding: 10px 12px; }
.fire-stat-val { font-size: 16px; font-weight: 800; color: var(--text); }
.fire-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.fire-progress-wrap { margin-top: 4px; }
.fire-progress-track { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.fire-progress-fill { height: 100%; background: linear-gradient(90deg, var(--green), #34d399); border-radius: 4px; transition: width 0.6s ease; }
.fire-progress-label { font-size: 11px; color: var(--text-muted); text-align: right; }

/* ── Emergency Fund ── */
.ef-track-wrap { margin-bottom: 12px; }
.ef-track { position: relative; height: 12px; background: var(--border); border-radius: 6px; overflow: visible; margin-bottom: 4px; }
.ef-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--orange), #fbbf24); transition: width 0.6s ease; max-width: 100%; }
.ef-marker { position: absolute; top: -3px; width: 2px; height: 18px; background: var(--text-muted); border-radius: 1px; transform: translateX(-50%); }
.ef-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); }
.ef-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ef-stat { background: var(--bg); border-radius: var(--radius-xs); padding: 8px 10px; }
.ef-stat-label { font-size: 10px; color: var(--text-muted); display: block; margin-bottom: 2px; }
.ef-stat-val { font-size: 13px; font-weight: 700; }

/* ── Debt Strategy ── */
.strategy-toggle { margin-left: auto; display: flex; gap: 4px; }
.strat-btn { padding: 5px 10px; border: 1px solid var(--border); border-radius: 6px; background: transparent; font-size: 11px; font-weight: 600; cursor: pointer; color: var(--text-secondary); }
.strat-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.debt-payoff-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.debt-payoff-item:last-child { border-bottom: none; }
.debt-payoff-rank { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: white; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.debt-payoff-info { flex: 1; }
.debt-payoff-name { font-size: 13px; font-weight: 600; }
.debt-payoff-meta { font-size: 11px; color: var(--text-muted); }
.debt-payoff-amount { font-size: 14px; font-weight: 700; color: var(--red); }

/* ── Spending Breakdown ── */
.spending-item { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.spending-cat { font-size: 12px; font-weight: 600; width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spending-bar-wrap { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.spending-bar-fill { height: 100%; border-radius: 4px; background: var(--purple); transition: width 0.5s ease; }
.spending-amount { font-size: 12px; font-weight: 700; width: 70px; text-align: right; flex-shrink: 0; }

/* ============= SECTION HEADERS ============= */
.fin-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; background: var(--card-bg); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); margin-bottom: 4px; cursor: pointer;
}
.fin-section-left { display: flex; align-items: center; gap: 10px; flex: 1; }
.fin-section-icon { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.fin-section-left > span { font-size: 14px; font-weight: 700; }
.fin-count { background: var(--primary-light); color: var(--primary); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.fin-chevron { color: var(--text-muted); font-size: 12px; transition: transform 0.3s; }
.debt-summary-inline { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
.debt-summary-inline .red { color: var(--red); font-size: 12px; font-weight: 700; }
.debt-summary-inline .green { color: var(--green); font-size: 12px; font-weight: 700; }
.see-all-link { font-size: 13px; color: var(--primary); font-weight: 600; text-decoration: none; }

/* ============= LISTS ============= */
#accounts-list, #income-sources-list, #borrowed-list, #lent-list { padding: 4px 0 8px; }
.account-item, .income-item, .debt-item-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: var(--bg); border-radius: var(--radius-xs); margin-bottom: 6px;
}
.account-info, .income-info, .debt-info { flex: 1; }
.account-name, .income-name, .debt-person { font-weight: 600; font-size: 14px; }
.account-type-tag, .income-freq { font-size: 11px; color: var(--text-muted); }
.account-balance { font-size: 14px; font-weight: 700; color: var(--primary); }
.income-amount { font-size: 13px; font-weight: 700; color: var(--green); }
.debt-amount-display { font-size: 13px; font-weight: 700; }
.delete-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 6px; border-radius: 50%; }
.delete-btn:hover { background: var(--red-light); color: var(--red); }

/* ============= TRANSACTIONS ============= */
.no-transactions { text-align: center; padding: 32px 16px; color: var(--text-muted); }
.no-transactions i { font-size: 36px; margin-bottom: 10px; color: var(--border); display: block; }
.add-transaction-btn {
    margin-top: 12px; padding: 10px 20px; background: var(--primary); color: white;
    border: none; border-radius: var(--radius-xs); font-size: 13px; font-weight: 600; cursor: pointer;
}
.transaction-item-card {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: var(--card-bg); border-radius: var(--radius-xs);
    margin-bottom: 6px; box-shadow: var(--shadow);
}
.txn-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.txn-icon.income { background: var(--green-light); color: var(--green); }
.txn-icon.expense { background: var(--red-light); color: var(--red); }
.transaction-details { flex: 1; }
.transaction-category { font-weight: 600; font-size: 14px; }
.transaction-meta { font-size: 11px; color: var(--text-muted); }
.transaction-amount-income { font-weight: 700; color: var(--green); font-size: 14px; }
.transaction-amount-expense { font-weight: 700; color: var(--red); font-size: 14px; }

/* ============= FILTER BAR ============= */
.filter-bar {
    display: flex; gap: 10px; margin-bottom: 14px; padding: 12px;
    background: var(--card-bg); border-radius: var(--radius-sm);
}
.filter-bar select, .filter-bar input {
    flex: 1; padding: 9px 12px; border: 1px solid var(--border);
    border-radius: var(--radius-xs); background: var(--bg); color: var(--text); font-size: 13px;
}

/* ============= ADD SCREENS ============= */
.quick-add-label { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.4px; }
.quick-add-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
.quick-add-item {
    padding: 14px; background: var(--card-bg); border-radius: var(--radius-sm);
    box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
}
.quick-add-item:active { transform: scale(0.95); }
.qa-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 13px; }
.quick-add-item span { font-size: 12px; font-weight: 600; }
.quick-add-item small { font-size: 10px; color: var(--text-muted); }
.divider { display: flex; align-items: center; margin: 16px 0; color: var(--text-muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.divider span { padding: 0 12px; }
.finance-quick-grid { display: contents; }

/* ============= SLIDE-UP PANELS ============= */
.panel-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 400;
    backdrop-filter: blur(2px);
}
.panel-backdrop.active { display: block; }

.slide-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--card-bg);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
    z-index: 500;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32,0.72,0,1);
    max-height: 92vh;
    overflow-y: auto;
}
.slide-panel.open { transform: translateY(0); }

@media (min-width: 600px) {
    .slide-panel { max-width: 520px; left: 50%; transform: translateX(-50%) translateY(100%); border-radius: 20px 20px 0 0; }
    .slide-panel.open { transform: translateX(-50%) translateY(0); }
}

.panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--card-bg); z-index: 1;
}
/* drag handle */
.panel-header::before {
    content: '';
    position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
    width: 36px; height: 4px; border-radius: 2px; background: var(--border);
}
.panel-title { font-size: 16px; font-weight: 700; }
.panel-close { background: var(--bg); border: none; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; color: var(--text-secondary); font-size: 14px; display: flex; align-items: center; justify-content: center; }
.panel-body { padding: 16px 20px 32px; }
.panel-submit-btn {
    width: 100%; padding: 14px; background: var(--primary); color: white;
    border: none; border-radius: var(--radius-xs); font-size: 15px; font-weight: 700;
    cursor: pointer; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.panel-submit-btn:hover { background: var(--primary-dark); }

/* ── Transaction type toggle ── */
.txn-type-toggle { display: flex; gap: 6px; margin-bottom: 16px; background: var(--bg); padding: 4px; border-radius: var(--radius-xs); }
.txn-type-btn {
    flex: 1; padding: 9px 6px; border: none; background: transparent;
    border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer;
    color: var(--text-secondary); display: flex; align-items: center; justify-content: center; gap: 5px;
}
.txn-type-btn.active { background: var(--primary); color: white; }

/* ── Quick amount buttons ── */
.quick-amounts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.quick-amounts button {
    padding: 5px 12px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text);
}
.quick-amounts button:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

/* ── Category grid ── */
.cat-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cat-btn {
    padding: 7px 12px; background: var(--bg); border: 1.5px solid var(--border);
    border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text);
    white-space: nowrap;
}
.cat-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Debt type toggle ── */
#debt-btn-borrowed.active { background: var(--red); }
#debt-btn-lent.active { background: var(--green); }

/* ============= DAILY FINANCE TASKS ============= */
.fin-task-templates { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.fin-task-template {
    padding: 6px 12px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 20px; font-size: 12px; cursor: pointer; color: var(--text);
}
.fin-task-template:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.fin-task-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; background: var(--bg); border-radius: var(--radius-xs);
    margin-bottom: 6px;
}
.fin-task-item input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; }
.fin-task-info { flex: 1; }
.fin-task-name { font-size: 13px; font-weight: 600; }
.fin-task-name.done { text-decoration: line-through; color: var(--text-muted); }
.fin-task-meta { font-size: 11px; color: var(--text-muted); }
.fin-task-priority { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fin-task-priority.high { background: var(--red); }
.fin-task-priority.medium { background: var(--orange); }
.fin-task-priority.low { background: var(--green); }

/* ── FIRE Plan inputs ── */
.fire-inputs { margin-bottom: 14px; }
.fire-input-row { display: flex; gap: 10px; margin-bottom: 10px; }
.fire-input-group { flex: 1; }
.fire-input-group label { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.fire-input-group input {
    width: 100%; padding: 9px 12px;
    border: 1.5px solid var(--border); border-radius: var(--radius-xs);
    background: var(--bg); color: var(--text); font-size: 14px; font-weight: 600;
    outline: none; transition: border-color 0.2s;
}
.fire-input-group input:focus { border-color: var(--primary); background: var(--card-bg); }
.fire-autofill-btn {
    width: 100%; padding: 9px; margin-top: 4px;
    background: var(--primary-light); color: var(--primary);
    border: 1.5px dashed var(--primary); border-radius: var(--radius-xs);
    font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.fire-autofill-btn:hover { background: var(--primary); color: white; }
