/* Layer 3 Financial Statements Styling */
:root {
    --fin-primary: #4f46e5;
    --fin-primary-light: #eef2ff;
    --fin-success: #059669;
    --fin-success-light: #ecfdf5;
    --fin-danger: #dc2626;
    --fin-danger-light: #fef2f2;
    --fin-warning: #d97706;
    --fin-warning-light: #fffbeb;
    --fin-info: #0284c7;
    --fin-info-light: #f0f9ff;
    --fin-dark: #0f172a;
    --fin-surface: #ffffff;
    --fin-surface-alt: #f8fafc;
    --fin-border: #e2e8f0;
    --fin-text: #1e293b;
    --fin-text-muted: #64748b;
}

/* Individual Card Segmented Switcher */
.fin-card-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
    gap: 3px;
    margin-bottom: 12px;
}

.fin-card-tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 5px 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--fin-text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: 'Prompt', sans-serif;
}

.fin-card-tab-btn:hover {
    color: var(--fin-text);
    background: rgba(255, 255, 255, 0.5);
}

.fin-card-tab-btn.active {
    background: #ffffff;
    color: #4338ca;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    font-weight: 700;
}

/* Modal Improvements */
.fin-modal-content {
    background-color: #f8fafc;
    margin: 2% auto;
    width: 90%;
    max-width: 1050px;
    border-radius: 20px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    animation: finModalSlide 0.3s ease-out;
    display: flex;
    flex-direction: column;
    max-height: 92vh;
}

.fin-modal-header {
    padding: 20px 28px;
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fin-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
}

/* Modal Navigation Tabs */
.fin-modal-nav {
    display: flex;
    gap: 8px;
    background: #e2e8f0;
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.fin-modal-nav-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 9px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Prompt', sans-serif;
}

.fin-modal-nav-btn:hover {
    color: #0f172a;
    background: rgba(255, 255, 255, 0.5);
}

.fin-modal-nav-btn.active {
    background: #ffffff;
    color: #4338ca;
    box-shadow: 0 3px 10px rgba(79, 70, 229, 0.18);
    font-weight: 700;
}

/* Summary Metric Cards in Modal */
.fin-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.fin-metric-tile {
    background: white;
    border: 1px solid var(--fin-border);
    border-radius: 12px;
    padding: 14px 18px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fin-metric-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

.fin-metric-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--fin-text-muted);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fin-metric-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--fin-text);
    font-family: 'Prompt', sans-serif;
}

.fin-metric-sub {
    font-size: 0.72rem;
    color: var(--fin-text-muted);
    margin-top: 4px;
}

/* Detailed Tables */
.fin-table-container {
    background: white;
    border: 1px solid var(--fin-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.fin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    font-family: 'Prompt', sans-serif;
}

.fin-table th,
.fin-table td {
    padding: 10px 16px;
}

.fin-table-cat {
    background: #f8fafc;
    font-weight: 700;
    color: #1e293b;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

.fin-table-subcat {
    background: #f1f5f9;
    font-weight: 600;
    color: #334155;
    padding-left: 28px !important;
}

.fin-table-row {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}

.fin-table-row:hover {
    background: #f8fafc;
}

.fin-table-acc {
    padding-left: 45px !important;
    color: #64748b;
    font-size: 0.82rem;
}

.fin-table-val {
    text-align: right;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    font-size: 0.92rem;
}

.fin-table-total {
    background: #f1f5f9;
    font-weight: 800;
    color: #0f172a;
    border-top: 2px solid #cbd5e1;
    border-bottom: 2px solid #cbd5e1;
}

.fin-table-profit {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #065f46;
    font-weight: 900;
    font-size: 1.05rem;
    border-top: 2px solid #10b981;
}

.fin-table-highlight {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #3730a3;
    font-weight: 900;
    font-size: 1.05rem;
    border-top: 2px solid #6366f1;
}

.text-positive {
    color: #059669 !important;
}

.text-negative {
    color: #dc2626 !important;
}

.text-neutral {
    color: #475569 !important;
}

/* Balance check badge */
.fin-balance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
}

.fin-balance-badge.balanced {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.fin-balance-badge.unbalanced {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}
