/* ============================================================================
   TERMINAL DESIGN SYSTEM - CSS Variables
   ============================================================================ */
:root {
  /* Terminal Colors */
  --t-bg-base: #0a0e1a;
  --t-bg-elevated: #0f1419;
  --t-bg-panel: #151a23;
  --t-border-base: rgba(255, 255, 255, 0.08);
  --t-border-hover: rgba(255, 255, 255, 0.15);
  --t-text-primary: #e5e7eb;
  --t-text-secondary: #9ca3af;
  --t-text-muted: #6b7280;

  /* Accents */
  --t-accent-green: #10b981;
  --t-accent-red: #ef4444;
  --t-accent-blue: #3b82f6;
  --t-accent-cyan: #06b6d4;
  --t-accent-purple: #a78bfa;
  --t-accent-amber: #f59e0b;

  /* Typography */
  --t-font-number: 'Space Grotesk', monospace;
  --t-font-text: 'Inter', sans-serif;
  --t-size-hero: 3.5rem;
  --t-size-metric: 1.5rem;
  --t-size-label: 0.875rem;
  --t-size-tiny: 0.75rem;

  /* Spacing */
  --t-space-xs: 4px;
  --t-space-sm: 8px;
  --t-space-md: 16px;
  --t-space-lg: 24px;
  --t-space-xl: 32px;
  --t-space-2xl: 48px;

  /* Shadows & Effects */
  --t-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --t-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --t-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --t-shadow-xl: 0 12px 48px rgba(0, 0, 0, 0.6);
  --t-radius-sm: 8px;
  --t-radius-md: 12px;
  --t-radius-lg: 16px;

  /* Transitions */
  --t-transition-fast: 150ms ease;
  --t-transition-base: 250ms ease;
  --t-transition-slow: 350ms ease;
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Account for any fixed header when jumping to sections */
:target {
    scroll-margin-top: 100px;
}

/* Highlight targeted section briefly */
:target {
    animation: highlight-target 2s ease;
}

@keyframes highlight-target {
    0% {
        background-color: rgba(102, 126, 234, 0.1);
    }
    100% {
        background-color: transparent;
    }
}

/* === Dashboard New (dashboardNew.php) === */
body.dashboard-new {
    background: radial-gradient(circle at 15% 20%, rgba(99, 102, 241, 0.2), transparent 30%),
                radial-gradient(circle at 80% 0%, rgba(16, 185, 129, 0.15), transparent 30%),
                radial-gradient(circle at 50% 100%, rgba(14, 165, 233, 0.15), transparent 35%),
                #0b1222;
    color: #e2e8f0;
}

.dash-spotlight {
    position: relative;
    margin: 8px 0 28px;
    border-radius: 22px;
    padding: 26px;
    background:
        radial-gradient(140% 140% at 10% 0%, rgba(79, 70, 229, 0.35), transparent 45%),
        radial-gradient(120% 120% at 90% 10%, rgba(16, 185, 129, 0.32), transparent 45%),
        linear-gradient(125deg, #0b1222 0%, #0f172a 40%, #0b1222 75%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 30px 70px rgba(5, 10, 25, 0.55);
    color: #e2e8f0;
    overflow: hidden;
}

.dash-spotlight-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 20px;
}

.dash-spotlight-left h1 {
    font-family: 'Space Grotesk', var(--font-family);
    color: #f8fafc;
    margin: 8px 0 14px 0;
    font-size: 2rem;
}

.dash-hero-networth {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.dash-eyebrow {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #cbd5e1;
}

.dash-label {
    display: block;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    color: #cbd5e1;
    text-transform: uppercase;
}

.dash-sub {
    display: block;
    font-size: 0.95rem;
    color: #475569;
}

.dash-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.dash-value.light {
    color: #e2e8f0;
}

.dash-change {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5f5;
}

.dash-change.positive { color: #c3ffdd; }
.dash-change.negative { color: #ffd7d5; }
.dash-change.neutral { color: #cbd5f5; }

.dash-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.dash-chip {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    font-size: 0.95rem;
}

.dash-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.dash-spotlight-right {
    display: grid;
    gap: 12px;
}

.dash-hero-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.35);
    color: #e2e8f0;
}

.dash-hero-card.neon {
    background: linear-gradient(155deg, rgba(255,255,255,0.16), rgba(255,255,255,0.05));
    box-shadow: 0 25px 60px rgba(14, 165, 233, 0.38);
}

.dash-hero-card.neon.secondary {
    background: linear-gradient(165deg, rgba(255,255,255,0.1), rgba(255,255,255,0.03));
    box-shadow: 0 25px 60px rgba(99, 102, 241, 0.35);
}

.dash-hero-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.dash-note {
    display: block;
    font-size: 0.95rem;
    color: #cbd5e1;
}

.neon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.dash-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.dash-card.glass {
    background: linear-gradient(145deg, rgba(255,255,255,0.96), rgba(255,255,255,0.9));
    border: 1px solid #e2e8f0;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.18);
}

.dash-card-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.focus-list {
    margin-top: 12px;
    display: grid;
    gap: 10px;
}

.focus-item {
    padding: 12px 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    color: #0f172a;
    font-weight: 600;
    display: flex;
    gap: 8px;
    align-items: center;
}

.focus-item .badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(14, 165, 233, 0.25);
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.stat-row.tight {
    gap: 10px;
}

.stat-block {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    background: #f8fafc;
}

.stat-block.soft {
    background: linear-gradient(150deg, #f8fafc, #eef2ff);
}

.stat-block.highlight {
    background: #ecfdf3;
    border-color: #bbf7d0;
}

.stat-block.soft {
    background: linear-gradient(150deg, #f8fafc, #eef2ff);
}

.stat-block .dash-value {
    color: #0f172a;
}

.dash-card .dash-note {
    margin-top: 8px;
}

.dash-hero-right .dash-note,
.dash-hero-right .dash-value,
.dash-hero-right .dash-sub {
    color: #e2e8f0;
}

.dash-meta-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin: 14px 0 8px;
}

.metric-chip {
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.metric-chip .chip-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #cbd5e1;
}

.metric-chip .chip-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: #f8fafc;
}

.metric-chip.success {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.12);
}

.metric-chip.warning {
    border-color: rgba(234, 179, 8, 0.35);
    background: rgba(234, 179, 8, 0.12);
}

.pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    color: #e2e8f0;
}

.pill.ghost {
    border-color: rgba(255, 255, 255, 0.15);
    color: #cbd5e1;
}

@media (max-width: 900px) {
    .dash-spotlight-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .dash-hero-networth {
        flex-direction: column;
        align-items: flex-start;
    }
}


/* Main Dashboard Content Area */
.dashboard-main {
    padding-top: 40px; /* Space below sticky header */
    padding-bottom: 60px;
    min-height: calc(100vh - var(--header-height) - 70px); /* Header height + footer height approx */
}

.top-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}

.flow-card .insight-line {
    margin-top: 12px;
}

.dashboard-main h1 { /* General h1 within dashboard */
    margin-bottom: 20px; 
    font-size: 2rem; /* Default, specific titles might override */
}
.dashboard-title { /* Specific for "Your 365 Holistic Financial Guide" */
    font-size: 1.8rem; 
    margin-bottom: 8px;
    color: var(--text-color-dark);
}
.dashboard-subtitle {
    font-size: 1rem;
    color: var(--text-light-color);
    margin-bottom: 18px;
}

.dashboard-hero {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(140% 140% at 12% 0%, rgba(14, 165, 233, 0.28), transparent 42%),
        radial-gradient(120% 120% at 86% 8%, rgba(34, 197, 94, 0.22), transparent 42%),
        linear-gradient(120deg, #0f172a 0%, #0b1a2a 45%, #0f172a 90%);
    color: #f8fafc;
    padding: 30px;
    border-radius: 18px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 20px 50px rgba(8, 15, 30, 0.45);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    align-items: start;
}

.hero-primary h2,
.hero-value,
.signal-card-value {
    font-family: 'Space Grotesk', var(--font-family);
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.75rem;
    color: #cbd5f5;
}

.hero-metric {
    margin-top: 16px;
}

.hero-label {
    display: block;
    font-size: 0.95em;
    opacity: 0.92;
    margin-bottom: 8px;
    color: #e2e8f0;
}

.hero-value-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: baseline;
}

.hero-value {
    display: block;
    font-size: 2.6em;
    font-weight: 700;
    line-height: 1.05;
}

.hero-change {
    font-size: 1.05em;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5f5;
}

.hero-change.positive { color: #c3ffdd; }
.hero-change.negative { color: #ffd7d5; }

.hero-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: #e2e8f0;
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 0.9em;
}

.hero-actions {
    display: grid;
    gap: 12px;
}

.quick-action-card {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    padding: 18px;
    border-radius: 12px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(8px);
}

.action-icon {
    font-size: 2em;
}

.quick-action-card h3 {
    margin: 0 0 4px 0;
    font-size: 1.05em;
    color: #f8fafc;
}

.quick-action-card p {
    margin: 0 0 8px 0;
    font-size: 0.9em;
    color: #d8e5ff;
}

.btn-link {
    color: #a5f3fc;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9em;
}

.btn-link:hover {
    text-decoration: underline;
}

.hero-signal-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.hero-signal {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.28);
}

.hero-signal .signal-label {
    display: block;
    font-size: 0.85em;
    color: #cbd5f5;
    margin-bottom: 6px;
}

.hero-signal .signal-value {
    display: block;
    font-size: 1.3em;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.2;
}

.hero-signal .signal-note {
    display: block;
    font-size: 0.85em;
    color: #d8e5ff;
    margin-top: 4px;
}

.hero-signal.warning {
    border-color: rgba(255, 193, 7, 0.6);
}

@media (max-width: 768px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-hero {
        padding: 20px;
    }
}

.signal-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.signal-card {
    background: linear-gradient(145deg, #ffffff 0%, #f5f7fb 100%);
    border: 1px solid #e3e8ef;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.signal-card.signal-positive {
    border-color: #c7f9cc;
}

.signal-card.signal-warning {
    border-color: #ffe7a3;
}

.signal-card.signal-neutral {
    border-color: #a5f3fc;
}

.signal-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #0f172a;
}

.signal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #0ea5e9);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.signal-card-label {
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
}

.signal-card-value {
    font-size: 1.8em;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.signal-card-note {
    font-size: 0.95em;
    color: #4b5563;
    margin: 6px 0 10px 0;
}

.signal-link {
    color: #0ea5e9;
    font-weight: 600;
    font-size: 0.95em;
}

.signal-link:hover {
    text-decoration: underline;
}

.score-components-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.component-chip {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    white-space: nowrap;
}

.component-chip.metric-positive {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.component-chip.metric-negative {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.component-chip.metric-neutral {
    background: #fff8e1;
    border-color: #ffc107;
    color: #f57f17;
}

.score-insight-box {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    padding: 16px;
    margin: 16px 0;
    border-radius: 4px;
}

.score-insight-box strong {
    color: #667eea;
}

.score-insight-box p {
    margin: 8px 0 0 0;
}

.btn-toggle-details {
    width: 100%;
    padding: 12px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    color: #667eea;
    font-weight: 500;
    transition: all 0.2s;
    margin-top: 16px;
}

.btn-toggle-details:hover {
    background: #667eea;
    color: white;
}

.health-details {
    margin-top: 24px;
    animation: slideDown 0.3s ease;
}

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

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

.component-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.component-bar-fill {
    height: 100%;
    background: #667eea;
    transition: width 0.3s ease;
}

.component-bar-fill.metric-positive {
    background: #4caf50;
}

.component-bar-fill.metric-negative {
    background: #f44336;
}

.component-bar-fill.metric-neutral {
    background: #ffc107;
}

/* Fix FI table overflow */
.fi-section {
    overflow-x: auto;
    margin: 0 -16px;
    padding: 0 16px;
}

.fi-timeline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    min-width: 600px; /* Allows horizontal scroll on mobile */
}

.fi-timeline-table thead th {
    background: #f5f5f5;
    padding: 12px 8px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.fi-timeline-table tbody td {
    padding: 12px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.fi-timeline-table tbody tr:hover {
    background: #f9f9f9;
}

.fi-timeline-table tbody tr.timeline-achieved {
    background: #e8f5e9;
}

.fi-timeline-table tbody tr.timeline-achieved td {
    color: #2e7d32;
}

.fi-timeline-note {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-top: 2px;
}

.fi-timeline-age {
    display: block;
    font-size: 0.85em;
    color: #666;
    font-style: italic;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .fi-timeline-table {
        font-size: 0.85em;
    }
    
    .fi-timeline-table thead th,
    .fi-timeline-table tbody td {
        padding: 8px 6px;
    }
}

/* Ensure parent card allows scrolling */
.fi-card {
    overflow: visible;
}

.fi-section-grid {
    display: grid;
    gap: 24px;
    margin: 24px 0;
}

@media (min-width: 992px) {
    .fi-section-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -16px 16px -16px;
    padding: 0 16px;
}

.table-scroll-wrapper::-webkit-scrollbar {
    height: 8px;
}

.table-scroll-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #555;
}


/* Basic App Footer */
.app-footer {
    text-align: center;
    padding: 20px 0;
    background-color: var(--t-bg-panel);
    border-top: 1px solid var(--t-border-base);
    font-size: 0.9rem;
    color: var(--t-text-secondary);
}

.app-footer a {
    color: var(--t-accent-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

.app-footer a:hover {
    color: var(--t-text-primary);
}

/* Responsive adjustments for app header (example) */
@media (max-width: 768px) {
    .app-nav {
        display: none; /* Simple hide for now, full mobile menu later if needed */
    }
    .app-header .header-container {
        justify-content: space-between;
    }
     .user-menu .user-name-display {
        display: none; /* Hide name on small screens if too cluttered */
    }
    .score-component {
        grid-template-columns: 1fr;
    }
    .score-component .component-note {
        grid-column: 1;
    }
    .score-display .score-value {
        font-size: 2.4rem;
    }
    .debt-summary-grid {
        grid-template-columns: 1fr;
    }
    .debt-timeline-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .spending-summary-grid {
        grid-template-columns: 1fr;
    }
    .spending-trends-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}


/* Alert Messages */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 0.9rem;
}
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

/* Card style for main content sections */
.card-style {
    background-color: var(--bg-color-card); 
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.07); 
    margin-bottom: 30px;
}
.card-style h2 {
    font-size: 1.4rem;
    margin-bottom: 20px;
}

/* Financial Health Score */
.financial-health-card .card-header {
    align-items: center;
    justify-content: space-between;
}
.score-pill {
    display: inline-flex;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.score-display {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 12px;
}
.score-display .score-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-color-dark);
}
.score-display .score-out-of {
    font-size: 1rem;
    color: var(--text-light-color);
}
.score-progress {
    margin-bottom: 16px;
}
.score-progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.06);
    overflow: hidden;
}
.score-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: inherit;
    transition: width 0.4s ease;
}
.score-context {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-light-color);
}
.score-focus {
    background: rgba(255, 232, 184, 0.4);
    border-left: 4px solid var(--accent-color);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.95rem;
    margin-bottom: 16px;
}
.score-component-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}
.score-component {
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 10px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1.4fr 1fr 0.8fr;
    gap: 12px;
    background: rgba(255,255,255,0.6);
}
.score-component .component-label {
    font-weight: 600;
    color: var(--text-color-dark);
}
.score-component .component-score {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--text-color-dark);
}
.score-component .component-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light-color);
}
.score-component .component-note {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    color: var(--text-light-color);
}
.score-pill.metric-positive { background: #e5f6ed; color: #1b7f3b; }
.score-pill.metric-neutral { background: #fff4e5; color: #ad6800; }
.score-pill.metric-negative { background: #fdecea; color: #c62828; }
.score-pill.metric-neutral.metric-negative { color: #c62828; } /* fallback */
.score-pill.metric-neutral.metric-positive { color: #1b7f3b; }

/* Smart Actions */
.smart-actions-card .card-header {
    margin-bottom: 12px;
}
.smart-actions-card .card-subtitle {
    font-size: 0.9rem;
    color: var(--text-light-color);
}
.action-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.action-rank {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-light-color);
    margin-bottom: 6px;
}
.action-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 6px;
}
.action-detail {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-color);
}
.severity-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
    text-transform: uppercase;
}
.severity-critical .severity-pill { background: #c0392b; }
.severity-important .severity-pill { background: #f39c12; color: #1c1c1c; }
.severity-optimization .severity-pill { background: var(--primary-color); }

.completed-strip {
    margin-top: 18px;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding-top: 12px;
}
.completed-strip h4 {
    font-size: 0.95rem;
    margin-bottom: 8px;
}
.completed-strip ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-light-color);
}

/* Enhanced Smart Actions */
.action-list.enhanced {
    padding-left: 0;
    list-style: none;
}

.action-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: start;
    padding: 20px;
    margin-bottom: 16px;
    border-radius: 8px;
    background: white;
    border: 1px solid #e0e0e0;
    transition: all 0.3s;
}

