/**
 * Central Portal - Navision (Business Central) & Power BI Design System
 * Enterprise Financial Ledger & Executive BI Analytics Styling
 * Fully integrated with Filament v3 (Light & Dark Mode)
 */

/* -------------------------------------------------------------
 * 1. Design Tokens & Theme Variables
 * Day Theme: "Google Titanium" | Night Theme: "Hacker / Cyberpunk Terminal"
 * ----------------------------------------------------------- */
:root {
    /* Day Theme: Google Titanium */
    --nav-bg-canvas: #f8f9fa;
    --nav-bg-card: #ffffff;
    --nav-border-card: #dadce0;
    --nav-border-row: #e2e8f0;
    --nav-header-bg: #f1f3f4;
    --nav-header-text: #3c4043;
    --nav-text-main: #202124;
    --nav-text-muted: #5f6368;
    --nav-row-even: #f8f9fa;
    --nav-row-hover: #f1f3f4;

    /* Primary Google Cobalt / Titanium Blue */
    --nav-accent: #1a73e8;
    --nav-accent-hover: #185abc;
    --nav-accent-bg: #e8f0fe;
    --nav-accent-glow: 0 1px 2px rgba(26, 115, 232, 0.25);

    /* Functional Accents */
    --pbi-amber: #e37400;
    --pbi-amber-bg: #fef7e0;
    --pbi-blue: #1a73e8;
    --pbi-blue-bg: #e8f0fe;
    --pbi-green: #137333;
    --pbi-green-bg: #e6f4ea;
    --pbi-indigo: #5b5fc7;
    --pbi-indigo-bg: #eff2fe;
    --pbi-red: #d93025;
    --pbi-red-bg: #fce8e6;
}

:is(.dark),
html.dark {
    /* Night Theme: Hacker / Cyberpunk Terminal */
    --nav-bg-canvas: #050505;
    --nav-bg-card: #121212;
    --nav-border-card: rgba(0, 255, 102, 0.20);
    --nav-border-row: #1e293b;
    --nav-header-bg: #0a0a0a;
    --nav-header-text: #a7f3d0;
    --nav-text-main: #f8fafc;
    --nav-text-muted: #6ee7b7;
    --nav-row-even: rgba(18, 18, 18, 0.7);
    --nav-row-hover: rgba(0, 255, 102, 0.08);

    /* Primary Phosphor Neon Green / Matrix Emerald */
    --nav-accent: #00ff66;
    --nav-accent-hover: #10b981;
    --nav-accent-bg: rgba(0, 255, 102, 0.12);
    --nav-accent-glow: 0 0 12px rgba(0, 255, 102, 0.35);

    /* Cyberpunk Accents */
    --pbi-amber: #fbbf24;
    --pbi-amber-bg: rgba(251, 191, 36, 0.15);
    --pbi-blue: #38bdf8;
    --pbi-blue-bg: rgba(56, 189, 248, 0.15);
    --pbi-green: #00ff66;
    --pbi-green-bg: rgba(0, 255, 102, 0.15);
    --pbi-indigo: #818cf8;
    --pbi-indigo-bg: rgba(129, 140, 248, 0.15);
    --pbi-red: #f87171;
    --pbi-red-bg: rgba(248, 113, 113, 0.15);
}

/* -------------------------------------------------------------
 * 2. Navision Cue Cards / Power BI KPI Visuals
 * ----------------------------------------------------------- */
.pbi-kpi-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
    .pbi-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .pbi-kpi-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.pbi-kpi-card {
    background: var(--nav-bg-card);
    border: 1px solid var(--nav-border-card);
    border-radius: 10px;
    padding: 1.125rem 1.25rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

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

/* Navision Accent Top Bar */
.pbi-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.pbi-kpi-amber::before { background: #d97706; }
.pbi-kpi-blue::before { background: #0284c7; }
.pbi-kpi-green::before { background: #059669; }
.pbi-kpi-indigo::before { background: #4f46e5; }

.pbi-kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.pbi-kpi-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--nav-text-muted);
    margin: 0;
}

.pbi-kpi-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
}

.pbi-kpi-amber .pbi-kpi-icon { background: var(--pbi-amber-bg); color: var(--pbi-amber); }
.pbi-kpi-blue .pbi-kpi-icon { background: var(--pbi-blue-bg); color: var(--pbi-blue); }
.pbi-kpi-green .pbi-kpi-icon { background: var(--pbi-green-bg); color: var(--pbi-green); }
.pbi-kpi-indigo .pbi-kpi-icon { background: var(--pbi-indigo-bg); color: var(--pbi-indigo); }

.pbi-kpi-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--nav-text-main);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin: 0.25rem 0 0.5rem 0;
}

.pbi-kpi-footer {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--nav-text-muted);
    border-top: 1px solid var(--nav-border-card);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
}

