/* ═══════════════════════════════════════════════════════
   📊 INCOME DASHBOARD — Feature 14.3
   P/L timeline, dividend income, fee analysis, goals
   ═══════════════════════════════════════════════════════ */

/* ── Page Header ── */
.inc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.inc-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    display: flex;
    align-items: center;
    gap: 10px;
}
.inc-title svg { width: 26px; height: 26px; color: #6366f1; }

/* Period Selector */
.inc-period-select {
    display: flex;
    align-items: center;
    gap: 8px;
}
.inc-period-select label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
}
.inc-period-select select {
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 10px;
    color: var(--text-primary, #fff);
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 01.708 0L8 10.293l5.646-5.647a.5.5 0 01.708.708l-6 6a.5.5 0 01-.708 0l-6-6a.5.5 0 010-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.inc-period-select select:focus { border-color: rgba(99,102,241,0.5); }

/* ── Summary Cards ── */
.inc-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.inc-card {
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
    border-radius: 14px;
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}
.inc-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--accent, #6366f1);
}
.inc-card:hover { border-color: rgba(148,163,184,0.15); }
.inc-card.accent-green::before  { background: #22c55e; }
.inc-card.accent-red::before    { background: #ef4444; }
.inc-card.accent-blue::before   { background: #3b82f6; }
.inc-card.accent-purple::before { background: #a855f7; }
.inc-card.accent-amber::before  { background: #f59e0b; }
.inc-card.accent-indigo::before { background: #6366f1; }
.inc-card .card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted, #94a3b8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.inc-card .card-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary, #fff);
    line-height: 1.2;
}
.inc-card .card-value.positive { color: #22c55e; }
.inc-card .card-value.negative { color: #ef4444; }
.inc-card .card-sub {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-top: 4px;
}

/* ── Tab Bar ── */
.inc-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-elevated, #1e293b);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 20px;
    overflow-x: auto;
}
.inc-tab {
    flex: 1;
    min-width: 80px;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted, #94a3b8);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}
.inc-tab:hover {
    color: var(--text-primary, #fff);
    background: rgba(255,255,255,0.05);
}
.inc-tab.active {
    background: rgba(99,102,241,0.15);
    color: #818cf8;
}

/* ── Panels ── */
.inc-panel { display: none; }
.inc-panel.active {
    display: block;
    animation: incFadeIn 0.25s ease;
}
@keyframes incFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Chart Container ── */
.inc-chart-card {
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}
.inc-chart-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #fff);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.inc-chart-title svg { width: 20px; height: 20px; }
.inc-chart-container {
    position: relative;
    height: 280px;
    background: rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 12px;
}
.inc-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* View toggle row (Daily / Weekly / Monthly) */
.inc-view-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}
.inc-view-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color, rgba(148,163,184,0.15));
    background: transparent;
    color: var(--text-muted, #94a3b8);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.inc-view-btn:hover {
    color: var(--text-primary, #fff);
    border-color: rgba(255,255,255,0.2);
}
.inc-view-btn.active {
    background: rgba(99,102,241,0.15);
    color: #818cf8;
    border-color: rgba(99,102,241,0.3);
}

/* ── Breakdown List (dividend, fee items) ── */
.inc-list { display: flex; flex-direction: column; gap: 10px; }
.inc-list-card {
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: border-color 0.2s;
}
.inc-list-card:hover { border-color: rgba(99,102,241,0.2); }
.inc-list-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}
.inc-list-icon.green { background: rgba(34,197,94,0.1); color: #22c55e; }
.inc-list-icon.amber { background: rgba(245,158,11,0.1); color: #f59e0b; }
.inc-list-icon.red   { background: rgba(239,68,68,0.1); color: #ef4444; }
.inc-list-icon.blue  { background: rgba(59,130,246,0.1); color: #3b82f6; }
.inc-list-info { flex: 1; min-width: 0; }
.inc-list-info .title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #fff);
}
.inc-list-info .detail {
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
}
.inc-list-value {
    text-align: right;
    flex-shrink: 0;
}
.inc-list-value .amount {
    font-size: 14px;
    font-weight: 700;
}
.inc-list-value .amount.positive { color: #22c55e; }
.inc-list-value .amount.negative { color: #ef4444; }
.inc-list-value .sub {
    font-size: 11px;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
}

/* ── Goals Section ── */
.inc-goal-card {
    background: var(--bg-elevated, #1e293b);
    border: 1px solid var(--border-color, rgba(255,255,255,0.06));
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
}
.inc-goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.inc-goal-header .goal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #fff);
}
.inc-goal-header .goal-pct {
    font-size: 18px;
    font-weight: 800;
    color: #818cf8;
}
.inc-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 12px;
}
.inc-progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
    background: linear-gradient(90deg, #6366f1, #818cf8);
}
.inc-progress-fill.green { background: linear-gradient(90deg, #22c55e, #4ade80); }
.inc-progress-fill.amber { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.inc-goal-detail {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
}

/* Breakdown Donut section */
.inc-breakdown-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    align-items: center;
}
.inc-donut-container {
    position: relative;
    width: 200px;
    height: 200px;
}
.inc-donut-container canvas {
    width: 100% !important;
    height: 100% !important;
}
.inc-breakdown-legend {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.inc-legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.inc-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
    flex-shrink: 0;
}
.inc-legend-label {
    font-size: 13px;
    color: var(--text-muted, #94a3b8);
    flex: 1;
}
.inc-legend-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary, #fff);
}

/* ── Info Banner ── */
.inc-info-banner {
    background: rgba(99,102,241,0.08);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted, #94a3b8);
    line-height: 1.5;
}
.inc-info-banner svg { flex-shrink: 0; width: 18px; height: 18px; color: #818cf8; margin-top: 1px; }

/* ── Empty / Loading ── */
.inc-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted, #94a3b8);
}
.inc-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.inc-empty-text { font-size: 15px; font-weight: 600; color: var(--text-primary, #fff); margin-bottom: 6px; }
.inc-empty-sub { font-size: 13px; }
.inc-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #94a3b8);
    font-size: 14px;
}
.inc-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(99,102,241,0.2);
    border-top-color: #6366f1;
    border-radius: 50%;
    margin: 0 auto 12px;
    animation: incSpin 0.8s linear infinite;
}
@keyframes incSpin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 600px) {
    .inc-summary { grid-template-columns: repeat(2, 1fr); }
    .inc-card { padding: 12px 10px; }
    .inc-card .card-value { font-size: 16px; }
    .inc-tab { min-width: 70px; padding: 8px 8px; font-size: 12px; }
    .inc-chart-container { height: 220px; }
    .inc-header { flex-direction: column; align-items: flex-start; }
    .inc-breakdown-row { grid-template-columns: 1fr; justify-items: center; }
    .inc-donut-container { width: 180px; height: 180px; }
}