.action-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.action-checkbox {
    padding-top: 4px;
}

.action-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
}

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

.action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.action-item.completed {
    opacity: 0.6;
    background: #f5f5f5;
}

.action-item.completed .action-title {
    text-decoration: line-through;
    color: #999;
}

.action-resources {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.resource-link {
    font-size: 0.9em;
    color: #667eea;
    text-decoration: none;
    padding: 6px 12px;
    background: #f0f4ff;
    border-radius: 4px;
    transition: all 0.2s;
    border: 1px solid #e0e9ff;
    white-space: nowrap;
}

.resource-link:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
}

.empty-state-positive {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border-radius: 8px;
}

.empty-icon {
    font-size: 3em;
    display: block;
    margin-bottom: 16px;
}

.empty-state-positive p {
    margin: 8px 0;
    color: #666;
}

.empty-state-positive strong {
    color: #333;
}

/* Toast notifications */
.toast-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    max-width: 350px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-notification::before {
    content: '';
    font-size: 1.2em;
}

.toast-notification.show {
    transform: translateX(0);
}

.toast-success { 
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
}

.toast-success::before { content: '✓'; }

.toast-error { 
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
}

.toast-error::before { content: '✕'; }

.toast-info { 
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
}

.toast-info::before { content: 'ℹ'; }

@media (max-width: 768px) {
    .action-item {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .action-checkbox {
        padding-top: 0;
    }
    
    .toast-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Retirement Card */
.retirement-card .card-header {
    align-items: center;
    justify-content: space-between;
}
.retirement-card .status-badge {
    text-transform: uppercase;
}
.retirement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 16px;
}
.retirement-metric .metric-label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light-color);
}
.retirement-metric .metric-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-color-dark);
}
.retirement-metric .metric-note {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-light-color);
}
.retirement-footnotes {
    font-size: 0.9rem;
    color: var(--text-color);
    background: rgba(0,0,0,0.03);
    padding: 12px 14px;
    border-radius: 10px;
}

/* Debt Timeline */
.debt-timeline-card .card-header {
    align-items: center;
    justify-content: space-between;
}
.debt-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.debt-summary-metric .metric-label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light-color);
}
.debt-summary-metric .metric-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color-dark);
}
.debt-timeline-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}
.debt-timeline-table th,
.debt-timeline-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    font-size: 0.9rem;
}
.debt-timeline-table th {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-light-color);
    background: rgba(0,0,0,0.03);
}
.debt-timeline-table tr.metric-positive {
    background: rgba(46, 204, 113, 0.08);
}
.debt-timeline-table tr.metric-negative {
    background: rgba(231, 76, 60, 0.08);
}
.debt-timeline-table tr.metric-neutral {
    background: rgba(255, 206, 86, 0.08);
}
.debt-footnotes {
    font-size: 0.85rem;
    color: var(--text-light-color);
    background: rgba(0,0,0,0.03);
    padding: 12px 14px;
    border-radius: 10px;
}

/* Spending Trends */
.spending-trends-card .card-header {
    align-items: center;
    justify-content: space-between;
}
.spending-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.spending-summary-metric .metric-label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light-color);
}
.spending-summary-metric .metric-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color-dark);
}
.spending-summary-metric .metric-value.negative {
    color: #c0392b;
}
.spending-summary-metric .metric-value.positive {
    color: #1b7f3b;
}
.spending-trends-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}
.spending-trends-table th,
.spending-trends-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    font-size: 0.9rem;
}
.spending-trends-table th {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-light-color);
    background: rgba(0,0,0,0.03);
}
.spending-trends-table tr.alert {
    background: rgba(231, 76, 60, 0.08);
}
.spending-trends-table tr.positive {
    background: rgba(46, 204, 113, 0.08);
}
.spending-trends-table tr.neutral {
    background: rgba(255, 206, 86, 0.08);
}
.trend-chip {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-left: 6px;
}
.trend-chip.alert { background: #c0392b; color: #fff; }
.trend-chip.positive { background: #1b7f3b; color: #fff; }
.trend-chip.neutral { background: #f1c40f; color: #1c1c1c; }
.spending-footnotes {
    font-size: 0.85rem;
    color: var(--text-light-color);
    background: rgba(0,0,0,0.03);
    padding: 12px 14px;
    border-radius: 10px;
}

/* Dashboard notice styling */
.dashboard-notice {
    margin: 1rem 0;
}

.dashboard-notice .card-style {
    background: #fffbf0;
}

.dashboard-notice h4 {
    font-size: 1.1rem;
    font-weight: 600;
}

.dashboard-notice p {
    color: #333;
}

/* Onboarding Section Styles */
.onboarding-section {
    /* background-color: #fff;  Re-evaluate if this should be different from default card-style */
    padding: 30px;
    /* border-radius: 12px; */ /* from card-style */
    /* box-shadow: 0 5px 15px rgba(0,0,0,0.07); */ /* from card-style */
    margin-bottom: 40px;
    text-align: center;
}
.onboarding-section h2 {
    font-size: 1.6rem;
    margin-bottom: 10px;
    color: var(--text-color);
}
.onboarding-section > p {
    color: var(--text-light-color);
    margin-bottom: 30px;
    font-size: 1rem;
}
.onboarding-steps {
    display: flex;
    flex-direction: column;
    gap: 20px; 
}
.onboarding-step {
    border: 1px solid var(--border-color);
    padding: 20px 25px; 
    border-radius: 8px;
    text-align: left;
    background-color: #fff; 
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
.onboarding-step .step-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px; 
}
.step-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; 
    height: 28px;
    border-radius: 50%;
    background-color: var(--secondary-color);
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.85rem; 
    margin-right: 10px;
}
.onboarding-step h3 {
    font-size: 1.15rem; 
    margin-bottom: 0;
    color: var(--text-color);
}
.onboarding-step p {
    font-size: 0.9rem;
    color: var(--text-light-color);
    margin-bottom: 15px;
    line-height: 1.5;
}
.onboarding-step .btn {
    font-size: 0.9rem;
    padding: 8px 16px; 
}
.onboarding-step.active-step {
    border-color: var(--primary-color);
    background-color: #f4f8ff; 
    box-shadow: 0 2px 8px rgba(var(--primary-color-rgb, 0, 122, 255), 0.1);
}
.onboarding-step.active-step .step-number-badge {
    background-color: var(--primary-color);
    color: #fff;
}
.onboarding-step.completed {
    background-color: #f9fafb; 
    border-color: #e5e7eb;
}
.onboarding-step.completed .step-number-badge {
    background-color: var(--accent-color); 
    color: #fff;
}
.onboarding-step.completed h3 {
    color: var(--text-color); 
}
.onboarding-step.completed p {
    color: var(--text-light-color);
}
.onboarding-step.completed .inline-svg-icon.ai-check-icon { 
    width: 18px;
    height: 18px;
    stroke: var(--accent-color);
    margin-right: 8px;
    vertical-align: text-bottom;
}
.edit-link {
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: 5px;
}
.onboarding-step.upcoming-step {
    opacity: 0.6;
    background-color: #f9fafb;
}
.onboarding-step.upcoming-step .step-number-badge {
    background-color: #e5e7eb;
    color: #6b7280;
}
.onboarding-step.upcoming-step .btn { 
    background-color: var(--border-color);
    border-color: var(--border-color);
    color: #9ca3af;
    cursor: not-allowed;
    pointer-events: none; 
}
.onboarding-step.upcoming-step h3,
.onboarding-step.upcoming-step p {
    color: #6b7280; 
}

/* SVG Icon for completed check - if not styled globally */
.inline-svg-icon.ai-check-icon {
    /* default stroke/width/height can be here or on the element itself */
}

/* Manual Add Page specific styles */
.manual-add-container {
    max-width: 700px;
    margin: 30px auto;
    padding: 0 15px;
}
.manual-add-container h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1.8rem;
    color: var(--text-color-dark);
}
.manual-add-container > p {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-light-color);
}
.form-section {
    background-color: #fff; 
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 40px;
}
.form-section h2 {
    font-size: 1.5rem;
    color: var(--text-color-dark);
    margin-top: 0;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color-light);
}
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 500; color: var(--text-color); margin-bottom: 8px; font-size: 0.9rem; }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%; padding: 12px 15px; border: 1px solid var(--border-color-dark);
    border-radius: 6px; box-sizing: border-box; font-size: 0.95rem;
    color: var(--text-color); background-color: #fff; 
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb, 0, 122, 255), 0.2);
}
.form-group textarea { min-height: 90px; resize: vertical; }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-light-color); opacity: 0.8; }
.form-group input[type="date"] { position: relative; appearance: none; -webkit-appearance: none; -moz-appearance: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px 25px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-section hr { margin: 25px 0; border: 0; border-top: 1px solid var(--border-color-light); }
.form-section > p { font-size: 0.9em; color: var(--text-light-color); margin-bottom: 20px; }
.form-section .btn-primary { display: inline-block; padding: 12px 25px; font-size: 1rem; }
.manual-add-container > p[style*="text-align: center"] { margin-top: 40px; }
.form-group .input-hint { font-size: 0.8rem; color: var(--text-light-color); margin-top: 4px; display: block; }
.form-group label sup { color: var(--danger-color); font-weight: normal; margin-left: 2px; }

/* Account Management Actions (on connect_accounts.php, could be reused) */
.account-management-actions { margin-top: 40px; }
.account-management-actions h3 { font-size: 1.3rem; margin-bottom: 20px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.action-buttons-container { display: flex; gap: 15px; flex-wrap: wrap; }
.action-buttons-container .btn { flex-grow: 1; text-align: center; }

/* Review Accounts Page Specific Styles */
.review-container { max-width: 1000px; margin: 30px auto; }
.account-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    font-size: 0.9rem;
    table-layout: auto; /* Allow columns to size based on content */
}
.account-table th,
.account-table td {
    padding: 10px 12px; vertical-align: middle; text-align: left;
    border-bottom: 1px solid var(--border-color-light);
    border-left: none; border-right: none;
}
.account-table th:first-child,
.account-table td:first-child { padding-left: 15px; }
.account-table th:last-child,
.account-table td:last-child { padding-right: 15px; }
.account-table thead th {
    background-color: var(--bg-light-section); font-weight: 500;
    font-size: 0.8rem; color: var(--text-light-color); text-transform: uppercase;
    letter-spacing: 0.5px; border-bottom-width: 2px; border-bottom-color: var(--border-color);
}
.account-table tbody tr:last-child td { border-bottom: none; }
.account-table td.editable-cell { padding: 0; }
.account-table input[type="text"].editable-field,
.account-table input[type="number"].editable-field {
    border: 1px solid transparent; background-color: transparent; padding: 10px 12px;
    width: 100%; font-size: inherit; color: inherit; border-radius: 0;
    box-shadow: none; cursor: text; box-sizing: border-box;
}
.account-table input[type="text"].editable-field:hover,
.account-table input[type="number"].editable-field:hover { background-color: #f8f9fa; }
.account-table input[type="text"].editable-field:focus,
.account-table input[type="number"].editable-field:focus {
    border: 1px solid var(--primary-color); background-color: #fff;
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb, 0, 122, 255), 0.1);
}
.account-table td.select-cell {
    padding: 0;
    min-width: 140px; /* Ensure Type column is wide enough for full text */
}
.account-table td.select-cell select {
    border: 1px solid transparent; background-color: transparent; padding: 10px 25px 10px 12px;
    font-size: inherit; color: inherit; border-radius: 4px; cursor: pointer;
    width: 100%; min-width: 140px; box-sizing: border-box; appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235A6470'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 0.8em;
    white-space: nowrap; /* Prevent text from wrapping */
}

/* Redesigned dashboard cards */
.dashboard-summary.card-style {
    margin-top: 10px;
}

.summary-highlight-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 8px;
}

.summary-highlight-list li {
    font-size: 0.95rem;
    color: var(--text-color);
}

.dashboard-grid.redesigned-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-top: 25px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(140deg, #ffffff 0%, #fafbff 70%);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.dashboard-card .metric-grid {
    gap: 14px;
}

.dashboard-card .metric-grid.compact-grid .metric {
    padding: 12px;
}