.pbi-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.pbi-dot-green { background: #10b981; }
.pbi-dot-blue { background: #38bdf8; }
.pbi-dot-amber { background: #f59e0b; }

/* -------------------------------------------------------------
 * 3. Navision General Ledger Matrix Grid (True ERP Table)
 * ----------------------------------------------------------- */
.nav-ledger-container {
    border: 1px solid var(--nav-border-card);
    border-radius: 10px;
    overflow-x: auto;
    background: var(--nav-bg-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.nav-ledger-table {
    width: 100%;
    min-width: 960px;
    border-collapse: collapse !important;
    border-spacing: 0;
    text-align: left;
    font-size: 0.8125rem;
    line-height: 1.25rem;
}

.nav-ledger-table th,
.nav-ledger-table td {
    border: 1px solid var(--nav-border-row) !important;
    padding: 0.5rem 0.75rem !important;
    vertical-align: middle;
}

.nav-ledger-table thead th {
    background-color: var(--nav-header-bg) !important;
    color: var(--nav-header-text) !important;
    font-weight: 700 !important;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-bottom: 2px solid var(--nav-border-card) !important;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.nav-ledger-table tbody tr:nth-child(even) {
    background-color: var(--nav-row-even);
}

.nav-ledger-table tbody tr:hover {
    background-color: var(--nav-row-hover) !important;
}

/* Navision Account Hierarchy Indentation */
.nav-acc-no {
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-weight: 700;
    color: var(--nav-text-main);
    white-space: nowrap;
}

.nav-acc-name {
    color: var(--nav-text-main);
}

.nav-indent-0 { font-weight: 700; padding-left: 0.75rem !important; }
.nav-indent-1 { font-weight: 600; padding-left: 1.75rem !important; }
.nav-indent-2 { font-weight: 500; padding-left: 2.75rem !important; }
.nav-indent-3 { font-weight: 400; padding-left: 3.75rem !important; }

/* Financial Figures (Right Aligned, Monospace) */
.nav-num {
    text-align: right;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.nav-num-neg {
    color: #dc2626 !important;
    font-weight: 700;
}

:is(.dark) .nav-num-neg {
    color: #f87171 !important;
}

.nav-num-pos {
    color: var(--nav-text-main);
}

/* Totals / Balanced Ledger Proof Row */
.nav-ledger-footer {
    background-color: var(--nav-header-bg) !important;
    font-weight: 800 !important;
    border-top: 2px solid var(--nav-border-card) !important;
}

/* -------------------------------------------------------------
 * 4. Navision FastTab & Ribbon Styling
 * ----------------------------------------------------------- */
.nav-fasttab {
    background: var(--nav-bg-card);
    border: 1px solid var(--nav-border-card);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.nav-ribbon-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* -------------------------------------------------------------
 * 5. Strict Global Icon & SVG Sizing Guardrails
 * ----------------------------------------------------------- */
.nav-icon-16 {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    min-height: 16px !important;
    display: inline-block;
    flex-shrink: 0;
}

.nav-icon-20 {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    display: inline-block;
    flex-shrink: 0;
}

/* Guard against unconstrained SVGs anywhere in the portal */
.fi-page svg,
.fi-header svg,
.fi-section svg,
.fi-ta svg {
    max-width: 24px;
    max-height: 24px;
}

.pbi-kpi-icon svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    max-width: 20px !important;
}

.fi-btn svg,
button svg {
    max-width: 20px !important;
    max-height: 20px !important;
    flex-shrink: 0;
}

.fi-badge svg {
    max-width: 14px !important;
    max-height: 14px !important;
}

.fi-tabs-item svg {
    max-width: 18px !important;
    max-height: 18px !important;
}

/* -------------------------------------------------------------
 * 6. Navision / Business Central Grid Styling for ALL Tables
 * ----------------------------------------------------------- */
.fi-ta-table {
    border-collapse: collapse !important;
    border: 1px solid var(--nav-border-card) !important;
    border-radius: 8px;
    overflow: hidden;
}

.fi-ta-table thead th,
.fi-ta-header-cell {
    background-color: var(--nav-header-bg) !important;
    color: var(--nav-header-text) !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    border-bottom: 2px solid var(--nav-border-card) !important;
    border-right: 1px solid var(--nav-border-row) !important;
    padding: 0.5rem 0.75rem !important;
}

.fi-ta-table tbody td,
.fi-ta-cell {
    border: 1px solid var(--nav-border-row) !important;
    padding: 0.45rem 0.75rem !important;
    font-size: 0.8125rem !important;
    vertical-align: middle !important;
}

.fi-ta-table tbody tr:nth-child(even) {
    background-color: var(--nav-row-even) !important;
}

.fi-ta-table tbody tr:hover {
    background-color: var(--nav-row-hover) !important;
}

/* Form Input & Slicer Polish */
.fi-input-wrp {
    border-radius: 6px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

/* Compact Section Spacing */
.fi-section {
    border-radius: 10px !important;
    border-color: var(--nav-border-card) !important;
}

.fi-section-header {
    border-bottom: 1px solid var(--nav-border-row) !important;
    padding: 0.875rem 1.25rem !important;
}

/* Pagination polish */
nav[role="navigation"] {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* -------------------------------------------------------------
 * 7. Navision Group Card Accordion & Multi-Select Styling
 * ----------------------------------------------------------- */
.nav-group-card {
    border: 1px solid var(--nav-border-card);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    background: var(--nav-bg-card);
    overflow: hidden;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.nav-group-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

:is(.dark) .nav-group-card:hover {
    border-color: #475569;
}

.nav-group-header {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--nav-header-bg);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.nav-group-header:hover {
    background-color: var(--nav-row-hover);
}

.nav-group-header-expanded {
    border-bottom: 1px solid var(--nav-border-row);
}

.nav-group-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.nav-group-chevron {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    color: var(--nav-text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.nav-group-chevron-open {
    transform: rotate(90deg);
}

.nav-group-content {
    padding: 0.75rem 1rem;
    background-color: var(--nav-bg-card);
}

/* Multi-select box styling */
.nav-multiselect-container {
    border: 1px solid var(--nav-border-card);
    border-radius: 8px;
    background-color: var(--nav-bg-canvas);
    padding: 0.625rem;
    margin-top: 0.375rem;
}

.nav-multiselect-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--nav-border-card);
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.nav-multiselect-list {
    max-height: 240px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-right: 0.25rem;
}

.nav-multiselect-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: background-color 0.1s ease;
}

.nav-multiselect-item:hover {
    background-color: var(--nav-row-hover);
}

.nav-multiselect-item-selected {
    background-color: var(--pbi-blue-bg) !important;
}

/* Minimal Selected Tray below multiselect */
.nav-selected-tray {
    margin-top: 0.5rem;
    padding: 0.5rem 0.625rem;
    border-radius: 6px;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
}

.dark .nav-selected-tray {
    background-color: #0f172a;
    border-color: #334155;
}

.nav-selected-tray-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.375rem;
}

.nav-selected-tray-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
}

.dark .nav-selected-tray-title {
    color: #94a3b8;
}

.nav-selected-tray-count {
    font-size: 0.6875rem;
    font-weight: 700;
    font-family: ui-monospace, monospace;
    color: #0284c7;
}

.dark .nav-selected-tray-count {
    color: #38bdf8;
}

.nav-selected-tray-clear {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #94a3b8;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease;
}

.nav-selected-tray-clear:hover {
    color: #ef4444;
    text-decoration: underline;
}

.nav-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    max-height: 84px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.nav-selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.45rem;
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    font-family: ui-monospace, monospace;
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.25;
}

.dark .nav-selected-chip {
    background-color: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border-color: rgba(59, 130, 246, 0.35);
}

.nav-selected-chip-indigo {
    background-color: #f5f3ff;
    color: #6d28d9;
    border-color: #ddd6fe;
}

.dark .nav-selected-chip-indigo {
    background-color: rgba(124, 58, 237, 0.15);
    color: #c4b5fd;
    border-color: rgba(124, 58, 237, 0.35);
}

.nav-selected-chip-remove {
    cursor: pointer;
    opacity: 0.55;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    font-size: 0.75rem;
    line-height: 1;
    border: none;
    background: transparent;
    padding: 0;
    color: inherit;
    transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.nav-selected-chip-remove:hover {
    opacity: 1;
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.15);
}

.nav-selected-tray-empty {
    margin-top: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    background-color: rgba(241, 245, 249, 0.5);
    border: 1px dashed #e2e8f0;
}

.dark .nav-selected-tray-empty {
    background-color: rgba(15, 23, 42, 0.4);
    border-color: #334155;
    color: #64748b;
}

/* -------------------------------------------------------------
 * 8. Navision High-Density Pagination & Top Filter Toolbar
 * ----------------------------------------------------------- */
.nav-filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    margin-bottom: 0.75rem;
    background: var(--nav-bg-card);
    border: 1px solid var(--nav-border-card);
    border-radius: 8px;
    flex-wrap: wrap;
}

.nav-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.nav-filter-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nav-text-muted);
}

.nav-filter-select {
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid var(--nav-border-row);
    background-color: var(--nav-bg-card);
    color: var(--nav-text-main);
    padding: 0.35rem 0.65rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.nav-filter-select:focus {
    border-color: #0284c7;
}

.nav-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: var(--nav-header-bg);
    border-top: 1px solid var(--nav-border-row);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    font-size: 0.75rem;
    color: var(--nav-text-muted);
    flex-wrap: wrap;
}

.nav-pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--nav-border-row);
    background: var(--nav-bg-card);
    color: var(--nav-text-main);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.nav-pagination-btn:hover:not(:disabled) {
    background: var(--nav-row-hover);
    border-color: #cbd5e1;
}

.nav-pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-pagination-btn.active {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

/* -------------------------------------------------------------
 * 12. Formula Live Sandbox & Syntax Reference Guide
 * ----------------------------------------------------------- */
.sandbox-template-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--nav-header-bg);
    border: 1px solid var(--nav-border-row);
    border-radius: 8px;
    margin-bottom: 1rem;
}

.sandbox-template-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 600;
    background: var(--nav-bg-card);
    border: 1px solid var(--nav-border-card);
    color: var(--nav-text-main);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.sandbox-template-pill:hover {
    border-color: #0284c7;
    background: var(--pbi-blue-bg);
    color: #0284c7;
    transform: translateY(-1px);
}

.sandbox-template-pill .pill-stage {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: #e2e8f0;
    color: #475569;
}

:is(.dark) .sandbox-template-pill .pill-stage {
    background: #334155;
    color: #94a3b8;
}

.sandbox-guide-container {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.sandbox-guide-category {
    background: var(--nav-bg-card);
    border: 1px solid var(--nav-border-card);
    border-radius: 10px;
    padding: 1.125rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.sandbox-guide-cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--nav-border-row);
}

.sandbox-guide-cat-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--nav-text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sandbox-guide-cat-desc {
    font-size: 0.75rem;
    color: var(--nav-text-muted);
}

.sandbox-formula-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0.75rem;
}

.sandbox-formula-card {
    background: var(--nav-header-bg);
    border: 1px solid var(--nav-border-row);
    border-radius: 8px;
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.5rem;
    transition: border-color 0.15s ease;
}

.sandbox-formula-card:hover {
    border-color: #94a3b8;
}

.sandbox-formula-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.sandbox-formula-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--nav-text-main);
}