.metric .metric-value.negative {
    color: var(--danger-color);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.status-badge.status-healthy,
.status-badge.status-strong,
.status-badge.status-excellent,
.status-badge.status-ahead {
    background-color: #e5f6ed;
    color: #1b7f3b;
}

.status-badge.status-attention,
.status-badge.status-thin,
.status-badge.status-behind {
    background-color: #fdecea;
    color: #c62828;
}

.status-badge.status-stable,
.status-badge.status-adequate,
.status-badge.status-on-track {
    background-color: #fff4e5;
    color: #ad6800;
}

.status-badge.status-calculating {
    background-color: #eef2ff;
    color: #4c51bf;
}

.breakdown-list h4 {
    font-size: 0.9rem;
    margin-bottom: 8px;
    text-transform: uppercase;
    color: var(--text-light-color);
    letter-spacing: 0.6px;
}

.breakdown-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
}

.breakdown-list li {
    display: flex;
    justify-content: space-between;
    font-size: 0.92rem;
    color: var(--text-color);
}

.breakdown-list .label {
    font-weight: 500;
}

.breakdown-list .value {
    font-variant-numeric: tabular-nums;
}

.breakdown-list .value.negative {
    color: var(--danger-color);
}

.breakdown-list .empty-state {
    color: var(--text-light-color);
    font-style: italic;
}

.breakdown-list .list-total {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color-light);
    font-weight: 600;
}

.insight-line {
    font-size: 0.9rem;
    color: var(--text-light-color);
    margin: 0;
}

.status-pill-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background-color: #f1f5f9;
    font-size: 0.8rem;
}

.status-pill.status-healthy,
.status-pill.status-strong,
.status-pill.status-excellent {
    background-color: #e5f6ed;
    color: #1b7f3b;
}

.status-pill.status-attention,
.status-pill.status-thin {
    background-color: #fdecea;
    color: #c62828;
}

.status-pill.status-stable,
.status-pill.status-adequate {
    background-color: #fff4e5;
    color: #ad6800;
}

.status-pill.status-calculating {
    background-color: #eef2ff;
    color: #4c51bf;
}

.status-pill .pill-label {
    font-weight: 600;
}

.status-pill .pill-status {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Concentration Card */
.concentration-card .concentration-blurb {
    font-size: 0.95rem;
    color: var(--text-light-color);
    margin-bottom: 12px;
}
.concentration-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}
.concentration-table th,
.concentration-table td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    font-size: 0.9rem;
}
.concentration-table th {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--text-light-color);
    background: rgba(0,0,0,0.03);
}
.concentration-table tr.metric-negative {
    background: rgba(231, 76, 60, 0.08);
}
.concentration-table tr.metric-neutral {
    background: rgba(255, 159, 67, 0.08);
}
.concentration-advice {
    font-size: 0.85rem;
    color: var(--text-light-color);
}
.concentration-advice a {
    color: var(--primary-color);
    text-decoration: underline;
}

@media (max-width: 768px) {
    .dashboard-grid.redesigned-grid {
        grid-template-columns: 1fr;
    }
}
.account-table select:hover { border-color: var(--border-color-dark); }
.account-table select:focus { border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb, 0, 122, 255), 0.1); }
.account-table .action-cell { text-align: right; white-space: nowrap; }
.account-table .action-buttons-wrapper { display: inline-flex; align-items: center; gap: 8px; }
.account-table .action-buttons-wrapper form { margin: 0; }
.account-table th.checkbox-col, 
.account-table td.checkbox-cell { text-align: center; width: 80px; vertical-align: middle; }
.account-table input[type="checkbox"] { transform: scale(1.2); cursor: pointer; vertical-align: middle; margin: 0 auto;}
.btn-save-changes { background-color: var(--primary-color); color: #fff; border: 1px solid var(--primary-color); }
.btn-save-changes:hover { background-color: var(--primary-color-dark); border-color: var(--primary-color-dark); color: #fff; }
.btn-mark-liability, .btn-mark-asset {
    background-color: #fff; border: 1px solid var(--border-color-dark); color: var(--text-light-color);
}
.btn-mark-liability:hover, .btn-mark-asset:hover {
    border-color: var(--text-color); color: var(--text-color); background-color: var(--bg-light-section);
}
.btn.btn-primary.btn-small.btn-save-changes { color: #fff; }

/* Connect Accounts Page Specific Styles */
.connect-accounts-container { max-width: 700px; margin: 40px auto; }
.connect-instructions { margin-bottom: 30px; padding: 20px; background-color: var(--bg-light-section); border-radius: 8px; }
.connect-instructions h3 { font-size: 1.3rem; margin-bottom: 10px; }
.connect-instructions ol { margin-left: 20px; margin-bottom: 15px; }
.connect-instructions ol li { margin-bottom: 8px; }
.simplefin-link { font-weight: 600; }
.token-form .form-group { margin-bottom: 15px; }
.token-form textarea { width: 100%; min-height: 100px; padding: 10px; border-radius: 6px; border: 1px solid var(--border-color); font-family: monospace; font-size: 0.9rem; }
.token-form textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb, 0, 122, 255), 0.2); }
.connected-accounts-list { margin-top: 40px; }
.connected-accounts-list h3 { font-size: 1.3rem; margin-bottom: 15px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;}
.account-item { padding: 20px; margin-bottom: 20px; }
.account-info span { font-size: 0.9rem; color: var(--text-light-color); display: block; margin-top: 4px; }
.account-info strong { display: block; font-weight: 600; color: var(--text-color-dark); margin-bottom: 8px; font-size:1.2rem; }
.status-active { color: var(--accent-color); font-weight: 500; }
.status-error { color: var(--danger-color); font-weight: 500; }
.account-info span small { font-size: 0.8em; line-height: 1.3; }
.sync-options-form { margin-top: 10px; }
.sync-form-row { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; margin-bottom: 10px; }
.form-group-inline { display: flex; align-items: center; gap: 8px; flex-grow: 1; flex-shrink: 1; }
.form-group-inline label { font-size: 0.9rem; font-weight: 500; margin-bottom: 0; white-space: nowrap; }
.form-group-inline select {
    padding: 8px 12px; border-radius: 6px; border: 1px solid var(--border-color-dark);
    font-size: 0.9rem; flex-grow: 1; min-width: 180px; max-width: 300px;
}
.sync-options-form .btn-sync-submit { font-size: 0.9rem; padding: 8px 18px; flex-shrink: 0; }
.custom-dates-fields { display: none; gap: 15px; margin-top: 10px; padding-left: 0; flex-wrap: wrap; }
.custom-dates-fields.visible { display: flex; }
.custom-dates-fields .form-group { display: flex; align-items: center; gap: 8px; margin-bottom: 0; flex-basis: 200px; flex-grow: 1; }
.custom-dates-fields .form-group label { font-size: 0.9rem; margin-bottom:0; white-space: nowrap; }
.custom-dates-fields .form-group input[type="date"] {
    padding: 8px 10px; border-radius: 6px; border: 1px solid var(--border-color-dark);
    font-size: 0.9rem; width: auto; flex-grow: 1;
}

/* Dashboard Account Sync Section Styles */
.account-sync-section { margin-top: 30px; margin-bottom: 30px; }
.account-sync-section > p { color: var(--text-light-color); margin-bottom:20px; } /* Paragraph under h2 */
.connected-accounts-list-dashboard .account-item-dashboard {
    background-color: #fff; 
    border: 1px solid var(--border-color-light, #e9ecef);
    border-radius: var(--border-radius-medium, 8px);
    padding: 15px 20px; 
    margin-bottom: 15px; 
    box-shadow: var(--shadow-soft, 0 1px 3px rgba(0,0,0,0.04));
}
.account-item-dashboard .account-info strong { 
    font-size: 1.05em; 
    color: var(--text-color-dark); 
    display: block; 
    margin-bottom: 6px; 
}
.account-item-dashboard .account-info span { 
    font-size: 0.88em; 
    color: var(--text-light-color); 
    display: block; 
    margin-bottom: 3px; 
}
.account-item-dashboard .account-info span .status-active { color: var(--success-color, green); font-weight: bold; }
.account-item-dashboard .account-info span .status-error { color: var(--danger-color, red); font-weight: bold; }
.account-item-dashboard .account-actions { margin-top:15px; } /* From PHP, now in CSS */
.account-item-dashboard .sync-form-row { 
    display: flex; 
    align-items: flex-end; 
    gap: 10px; 
    flex-wrap: wrap; 
    margin-top: 12px; /* From PHP, now in CSS */
}
.account-item-dashboard .form-group-inline { flex-grow: 1; min-width: 200px; }
.account-item-dashboard .form-group-inline label,
.account-item-dashboard .custom-dates-fields .form-group label { 
    display: block; margin-bottom: 4px; font-size: 0.85em; 
    color: var(--text-medium-color); font-weight: 500;
}
.account-item-dashboard select.form-control-small, 
.account-item-dashboard input[type="date"].form-control-small {
    padding: 6px 8px; border-radius: var(--border-radius-small, 4px); 
    border: 1px solid var(--border-color-light, #ccc); 
    font-size: 0.9em; width: 100%; box-sizing: border-box;
    background-color: #fff;
}
.account-item-dashboard .btn-sync-submit.btn-small { 
    padding: 7px 12px; font-size: 0.85em; 
    align-self: flex-end; height: 34px; line-height: 1.5;
}
.account-item-dashboard .custom-dates-fields { 
    display: none; margin-top: 10px; gap: 10px; 
    flex-wrap: wrap; 
}
.account-item-dashboard .custom-dates-fields.visible { display: flex; }
.account-item-dashboard .custom-dates-fields .form-group { flex: 1; min-width: 130px; }
.account-sync-section .btn-secondary.btn-small { /* For "Manage All Connections" button */
    /* Add specific styling if needed, or rely on general .btn-secondary and .btn-small */
}


/* Loading Overlay Styles */
#loading-overlay {
    display: none; 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.75); /* Darker overlay */
    z-index: 10000; 
    flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
}
.loading-spinner {
    border: 5px solid #f3f3f3; 
    border-top: 5px solid var(--primary-color); 
    border-radius: 50%;
    width: 40px; height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}