.sandbox-formula-syntax {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    color: #0284c7;
    background: var(--pbi-blue-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px dashed rgba(2, 132, 199, 0.3);
    word-break: break-all;
}

.sandbox-formula-expl {
    font-size: 0.75rem;
    color: var(--nav-text-muted);
    line-height: 1.35;
}

.sandbox-formula-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.sandbox-try-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 6px;
    background: #0284c7;
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sandbox-try-btn:hover {
    background: #0369a1;
    transform: translateY(-1px);
}

/* -------------------------------------------------------------
 * 13. Log Analyzer Hub Styling (Power BI & Navision Integration)
 * ----------------------------------------------------------- */
.log-pills-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem 0;
}

.log-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    border: 1px solid var(--nav-border-card);
    background: var(--nav-bg-card);
    color: var(--nav-text-main);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.log-pill-btn:hover {
    background: var(--nav-row-hover);
    border-color: #94a3b8;
}

.log-pill-btn.active {
    background: #d97706 !important;
    border-color: #d97706 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 3px rgba(217, 119, 6, 0.3);
}

.log-pill-badge {
    padding: 0.1rem 0.45rem;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.08);
}

.log-pill-btn.active .log-pill-badge {
    background: rgba(0, 0, 0, 0.25);
    color: #ffffff;
}