.loading-text {
    margin-top: 15px; /* Adjusted from 20px */
    font-size: 1.05em; /* Adjusted from 1.1em */
    font-weight: 500;
    color: #fff; /* White text on dark overlay */
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Dashboard Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}
.overview-card .card-header { display: flex; align-items: center; margin-bottom: 15px; }
.overview-card .card-icon { width: 24px; height: 24px; margin-right: 12px; }
.overview-card .card-header h3 { font-size: 1rem; font-weight: 500; color: var(--text-light-color); margin-bottom: 0; }
.overview-card .card-header h3 small { font-size: 0.8em; font-weight: 400; }
.overview-card .card-value { font-size: 2.2rem; font-weight: 700; color: var(--text-color-dark); margin-bottom: 5px; line-height: 1.2; }
.overview-card .card-trend { font-size: 0.85rem; font-weight: 500; }
.overview-card .card-trend.positive { color: var(--accent-color); }
.overview-card .card-trend.negative { color: var(--danger-color); }
.overview-card .card-trend.neutral { color: var(--text-light-color); }
.overview-card .net-worth-change {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.9rem;
    color: var(--text-light-color);
}
.overview-card .net-worth-change .change-value { font-weight: 600; }
.overview-card .net-worth-change.positive-change .change-value { color: #2ecc71; }
.overview-card .net-worth-change.negative-change .change-value { color: #e74c3c; }
.card-style .card-callout {
    margin-top: 12px;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
}
.card-style .card-callout.warning { background: rgba(231, 76, 60, 0.15); color: #e74c3c; }
.card-style .card-callout.success { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.card-style .card-callout.neutral { background: rgba(255, 255, 255, 0.08); color: var(--text-light-color); }
.card-style .card-detail-toggle {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--primary-color);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}
.card-style .card-detail-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
.card-style .card-details {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.card-style .card-details.open {
    display: block;
}
.card-details-note {
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-light-color);
}
.card-style .card-details-table-wrapper {
    max-height: 220px;
    overflow-y: auto;
}
.card-style .card-details-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.card-style .card-details-table th,
.card-style .card-details-table td {
    text-align: left;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.card-style .card-details-table th:first-child,
.card-style .card-details-table td:first-child {
    padding-left: 0;
}
.card-style .card-details-table td:not(:first-child),
.card-style .card-details-table th:not(:first-child) {
    text-align: right;
}
.card-style .card-details-table td:last-child,
.card-style .card-details-table th:last-child {
    padding-right: 0;
}

.card-style .card-details-table .month-link {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
}

.card-style .card-details-table .month-link:hover,
.card-style .card-details-table .month-link:focus {
    color: var(--primary-color-dark, #0b508c);
}

.card-style .card-details-empty {
    font-size: 0.85rem;
    color: var(--text-light-color);
}

/* Life Goals Section */
.life-goals-section h2 { /* Already defined in card-style h2 */ }
.goals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.goal-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.goal-card h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0; }
.goal-progress-percentage { font-size: 0.9rem; font-weight: 600; color: var(--primary-color); }
.progress-bar-container {
    width: 100%; background-color: var(--border-color-light); 
    border-radius: 4px; height: 8px; overflow: hidden; margin-bottom: 8px;
}
.progress-bar { height: 100%; background-color: var(--primary-color); border-radius: 4px; transition: width 0.5s ease-in-out; }
.goal-target { font-size: 0.85rem; color: var(--text-light-color); margin-bottom: 0; }

/* Dashboard Controls (Date Range Form) */
.dashboard-controls.card-style { padding: 20px; margin-bottom: 30px; }
.date-range-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 15px; }
.date-range-form .form-group { margin-bottom: 0; flex-grow: 1; }
.date-range-form label { font-size: 0.85rem; color: var(--text-light-color); margin-bottom: 5px; display: block; }
.date-range-form input[type="date"] {
    padding: 8px 10px; border: 1px solid var(--border-color-dark);
    border-radius: 4px; font-size: 0.9rem; width: 100%; box-sizing: border-box;
}
.date-range-form button.btn-small { padding: 8px 15px; align-self: flex-end; }

/* AI Guidance Promo Section */
.ai-guidance-promo-section.card-style {
    /* Default card-style applies */
}
.ai-guidance-promo-section h2 {
    /* Default card-style h2 applies */
}
.ai-guidance-promo-section p {
    color: var(--text-light-color);
    line-height: 1.6;
    margin-bottom: 15px;
}
.ai-guidance-promo-section p:last-child {
    margin-bottom: 0;
}
.ai-guidance-promo-section .btn-link { /* Assuming .btn-link is defined elsewhere or style it here */
    font-weight: 600;
    /* text-decoration: underline; */ /* From inline style */
    /* color: var(--primary-color); */ /* From inline style */
}


@media (max-width: 600px) { 
    /* General responsive form adjustments for connect_accounts and dashboard sync */
    .sync-options-form, 
    .account-item-dashboard .sync-options-form, /* Target specifically for dashboard */
    .custom-dates-fields.visible,
    .account-item-dashboard .custom-dates-fields.visible { 
        flex-direction: column; 
        align-items: stretch; 
    }
    .sync-options-form select, 
    .sync-options-form input[type="date"], 
    .sync-options-form .btn-primary,
    .account-item-dashboard .sync-options-form select,
    .account-item-dashboard .sync-options-form input[type="date"],
    .account-item-dashboard .sync-options-form .btn-sync-submit { 
        width:100%; 
        margin-bottom:10px; 
        margin-right:0; 
    }
    .form-group-inline,
    .account-item-dashboard .form-group-inline {
        flex-direction: column;
        align-items: stretch; /* Make label and select full width */
    }
    .form-group-inline label,
    .account-item-dashboard .form-group-inline label {
        margin-bottom: 5px; /* Add some space when stacked */
    }
    .sync-form-row,
    .account-item-dashboard .sync-form-row {
        flex-direction: column;
        align-items: stretch;
    }
    .sync-form-row .btn-sync-submit,
    .account-item-dashboard .sync-form-row .btn-sync-submit {
        width: 100%; /* Make button full width */
    }
    
    /* Stack action buttons on connect_accounts.php */
    .action-buttons-container { flex-direction: column; }
    .action-buttons-container .btn { width: 100%; }
}

/* In your CSS file (e.g., dashboard.css or financial_plan.css) */
.plan-form-section .form-grid.align-inputs-bottom .form-group {
    display: flex; /* Use flexbox for the .form-group itself */
    flex-direction: column; /* Stack label above input */
    justify-content: flex-end; /* This will push the input (the last flex item) to the bottom */
}

/* Optional: If the labels themselves have different number of lines and you want them to align at their baseline */
.plan-form-section .form-grid.align-inputs-bottom .form-group label {
    min-height: 3em; /* Adjust this value based on max number of lines for labels in this row * line-height */
                     /* Or use a fixed height if more predictable */
}

.transaction-filters .filter-grid {
    display: grid;
    /* Adjust columns as needed. This creates 3 auto-sized columns for inputs, 
       and 1 column for actions that takes remaining space or auto-sizes.
       You might prefer fixed widths or more fluid columns.
       Example: grid-template-columns: 2fr 1fr 1fr auto; for search, date, date, buttons
    */
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); /* More flexible columns */
    gap: 15px 20px;
    /* align-items: end; */ /* We will control alignment within each .form-group */
}

.transaction-filters .form-group { /* Applies to all .form-group direct children of .filter-grid */
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Pushes label and input/button to the bottom of the cell */
}

.transaction-filters .form-group label {
    font-size: 0.85em;
    color: var(--text-medium-color);
    margin-bottom: 5px; /* Space between label and its input/button */
}

.transaction-filters .form-control {
    padding: 8px 10px;
    font-size: 0.9rem;
    border: 1px solid var(--border-color-dark); /* From your image */
    border-radius: 6px; /* From your image */
    box-sizing: border-box;
    width: 100%; /* Make inputs take full width of their .form-group container */
    line-height: 1.5; /* Helps with consistent height */
    height: 38px; /* Approximate height based on image and common button heights, adjust if needed */
}

.transaction-filters .filter-actions {
    display: flex;
    flex-direction: row; /* Buttons side-by-side */
    align-items: center; /* Center buttons vertically if they have diff text */
    justify-content: flex-start; /* Align buttons to the start of this container */
    gap: 10px;
    margin-top: auto; /* Pushes this group to the bottom if its grid cell is taller */
                     /* This might not be needed if all .form-group have justify-content: flex-end */
}

.transaction-filters .filter-actions .btn {
    padding: 8px 15px; /* Adjust for visual consistency with inputs */
    font-size: 0.9rem;
    line-height: 1.5; 
    height: 38px; /* Match input height */
    box-sizing: border-box;
    display: flex; /* To center text vertically within button if line-height isn't perfect */
    align-items: center;
    justify-content: center;
}

.transaction-filters .btn-primary {
    background-color: #007bff; /* Blue from image */
    border-color: #007bff;
    color: white;
}
.transaction-filters .btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.transaction-filters .btn-secondary {
    background-color: white;
    border-color: #007bff; /* Blue border from image */
    color: #007bff; /* Blue text from image */
}
.transaction-filters .btn-secondary:hover {
    background-color: #e6f2ff; /* Light blue hover */
}


/* Responsive adjustments */
@media (max-width: 992px) { /* Adjust breakpoint as needed */
    .transaction-filters .filter-grid {
        grid-template-columns: 1fr 1fr; /* Two columns for medium screens */
    }
    .transaction-filters .filter-actions {
        grid-column: 1 / -1; /* Make actions span full width */
        justify-content: flex-start; /* Or center/flex-end */
    }
}

@media (max-width: 768px) {
    .transaction-filters .filter-grid {
        grid-template-columns: 1fr; /* Stack all filter elements */
    }
    .transaction-filters .filter-actions {
        flex-direction: column; /* Stack buttons vertically */
        align-items: stretch; /* Make buttons full width when stacked */
    }
    .transaction-filters .filter-actions .btn {
        width: 100%; 
        margin-bottom: 10px; 
    }
    .transaction-filters .filter-actions .btn:last-child {
        margin-bottom: 0;
    }
}

.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
/* START: Replacement for Chart Container CSS */
.chart-container {
    padding: 20px;
    position: relative;
}

/* This is an optional but highly recommended wrapper inside the container */
.chart-canvas-wrapper {
    position: relative;
    width: 100%;
    min-height: 0;
    height: 300px;
}

.chart-container h3 {
    text-align: center;
    margin-bottom: 15px;
    font-weight: 500;
}

.chart-container.full-width-chart {
    grid-column: 1 / -1; /* This makes the item span the full grid width */
}
.card-header.stacked {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.card-header-title .card-icon {
    width: 28px;
    height: 28px;
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-light-color);
    margin: 0;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    width: 100%;
}

.metric {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 12px;
    min-height: 90px;
}

.metric-accent {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.metric-label {
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light-color);
}

.metric-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color-dark);
    margin-top: 6px;
}

.metric-note {
    font-size: 0.8rem;
    margin-top: 4px;
    color: var(--text-light-color);
}

.metric-note.positive {
    color: #2ecc71;
}

.metric-note.negative {
    color: #e74c3c;
}

.metric-note.neutral {
    color: var(--text-light-color);
}

.metric-positive .metric-value {
    color: #2ecc71;
}

.metric-negative .metric-value {
    color: #e74c3c;
}

.metric-neutral .metric-value {
    color: var(--text-color-dark);
}

.card-callout-wrapper {
    margin-top: 12px;
}
/* END: Replacement for Chart Container CSS */
@media (max-width: 900px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
}

/* ================================================================== */
/* Tooltip Styles                                                     */
/* ================================================================== */

.tooltip-icon {
    display: inline-block;
    position: relative; /* This is the key to positioning the tooltip */
    cursor: help; /* Changes the cursor to a question mark on hover */
    margin-left: 5px;
    font-weight: 500;
    color: var(--text-light-color);
    border: 1px solid var(--border-color-light);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    line-height: 16px; /* Adjust to vertically center the icon */
    text-align: center;
    font-size: 0.8em;
    user-select: none; /* Prevents text selection of the icon */
}

/* This is the actual tooltip bubble that appears */
.tooltip-icon::before {
    content: attr(data-tooltip); /* Reads the text from the data-tooltip attribute */
    position: absolute;
    bottom: 125%; /* Positions the tooltip above the icon */
    left: 50%;
    transform: translateX(-50%); /* Centers the tooltip horizontally */

    /* Styling */
    background-color: #333; /* Dark background */
    color: #fff; /* White text */
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.85rem; /* Reset font size for tooltip content */
    font-weight: 400; /* Normal font weight */
    line-height: 1.5;
    white-space: pre-wrap; /* Allows line breaks from your HTML attribute */
    width: 280px; /* Set a max-width for the tooltip */
    text-align: left; /* Align text to the left */

    /* Hide it by default */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    z-index: 10;
}

/* This is the little triangle pointing down */
.tooltip-icon::after {
    content: '';
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%) translateY(100%); /* Position it at the bottom of the bubble */
    border-width: 6px;
    border-style: solid;
    border-color: #333 transparent transparent transparent; /* Creates the triangle effect */

    /* Hide it by default */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    z-index: 10;
}

/* Show the tooltip and triangle on hover */
.tooltip-icon:hover::before,
.tooltip-icon:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ================================================================== */
/* "No Data" Message Styles for Charts                                */
/* ================================================================== */

.no-data-message {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: rgba(248, 249, 250, 0.5); /* A slightly transparent background */
    border-radius: var(--border-radius-medium); /* Match the canvas wrapper if it has one */
}

.no-data-message p {
    font-size: 0.95rem;
    color: var(--text-light-color);
    max-width: 80%;
    line-height: 1.5;
    font-style: italic;
}

/* ==================================================================
   AI Financial Health Check - Modern Styling (Corrected Version)
   ================================================================== */

/* --- Main container for the AI's response --- */
#aiResultContent {
    font-family: 'Inter', sans-serif;
    color: #343a40;
}

/* --- Section Headers (e.g., "1. What You're Doing Well") --- */
#aiResultContent h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color-dark, #2c3e50);
    margin-top: 2.5em;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 2px solid var(--primary-color);
    line-height: 1.3;
}

#aiResultContent h3:first-of-type {
    margin-top: 0;
}

/* --- The main analysis paragraphs --- */
#aiResultContent p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1.2em;
    color: #495057;
}

/* --- Bullet points for UNORDERED lists (ul) ONLY --- */
#aiResultContent ul {
    list-style-type: none;
    padding-left: 0;
    margin-left: 0;
    margin-bottom: 1.5em;
}

/* Apply padding and relative positioning ONLY to items in a <ul> */
#aiResultContent ul li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 1em;
    font-size: 1rem;
    line-height: 1.6;
}

/* Create custom bullet icons ONLY for items in a <ul> */
#aiResultContent ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
}

/* --- Custom Icons for each section's UNORDERED list --- */

/* Green checkmark for the list after the FIRST h3 */
#aiResultContent h3:nth-of-type(1) + ul li::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2328a745' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 12.75L11.25 15L15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z' /%3E%3C/svg%3E");
}

/* Orange lightbulb for the list after the SECOND h3 */
#aiResultContent h3:nth-of-type(2) + ul li::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fd7e14' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 18h6M12 22V18M12 6a6 6 0 014.243 10.243L12 22l-4.243-5.757A6 6 0 0112 6z' /%3E%3Cpath d='M12 6V2' /%3E%3Cpath d='M12 12h.01' /%3E%3C/svg%3E");
}

/* --- For "A Key Question to Ponder" - Now targets the FOURTH h3 --- */
#aiResultContent h3:nth-of-type(4) + p::before {
    content: '❓';
    font-size: 1.5rem;
    margin-right: 10px;
    vertical-align: middle;
}

/* ==================================================================
   Custom Styling for "Recommended Actions" Numbered List (FIXED)
   ================================================================== */

/* Reset the counter once at the section level */
#aiResultContent h3:nth-of-type(3) {
    counter-reset: actions-counter;
}

/* Target ALL <ol> elements that follow the THIRD h3 */
#aiResultContent h3:nth-of-type(3) ~ ol {
    list-style: none !important;
    list-style-type: none !important;
    padding-left: 0;
    /* Don't reset counter here - it's already reset at the h3 level */
}

/* Style ALL li elements within these ol elements */
#aiResultContent h3:nth-of-type(3) ~ ol > li {
    position: relative;
    padding-left: 45px;
    margin-bottom: 2em;
    list-style: none !important;
    list-style-type: none !important;
    counter-increment: actions-counter; /* Increment here first */
}

/* Create the numbered circles */
#aiResultContent h3:nth-of-type(3) ~ ol > li:before {
    content: counter(actions-counter);
    position: absolute;
    left: 0;
    top: -2px;
    width: 30px;
    height: 30px;
    background-color: var(--primary-color-light, #e6f2ff);
    color: var(--primary-color, #007bff);
    border-radius: 50%;
    font-weight: 700;
    font-size: 1rem;
    line-height: 30px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Style the "Strategy:" title */
#aiResultContent h3:nth-of-type(3) ~ ol > li strong:first-child {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color-dark, #2c3e50);
    margin-bottom: 0.5em;
}

/* The description paragraph within the <ol> */
#aiResultContent h3:nth-of-type(3) ~ ol > li p {
    margin-top: 0;
    margin-bottom: 0;
    color: #495057;
}

/* Additional fallback to ensure no default numbers show */
#aiResultContent ol {
    list-style: none !important;
}

#aiResultContent ol li {
    list-style: none !important;
    list-style-type: none !important;
}


/* ================================================================== */
/* Modern Styling for AI Financial Plan Output                        */
/* ================================================================== */

/* --- Main container for the plan --- */
.generated-plan-content {
    font-family: 'Inter', sans-serif;
    color: #495057; /* A softer default text color for paragraphs */
    line-height: 1.7;
}

/* --- Main Plan Title (e.g., # The Dave Family...) --- */
.generated-plan-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-color-dark, #2c3e50);
    margin-top: 0;
    margin-bottom: 1em;
    padding-bottom: 0.4em;
    border-bottom: 3px solid var(--primary-color);
}

/* --- Section Titles (e.g., ## Section 1: Executive Summary) --- */
.generated-plan-content h2 {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-color-dark, #2c3e50);
    margin-top: 2.5em; /* Creates nice spacing between major sections */
    margin-bottom: 1em;
    padding-bottom: 0.4em;
    border-bottom: 1px solid var(--border-color, #ced4da);
}

/* --- Subsection Titles (e.g., ### 2.1 Net Worth Statement) --- */
.generated-plan-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color); /* Use accent color for subsections */
    margin-top: 2em;
    margin-bottom: 1em;
    border-bottom: none; /* Remove default borders if any */
}

/* --- General paragraphs and list items --- */
.generated-plan-content p,
.generated-plan-content li {
    font-size: 1rem;
    line-height: 1.75;
    margin-bottom: 1em;
}