:is(.dark) .log-pill-badge {
    background: rgba(255, 255, 255, 0.15);
}

.log-filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.log-date-presets {
    display: inline-flex;
    align-items: center;
    background: var(--nav-header-bg);
    padding: 0.2rem;
    border-radius: 8px;
    border: 1px solid var(--nav-border-card);
}

.log-date-btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--nav-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.log-date-btn:hover {
    color: var(--nav-text-main);
}

.log-date-btn.active {
    background: #d97706;
    color: #ffffff;
    font-weight: 700;
}

.log-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
}

.log-modal-dialog {
    background: var(--nav-bg-card);
    border: 1px solid var(--nav-border-card);
    border-radius: 12px;
    width: 100%;
    max-width: 860px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

.log-modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--nav-border-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--nav-header-bg);
}

.log-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.log-modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--nav-border-card);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    background: var(--nav-header-bg);
}

.log-json-pre {
    background: #090d16;
    color: #34d399;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #1e293b;
    overflow-x: auto;
    max-height: 380px;
    line-height: 1.5;
}

.log-trace-pre {
    background: #090d16;
    color: #e2e8f0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.725rem;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #1e293b;
    overflow-x: auto;
    max-height: 380px;
    line-height: 1.4;
    white-space: pre-wrap;
}

/*/* -------------------------------------------------------------
 * 14. High-Contrast Form Checkboxes (Google Titanium & Cyberpunk Terminal)
 * ----------------------------------------------------------- */
input[type="checkbox"],
.fi-checkbox-input {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    border: 2px solid #5f6368 !important; /* High-contrast Titanium Slate */
    border-radius: 4px !important;
    background-color: #ffffff !important;
    cursor: pointer !important;
    display: inline-grid !important;
    place-content: center !important;
    vertical-align: middle !important;
    margin: 0 !important;
    outline: none !important;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.12) !important;
    transition: all 0.15s ease-in-out !important;
}

:is(.dark) input[type="checkbox"],
:is(.dark) .fi-checkbox-input,
html.dark input[type="checkbox"],
html.dark .fi-checkbox-input {
    border-color: rgba(0, 255, 102, 0.6) !important; /* Cyberpunk Phosphor Border */
    background-color: #0a0a0a !important;
    box-shadow: 0 0 6px rgba(0, 255, 102, 0.15) !important;
}

/* Hover state */
input[type="checkbox"]:hover:not(:disabled),
.fi-checkbox-input:hover:not(:disabled) {
    border-color: #1a73e8 !important;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.22) !important;
}

:is(.dark) input[type="checkbox"]:hover:not(:disabled),
:is(.dark) .fi-checkbox-input:hover:not(:disabled),
html.dark input[type="checkbox"]:hover:not(:disabled),
html.dark .fi-checkbox-input:hover:not(:disabled) {
    border-color: #00ff66 !important;
    box-shadow: 0 0 0 3px rgba(0, 255, 102, 0.3) !important;
}

/* Checked state - Day Theme (Google Cobalt Blue) */
input[type="checkbox"]:checked,
.fi-checkbox-input:checked {
    background-color: #1a73e8 !important;
    border-color: #1a73e8 !important;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e") !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Checked state - Night Theme (Hacker Phosphor Green with pitch-black checkmark) */
:is(.dark) input[type="checkbox"]:checked,
:is(.dark) .fi-checkbox-input:checked,
html.dark input[type="checkbox"]:checked,
html.dark .fi-checkbox-input:checked {
    background-color: #00ff66 !important;
    border-color: #00ff66 !important;
    box-shadow: 0 0 8px rgba(0, 255, 102, 0.5) !important;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='%23050505' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e") !important;
}

/* Indeterminate state - Day */
input[type="checkbox"]:indeterminate,
.fi-checkbox-input:indeterminate {
    background-color: #1a73e8 !important;
    border-color: #1a73e8 !important;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M4 8h8' stroke='white' stroke-width='2.5' stroke-linecap='round'/%3e%3c/svg%3e") !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Indeterminate state - Night */
:is(.dark) input[type="checkbox"]:indeterminate,
:is(.dark) .fi-checkbox-input:indeterminate,
html.dark input[type="checkbox"]:indeterminate,
html.dark .fi-checkbox-input:indeterminate {
    background-color: #00ff66 !important;
    border-color: #00ff66 !important;
    box-shadow: 0 0 8px rgba(0, 255, 102, 0.5) !important;
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M4 8h8' stroke='%23050505' stroke-width='2.5' stroke-linecap='round'/%3e%3c/svg%3e") !important;
}

/* Focus visible */
input[type="checkbox"]:focus-visible,
.fi-checkbox-input:focus-visible {
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.35) !important;
}
:is(.dark) input[type="checkbox"]:focus-visible,
:is(.dark) .fi-checkbox-input:focus-visible,
html.dark input[type="checkbox"]:focus-visible,
html.dark .fi-checkbox-input:focus-visible {
    box-shadow: 0 0 0 3px rgba(0, 255, 102, 0.45) !important;
}

/* -------------------------------------------------------------
 * 15. Solid Opaque Floating Dropdowns (Google Titanium & Cyberpunk Void)
 * ----------------------------------------------------------- */
.fi-dropdown-panel,
.fi-dropdown-list,
[id^="fi-select-input-dropdown-"],
.fi-fo-select-dropdown,
.fi-select-dropdown {
    background-color: #ffffff !important;
    border: 1px solid #dadce0 !important;
    border-radius: 8px !important;
    box-shadow: 0 8px 24px -4px rgba(60, 64, 67, 0.15), 0 2px 6px -1px rgba(60, 64, 67, 0.1) !important;
    color: #202124 !important;
    z-index: 1000 !important;
}

:is(.dark) .fi-dropdown-panel,
:is(.dark) .fi-dropdown-list,
:is(.dark) [id^="fi-select-input-dropdown-"],
:is(.dark) .fi-fo-select-dropdown,
:is(.dark) .fi-select-dropdown,
html.dark .fi-dropdown-panel,
html.dark .fi-dropdown-list,
html.dark [id^="fi-select-input-dropdown-"],
html.dark .fi-fo-select-dropdown,
html.dark .fi-select-dropdown {
    background-color: #121212 !important;
    border: 1px solid rgba(0, 255, 102, 0.25) !important;
    box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.85), 0 0 15px rgba(0, 255, 102, 0.1) !important;
    color: #f8fafc !important;
}