/* --- Styling for bulleted lists --- */
.generated-plan-content ul {
    list-style-type: none; /* Remove default black dots */
    padding-left: 0;
    margin-left: 5px;
}

.generated-plan-content ul li {
    position: relative;
    padding-left: 25px; /* Make space for our custom icon */
    margin-bottom: 0.8em;
}

/* A custom, modern bullet point for lists */
.generated-plan-content ul li::before {
    content: '■'; /* You can use other symbols like •, –, or an SVG icon */
    position: absolute;
    left: 0;
    top: 0px;
    color: var(--primary-color);
    font-size: 0.8em;
    line-height: inherit;
}


/* --- Table Styling (Making it cleaner) --- */
.generated-plan-content table {
    border: none; /* Remove the outer table border */
    box-shadow: none; /* Remove the shadow for a flatter look */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
}

.generated-plan-content thead th {
    background-color: transparent; /* Remove header background */
    font-weight: 600;
    color: var(--text-color-dark);
    border-bottom: 2px solid var(--border-color-dark); /* Stronger bottom border */
    text-align: left;
    padding: 12px 10px;
}

.generated-plan-content td {
    padding: 14px 10px;
    border-bottom: 1px solid var(--border-color-light); /* Only horizontal lines */
    border-top: none;
    border-left: none;
    border-right: none;
}

.generated-plan-content tbody tr:nth-child(even) td {
    background-color: transparent; /* Remove zebra striping for a cleaner look */
}

.generated-plan-content tbody tr:last-child td {
    border-bottom: none; /* No line after the last row */
}

.analysis-history-section {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color-light);
}
.history-list {
    max-width: 600px;
    margin: 0 auto;
}
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s, box-shadow 0.2s;
}
.history-item:hover {
    background-color: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.history-date {
    font-weight: 600;
    color: var(--text-color-dark);
}
.history-period {
    font-size: 0.9em;
    color: var(--text-light-color);
}
.history-arrow {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* --- Custom Chart Legend Styles --- */
.custom-chart-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 5px 20px; /* Vertical and horizontal gap */
    padding: 10px 0;
    margin-bottom: 15px;
    list-style: none;
}

.custom-chart-legend span {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-medium-color);
}

.custom-chart-legend span::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border-radius: 2px;
}

/* ============================================= */
/* == Transaction Analysis Page Specific Styles == */
/* ============================================= */

/* Target the chart container ONLY on the analysis page */
.page-transaction-analysis .chart-container {
    min-height: 520px; /* Give it enough height for the chart and legend */
    display: flex;
    flex-direction: column;
}

/* Make the chart wrapper grow to fill the space */
.page-transaction-analysis .chart-canvas-wrapper {
    flex-grow: 1;
    position: relative; /* Crucial for canvas sizing */
}

/* --- Net Worth Card Breakdown Styles --- */

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

.net-worth-card .card-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-medium-color);
    letter-spacing: 0.5px;
}

.net-worth-card .card-title-link {
    text-decoration: none;
}

.net-worth-card .card-value {
    font-size: 2.5rem; /* Larger font size */
    font-weight: 700;
    color: var(--text-color-dark);
    line-height: 1.1;
    margin-bottom: 20px;
}

.net-worth-card .add-item-btn {
    font-size: 1.2rem;
    line-height: 1;
    padding: 2px 8px;
    border-radius: 6px;
}

.net-worth-breakdown {
    margin-top: auto; /* Pushes the breakdown to the bottom of the card */
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.breakdown-label {
    font-weight: 500;
    color: var(--text-medium-color);
}

.breakdown-value {
    font-weight: 600;
    color: var(--text-color-dark);
}

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

.progress-bar-asset {
    background-color: #27B5AE; /* Teal color */
    height: 100%;
    border-radius: 4px;
}

.progress-bar-liability {
    background-color: #F07E61; /* Orange/Coral color */
    height: 100%;
    border-radius: 4px;
}

/* --- Net Worth Details Trend Chart Styles --- */
.net-worth-trend-section {
    margin-bottom: 25px;
    padding: 20px 25px;
}
.trend-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}
.trend-summary h2 {
    margin: 0 0 5px 0;
    font-size: 1.2rem;
}
.trend-summary span {
    font-size: 0.9rem;
    color: var(--text-medium-color);
}
.trend-filters select {
    padding: 5px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background-color: var(--bg-light-section);
}
.trend-total {
    text-align: right;
}
.trend-total .total-value {
    font-size: 1.5rem;
    font-weight: 600;
}
.trend-total .day-change {
    font-size: 0.9rem;
    color: var(--danger-color);
}

/* --- Change Indicator Colors --- */
.trend-summary span.positive,
.day-change span.positive {
    color: var(--accent-color, #28a745);
    font-weight: 500;
}

.trend-summary span.negative,
.day-change span.negative {
    color: var(--danger-color, #dc3545);
    font-weight: 500;
}

/* ============================================= */
/* == New Responsive Header & Dropdown Styles == */
/* ============================================= */

.app-header {
    background-color: var(--t-bg-panel);
    border-bottom: 1px solid var(--t-border-base);
    padding: 0 20px;
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Main Header Container */
.app-header .header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.app-header .logo img {
    height: 30px;
    margin-right: 8px;
}

/* Navigation Container */
.app-nav {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-item {
    position: relative;
}

.nav-link {
    padding: 10px 15px;
    text-decoration: none;
    color: var(--t-text-secondary);
    font-weight: 500;
    border-radius: 6px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-link:hover,
.nav-item.active .nav-link,
.nav-item .dropdown-item.active { /* Ensure active dropdown items are highlighted */
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--t-accent-blue);
}

/* Dropdown Styles */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    display: flex; /* Helps align text and arrow */
    align-items: center;
}

.nav-item {
    position: relative;
    padding-bottom: 8px; /* <-- ADD THIS. It creates the visual space below the link. */
    margin-bottom: -8px; /* <-- ADD THIS. It pulls the next nav item up to keep spacing even. */
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--t-bg-panel);
    border: 1px solid var(--t-border-base);
    border-radius: 8px;
    box-shadow: var(--t-shadow-md);
    min-width: 200px;
    z-index: 1000;
    margin-top: 0; /* <-- CHANGE THIS to 0. This removes the gap. */
    padding: 5px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-item.dropdown:hover .dropdown-menu,
.user-menu .dropdown:hover .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 10px 20px;
    color: var(--t-text-secondary);
    text-decoration: none;
    white-space: nowrap;
    font-size: 0.9rem; /* Slightly smaller text for dropdown items */
    transition: background-color 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--t-text-primary);
}

/* User Menu Alignment */
.user-menu {
    display: flex;
    align-items: center;
}
.user-menu .dropdown-toggle {
    font-weight: 500;
    color: var(--t-text-primary);
}
.user-menu .dropdown-menu {
    left: auto;
    right: 0; /* Align to the right */
}

/* Hide mobile-only items on desktop */
.mobile-only-nav-item {
    display: none;
}

/* Hamburger Menu Button */
.mobile-menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 8px;
    cursor: pointer;
}
.mobile-menu-toggle .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--text-color-dark);
    margin: 4px 0;
    transition: all 0.2s ease-in-out;
}
/* Hamburger animation */
.mobile-menu-toggle.is-active .icon-bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.mobile-menu-toggle.is-active .icon-bar:nth-child(2) {
    opacity: 0;
}
.mobile-menu-toggle.is-active .icon-bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}


/* --- Mobile Responsive Styles --- */
@media (max-width: 992px) {
    .mobile-menu-toggle {
        display: block; /* Show on mobile */
    }
    .user-menu {
        display: none; /* Hide the entire user menu on desktop, it's handled in the slide-out */
    }
    
    .app-nav {
        display: none; /* Hide the nav by default */
        position: absolute;
        top: 60px; /* Position below the header */
        left: 0;
        right: 0;
        background-color: var(--t-bg-panel);
        border-bottom: 1px solid var(--t-border-base);
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        flex-direction: column;
        align-items: stretch;
        padding: 10px 0;
        z-index: 1000;
        gap: 0;
    }

    .app-nav.is-open {
        display: flex; /* Show the nav when active */
    }

    .nav-item, .dropdown {
        text-align: left; /* Align text left on mobile */
        width: 100%;
        margin-bottom: 0;
        padding-bottom: 0;
        background-color: var(--t-bg-panel);
    }
    .nav-item .nav-link {
        display: block; /* Make links take full width */
        background-color: var(--t-bg-panel);
        color: var(--t-text-primary);
        border-radius: 0;
        padding: 14px 20px;
        border-top: 1px solid var(--t-border-base);
        font-weight: 500;
    }

    .nav-item .nav-link:hover {
        background-color: var(--t-bg-elevated);
        color: var(--t-accent-blue);
    }
    .nav-item:first-child .nav-link {
        border-top: none;
    }

    /* Mobile-only nav items (Profile, Logout) */
    .mobile-only-nav-item {
        display: block !important;
        width: 100%;
        margin: 0;
        padding: 0;
        background-color: var(--t-bg-panel);
    }

    .mobile-only-nav-item .nav-link {
        color: var(--t-text-primary);
        background-color: var(--t-bg-panel);
        font-weight: 500;
        padding: 14px 20px;
        margin: 0;
        box-sizing: border-box;
    }
    .nav-item:first-child .nav-link {
        border-top: none;
    }
    .nav-item.dropdown.is-open > .nav-link {
        background-color: var(--primary-color-light);
        color: var(--primary-color-dark);
    }
    
    .dropdown-menu {
        position: static;
        display: none; /* Dropdowns are closed by default on mobile */
        border: none;
        box-shadow: none;
        background-color: var(--t-bg-elevated);
        min-width: 100%;
        margin-top: 0;
        padding-left: 0;
        padding-bottom: 6px;
    }

    .nav-item.dropdown.is-open .dropdown-menu {
        display: block; /* Show dropdown when active */
    }
    .dropdown-menu .dropdown-item {
        padding: 10px 32px;
        background-color: var(--t-bg-elevated);
        color: var(--t-text-primary);
        border-top: 1px solid var(--t-border-base);
    }
    .dropdown-menu .dropdown-item:first-child {
        border-top: none;
    }
    .dropdown-menu .dropdown-item:hover {
        background-color: var(--t-bg-panel);
        color: var(--t-accent-blue);
    }
    
    /* Show mobile-only items - removed duplicate */
    }
}

/* ============================================= */
/* == AI Co-pilot Floating Widget (Master Style) == */
/* ============================================= */

.copilot-floating-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

/* Toggle Button */
.copilot-toggle-button {
    width: 56px;
    height: 56px;
    border-radius: 28px;
    background: var(--primary-color, #0066FF);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.copilot-toggle-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(0, 102, 255, 0.25);
    background: #0052CC;
}

.copilot-toggle-button:active {
    transform: translateY(0);
}

/* Modern chat icon using CSS */
.copilot-toggle-button::before {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.copilot-toggle-button::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid white;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    bottom: 12px;
    right: 12px;
    transition: all 0.3s ease;
}

.copilot-toggle-button.active::before {
    transform: rotate(45deg);
    border-radius: 2px;
    width: 20px;
    height: 3px;
}

.copilot-toggle-button.active::after {
    width: 20px;
    height: 3px;
    background: white;
    border: none;
    transform: rotate(-45deg);
}

/* Chat Container */
.copilot-floating-container {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 400px;
    height: 600px;
    background: #0A0A0B;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.95) translateY(20px);
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.copilot-floating-container.is-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    visibility: visible;
}

/* Header */
.copilot-floating-header {
    padding: 20px 24px;
    background: #141416;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #2A2A2D;
}

.copilot-floating-header span {
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    letter-spacing: -0.02em;
}

.copilot-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Icon Buttons */
.copilot-icon-button {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: #A0A0A0;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
}

.copilot-icon-button:hover {
    background: #1A1A1D;
    color: #FFFFFF;
}

/* Clear button icon */
.copilot-clear-button::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 0 0 4px 4px;
    border-top: none;
}

.copilot-clear-button::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 2px;
    background: currentColor;
    top: 8px;
}

/* Close button icon */
.copilot-close-button::before,
.copilot-close-button::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.copilot-close-button::before {
    transform: rotate(45deg);
}

.copilot-close-button::after {
    transform: rotate(-45deg);
}

/* Chat History */
.copilot-chat-history {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: #2A2A2D transparent;
}

.copilot-chat-history::-webkit-scrollbar {
    width: 6px;
}

.copilot-chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.copilot-chat-history::-webkit-scrollbar-thumb {
    background: #2A2A2D;
    border-radius: 3px;
}

/* Chat Messages */
.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease-out;
}

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