/* Dropdown Search Box Container */
.fi-select-input-search-ctn {
    background-color: #f8f9fa !important;
    border-bottom: 1px solid #dadce0 !important;
    padding: 0.5rem !important;
}

:is(.dark) .fi-select-input-search-ctn,
html.dark .fi-select-input-search-ctn {
    background-color: #0a0a0a !important;
    border-bottom: 1px solid #1e293b !important;
}

.fi-select-input-search-ctn input,
.fi-select-input-search-ctn .fi-input {
    background-color: #ffffff !important;
    border: 1px solid #dadce0 !important;
    color: #202124 !important;
    border-radius: 6px !important;
}

:is(.dark) .fi-select-input-search-ctn input,
:is(.dark) .fi-select-input-search-ctn .fi-input,
html.dark .fi-select-input-search-ctn input,
html.dark .fi-select-input-search-ctn .fi-input {
    background-color: #050505 !important;
    border: 1px solid rgba(0, 255, 102, 0.3) !important;
    color: #f8fafc !important;
}

/* Dropdown Options List Items */
.fi-dropdown-list-item,
.fi-select-input-option {
    background-color: transparent !important;
    color: #202124 !important;
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8125rem !important;
    transition: background-color 0.1s ease !important;
    cursor: pointer !important;
}

:is(.dark) .fi-dropdown-list-item,
:is(.dark) .fi-select-input-option,
html.dark .fi-dropdown-list-item,
html.dark .fi-select-input-option {
    color: #f8fafc !important;
}

.fi-dropdown-list-item:hover,
.fi-select-input-option:hover,
.fi-dropdown-list-item.fi-active,
.fi-select-input-option.fi-active,
.fi-select-input-option[aria-selected="true"] {
    background-color: #e8f0fe !important;
    color: #1a73e8 !important;
    border-left: 3px solid #1a73e8 !important;
}

:is(.dark) .fi-dropdown-list-item:hover,
:is(.dark) .fi-select-input-option:hover,
:is(.dark) .fi-dropdown-list-item.fi-active,
:is(.dark) .fi-select-input-option.fi-active,
:is(.dark) .fi-select-input-option[aria-selected="true"],
html.dark .fi-dropdown-list-item:hover,
html.dark .fi-select-input-option:hover,
html.dark .fi-dropdown-list-item.fi-active,
html.dark .fi-select-input-option.fi-active,
html.dark .fi-select-input-option[aria-selected="true"] {
    background-color: rgba(0, 255, 102, 0.12) !important;
    color: #00ff66 !important;
    border-left: 3px solid #00ff66 !important;
}

/* -------------------------------------------------------------
 * 16. Financial Statement Reports & Design Customization Styles
 * ----------------------------------------------------------- */
.fs-toolbar-card {
    background: var(--nav-bg-card);
    border: 1px solid var(--nav-border-card);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.fs-filter-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
}

.fs-filter-control {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.fs-filter-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nav-text-muted);
}

.fs-filter-select {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid var(--nav-border-row);
    background-color: var(--nav-bg-card);
    color: var(--nav-text-main);
    min-width: 140px;
    outline: none;
    transition: border-color 0.15s ease;
}

.fs-filter-select:focus {
    border-color: var(--nav-accent);
}

.fs-filter-select:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background-color: rgba(148, 163, 184, 0.1);
}

/* Mutually Exclusive Dimension Selector Pills */
.fs-dimension-pills {
    display: inline-flex;
    align-items: center;
    background: var(--nav-header-bg);
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid var(--nav-border-card);
    gap: 0.25rem;
}

.fs-dim-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--nav-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.fs-dim-btn:hover {
    color: var(--nav-text-main);
}

.fs-dim-btn.active {
    background: #1a73e8 !important;
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(26, 115, 232, 0.35);
}

:is(.dark) .fs-dim-btn.active,
html.dark .fs-dim-btn.active {
    background: #00ff66 !important;
    color: #050505 !important;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(0, 255, 102, 0.45);
}

/* Line Design Styling Classes (propagated from Admin to both panels) */
.nav-line-amber {
    color: #d97706 !important;
}
:is(.dark) .nav-line-amber {
    color: #fbbf24 !important;
}

.nav-line-green {
    color: #059669 !important;
}
:is(.dark) .nav-line-green {
    color: #34d399 !important;
}

.nav-line-blue {
    color: #0284c7 !important;
}
:is(.dark) .nav-line-blue {
    color: #38bdf8 !important;
}

.nav-line-red {
    color: #dc2626 !important;
}
:is(.dark) .nav-line-red {
    color: #f87171 !important;
}

.nav-line-purple {
    color: #7c3aed !important;
}
:is(.dark) .nav-line-purple {
    color: #a78bfa !important;
}

.nav-line-muted {
    color: #64748b !important;
}
:is(.dark) .nav-line-muted {
    color: #94a3b8 !important;
}

.nav-line-bold {
    font-weight: 700 !important;
}

.nav-line-italic {
    font-style: italic !important;
}

.nav-line-underline {
    text-decoration: underline !important;
}

/* Admin Design Controls Drawer / Section */
.fs-admin-design-panel {
    background: var(--nav-bg-card);
    border: 1px solid var(--pbi-amber);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 6px -1px rgba(217, 119, 6, 0.1);
}

.fs-admin-design-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--nav-border-row);
}