.chat-message.user {
    align-self: flex-end;
    background: var(--primary-color, #0066FF);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant {
    align-self: flex-start;
    background: #141416;
    color: #FFFFFF;
    border-bottom-left-radius: 4px;
    margin-left: 40px;
    position: relative;
}

/* Assistant Avatar */
.chat-message.assistant::before {
    content: '';
    position: absolute;
    left: -40px;
    top: 0;
    width: 32px;
    height: 32px;
    background: var(--primary-color, #0066FF);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-message.assistant::after {
    content: '';
    position: absolute;
    left: -32px;
    top: 8px;
    width: 16px;
    height: 16px;
    background: white;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'/%3E%3C/svg%3E") center/contain no-repeat;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Typing Indicator */
.chat-message.assistant.typing {
    display: flex;
    align-items: center;
    padding: 16px;
}

.chat-message.assistant.typing span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #A0A0A0;
    border-radius: 50%;
    margin: 0 2px;
    animation: typingBounce 1.4s infinite;
}

.chat-message.assistant.typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-message.assistant.typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Error Messages */
.chat-message.assistant.error {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Form */
.copilot-form {
    padding: 16px 24px 24px;
    background: #141416;
    border-top: 1px solid #2A2A2D;
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.copilot-form textarea {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px;
    background: #0A0A0B;
    color: #FFFFFF;
    border: 1px solid #2A2A2D;
    border-radius: 12px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.copilot-form textarea:focus {
    outline: none;
    border-color: var(--primary-color, #0066FF);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.copilot-form textarea::placeholder {
    color: #A0A0A0;
}

.copilot-form button {
    padding: 12px 20px;
    background: var(--primary-color, #0066FF);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copilot-form button:hover {
    background: #0052CC;
    transform: translateY(-1px);
}

.copilot-form button:active {
    transform: translateY(0);
}

.copilot-form button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Path to Financial Independence */
.fi-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.fi-hero {
    background: var(--panel-bg, #f8f9fb);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.fi-hero-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
    margin: 0 0 0.25rem 0;
}

.fi-hero-metric {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.fi-hero-caption {
    margin: 0.5rem 0 0;
    color: var(--text-muted, #6b7280);
}

.fi-section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.fi-section {
    background: var(--panel-bg, #f8f9fb);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fi-stat-highlight {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.fi-stat-amount {
    font-size: 1.25rem;
    font-weight: 700;
}

.fi-stat-note {
    color: var(--text-muted, #6b7280);
}

.fi-coverage {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.fi-coverage-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--divider, #e5e7eb);
    overflow: hidden;
}

.fi-coverage-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.coverage-excellent { background: var(--success-color, #20c997); }
.coverage-achieved { background: var(--success-color, #20c997); }
.coverage-near { background: var(--warning-color, #f7b731); }
.coverage-pending { background: var(--text-muted, #6b7280); }

.fi-coverage-status {
    font-weight: 600;
}

.fi-progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: var(--divider, #e5e7eb);
    overflow: hidden;
}

.fi-progress-fill {
    height: 100%;
    background: var(--primary-color, #0066ff);
    border-radius: 999px;
    transition: width 0.4s ease;
}

.fi-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted, #6b7280);
}

.fi-progress-gap {
    font-weight: 600;
}

.fi-muted {
    color: var(--text-muted, #6b7280);
    font-style: italic;
}

.fi-accelerators {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fi-accelerators li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--divider, #e5e7eb);
}

.fi-accelerators li:last-child {
    border-bottom: none;
}

.fi-accelerator-icon {
    font-weight: 700;
}

.fi-accelerator-label {
    flex: 1;
    color: var(--text-muted, #6b7280);
}

.fi-timeline-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.fi-timeline-table th,
.fi-timeline-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--divider, #e5e7eb);
    text-align: left;
}

.timeline-achieved {
    background: rgba(32, 201, 151, 0.08);
}

.timeline-pending {
    background: transparent;
}

.fi-timeline-note {
    display: block;
    color: var(--text-muted, #6b7280);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.fi-timeline-age {
    color: var(--text-muted, #6b7280);
    font-size: 0.85rem;
}

.fi-insight-box {
    background: rgba(90, 102, 241, 0.08);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .fi-section-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .copilot-floating-widget {
        bottom: 16px;
        right: 16px;
    }

    .copilot-floating-container {
        width: calc(100vw - 32px);
        height: calc(100vh - 100px);
        bottom: 64px;
    }
}

/* ============================================
   MOBILE RESPONSIVE OVERRIDES
   ============================================ */

/* Base mobile optimizations */
@media (max-width: 992px) {
    .dashboard-main {
        padding: 16px;
    }
    
    .card-style {
        padding: 20px 16px;
        margin-bottom: 20px;
    }
}

/* Tablet & Small Desktop (768px - 992px) */
@media (max-width: 992px) and (min-width: 769px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .quick-stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile (up to 768px) */
@media (max-width: 768px) {
    /* Typography */
    .dashboard-title {
        font-size: 1.75em;
        margin-bottom: 12px;
    }
    
    .dashboard-subtitle {
        font-size: 0.95em;
    }
    
    h2 {
        font-size: 1.5em;
    }
    
    h3 {
        font-size: 1.25em;
    }
    
    /* At a Glance Section */
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .hero-value {
        font-size: 2em;
    }
    
    .quick-action-card {
        padding: 14px;
    }
    
    .quick-action-card h3 {
        font-size: 0.95em;
    }
    
    .quick-action-card p {
        font-size: 0.85em;
    }
    
    /* Quick Stats Bar */
    .quick-stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .stat-item {
        padding: 12px;
    }
    
    .stat-icon {
        font-size: 1.75em;
    }
    
    .stat-value {
        font-size: 1.25em;
    }
    
    .stat-label {
        font-size: 0.8em;
    }
    
    /* Dashboard Controls */
    .dashboard-controls {
        padding: 16px;
    }
    
    .date-range-form {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-group {
        width: 100%;
    }
    
    .form-group input[type="date"] {
        width: 100%;
    }
    
    /* Financial Health Score */
    .score-display {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .score-value {
        font-size: 3em;
    }
    
    .score-out-of {
        font-size: 1.5em;
    }
    
    .score-components-inline {
        gap: 6px;
    }
    
    .component-chip {
        font-size: 0.8em;
        padding: 4px 8px;
    }
    
    /* Smart Actions */
    .action-item {
        padding: 16px;
    }
    
    .action-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-rank {
        font-size: 0.85em;
    }
    
    .severity-pill {
        font-size: 0.75em;
        padding: 3px 8px;
    }
    
    .action-title {
        font-size: 1em;
    }
    
    .action-detail {
        font-size: 0.9em;
    }
    
    .action-resources {
        gap: 8px;
    }
    
    .resource-link {
        font-size: 0.85em;
        padding: 5px 10px;
    }
    
    /* Dashboard Grid Cards */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .metric-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .metric-grid.compact-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Financial Summary */
    .summary-highlight-list {
        font-size: 0.9em;
    }
    
    /* Spending Trends Table */
    .spending-trends-table {
        font-size: 0.85em;
    }
    
    .spending-trends-table th,
    .spending-trends-table td {
        padding: 8px 6px;
    }
    
    /* Chart containers */
    .chart-canvas-wrapper {
        height: 250px;
    }
    
    /* FI Section */
    .fi-hero-metric {
        font-size: 2em;
    }
    
    .fi-section-grid {
        grid-template-columns: 1fr;
    }
    
    .fi-stat-amount {
        font-size: 1.5em;
    }
    
    /* Toast notifications */
    .toast-notification {
        top: 70px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Small Mobile (up to 480px) */
@media (max-width: 480px) {
    /* Hero Section - Extra Small Screens */
    .hero-value {
        font-size: 2rem;
    }

    .hero-eyebrow {
        font-size: 0.65rem;
        padding: 4px 10px;
    }

    .hero-change {
        font-size: 1rem;
    }

    .hero-breakdown {
        font-size: 0.75rem;
    }

    /* Stats Bar - Full Width */
    .quick-stats-bar {
        grid-template-columns: 1fr;
    }

    /* Make metric grids single column */
    .metric-grid.compact-grid {
        grid-template-columns: 1fr;
    }

    /* Financial Health Score */
    .score-value {
        font-size: 2.5em;
    }

    .component-chip {
        font-size: 0.75em;
        padding: 3px 6px;
    }

    /* Action Items */
    .action-item {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .action-checkbox {
        display: flex;
        align-items: center;
        gap: 8px;
        padding-top: 0;
    }
    
    .action-checkbox input[type="checkbox"] {
        flex-shrink: 0;
    }
    
    .action-checkbox::after {
        content: 'Mark as done';
        font-size: 0.85em;
        color: #666;
    }
    
    /* Buttons */
    .btn, .btn-primary, .btn-secondary {
        width: 100%;
        padding: 12px;
        font-size: 0.95em;
    }
    
    .btn-small {
        padding: 10px;
        font-size: 0.9em;
    }
    
    /* Tables - Force horizontal scroll */
    .table-scroll-wrapper {
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    table {
        font-size: 0.8em;
    }
    
    /* Hero section */
    .hero-value {
        font-size: 1.75em;
    }
    
    .hero-change {
        font-size: 0.95em;
    }
    
    .action-icon {
        font-size: 1.75em;
    }
}

/* Touch Target Improvements (all mobile) */
@media (max-width: 768px) {
    /* Ensure minimum 44px touch targets */
    button, 
    .btn, 
    a.btn,
    .dropdown-toggle,
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    .resource-link,
    .btn-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Improve tap areas for checkboxes */
    .action-checkbox {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Better spacing for tappable elements */
    .nav-link,
    .dropdown-item {
        padding: 12px 16px;
    }
}

/* Landscape Mobile (up to 768px height) */
@media (max-height: 768px) and (orientation: landscape) {
    .dashboard-hero {
        padding: 20px;
    }
    
    .hero-value {
        font-size: 1.75em;
    }
    
    .quick-stats-bar {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    
    .stat-item {
        padding: 10px;
    }
    
    .stat-icon {
        font-size: 1.5em;
    }
}

/* Print styles */
@media print {
    .dashboard-controls,
    .action-checkbox,
    .resource-link,
    .btn-toggle-details,
    .mobile-menu-toggle,
    .user-menu,
    nav {
        display: none !important;
    }
    
    .card-style {
        break-inside: avoid;
        page-break-inside: avoid;
    }
    
    .chart-canvas-wrapper {
        max-height: 400px;
    }
}

/* Responsive utility classes */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
    
    .mobile-hide {
        display: none !important;
    }
}

/* Improved scrollable containers on mobile */
@media (max-width: 768px) {
    .card-style {
        overflow: visible;
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        width: 100%;
    }

    /* Dashboard Header Bar Mobile */
    .dashboard-header-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 1.25rem;
    }

    .date-range-picker {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .date-range-picker label {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }

    .date-range-picker input[type="date"] {
        width: 100%;
        padding: 0.65rem;
        font-size: 1rem;
    }

    .date-range-picker > span {
        text-align: center;
        font-size: 0.9rem;
    }

    .btn-update {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
    }

    .sync-status {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
        width: 100%;
    }

    .sync-time {
        text-align: center;
        font-size: 0.9rem;
    }

    .sync-form {
        flex-direction: column;
        width: 100%;
    }

    .sync-select {
        width: 100%;
        margin-bottom: 0.5rem;
        padding: 0.65rem;
        font-size: 1rem;
    }

    .btn-sync {
        width: 100%;
        padding: 0.75rem;
        font-size: 1rem;
    }
}

/* ============================================================================
   BLOOMBERG TERMINAL-LITE COMPONENTS
   ============================================================================ */

/* Terminal Base Styles - Force dark theme */
html:has(body.dashboard-terminal) {
  background: var(--t-bg-base) !important;
}

body.dashboard-terminal {
  background: var(--t-bg-base) !important;
  color: var(--t-text-primary) !important;
  font-family: var(--t-font-text);
  line-height: 1.6;
  min-height: 100vh;
}

body.dashboard-terminal::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--t-bg-base);
  z-index: -1;
}

/* Override light backgrounds */
body.dashboard-terminal .container,
body.dashboard-terminal main {
  background: transparent !important;
}

/* Override header styling for terminal theme */
body.dashboard-terminal header,
body.dashboard-terminal .header,
body.dashboard-terminal nav,
body.dashboard-terminal .navbar {
  background: var(--t-bg-elevated) !important;
  border-bottom: 1px solid var(--t-border-base) !important;
  color: var(--t-text-primary) !important;
}

body.dashboard-terminal .navbar-brand,
body.dashboard-terminal .nav-link {
  color: var(--t-text-primary) !important;
}

body.dashboard-terminal .nav-link:hover {
  color: var(--t-accent-blue) !important;
}

/* Footer styling for dark mode */
body.dashboard-terminal .app-footer {
  background: var(--t-bg-elevated) !important;
  border-top: 1px solid var(--t-border-base) !important;
  color: var(--t-text-secondary) !important;
}

.container.terminal-container {
  max-width: 1800px;
  width: 95%;
  padding: var(--t-space-lg);
  margin: 0 auto;
}

/* Terminal Panel - Base Workspace Component */
.terminal-panel,
.workspace-panel {
  background: var(--t-bg-panel);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-md);
  padding: var(--t-space-lg);
  box-shadow: var(--t-shadow-md);
  transition: all var(--t-transition-base);
}

.terminal-panel:hover,
.workspace-panel:hover {
  border-color: var(--t-border-hover);
  box-shadow: var(--t-shadow-lg);
}

/* Panel Headers */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--t-space-lg);
  padding-bottom: var(--t-space-md);
  border-bottom: 1px solid var(--t-border-base);
}

.panel-title {
  font-family: var(--t-font-number);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--t-text-primary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Tooltip */
.panel-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  color: var(--t-accent-blue);
  font-size: 0.75rem;
  font-weight: 600;
  font-style: normal;
  cursor: help;
  position: relative;
  transition: all 0.2s ease;
}

.panel-info-icon:hover {
  background: rgba(59, 130, 246, 0.25);
  transform: scale(1.1);
}

.panel-info-icon .tooltip-text {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  padding: 12px 14px;
  background: rgba(15, 20, 25, 0.98);
  color: var(--t-text-primary);
  font-family: var(--t-font-text);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: normal;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  pointer-events: none;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.panel-info-icon .tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(15, 20, 25, 0.98);
}

.panel-info-icon:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

.panel-body {
  color: var(--t-text-secondary);
}

/* AI Insights Panel */
.insights-panel {
  grid-column: span 2;
}

.insights-container {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-md);
  margin-bottom: var(--t-space-lg);
}

.insight-item {
  display: flex;
  gap: var(--t-space-md);
  padding: var(--t-space-md);
  background: rgba(59, 130, 246, 0.05);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--t-radius-md);
  transition: all 0.2s ease;
}

.insight-item:hover {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.25);
}

.insight-icon {
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
}

.insight-content {
  flex: 1;
}

.insight-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--t-text-primary);
  margin-bottom: 0.25rem;
}

.insight-description {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--t-text-secondary);
}

.insights-recommendations {
  padding: var(--t-space-md);
  background: rgba(16, 185, 129, 0.05);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--t-radius-md);
  margin-bottom: var(--t-space-lg);
}

.recommendations-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--t-accent-green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--t-space-sm);
}

.recommendations-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recommendations-list li {
  padding: 0.5rem 0;
  padding-left: 1.5rem;
  position: relative;
  color: var(--t-text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
}

.recommendations-list li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--t-accent-green);
  font-weight: 600;
}

.insights-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--t-space-md);
  border-top: 1px solid var(--t-border-base);
  font-size: 0.8125rem;
}

.insights-timestamp {
  color: var(--t-text-muted);
}

.insights-refresh-btn {
  background: transparent;
  border: 1px solid var(--t-border-base);
  color: var(--t-text-secondary);
  padding: 0.375rem 0.875rem;
  border-radius: var(--t-radius-sm);
  font-size: 0.8125rem;
  font-family: var(--t-font-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.insights-refresh-btn:hover {
  background: var(--t-bg-elevated);
  border-color: var(--t-accent-blue);
  color: var(--t-accent-blue);
}

.insights-placeholder {
  text-align: center;
  padding: var(--t-space-xl) var(--t-space-md);
}

.placeholder-icon {
  display: flex;
  justify-content: center;
  margin-bottom: var(--t-space-md);
  opacity: 0.5;
}

.placeholder-icon svg {
  color: var(--t-accent-blue);
}

.placeholder-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--t-text-primary);
  margin-bottom: var(--t-space-sm);
}

.placeholder-description {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--t-text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

/* Data Card - Small Metric Cards */
.data-card {
  background: var(--t-bg-elevated);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-sm);
  padding: var(--t-space-md);
  transition: all var(--t-transition-fast);
}

.data-card:hover {
  border-color: var(--t-border-hover);
  transform: translateY(-2px);
}

/* Highlight Card - Important Info */
.highlight-card {
  background: var(--t-bg-panel);
  border: 1px solid var(--t-accent-blue);
  border-radius: var(--t-radius-md);
  padding: var(--t-space-lg);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Terminal Table */
.terminal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--t-size-label);
}

.terminal-table thead {
  position: sticky;
  top: 0;
  background: var(--t-bg-panel);
  z-index: 10;
}

.terminal-table th {
  padding: var(--t-space-md);
  text-align: left;
  font-family: var(--t-font-number);
  font-size: var(--t-size-tiny);
  font-weight: 600;
  color: var(--t-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--t-border-base);
}

.terminal-table td {
  padding: var(--t-space-md);
  color: var(--t-text-secondary);
  border-bottom: 1px solid var(--t-border-base);
}

.terminal-table tbody tr {
  transition: background-color var(--t-transition-fast);
}

.terminal-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.terminal-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.terminal-table .col-number {
  text-align: right;
  font-family: var(--t-font-number);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--t-text-primary);
}

/* Hero Command Center */
.terminal-hero {
  margin-bottom: var(--t-space-xl);
}

.hero-grid {
  display: grid;
  grid-template-columns: 40% 35% 25%;
  gap: 0;
  background: var(--t-bg-panel);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-lg);
  padding: var(--t-space-xl);
  box-shadow: var(--t-shadow-xl);
}

.hero-eyebrow {
  font-family: var(--t-font-number);
  font-size: var(--t-size-tiny);
  font-weight: 600;
  color: var(--t-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--t-space-sm);
}

/* Hero Net Worth Section */
.hero-networth {
  padding-right: var(--t-space-lg);
}

.hero-value {
  font-family: var(--t-font-number);
  font-size: var(--t-size-hero);
  font-weight: 700;
  color: var(--t-text-primary);
  line-height: 1.1;
  margin: var(--t-space-sm) 0;
}

.hero-change {
  font-family: var(--t-font-number);
  font-size: var(--t-size-metric);
  font-weight: 600;
  margin: var(--t-space-md) 0;
  display: flex;
  align-items: center;
  gap: var(--t-space-sm);
}

.hero-change.positive {
  color: var(--t-accent-green);
}

.hero-change.negative {
  color: var(--t-accent-red);
}

.change-percent {
  font-size: var(--t-size-label);
  opacity: 0.8;
}

.hero-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-xs);
  margin-top: var(--t-space-md);
  padding-top: var(--t-space-md);
  border-top: 1px solid var(--t-border-base);
  font-size: var(--t-size-label);
  color: var(--t-text-secondary);
}

/* Hero Trend Section */
.hero-trend {
  padding: 0 var(--t-space-xl);
  border-left: 1px solid var(--t-border-base);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.trend-velocity {
  font-size: var(--t-size-tiny);
  color: var(--t-text-muted);
  margin-top: var(--t-space-sm);
  line-height: 1.4;
}

/* Pace to Goal Metrics */
.pace-metrics {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-md);
  margin-top: var(--t-space-md);
}

.pace-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--t-space-sm) 0;
}

.pace-label {
  font-size: 0.8rem;
  color: var(--t-text-secondary);
  font-weight: 400;
}

.pace-value {
  font-size: 1rem;
  font-family: var(--t-font-number);
  color: var(--t-text-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pace-highlight {
  font-size: 1.1rem;
}

.pace-ahead {
  color: var(--t-accent-green);
}

.pace-behind {
  color: var(--t-accent-red);
}

.pace-on-track {
  color: var(--t-accent-blue);
}

.pace-icon {
  font-size: 1rem;
  font-weight: bold;
}

.pace-status-bar {
  margin-top: var(--t-space-sm);
  padding: var(--t-space-md);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--t-border-base);
}

.pace-status-text {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--t-text-secondary);
}

.pace-status-text strong {
  color: var(--t-text-primary);
  font-weight: 600;
}

.status-ahead strong {
  color: var(--t-accent-green);
}

.status-behind strong {
  color: var(--t-accent-red);
}

.status-on-track strong {
  color: var(--t-accent-blue);
}

/* Automated Actions Styles */
.automated-actions-list {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-md);
}

.action-item {
  display: flex;
  align-items: flex-start;
  gap: var(--t-space-md);
  padding: var(--t-space-md);
  background: var(--t-bg-elevated);
  border: 1px solid var(--t-border-base);
  border-radius: 8px;
  transition: all 0.3s ease;
}

.action-item:hover {
  border-color: var(--t-border-hover);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Priority Colors */
.action-critical {
  border-left: 3px solid var(--t-accent-red);
  background: rgba(239, 68, 68, 0.05);
}

.action-high {
  border-left: 3px solid #f59e0b;
  background: rgba(245, 158, 11, 0.05);
}

.action-medium {
  border-left: 3px solid var(--t-accent-blue);
  background: rgba(59, 130, 246, 0.05);
}

.action-low {
  border-left: 3px solid #6b7280;
}

.action-info {
  border-left: 3px solid var(--t-accent-green);
  background: rgba(16, 185, 129, 0.05);
}

.action-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
}

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

.action-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--t-text-primary);
  margin-bottom: 0.25rem;
}

.action-description {
  font-size: 0.8rem;
  color: var(--t-text-secondary);
  line-height: 1.5;
}

.action-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--t-accent-blue);
  text-decoration: none;
  font-weight: 500;
}

.action-link:hover {
  text-decoration: underline;
}

/* Pace Projection Section */
.pace-projection {
  margin-top: var(--t-space-lg);
  padding: var(--t-space-md);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.projection-header {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--t-accent-green);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--t-space-md);
}

.projection-options {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-md);
}

.projection-option {
  display: flex;
  align-items: flex-start;
  gap: var(--t-space-md);
}

.projection-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.projection-content {
  flex: 1;
}

.projection-label {
  font-size: 0.75rem;
  color: var(--t-text-secondary);
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.projection-value {
  font-size: 1rem;
  font-family: var(--t-font-number);
  color: var(--t-accent-green);
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.projection-subtext {
  font-size: 0.75rem;
  color: var(--t-text-muted);
  font-family: var(--t-font-text);
  font-weight: 400;
}

/* Hero Composition Section */
.hero-composition {
  display: flex;
  flex-direction: column;
  padding-left: var(--t-space-lg);
  padding-right: var(--t-space-sm);
  border-left: 1px solid var(--t-border-base);
}

.hero-composition .hero-eyebrow {
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  word-wrap: break-word;
}

.hero-composition canvas {
  margin: var(--t-space-md) 0;
}

.composition-legend {
  display: flex;
  flex-direction: column;
  gap: var(--t-space-sm);
  font-size: var(--t-size-tiny);
  color: var(--t-text-secondary);
  line-height: 1.6;
}

.composition-legend > div {
  padding: var(--t-space-xs) 0;
}

/* Fix plan progress bar in hero */
.hero-composition .plan-progress-bar-container {
  margin: var(--t-space-md) 0;
}

.hero-composition .plan-progress-bar {
  height: 8px;
  background: var(--t-bg-elevated);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--t-space-md);
}

/* Market Ticker Strip */
.terminal-ticker {
  margin-bottom: var(--t-space-xl);
}

.ticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--t-space-md);
}

.ticker-metric {
  background: var(--t-bg-panel);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-md);
  padding: var(--t-space-lg);
  cursor: pointer;
  transition: all var(--t-transition-base);
}

.ticker-metric:hover {
  border-color: var(--t-accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

.ticker-label {
  font-family: var(--t-font-number);
  font-size: var(--t-size-tiny);
  font-weight: 600;
  color: var(--t-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--t-space-xs);
}

.ticker-value {
  font-family: var(--t-font-number);
  font-size: var(--t-size-metric);
  font-weight: 700;
  color: var(--t-text-primary);
  margin: var(--t-space-sm) 0;
}

.ticker-value.positive {
  color: var(--t-accent-green);
}

.ticker-value.negative {
  color: var(--t-accent-red);
}

.ticker-context {
  font-size: var(--t-size-tiny);
  color: var(--t-text-muted);
}

/* Workspace Grid */
.terminal-workspace {
  margin-bottom: var(--t-space-xl);
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--t-space-lg);
}

.workspace-panel {
  min-height: 400px;
}

/* Plan & Scenarios - Full Width */
#panel-plan {
  grid-column: 1 / -1; /* Span all columns */
}

/* AI Insights - Compact when collapsed */
#panel-insights {
  min-height: auto; /* Override default min-height */
  transition: all 0.3s ease;
}

#panel-insights.collapsed {
  min-height: auto;
  padding: var(--t-space-md) var(--t-space-lg); /* Reduce vertical padding when collapsed */
}

#panel-insights.collapsed .panel-header {
  margin-bottom: 0; /* Remove bottom margin when collapsed */
}

/* Collapsible Panel Styles */
.workspace-panel.collapsed {
  min-height: auto;
  padding: var(--t-space-md) var(--t-space-lg);
}

.workspace-panel.collapsed .panel-header {
  margin-bottom: 0;
}

.panel-toggle-btn:hover {
  color: var(--t-text-primary) !important;
}

/* Panel Highlight Animation */
@keyframes panelPulse {
  0%, 100% {
    border-color: var(--t-border-base);
    box-shadow: var(--t-shadow-md);
  }
  50% {
    border-color: var(--t-accent-blue);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3), var(--t-shadow-lg);
  }
}

.panel-highlight {
  animation: panelPulse 2s ease;
}

/* Time Range Selector */
.time-range-selector {
  display: flex;
  gap: var(--t-space-sm);
  padding: var(--t-space-sm);
  background: var(--t-bg-elevated);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-md);
}

.range-btn {
  padding: var(--t-space-sm) var(--t-space-md);
  background: transparent;
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-sm);
  color: var(--t-text-secondary);
  font-family: var(--t-font-number);
  font-size: var(--t-size-tiny);
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--t-transition-fast);
}

.range-btn:hover {
  background: var(--t-bg-panel);
  border-color: var(--t-border-hover);
  color: var(--t-text-primary);
}

.range-btn.active {
  background: var(--t-accent-blue);
  border-color: var(--t-accent-blue);
  color: white;
}

/* Compact Header */
.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--t-space-lg);
  background: var(--t-bg-panel);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-md);
  margin-bottom: var(--t-space-xl);
}