/* -------------------------------------------------------------
 * 17. Comprehensive UI System Theming: Google Titanium & Cyberpunk Terminal
 * ----------------------------------------------------------- */

/* Monospace font standard for badges, system logs, session dumps, code tags */
code, pre, kbd, samp,
.font-mono,
.fi-badge,
.fi-ta-text-item-monospace,
[data-font-mono] {
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', Courier, monospace !important;
}

/* =============================================================
 * Day Theme: "Google Titanium" Overrides (Light Mode)
 * ============================================================= */
html:not(.dark),
html:not(.dark) body,
html:not(.dark) .fi-layout,
html:not(.dark) .fi-main-ctn,
html:not(.dark) .fi-main {
    background-color: #f8f9fa !important;
    color: #202124 !important;
}

/* Light Topbar */
html:not(.dark) .fi-topbar {
    background-color: #ffffff !important;
    border-bottom: 1px solid #dadce0 !important;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.08) !important;
}

/* Light Sidebar */
html:not(.dark) .fi-sidebar {
    background-color: #ffffff !important;
    border-right: 1px solid #dadce0 !important;
}

html:not(.dark) .fi-sidebar-item-active .fi-sidebar-item-btn {
    background-color: #e8f0fe !important;
    color: #1a73e8 !important;
    font-weight: 600 !important;
}

/* Light Cards, Sections & Tables */
html:not(.dark) .fi-section,
html:not(.dark) .fi-ta-ctn,
html:not(.dark) .fi-page-header-ctn,
html:not(.dark) .fi-modal-window,
html:not(.dark) .fi-widget {
    background-color: #ffffff !important;
    border: 1px solid #dadce0 !important;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.08) !important;
}

html:not(.dark) thead tr,
html:not(.dark) .fi-ta-header,
html:not(.dark) .fi-ta-header-ctn {
    background-color: #f1f3f4 !important;
    border-bottom: 1px solid #dadce0 !important;
}

html:not(.dark) thead th {
    color: #3c4043 !important;
    font-weight: 600 !important;
}

html:not(.dark) tbody tr {
    border-bottom: 1px solid #e2e8f0 !important;
}

html:not(.dark) tbody tr:hover {
    background-color: #f8f9fa !important;
}

/* Light Primary Buttons */
html:not(.dark) .fi-btn-primary,
html:not(.dark) .fi-color-primary.fi-btn {
    background-color: #1a73e8 !important;
    color: #ffffff !important;
    border: 1px solid #1a73e8 !important;
    box-shadow: 0 1px 2px rgba(26, 115, 232, 0.25) !important;
}

html:not(.dark) .fi-btn-primary:hover,
html:not(.dark) .fi-color-primary.fi-btn:hover {
    background-color: #185abc !important;
    border-color: #185abc !important;
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.35) !important;
}

/* Light Inputs & Form Controls */
html:not(.dark) .fi-input-wrp {
    background-color: #ffffff !important;
    border: 1px solid #dadce0 !important;
    color: #202124 !important;
}

html:not(.dark) .fi-input-wrp:focus-within {
    border-color: #1a73e8 !important;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.2) !important;
}

/* =============================================================
 * Night Theme: "Hacker / Cyberpunk Terminal" Overrides (Dark Mode)
 * ============================================================= */
html.dark,
html.dark body,
html.dark .fi-layout,
html.dark .fi-main-ctn,
html.dark .fi-main,
:is(.dark) body {
    background-color: #050505 !important;
    color: #f8fafc !important;
}

/* Cyberpunk Topbar & Navigation */
html.dark .fi-topbar {
    background-color: #0a0a0a !important;
    border-bottom: 1px solid rgba(0, 255, 102, 0.25) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.95), 0 0 15px rgba(0, 255, 102, 0.05) !important;
}

/* Cyberpunk Sidebar */
html.dark .fi-sidebar {
    background-color: #080808 !important;
    border-right: 1px solid rgba(0, 255, 102, 0.2) !important;
}

html.dark .fi-sidebar-item-active .fi-sidebar-item-btn {
    background-color: rgba(0, 255, 102, 0.12) !important;
    color: #00ff66 !important;
    border: 1px solid rgba(0, 255, 102, 0.35) !important;
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.2) !important;
    font-weight: 700 !important;
}

/* Cyberpunk Dark Cards, Sections & Modals */
html.dark .fi-section,
html.dark .fi-ta-ctn,
html.dark .fi-page-header-ctn,
html.dark .fi-modal-window,
html.dark .fi-widget {
    background-color: #121212 !important;
    border: 1px solid rgba(0, 255, 102, 0.2) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 12px rgba(0, 255, 102, 0.04) !important;
}

/* Cyberpunk Tables */
html.dark thead tr,
html.dark .fi-ta-header,
html.dark .fi-ta-header-ctn {
    background-color: #0a0a0a !important;
    border-bottom: 1px solid rgba(0, 255, 102, 0.25) !important;
}

html.dark thead th {
    color: #a7f3d0 !important;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', Courier, monospace !important;
    font-size: 0.75rem !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
}

html.dark tbody tr {
    border-bottom: 1px solid #1e293b !important;
}

html.dark tbody tr:hover {
    background-color: rgba(0, 255, 102, 0.06) !important;
}

html.dark tbody td {
    color: #f8fafc !important;
}

/* Cyberpunk Primary Action Buttons */
html.dark .fi-btn-primary,
html.dark .fi-color-primary.fi-btn {
    background-color: #00ff66 !important;
    color: #050505 !important;
    font-weight: 700 !important;
    border: 1px solid #00ff66 !important;
    box-shadow: 0 0 14px rgba(0, 255, 102, 0.4) !important;
    text-shadow: none !important;
}

html.dark .fi-btn-primary:hover,
html.dark .fi-color-primary.fi-btn:hover {
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 20px rgba(0, 255, 102, 0.6) !important;
}