.header-controls {
  display: flex;
  gap: var(--t-space-md);
  align-items: center;
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-composition {
    grid-column: span 2;
    border-top: 1px solid var(--t-border-base);
    padding-top: var(--t-space-lg);
    margin-top: var(--t-space-lg);
  }

  .hero-composition .hero-eyebrow {
    margin-top: var(--t-space-md);
  }

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

@media (max-width: 768px) {
  .terminal-container {
    padding: var(--t-space-md);
  }

  .terminal-hero .hero-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    grid-template-columns: none !important;
  }

  .hero-networth,
  .hero-trend,
  .hero-composition {
    width: 100% !important;
    max-width: 100% !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: 1px solid var(--t-border-base);
    padding: var(--t-space-lg) 0 !important;
    margin-bottom: var(--t-space-lg);
    overflow: hidden;
  }

  .hero-networth {
    padding-top: 0 !important;
  }

  .hero-composition {
    border-bottom: none;
    padding-bottom: 0 !important;
    margin-bottom: 0;
  }

  .hero-value {
    font-size: 2.5rem;
  }

  .hero-eyebrow {
    font-size: 0.7rem;
  }

  .trend-velocity {
    font-size: 0.75rem;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Pace to Goal - Mobile */
  .pace-metrics {
    gap: var(--t-space-sm);
  }

  .pace-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: var(--t-space-sm) 0;
  }

  .pace-label {
    font-size: 0.7rem;
  }

  .pace-value {
    font-size: 0.95rem;
    align-self: flex-end;
  }

  .pace-highlight {
    font-size: 1rem;
  }

  .pace-status-bar {
    padding: var(--t-space-sm);
  }

  .pace-status-text {
    font-size: 0.75rem;
  }

  /* Pace Projection - Mobile */
  .pace-projection {
    margin-top: var(--t-space-md);
    padding: var(--t-space-sm);
  }

  .projection-header {
    font-size: 0.7rem;
    margin-bottom: var(--t-space-sm);
  }

  .projection-options {
    gap: var(--t-space-sm);
  }

  .projection-icon {
    font-size: 1.25rem;
  }

  .projection-label {
    font-size: 0.7rem;
  }

  .projection-value {
    font-size: 0.9rem;
  }

  .projection-subtext {
    font-size: 0.7rem;
  }

  /* Automated Actions - Mobile */
  .automated-actions-list {
    gap: var(--t-space-sm);
  }

  .action-item {
    flex-direction: column;
    padding: var(--t-space-sm);
  }

  .action-icon {
    font-size: 1.25rem;
  }

  .action-title {
    font-size: 0.8rem;
  }

  .action-description {
    font-size: 0.75rem;
  }

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

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

  .terminal-header {
    flex-direction: column;
    gap: var(--t-space-md);
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

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

  /* Reduce panel padding on mobile */
  .workspace-panel {
    padding: var(--t-space-md);
    overflow: hidden;
  }

  .detail-card {
    padding: var(--t-space-md);
    overflow: hidden;
  }

  .panel-body {
    padding: 0;
    overflow: hidden;
  }

  /* Spending Table Mobile Optimization - Card-Based Layout */
  .spending-table {
    display: block;
    width: 100%;
    max-width: 100%;
    border: none;
    overflow: hidden;
  }

  /* Hide table header on mobile */
  .spending-table thead {
    display: none;
  }

  .spending-table tbody,
  .spending-table tfoot {
    display: block;
    width: 100%;
  }

  /* Each row becomes a card */
  .spending-table tbody tr {
    display: flex;
    flex-direction: column;
    background: var(--t-bg-elevated);
    border: 1px solid var(--t-border-base);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .spending-table tbody tr:hover {
    background: var(--t-bg-elevated);
    border-color: var(--t-border-hover);
  }

  /* Footer (total row) */
  .spending-table tfoot tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    margin-top: 0.5rem;
    border-top: 2px solid var(--t-border-base);
    border: none;
  }

  .spending-table tfoot td {
    display: inline-block;
    padding: 0;
    border: none;
  }

  .spending-table tfoot td:first-child {
    font-weight: 600;
    font-size: 0.875rem;
  }

  /* Category name - first row */
  .spending-table tbody td:nth-child(1) {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--t-text-primary);
    margin-bottom: 0.5rem;
    padding: 0;
    border: none;
  }

  /* Current amount - second row */
  .spending-table tbody td:nth-child(2) {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    margin-bottom: 0.25rem;
    border: none;
    font-size: 0.8rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .spending-table tbody td:nth-child(2)::before {
    content: 'Current:';
    color: var(--t-text-secondary);
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-right: 0.5rem;
  }

  /* Hide Prior column on mobile */
  .spending-table tbody td:nth-child(3),
  .spending-table tfoot td:nth-child(3) {
    display: none !important;
  }

  /* Change amount - third row */
  .spending-table tbody td:nth-child(4) {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    border: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .spending-table tbody td:nth-child(4)::before {
    content: 'Change:';
    color: var(--t-text-secondary);
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-right: 0.5rem;
  }

  .spending-change {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    white-space: nowrap;
  }

  .detail-card-title {
    font-size: 0.95rem;
  }
}

/* Chart Container Styles */
.chart-canvas-wrapper {
  position: relative;
  height: 300px;
  margin: var(--t-space-lg) 0;
}

.workspace-panel canvas {
  max-height: 300px;
}

/* Utility Classes */
.text-success {
  color: var(--t-accent-green) !important;
}

.text-danger {
  color: var(--t-accent-red) !important;
}

.text-warning {
  color: var(--t-accent-amber) !important;
}

.text-muted {
  color: var(--t-text-muted) !important;
}

/* ============================================================================
   SYNC & OVERLAY COMPONENTS
   ============================================================================ */

/* Sync Message Toast */
.sync-toast {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 16px 20px;
  border-radius: 10px;
  color: white;
  font-weight: 500;
  z-index: 10001;
  transform: translateX(420px);
  transition: transform 0.3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  max-width: 400px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sync-toast.show { transform: translateX(0); }
.sync-toast.success { background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%); }
.sync-toast.error { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.toast-icon { font-size: 1.25rem; flex-shrink: 0; }
.toast-text { flex: 1; line-height: 1.4; }
.toast-close {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.toast-close:hover { background: rgba(255,255,255,0.3); }

/* Sync Loading Overlay */
.sync-loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 10000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.sync-loading-overlay.active { display: flex; }
.sync-loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.sync-loading-text {
  color: #fff;
  margin-top: 16px;
  font-size: 1.1rem;
  font-weight: 500;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Dashboard Header Bar */
.dashboard-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--t-bg-panel);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-md);
  margin-bottom: var(--t-space-xl);
  box-shadow: var(--t-shadow-md);
}

.date-range-picker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.date-range-picker label {
  color: var(--t-text-secondary);
  font-size: var(--t-size-label);
  font-weight: 500;
}
.date-range-picker input[type="date"] {
  background: var(--t-bg-elevated);
  border: 1px solid var(--t-border-base);
  color: var(--t-text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--t-radius-sm);
  font-size: var(--t-size-label);
  outline: none;
  transition: border-color var(--t-transition-fast);
}
.date-range-picker input[type="date"]:focus {
  border-color: var(--t-accent-blue);
}
.date-range-picker input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
  cursor: pointer;
}

.btn-update {
  background: var(--t-accent-blue);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: var(--t-radius-sm);
  cursor: pointer;
  font-size: var(--t-size-label);
  font-weight: 600;
  transition: background var(--t-transition-fast);
}
.btn-update:hover {
  background: #2563eb;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.sync-time {
  color: var(--t-text-secondary);
  font-size: var(--t-size-label);
}
.sync-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sync-select {
  background: var(--t-bg-elevated);
  border: 1px solid var(--t-border-base);
  color: var(--t-text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--t-radius-sm);
  font-size: 0.8125rem;
  cursor: pointer;
  outline: none;
}
.btn-sync {
  background: var(--t-bg-elevated);
  border: 1px solid var(--t-border-base);
  color: var(--t-text-primary);
  padding: 0.6rem 1rem;
  border-radius: var(--t-radius-sm);
  cursor: pointer;
  text-decoration: none;
  font-size: var(--t-size-label);
  font-weight: 500;
  transition: all var(--t-transition-fast);
}
.btn-sync:hover {
  background: var(--t-bg-panel);
  border-color: var(--t-border-hover);
}

/* ============================================================================
   DETAIL CARDS & GRIDS
   ============================================================================ */

.detail-grid,
.detail-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--t-space-lg);
}

.detail-card {
  background: var(--t-bg-elevated);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-md);
  padding: var(--t-space-lg);
}

.detail-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--t-text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--t-border-base);
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--t-border-base);
}
.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--t-text-secondary);
  font-size: 0.9rem;
}

.detail-value {
  font-weight: 600;
  color: var(--t-text-primary);
  font-size: 0.9rem;
  font-family: var(--t-font-number);
}
.detail-value.positive {
  color: var(--t-accent-green);
}
.detail-value.negative {
  color: var(--t-accent-red);
}

/* Spending Table */
.spending-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.spending-table thead th {
  text-align: left;
  padding: 1rem;
  background: var(--t-bg-elevated);
  color: var(--t-text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--t-border-base);
}

.spending-table tbody td {
  padding: 1rem;
  border-bottom: 1px solid var(--t-border-base);
  color: var(--t-text-secondary);
}

.spending-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.spending-table tfoot td {
  padding: 1rem;
  background: var(--t-bg-elevated);
  font-weight: 700;
  color: var(--t-text-primary);
}

.spending-change {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
}
.spending-change.up {
  background: rgba(239, 68, 68, 0.1);
  color: var(--t-accent-red);
}
.spending-change.down {
  background: rgba(16, 185, 129, 0.1);
  color: var(--t-accent-green);
}

/* Expense Category Bar */
.expense-category-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.expense-category-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.expense-category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.expense-category-name {
  font-weight: 600;
  color: var(--t-text-secondary);
  font-size: 0.9rem;
}

.expense-category-amount {
  font-weight: 700;
  color: var(--t-text-primary);
  font-size: 0.95rem;
  font-family: var(--t-font-number);
}

.expense-category-bar {
  height: 8px;
  background: var(--t-bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.expense-category-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.expense-category-fill.cat-1 { background: var(--t-accent-blue); }
.expense-category-fill.cat-2 { background: var(--t-accent-purple); }
.expense-category-fill.cat-3 { background: var(--t-accent-cyan); }
.expense-category-fill.cat-4 { background: var(--t-accent-amber); }
.expense-category-fill.cat-5 { background: var(--t-accent-green); }
.expense-category-fill.cat-6 { background: #ec4899; }

/* Health Score Styles */
.health-score-hero {
  text-align: center;
  padding: 2.5rem;
  background: var(--t-bg-elevated);
  border-radius: var(--t-radius-lg);
  margin-bottom: 2rem;
  border: 1px solid var(--t-border-base);
}

.health-score-number {
  font-size: 5rem;
  font-weight: 800;
  font-family: var(--t-font-number);
  color: var(--t-text-primary);
  line-height: 1;
  letter-spacing: -0.05em;
}

.health-score-label {
  font-size: 1.125rem;
  color: var(--t-text-secondary);
  margin-top: 0.75rem;
  font-weight: 500;
}

.health-score-badge {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 1.25rem;
}
.health-score-badge.excellent { background: rgba(16, 185, 129, 0.2); color: var(--t-accent-green); }
.health-score-badge.good { background: rgba(59, 130, 246, 0.2); color: var(--t-accent-blue); }
.health-score-badge.fair { background: rgba(245, 158, 11, 0.2); color: var(--t-accent-amber); }
.health-score-badge.poor { background: rgba(239, 68, 68, 0.2); color: var(--t-accent-red); }

.health-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.health-item {
  background: var(--t-bg-elevated);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-md);
  padding: var(--t-space-lg);
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  transition: all var(--t-transition-base);
}
.health-item:hover {
  border-color: var(--t-border-hover);
  box-shadow: var(--t-shadow-md);
}

.health-score-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
  position: relative;
  font-family: var(--t-font-number);
}
.health-score-circle::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px solid currentColor;
  opacity: 0.2;
}
.health-score-circle.high { background: rgba(16, 185, 129, 0.2); color: var(--t-accent-green); }
.health-score-circle.medium { background: rgba(245, 158, 11, 0.2); color: var(--t-accent-amber); }
.health-score-circle.low { background: rgba(239, 68, 68, 0.2); color: var(--t-accent-red); }

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

.health-item-title {
  font-weight: 600;
  color: var(--t-text-primary);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.health-item-label {
  color: var(--t-text-secondary);
  font-size: 0.85rem;
}

.health-item-bar {
  height: 6px;
  background: var(--t-bg-elevated);
  border-radius: 3px;
  margin-top: 1rem;
  overflow: hidden;
}

.health-item-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.health-item-bar-fill.high { background: var(--t-accent-green); }
.health-item-bar-fill.medium { background: var(--t-accent-amber); }
.health-item-bar-fill.low { background: var(--t-accent-red); }

/* Holdings List */
.holdings-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.holding-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--t-bg-elevated);
  border-radius: var(--t-radius-sm);
  border: 1px solid var(--t-border-base);
}

.holding-info {
  display: flex;
  flex-direction: column;
}

.holding-ticker {
  font-weight: 700;
  color: var(--t-text-primary);
  font-size: 0.95rem;
  font-family: var(--t-font-number);
}

.holding-shares {
  font-size: 0.8rem;
  color: var(--t-text-secondary);
}

.holding-value {
  text-align: right;
}

.holding-amount {
  font-weight: 600;
  color: var(--t-text-primary);
  font-size: 0.9rem;
  font-family: var(--t-font-number);
}

.holding-percent {
  font-size: 0.8rem;
  color: var(--t-text-secondary);
}

/* Chart Container */
.chart-container {
  position: relative;
  height: 300px;
  margin: var(--t-space-lg) 0;
}

/* Goals Grid */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--t-space-lg);
  margin-top: var(--t-space-lg);
}

/* Goal Card */
.goal-card {
  background: var(--t-bg-panel);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-md);
  padding: var(--t-space-lg);
  transition: all 0.2s ease;
}

.goal-card:hover {
  border-color: var(--t-accent-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.goal-card.completed {
  border-color: var(--t-accent-green);
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--t-space-md);
}

.goal-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.goal-percent {
  font-family: var(--t-font-number);
  font-size: 1.25rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--t-accent-blue);
}

.goal-percent.complete {
  background: rgba(16, 185, 129, 0.15);
  color: var(--t-accent-green);
}

.goal-name {
  color: var(--t-text-primary);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--t-space-md);
  line-height: 1.4;
}

.goal-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--t-bg-elevated);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: var(--t-space-md);
}

.goal-progress-fill {
  height: 100%;
  background: var(--t-accent-blue);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.goal-progress-fill.complete {
  background: var(--t-accent-green);
}

.goal-amounts {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--t-font-number);
  font-size: 0.875rem;
}

.goal-amounts span:first-child {
  color: var(--t-accent-green);
  font-weight: 600;
}

.goal-amounts span:last-child {
  color: var(--t-text-secondary);
}

/* Goal Advisor Button - Opens chatbot with goal context */
.goal-advisor-btn {
  width: 100%;
  margin-top: var(--t-space-md);
  padding: 8px 12px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--t-accent-blue);
  border-radius: 6px;
  color: var(--t-accent-blue);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.goal-advisor-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
}

/* Removed AI Suggestions Modal - Now using integrated chatbot instead */

/* Ask Advisor Buttons - Context-aware chatbot integration */
.ask-advisor-btn {
  padding: 10px 16px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid var(--t-accent-blue);
  border-radius: 8px;
  color: var(--t-accent-blue);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.ask-advisor-btn:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.ask-advisor-btn:active {
  transform: translateY(0);
}

/* Specific context buttons */
.ask-advisor-networth {
  margin-top: 16px;
}

.ask-advisor-cashflow,
.ask-advisor-health,
.ask-advisor-spending {
  margin-top: 20px;
}

/* AI Insights Loading Skeleton */
.insights-loading {
  padding: var(--t-space-md);
}

.insights-loading-text {
  text-align: center;
  color: var(--t-text-secondary);
  font-size: 0.875rem;
  margin-top: var(--t-space-lg);
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-insight {
  display: flex;
  gap: var(--t-space-md);
  margin-bottom: var(--t-space-lg);
}

.skeleton-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(
    90deg,
    var(--t-bg-elevated) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    var(--t-bg-elevated) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  flex-shrink: 0;
}

.skeleton-text {
  flex: 1;
}

.skeleton-line {
  height: 16px;
  background: linear-gradient(
    90deg,
    var(--t-bg-elevated) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    var(--t-bg-elevated) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-line.short {
  width: 60%;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Plan Progress Bar */
.plan-progress-bar-container {
  margin: var(--t-space-md) 0;
}

.plan-progress-bar {
  height: 8px;
  background: var(--t-bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}

.plan-progress-fill {
  height: 100%;
  background: var(--t-accent-green);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Onboarding */
.dashboard-onboarding {
  background: var(--t-bg-panel);
  border: 1px solid var(--t-border-base);
  border-radius: var(--t-radius-lg);
  padding: var(--t-space-xl);
  margin-bottom: var(--t-space-xl);
  text-align: center;
}

.onboarding-title {
  color: var(--t-text-primary);
  font-size: 1.5rem;
  margin-bottom: var(--t-space-md);
}

.onboarding-text {
  color: var(--t-text-secondary);
  margin-bottom: var(--t-space-lg);
}

.onboarding-buttons {
  display: flex;
  gap: var(--t-space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary {
  background: var(--t-accent-blue);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--t-radius-sm);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--t-transition-fast);
}
.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--t-border-base);
  color: var(--t-text-primary);
  padding: 0.75rem 1.5rem;
  border-radius: var(--t-radius-sm);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--t-transition-fast);
}
.btn-secondary:hover {
  background: var(--t-bg-elevated);
  border-color: var(--t-border-hover);
}

/* Dashboard Goals Section */
.dashboard-goals-section {
  margin-bottom: var(--t-space-xl);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--t-space-lg);
}

.section-title {
  font-size: 1.5rem;
  color: var(--t-text-primary);
  font-family: var(--t-font-number);
  font-weight: 600;
}

.section-link {
  color: var(--t-accent-blue);
  text-decoration: none;
  font-size: var(--t-size-label);
  font-weight: 500;
}
.section-link:hover {
  color: #2563eb;
}