/* Cyberpunk Inputs */
html.dark .fi-input-wrp {
    background-color: #0a0a0a !important;
    border: 1px solid rgba(0, 255, 102, 0.25) !important;
    color: #f8fafc !important;
}

html.dark .fi-input-wrp:focus-within {
    border-color: #00ff66 !important;
    box-shadow: 0 0 0 3px rgba(0, 255, 102, 0.25), 0 0 8px rgba(0, 255, 102, 0.3) !important;
}

html.dark .fi-input {
    color: #f8fafc !important;
}

/* Cyberpunk Badges */
html.dark .fi-badge.fi-color-primary {
    background-color: rgba(0, 255, 102, 0.15) !important;
    color: #00ff66 !important;
    border: 1px solid rgba(0, 255, 102, 0.4) !important;
    box-shadow: 0 0 6px rgba(0, 255, 102, 0.2) !important;
}

/* Financial statement admin design panel in dark mode */
:is(.dark) .fs-admin-design-panel,
html.dark .fs-admin-design-panel {
    background: #121212 !important;
    border: 1px solid rgba(0, 255, 102, 0.3) !important;
    box-shadow: 0 0 15px rgba(0, 255, 102, 0.1) !important;
}

/* -------------------------------------------------------------
 * 18. System & Infrastructure Management Components
 * Clean Enterprise Grid, Metric Cards, Explorer Tables & Controls
 * ----------------------------------------------------------- */

/* System Grid Systems */
.sys-grid-4 {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
@media (min-width: 640px) {
    .sys-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (min-width: 1024px) {
    .sys-grid-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.sys-grid-3 {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}
@media (min-width: 768px) {
    .sys-grid-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.sys-grid-2 {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
@media (min-width: 768px) {
    .sys-grid-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.sys-grid-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}
@media (min-width: 1024px) {
    .sys-grid-split {
        grid-template-columns: 360px 1fr;
    }
}

/* System Stat Metric Cards */
.sys-stat-card {
    background: var(--nav-bg-card);
    border: 1px solid var(--nav-border-card);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}
.sys-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
:is(.dark) .sys-stat-card,
html.dark .sys-stat-card {
    background: #121212 !important;
    border: 1px solid rgba(0, 255, 102, 0.2) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 10px rgba(0, 255, 102, 0.04) !important;
}
:is(.dark) .sys-stat-card:hover,
html.dark .sys-stat-card:hover {
    border-color: #00ff66 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 0 16px rgba(0, 255, 102, 0.2) !important;
}

/* Stat Icon Circle */
.sys-stat-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    max-width: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sys-stat-icon svg {
    width: 24px;
    height: 24px;
}
.sys-icon-emerald {
    background: #e6f4ea;
    color: #137333;
}
:is(.dark) .sys-icon-emerald,
html.dark .sys-icon-emerald {
    background: rgba(0, 255, 102, 0.15) !important;
    color: #00ff66 !important;
    border: 1px solid rgba(0, 255, 102, 0.3) !important;
}

.sys-icon-amber {
    background: #fef7e0;
    color: #e37400;
}
:is(.dark) .sys-icon-amber,
html.dark .sys-icon-amber {
    background: rgba(251, 191, 36, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid rgba(251, 191, 36, 0.3) !important;
}

.sys-icon-blue {
    background: #e8f0fe;
    color: #1a73e8;
}
:is(.dark) .sys-icon-blue,
html.dark .sys-icon-blue {
    background: rgba(56, 189, 248, 0.15) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.3) !important;
}

.sys-icon-indigo {
    background: #eff2fe;
    color: #5b5fc7;
}
:is(.dark) .sys-icon-indigo,
html.dark .sys-icon-indigo {
    background: rgba(129, 140, 248, 0.15) !important;
    color: #818cf8 !important;
    border: 1px solid rgba(129, 140, 248, 0.3) !important;
}

.sys-icon-red {
    background: #fce8e6;
    color: #d93025;
}
:is(.dark) .sys-icon-red,
html.dark .sys-icon-red {
    background: rgba(248, 113, 113, 0.15) !important;
    color: #f87171 !important;
    border: 1px solid rgba(248, 113, 113, 0.3) !important;
}

/* Stat Body & Typography */
.sys-stat-body {
    flex: 1;
    min-width: 0;
}
.sys-stat-label {
    font-size: 0.725rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nav-text-muted);
    margin-bottom: 0.25rem;
}
.sys-stat-val {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--nav-text-main);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
:is(.dark) .sys-stat-val,
html.dark .sys-stat-val {
    color: #f8fafc !important;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.sys-stat-sub {
    font-size: 0.75rem;
    color: var(--nav-text-muted);
    margin-top: 0.25rem;
}

/* System Action & Banner Bars */
.sys-action-bar {
    background: var(--nav-bg-card);
    border: 1px solid var(--nav-border-card);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
:is(.dark) .sys-action-bar,
html.dark .sys-action-bar {
    background: #121212 !important;
    border: 1px solid rgba(0, 255, 102, 0.2) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6) !important;
}

.sys-action-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--nav-text-main);
}
:is(.dark) .sys-action-title,
html.dark .sys-action-title {
    color: #00ff66 !important;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.sys-action-desc {
    font-size: 0.75rem;
    color: var(--nav-text-muted);
    margin-top: 0.25rem;
}

/* System Buttons */
.sys-btn-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
}
.sys-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.2;
}
.sys-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.sys-btn:disabled,
.sys-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

.sys-btn-primary {
    background: #1a73e8;
    color: #ffffff;
    border-color: #1a73e8;
}
.sys-btn-primary:hover:not(:disabled) {
    background: #185abc;
    border-color: #185abc;
}
:is(.dark) .sys-btn-primary,
html.dark .sys-btn-primary {
    background: #00ff66 !important;
    color: #050505 !important;
    border-color: #00ff66 !important;
    font-weight: 700;
    box-shadow: 0 0 12px rgba(0, 255, 102, 0.4);
}
:is(.dark) .sys-btn-primary:hover:not(:disabled),
html.dark .sys-btn-primary:hover:not(:disabled) {
    background: #10b981 !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 18px rgba(0, 255, 102, 0.6);
}

.sys-btn-emerald {
    background: #137333;
    color: #ffffff;
    border-color: #137333;
}
.sys-btn-emerald:hover:not(:disabled) {
    background: #0d5a27;
}
:is(.dark) .sys-btn-emerald,
html.dark .sys-btn-emerald {
    background: rgba(0, 255, 102, 0.15) !important;
    color: #00ff66 !important;
    border: 1px solid #00ff66 !important;
}
:is(.dark) .sys-btn-emerald:hover:not(:disabled),
html.dark .sys-btn-emerald:hover:not(:disabled) {
    background: rgba(0, 255, 102, 0.28) !important;
    box-shadow: 0 0 12px rgba(0, 255, 102, 0.4);
}

.sys-btn-amber {
    background: #e37400;
    color: #ffffff;
    border-color: #e37400;
}
.sys-btn-amber:hover:not(:disabled) {
    background: #c26100;
}
:is(.dark) .sys-btn-amber,
html.dark .sys-btn-amber {
    background: rgba(251, 191, 36, 0.15) !important;
    color: #fbbf24 !important;
    border: 1px solid #fbbf24 !important;
}
:is(.dark) .sys-btn-amber:hover:not(:disabled),
html.dark .sys-btn-amber:hover:not(:disabled) {
    background: rgba(251, 191, 36, 0.28) !important;
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}

.sys-btn-secondary {
    background: #ffffff;
    color: #3c4043;
    border-color: #dadce0;
}
.sys-btn-secondary:hover:not(:disabled) {
    background: #f1f3f4;
}
:is(.dark) .sys-btn-secondary,
html.dark .sys-btn-secondary {
    background: #1a1a1a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}
:is(.dark) .sys-btn-secondary:hover:not(:disabled),
html.dark .sys-btn-secondary:hover:not(:disabled) {
    background: #262626 !important;
    border-color: #475569 !important;
}

.sys-btn-danger {
    background: #fce8e6;
    color: #d93025;
    border-color: #fad2cf;
}
.sys-btn-danger:hover:not(:disabled) {
    background: #fad2cf;
}
:is(.dark) .sys-btn-danger,
html.dark .sys-btn-danger {
    background: rgba(248, 113, 113, 0.15) !important;
    color: #f87171 !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
}
:is(.dark) .sys-btn-danger:hover:not(:disabled),
html.dark .sys-btn-danger:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.25) !important;
    border-color: #f87171 !important;
}

.sys-btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

/* System Container & Tables */
.sys-table-container {
    background: var(--nav-bg-card);
    border: 1px solid var(--nav-border-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.25rem;
}
:is(.dark) .sys-table-container,
html.dark .sys-table-container {
    background: #121212 !important;
    border: 1px solid rgba(0, 255, 102, 0.2) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6) !important;
}

.sys-table-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--nav-border-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--nav-header-bg);
}
:is(.dark) .sys-table-header,
html.dark .sys-table-header {
    background: #0a0a0a !important;
    border-bottom: 1px solid rgba(0, 255, 102, 0.25) !important;
}
.sys-table-header-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--nav-text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
:is(.dark) .sys-table-header-title,
html.dark .sys-table-header-title {
    color: #a7f3d0 !important;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

.sys-table-scroll {
    overflow-x: auto;
    width: 100%;
}
.sys-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.8125rem;
}
.sys-table th {
    padding: 0.75rem 1.25rem;
    font-size: 0.725rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--nav-header-bg);
    color: var(--nav-text-muted);
    border-bottom: 1px solid var(--nav-border-card);
}
:is(.dark) .sys-table th,
html.dark .sys-table th {
    background: #0a0a0a !important;
    color: #a7f3d0 !important;
    border-bottom: 1px solid rgba(0, 255, 102, 0.2) !important;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.sys-table td {
    padding: 0.85rem 1.25rem;
    color: var(--nav-text-main);
    border-bottom: 1px solid var(--nav-border-row);
    vertical-align: middle;
}
:is(.dark) .sys-table td,
html.dark .sys-table td {
    color: #f8fafc !important;
    border-bottom: 1px solid #1e293b !important;
}
.sys-table tbody tr:hover {
    background: var(--nav-row-hover);
}
:is(.dark) .sys-table tbody tr:hover,
html.dark .sys-table tbody tr:hover {
    background: rgba(0, 255, 102, 0.05) !important;
}

.sys-empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--nav-text-muted);
}
.sys-empty-state svg {
    width: 44px;
    height: 44px;
    margin: 0 auto 0.75rem auto;
    opacity: 0.6;
}

/* Terminal & API Endpoints Box */
.sys-endpoint-box {
    background: #f8f9fa;
    border: 1px solid #dadce0;
    border-radius: 8px;
    padding: 0.65rem 0.85rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
:is(.dark) .sys-endpoint-box,
html.dark .sys-endpoint-box {
    background: #0a0a0a !important;
    border: 1px solid rgba(0, 255, 102, 0.2) !important;
    color: #f8fafc !important;
}
.sys-method-badge {
    padding: 0.15rem 0.45rem;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 4px;
    letter-spacing: 0.05em;
}
.sys-method-get {
    background: #e6f4ea;
    color: #137333;
}
:is(.dark) .sys-method-get,
html.dark .sys-method-get {
    background: rgba(0, 255, 102, 0.18) !important;
    color: #00ff66 !important;
    border: 1px solid rgba(0, 255, 102, 0.4) !important;
}
.sys-method-post {
    background: #e8f0fe;
    color: #1a73e8;
}
:is(.dark) .sys-method-post,
html.dark .sys-method-post {
    background: rgba(56, 189, 248, 0.18) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.4) !important;
}




