/* Master Stylesheet for Personal Finance App */

:root {
    /* --- LIGHT MODE --- */
    --bg-app: #F5F7FA;
    --bg-surface: #FFFFFF;
    --text-primary: #252A34;
    --text-secondary: #788195;
    --brand-pos: #08D9D6;
    --text-brand-pos-readable: #009E9B;
    /* Readable Teal for Light Mode */
    --brand-neg: #FF2E63;

    /* Mapping to BS variables where possible, or using custom */
    --bg-body: var(--bg-app);
    --bg-card: var(--bg-surface);
    --text-main: var(--text-primary);
    --text-muted: var(--text-secondary);
    --border-color: var(--text-secondary);
    /* Defined border */
    --shadow-color: rgba(0, 0, 0, 0.15);
    /* Stronger shadow for light mode */
    --chart-fill-opacity: 0.3;
    /* More visible charts in light mode */

    /* Bootstrap Overrides */
    --bs-primary: var(--brand-pos);
    --bs-danger: var(--brand-neg);
}

[data-bs-theme="dark"] {
    /* --- DARK MODE --- */
    --bg-app: #252A34;
    --bg-surface: #2F3640;
    --text-primary: #EAEAEA;
    --text-secondary: #959FA8;
    --brand-pos: #08D9D6;
    /* Same Neon Cyan */
    --text-brand-pos-readable: #08D9D6;
    /* Keep Neon in Dark Mode */
    --brand-neg: #FF2E63;
    /* Same Neon Pink */

    --bg-body: var(--bg-app);
    --bg-card: var(--bg-surface);
    --text-main: var(--text-primary);
    --text-muted: var(--text-secondary);
    --border-color: var(--text-secondary);
    --shadow-color: rgba(0, 0, 0, 0.25);
    --chart-fill-opacity: 0.1;
    /* Keep subtle in dark mode */

    /* Bootstrap Overrides */
    --bs-primary: var(--brand-pos);
    --bs-danger: var(--brand-neg);
    --bs-body-bg: var(--bg-app);
    --bs-body-color: var(--text-primary);
}

/* --- COMPONENT STYLES --- */

/* Primary Button: Cyan Background, Dark Text */
.btn-primary {
    background-color: var(--brand-pos) !important;
    border-color: var(--brand-pos) !important;
    color: #252A34 !important;
    /* Always dark */
    font-weight: 600;
}

/* Button Outline Primary Override (Cyan) */
.btn-outline-primary {
    color: var(--brand-pos);
    border-color: var(--brand-pos);
}

.btn-outline-primary:hover {
    background-color: var(--brand-pos);
    border-color: var(--brand-pos);
    color: #252A34;
    /* Dark text on hover */
}

.btn-primary:hover {
    filter: brightness(0.9);
}

/* Secondary Button: Outline Style */
.btn-secondary {
    background-color: transparent !important;
    border: 1px solid var(--text-secondary) !important;
    color: var(--text-secondary) !important;
}

.btn-secondary:hover {
    background-color: transparent !important;
    border-color: var(--brand-pos) !important;
    color: var(--brand-pos) !important;
}

/* Sidebar / Nav: Always Dark */
.navbar {
    background-color: #252A34 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.navbar-brand,
.navbar {
    background-color: #252A34;
    /* Dark Gunmetal */
}

.navbar-nav .nav-link {
    color: #EAEAEA !important;
    /* Force Light Text */
}

.navbar-nav .nav-link:hover {
    color: #08D9D6 !important;
    /* Glow Cyan on hover */
}

.navbar-nav .nav-link.active {
    color: #08D9D6 !important;
    /* Brand Cyan */
    font-weight: bold;
}

.navbar-toggler-icon {
    filter: invert(1);
}

[data-bs-theme="dark"] .navbar-toggler-icon {
    filter: none;
}

.navbar-toggler {
    border-color: #788195;
    /* Make the box visible */
}

.btn-link {
    color: #FFFFFF !important;
}

.nav-link.active {
    color: var(--brand-pos) !important;
    font-weight: 700;
}

/* Text Secondary Override */
.text-secondary {
    color: var(--text-secondary) !important;
}

/* Force topnav to dark even in light mode contexts if needed */
[data-bs-theme="light"] .navbar {
    background-color: #252A34 !important;
}

/* Input Fields */
input,
select,
textarea,
.form-control,
.form-select {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--text-secondary) !important;
    color: var(--text-primary) !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
    box-sizing: border-box !important; /* Ensures padding doesn't break widths */
    line-height: 1.5 !important;
}

/* Specific fix for select dropdown arrows */
select, .form-select {
    /* Ensures the text doesn't overlap the dropdown arrow on the right */
    padding-right: 36px !important;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-pos) !important;
    box-shadow: 0 0 0 0.25rem rgba(8, 217, 214, 0.25) !important;
}

.form-check-input:checked {
    background-color: var(--brand-pos);
    border-color: var(--brand-pos);
}

/* Cards / Containers */
.card {
    background-color: var(--bg-surface);
    border: none;
    box-shadow: 0 2px 8px var(--shadow-color);
}

/* Text & Brand Utilities */
.text-brand-pos {
    color: var(--brand-pos) !important;
}

.text-brand-pos-readable {
    color: var(--text-brand-pos-readable) !important;
}

.text-brand-neg {
    color: var(--brand-neg) !important;
}

.bg-brand-pos {
    background-color: var(--brand-pos) !important;
}

.bg-brand-neg {
    background-color: var(--brand-neg) !important;
}

/* Widgets Styling */
.widget-income {
    border-top: 4px solid var(--brand-pos);
}

.widget-expense {
    border-top: 4px solid var(--brand-neg);
}

.border-brand-pos {
    border-color: var(--brand-pos) !important;
}

.border-brand-neg {
    border-color: var(--brand-neg) !important;
}

/* Border Top Utilities */
.border-top-brand-pos {
    border-top: 4px solid var(--brand-pos) !important;
}

.border-top-brand-neg {
    border-top: 4px solid var(--brand-neg) !important;
}

.border-start-brand-pos {
    border-left: 4px solid var(--brand-pos) !important;
}

/* Hover Text Utilities */
.text-hover-brand-pos:hover {
    color: var(--brand-pos) !important;
}

.text-hover-brand-neg:hover {
    color: var(--brand-neg) !important;
}

/* Global Styles */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    padding-bottom: 80px;
    /* Ensure content doesn't get hidden behind the fixed footer widget */
}

/* Utility Classes */
.cursor-pointer {
    cursor: pointer;
}

/* Dashboard Styles */
.spark-dot:hover {
    opacity: 1 !important;
    r: 5;
}

/* Horizontal Scroll for Widgets */
.widget-scroll-container {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 1rem;
    gap: 1rem;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
}

.widget-card-wrapper {
    flex: 0 0 auto;
    width: 85%;
    /* Mobile: 1 card + peek */
}

@media (min-width: 768px) {
    .widget-card-wrapper {
        width: 19%;
        /* Desktop: ~5 cards */
    }
}

/* Fix Floating Cards: Add Border definition in Light Mode */
.widget-card-wrapper .card {
    border: 1px solid #E5E7EB;
    /* Light Grey Border */
}

[data-bs-theme="dark"] .widget-card-wrapper .card {
    border: none;
    /* No border needed in dark mode (contrast is enough) or use different color */
}

/* Alert Overrides (Card Style) */
.alert {
    background-color: var(--bg-surface) !important;
    border: none !important;
    border-left: 4px solid var(--brand-pos) !important;
    color: var(--text-primary) !important;
    box-shadow: 0 2px 8px var(--shadow-color) !important;
    border-radius: 0.375rem !important;
}

.alert-danger {
    border-left-color: var(--brand-neg) !important;
}

/* Input Icon Wrapper */
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper .form-control {
    padding-right: 2rem;
    /* Make room for the icon */
}

/* The overlay button */
.input-icon-wrapper .action-icon {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    color: #788195 !important;
    opacity: 0.8 !important;
    transition: all 0.2s ease-in-out;
    background: transparent;
    border: none;
    padding: 0;
    pointer-events: auto;
    /* clickable */
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-icon-wrapper .form-control:focus+.action-icon,
.input-icon-wrapper .action-icon:hover {
    color: var(--brand-pos) !important;
    opacity: 1 !important;
}

.unsaved-changes-glow {
    color: #08D9D6 !important;
    opacity: 1 !important;
    text-shadow: 0 0 8px rgba(8, 217, 214, 0.4);
}


/* Progress Bar Track Visibility Fix */
.progress {
    background-color: rgba(0, 0, 0, 0.1);
}

[data-bs-theme="light"] .progress {
    background-color: #D1D5DB;
    /* Darker grey to contrast with table hover */
}

[data-bs-theme="dark"] .progress {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Transactions Styles - Responsive Table */
@media (max-width: 768px) {
    .table-responsive table {
        background: transparent !important;
    }

    .table-responsive thead {
        display: none;
    }

    .table-responsive tbody tr {
        display: block;
        margin-bottom: 0.5rem;
        background: var(--bg-card) !important;
        /* Override striped rows */
        border: 1px solid var(--border-color);
        border-radius: 0.5rem;
        box-shadow: 0 1px 2px var(--shadow-color);
        padding: 0.5rem;
        /* Compact padding */
    }

    .table-responsive td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 0.25rem 0;
        /* Compact row spacing */
        border-bottom: 1px solid var(--border-light);
    }

    .table-responsive td:last-child {
        border-bottom: none;
        justify-content: flex-end;
        padding-top: 0.5rem;
    }

    .table-responsive td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.8rem;
        margin-right: 1rem;
    }

    /* Hide empty labels if needed */
    .table-responsive td[data-label="Actions"]::before {
        display: none;
    }
}

/* Portfolio Styles - Responsive Table (Shared with Transactions but kept for clarity/specificity if needed) */
/* Note: The styles are identical to transactions, so we can rely on the shared media query above. */
/* If specific portfolio overrides are needed, add them here. */

/* Planning Styles - Responsive Table */
@media (max-width: 768px) {

    /* Reuse shared table styles where possible, add specific overrides */
    .table-responsive td form {
        width: 100%;
        justify-content: flex-end;
    }

    .table-responsive td form input {
        width: auto !important;
        max-width: 120px;
    }

    /* Hide tfoot on mobile as it doesn't fit the card layout well */
    .table-responsive tfoot {
        display: none;
    }
}

/* Accounts Styles - Responsive Table */
@media (max-width: 768px) {

    /* Force table to not be like tables anymore */
    #accountsTable,
    #accountsTable tbody,
    #accountsTable th,
    #accountsTable td,
    #accountsTable tr {
        display: block;
    }

    /* Hide table headers (but not display: none;, for accessibility) */
    #accountsTable thead {
        display: none;
    }

    #accountsTable tr {
        margin-bottom: 1rem;
        border: 1px solid var(--border-color);
        border-radius: 0.5rem;
        background-color: var(--bg-card);
        box-shadow: 0 0.125rem 0.25rem var(--shadow-color);
    }

    #accountsTable td {
        /* Behave  like a "row" */
        border: none;
        border-bottom: 1px solid var(--border-light);
        position: relative;
        padding-left: 50%;
        text-align: right;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }

    #accountsTable td:last-child {
        border-bottom: 0;
    }

    #accountsTable td:before {
        /* Now like a table header */
        position: absolute;
        /* Top/left values mimic padding */
        top: 0.5rem;
        left: 1rem;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        content: attr(data-label);
        color: var(--text-muted);
    }

    /* Adjust actions column */
    #accountsTable td:last-child {
        text-align: center;
        padding-left: 0;
    }

    #accountsTable td:last-child:before {
        display: none;
    }
}

/* Chat Widget Styles */
#chat-widget-container {
    position: fixed;
    bottom: 0;
    right: 20px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#chat-fab {
    display: none !important;
}

#chat-window {
    width: 380px;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
    margin-bottom: 0;
    transition: height 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s;
    height: 50px;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: flex;
    flex-direction: column;
}


/* Tab Toggles (Segmented/Outline Style) */
/* Tab Toggles (Segmented/Outline Style) */
.btn-tab {
    display: inline-block;
    background: transparent !important;
    border: none !important;
    border-bottom: 3px solid transparent !important;
    color: var(--text-secondary) !important;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 0 !important;
    transition: all 0.2s ease-in-out;
    opacity: 0.85;
    /* Better contrast for inactive tabs */
}

.btn-tab.active,
.btn-tab:active,
.btn-tab:hover {
    color: var(--text-primary) !important;
    opacity: 1;
}

.btn-tab.active {
    font-weight: 700;
}

/* Specific Active Colors */
.btn-tab-cyan.active {
    border-bottom-color: var(--brand-pos) !important;
}

.btn-tab-pink.active {
    border-bottom-color: var(--brand-neg) !important;
}

/* Support for btn-check + btn-tab (Segmented Control Logic) */
.btn-check:checked+.btn-tab {
    color: var(--text-primary) !important;
    font-weight: 700;
    opacity: 1;
}

.btn-check:checked+.btn-tab-cyan {
    border-bottom-color: var(--brand-pos) !important;
}

.btn-check:checked+.btn-tab-pink {
    border-bottom-color: var(--brand-neg) !important;
}

/* Chat Widget Styling (Finance Assistant) */
#chat-window .card-header {
    background-color: #252A34 !important;
    /* Dark Gunmetal */
    color: var(--brand-pos) !important;
    /* Neon Cyan */
    border-bottom: 1px solid var(--brand-pos) !important;
    /* Border for glow */
    height: 50px;
    padding-bottom: 16px;
    padding-top: 16px;
    border-radius: 10px 10px 0 0 !important;
    /* Match container radius to prevent corners */
}

#chat-window.chat-open .card-header {
    border-bottom: 1px solid rgba(8, 217, 214, 0.3) !important;
}

/* Adjust icons inside chat header */
#chat-window .card-header i {
    color: var(--brand-pos) !important;
}

/* Override close button to be cyan-ish or white */
#chat-window .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

#chat-window.chat-open {
    height: 600px;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.2) !important;
}

#chat-window.chat-open .chat-controls {
    display: block;
}

#chat-window.chat-open .chat-collapsed-icon {
    display: none;
}

#chat-window .card-body {
    display: none;
    flex: 1;
    height: auto !important;
    opacity: 0;
    transition: opacity 0.3s;
}

#chat-window.chat-open .card-body {
    display: flex;
    opacity: 1;
    min-height: 0;
}

#chat-messages {
    overflow-y: auto;
    min-height: 0;
    scroll-behavior: smooth;
}

.chat-collapsed-icon {
    display: block;
}

.chat-controls {
    display: none;
}

/* Message Bubbles */
.chat-message.user-message {
    text-align: right;
}

.chat-message.user-message .d-inline-block {
    background-color: var(--brand-pos) !important;
    color: #252A34 !important;
    /* Dark text on Cyan */
}

.chat-message.bot-message {
    text-align: left;
}

.chat-bubble-content p {
    margin-bottom: 0.5rem;
}

.chat-bubble-content p:last-child {
    margin-bottom: 0;
}

.chat-bubble-content ul,
.chat-bubble-content ol {
    margin-bottom: 0.5rem;
    padding-left: 1.2rem;
}

.spinner-dots>span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 2px;
    background-color: #333;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.spinner-dots .bounce1 {
    animation-delay: -0.32s;
}

.spinner-dots .bounce2 {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

/* Sidebar List Group Active State */
.list-group-item.active {
    background-color: rgba(8, 217, 214, 0.1) !important;
    color: var(--text-brand-pos-readable) !important;
    font-weight: 700;
    border: none !important;
    border-right: 3px solid var(--brand-pos) !important;
}

[data-bs-theme="dark"] .list-group-item.active {
    background-color: rgba(8, 217, 214, 0.1) !important;
    /* 10% Cyan Tint */
    color: #08D9D6 !important;
    /* Neon Cyan Text */
    font-weight: 700;
    border: none !important;
    border-right: 3px solid #08D9D6 !important;
    /* Cyan Indicator Line */
}

/* --- Settings Privacy & Sharing --- */
[data-bs-theme="dark"] .sharing-user-list {
    background-color: #2F3640;
    /* Dark Surface */
    border: 1px solid #788195;
    /* Secondary Grey Border */
    color: #EAEAEA;
    /* Ensure text is White/Light Grey */
}

.sharing-user-list {
    background-color: var(--bg-surface);
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 8px;
    padding: 16px;
}

/* Style the individual user row */
.sharing-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

/* Make the checkbox match the brand */
.sharing-user-item input[type="checkbox"] {
    accent-color: var(--brand-pos);
    /* Brand Cyan */
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.sharing-user-item label {
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

/* --- Two-Tier Navigation Premium Styles --- */

/* Tier 1: Segmented Control (Master Tabs) */
.nav-segmented {
    background-color: #E2E8F0;
    /* Light Pill Container by default */
    border-radius: 50rem;
    padding: 0.35rem;
    display: inline-flex;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Inner shadow for depth */
}

[data-bs-theme="dark"] .nav-segmented {
    background-color: #1F242C;
    border-color: rgba(255, 255, 255, 0.05);
    box-shadow: none;
}

.nav-link-segmented {
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 50rem;
    padding: 0.5rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    z-index: 2;
}

.nav-link-segmented:hover {
    color: #Eaeaea;
}

.nav-link-segmented.active {
    color: #252A34 !important;
    /* Dark text for contrast */
    background-color: var(--brand-pos);
    /* Default Cyan */
    box-shadow: 0 0 15px rgba(8, 217, 214, 0.4);
    /* Cyan Glow */
}

/* Debts Tab Specifics (Pink) */
.nav-link-segmented[data-theme="pink"].active {
    background-color: var(--brand-neg);
    box-shadow: 0 0 15px rgba(255, 46, 99, 0.4);
    /* Pink Glow */
}

/* Tier 2: Ghost Pills (Fine Tuning) */
.btn-ghost {
    background-color: transparent;
    border: 1px solid var(--text-secondary);
    /* Grey Inactive Border */
    color: var(--text-secondary);
    /* Grey Inactive Text */
    border-radius: 50rem;
    padding: 0.25rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    opacity: 0.85;
    /* Better contrast for ghost buttons */
}

.btn-ghost:hover {
    border-color: #Eaeaea;
    color: #Eaeaea;
    opacity: 1;
}

.btn-check:checked+.btn-ghost {
    opacity: 1;
    font-weight: 700;
}

/* Ghost Cyan (Assets/Portfolio) */
.btn-ghost-cyan:hover,
.btn-check:checked+.btn-ghost-cyan {
    border-color: var(--brand-pos);
    color: var(--text-brand-pos-readable);
    /* Use Readable Teal in Light Mode */
    background-color: rgba(8, 217, 214, 0.1);
    /* 10% Opacity Fill */
}

/* Revert to Neon in Dark Mode */
[data-bs-theme="dark"] .btn-ghost-cyan:hover,
[data-bs-theme="dark"] .btn-check:checked+.btn-ghost-cyan {
    color: var(--brand-pos);
}

/* Ghost Pink (Debts) */
.btn-ghost-pink:hover,
.btn-check:checked+.btn-ghost-pink {
    border-color: var(--brand-neg);
    color: var(--brand-neg);
    background-color: rgba(255, 46, 99, 0.1);
    /* 10% Opacity Fill */
}

/* --- Mobile Control Toolbar (Wealth Page) --- */
.mobile-toolbar-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Row 1: Context (Date + Badge) */
.mobile-toolbar-row-context {
    display: flex;
    flex: 1 1 100%;
    /* Full width on mobile */
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

/* Row 2: Actions */
.mobile-toolbar-row-actions {
    display: flex;
    flex: 1 1 100%;
    /* Full width on mobile */
    gap: 10px;
}

/* Desktop Overrides (Min-Width 768px) */
@media (min-width: 768px) {
    .mobile-toolbar-grid {
        flex-wrap: nowrap;
        align-items: center;
        width: 100%;
    }

    .mobile-toolbar-row-context,
    .mobile-toolbar-row-actions {
        flex: 0 1 auto;
        /* Auto width on desktop */
        width: auto;
    }

    .mobile-toolbar-row-actions {
        margin-left: auto;
        /* Push to right */
    }
}

/* Action Icons (Compact Mode) */
.btn-icon-only {
    padding: 0.375rem 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-label {
    display: none;
    /* Hidden by default on mobile if space constrained, or we use specific classes */
}

@media (min-width: 768px) {
    .btn-icon-label {
        display: inline;
        margin-left: 0.5rem;
    }
}

/* --- Taxonomy Add Row --- */
.taxonomy-add-row {
    background-color: #F8F9FA;
    border: 1px solid #DEE2E6;
    border-radius: 8px;
    padding: 12px;
}

[data-bs-theme="dark"] .taxonomy-add-row {
    background-color: #2F3640;
    /* Dark Surface */
    border: 1px solid #38404B;
    border-radius: 8px;
    padding: 12px;
}

/* Fix the "Share" Button */
.btn-share-dropdown {
    /* Base styles if needed */
}

[data-bs-theme="dark"] .btn-share-dropdown {
    background-color: transparent !important;
    color: #EAEAEA !important;
    border: 1px solid #788195 !important;
}

[data-bs-theme="dark"] .btn-share-dropdown:hover {
    border-color: #08D9D6 !important;
    /* Cyan glow on hover */
    color: #08D9D6 !important;
}

/* --- Table Row Hidden --- */
.table-row-hidden {
    background-color: transparent !important;
    opacity: 0.4;
    pointer-events: none;
}

/* --- Family Members Badges --- */
.badge-admin {
    background-color: rgba(8, 217, 214, 0.15) !important; /* Tinted Cyan */
    color: #08D9D6 !important;                            /* Neon Cyan Text */
    border: 1px solid rgba(8, 217, 214, 0.5) !important;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8rem;
}

/* --- Members Badges --- */
.badge-role-admin {
    background-color: rgba(8, 217, 214, 0.15) !important;
    /* Tinted Cyan */
    color: #08D9D6 !important;
    /* Neon Cyan Text */
    border: 1px solid rgba(8, 217, 214, 0.4) !important;
    border-radius: 4px;
    padding: 4px 8px;
    font-weight: 700;
}

.badge-status-active {
    background-color: transparent !important;
    color: #009E9B !important;
    /* Dark Teal */
    border: 1px solid #009E9B !important;
    border-radius: 4px;
    padding: 4px 8px;
}

.badge-role-member {
    background-color: transparent !important;
    color: #959FA8 !important;
    /* Secondary Grey */
    border: 1px solid #788195 !important;
    border-radius: 4px;
    padding: 4px 8px;
}

.badge-status-pending {
    background-color: transparent !important;
    color: #788195 !important;
    /* Secondary Grey */
    border: 1px dashed #788195 !important;
    /* Dashed line implies "waiting/incomplete" */
    border-radius: 4px;
    padding: 4px 8px;
}

/* --- Table Action Buttons --- */
.table-action-btn {
    background: transparent !important;
    border: none !important;
    color: #788195 !important;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.table-action-btn.edit:hover,
.table-action-btn.promote:hover {
    color: #08D9D6 !important;
    /* Glow Cyan */
}

.table-action-btn.delete:hover {
    color: #FF2E63 !important; /* Glows Pink */
}

/* --- Project Detail Page Fixes --- */

/* 1. Fix the Top Badges */
.badge-status-active, .badge-health-track {
    background-color: rgba(8, 217, 214, 0.15) !important; /* Tinted Cyan */
    color: #08D9D6 !important;                            /* Neon Cyan */
    border: 1px solid rgba(8, 217, 214, 0.5) !important;
}

/* Fix the White Project ID Badge */
.badge-project-id {
    background-color: transparent !important;
    color: #08D9D6 !important; /* Brand Cyan */
    border: 1px solid #08D9D6 !important;
}

/* 2. Fix the Progress Bars */
.progress-bar-revenue { background-color: #08D9D6 !important; } /* Cyan */
.progress-bar-costs { background-color: #FF2E63 !important; }   /* Pink */

/* 3. Fix the Flashbang Headers (P&L and Tables) */
[data-bs-theme="dark"] .pnl-category-header,
[data-bs-theme="dark"] .table-transactions thead th {
    background-color: #252A34 !important; /* Dark Gunmetal */
    color: #959FA8 !important;            /* Secondary Grey */
    border-bottom: 2px solid #38404B !important;
}

/* 4. Fix the "White Pill" Transaction Tags */
.badge-transaction-type {
    background-color: transparent !important;
    color: #959FA8 !important;
    border: 1px solid #788195 !important;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
}

/* 5. Fix the Pale Green Net P&L Row */
[data-bs-theme="dark"] .row-net-pnl {
    background-color: rgba(8, 217, 214, 0.1) !important; /* 10% Cyan Tint */
    color: #08D9D6 !important;                            /* Neon Cyan Text */
    border-top: 2px solid #08D9D6 !important;
}

/* --- Business Dashboard Fixes --- */

/* 1. Fix the Cost Breakdown Progress Bars */
.progress-bar-cost {
    background-color: #FF2E63 !important; /* Brand Pink */
}

/* 2. Fix the Category Indicator Dots */
.indicator-dot-active {
    background-color: #08D9D6 !important; /* Neon Cyan */
    box-shadow: 0 0 6px rgba(8, 217, 214, 0.4); /* Subtle glow */
}

.indicator-dot-inactive {
    background-color: #788195 !important; /* Secondary Grey */
    box-shadow: none !important;
}

/* 3. Ensure the positive badges match the true Brand Cyan */
.badge-metric-positive {
    background-color: rgba(8, 217, 214, 0.15) !important; 
    color: #08D9D6 !important;                            
    border: 1px solid rgba(8, 217, 214, 0.5) !important;
}



/* --- Team Memberships Modal & Badges --- */

/* 1. Fix the Modal Container */
[data-bs-theme="dark"] .modal-team-membership {
    background-color: #2F3640; /* Dark Surface */
    border: 1px solid #788195;
    color: #EAEAEA;
}

/* 2. Fix the Section Headers (Make them readable) */
[data-bs-theme="dark"] .modal-team-membership h3,
.modal-team-membership .modal-section-title {
    color: #959FA8; /* Secondary Grey */
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 3. Fix the User Name (No Blue!) */
.highlight-name {
    color: #08D9D6; /* Brand Cyan */
    font-weight: 700;
}

/* 4. Fix the Roles & Status Badges */
.badge-role-leader {
    background-color: rgba(8, 217, 214, 0.15); /* Tinted Cyan */
    color: #08D9D6;                            
    border: 1px solid rgba(8, 217, 214, 0.5);
}

/* Generic Fallback for other roles if needed to keep dark theme consistency */
.badge-role-member, .badge-role-manager {
    background-color: rgba(151, 159, 168, 0.1);
    color: #959FA8;
    border: 1px solid rgba(151, 159, 168, 0.3);
}

.badge-status-active {
    background-color: transparent;
    color: #009E9B; /* Dark Teal */
    border: 1px solid #009E9B;
}

/* 5. Fix the Negative Action Button (No Default Red!) */
.btn-end-membership {
    background-color: transparent;
    color: #FF2E63; /* Brand Pink */
    border: 1px solid #FF2E63;
    transition: all 0.2s;
}

.btn-end-membership:hover {
    background-color: rgba(255, 46, 99, 0.1); /* Pink Glow on hover */
    box-shadow: 0 0 8px rgba(255, 46, 99, 0.2);
    color: #FF2E63;
}

/* --- Business Direction P&L Table --- */

/* Fix the Table Background and Text */
[data-bs-theme="dark"] .table-business-pnl {
    background-color: #2F3640; /* Dark Surface */
    color: #EAEAEA;            /* Light Grey Text */
    border-collapse: collapse;
}

/* Fix the Table Header */
[data-bs-theme="dark"] .table-business-pnl thead th {
    background-color: #252A34 !important; /* Dark Gunmetal (slightly darker than rows) */
    color: #959FA8 !important;            /* Secondary Grey */
    border-bottom: 2px solid #38404B !important;
    text-transform: uppercase;
    font-size: 0.85rem;
}

/* Fix Row Borders */
[data-bs-theme="dark"] .table-business-pnl tbody td {
    border-bottom: 1px solid #38404B !important;
}

/* --- Custom Metric Badges --- */

/* Positive Badge (Replaces the Green MoM pill) */
.badge-metric-positive {
    background-color: rgba(8, 217, 214, 0.15) !important; /* Tinted Cyan */
    color: #08D9D6 !important;                            /* Neon Cyan Text */
    border: 1px solid rgba(8, 217, 214, 0.5) !important;
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 600;
}

/* Alert Badge (Replaces the Dark Red pill) */
.badge-metric-alert {
    background-color: rgba(255, 46, 99, 0.15) !important; /* Tinted Pink */
    color: #FF2E63 !important;                            /* Neon Pink Text */
    border: 1px solid rgba(255, 46, 99, 0.5) !important;
    border-radius: 4px;
    padding: 2px 6px;
    font-weight: 600;
}

/* Standard Tags (Replaces the White B2C/B2B pills) */
.badge-tag-standard {
    background-color: transparent !important;
    color: #959FA8 !important; /* Secondary Grey */
    border: 1px solid #788195 !important;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* --- Transactions Page Fixes --- */

/* 1. Fix the Flashbang Table Header */
[data-bs-theme="dark"] .table-transactions thead th {
    background-color: #252A34 !important; /* Dark Gunmetal */
    color: #959FA8 !important;            /* Secondary Grey */
    border-bottom: 2px solid #38404B !important;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding: 12px 16px;
}

/* 2. Fix the Summary Badges (Traffic Lights) */
/* Positive (Revenue / Net) */
.badge-summary-positive {
    background-color: rgba(8, 217, 214, 0.15) !important; /* Tinted Cyan */
    color: #08D9D6 !important;                            /* Neon Cyan Text */
    border: 1px solid rgba(8, 217, 214, 0.5) !important;
    border-radius: 4px;
    padding: 4px 12px;
    font-weight: 600;
}

/* Negative (Costs) */
.badge-summary-negative {
    background-color: rgba(255, 46, 99, 0.15) !important; /* Tinted Pink */
    color: #FF2E63 !important;                            /* Neon Pink Text */
    border: 1px solid rgba(255, 46, 99, 0.5) !important;
    border-radius: 4px;
    padding: 4px 12px;
    font-weight: 600;
}

/* 3. Fix the Standard Blue Link */
.empty-state-link {
    color: #08D9D6 !important; /* Brand Cyan */
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.empty-state-link:hover {
    color: #FFFFFF !important; /* Glows white on hover */
    text-decoration: underline !important;
}

/* --- Projects Page Fixes --- */

/* 1. Fix the Flashbang Table Header AND Total Row */
[data-bs-theme="dark"] .table-projects thead th {
    background-color: #252A34 !important; /* Dark Gunmetal */
    color: #959FA8 !important;            /* Secondary Grey */
    border-bottom: 2px solid #38404B !important;
}

[data-bs-theme="dark"] .table-projects .row-total td {
    background-color: #252A34 !important; /* Dark Gunmetal */
    color: #EAEAEA !important;            /* Light Grey/White */
    font-weight: 700;
    border-top: 2px solid #38404B !important;
    border-bottom: none !important;
}

/* 2. Fix the Project Links */
.table-projects a.project-link {
    color: #08D9D6 !important; /* Neon Cyan */
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.table-projects a.project-link:hover {
    color: #FFFFFF !important; /* Glows white when hovered */
    text-decoration: underline !important;
}

/* 3. Banned Colors: Health & Status Badges */

/* 1. On Track (Good = Cyan) */
.badge-health-track {
    background-color: rgba(8, 217, 214, 0.15) !important;
    color: #08D9D6 !important;
    border: 1px solid rgba(8, 217, 214, 0.5) !important;
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 600;
}

/* 2. Off Track (Bad = Pink) */
.badge-health-off {
    background-color: rgba(255, 46, 99, 0.15) !important;
    color: #FF2E63 !important;
    border: 1px solid rgba(255, 46, 99, 0.5) !important;
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 600;
}

/* 3. At Risk (Warning = Dashed Grey/White) */
.badge-health-risk {
    background-color: transparent !important;
    color: #EAEAEA !important; /* Bright White */
    border: 1px dashed #EAEAEA !important;
    border-radius: 4px;
    padding: 2px 8px;
    font-weight: 600;
}

/* --- P&L Report Page Fixes --- */

/* 1. Fix the Category Headers in the P&L Table */
[data-bs-theme="dark"] .pnl-category-header {
    background-color: #252A34 !important; /* Dark Gunmetal */
    color: #959FA8 !important;            /* Secondary Grey */
    font-weight: 700 !important;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 2px solid #38404B !important;
}

/* 2. Fix the Net P&L Highlight Row */
[data-bs-theme="dark"] .row-net-pnl {
    background-color: rgba(8, 217, 214, 0.1) !important; /* 10% Cyan Tint */
    color: #08D9D6 !important;                           /* Neon Cyan Text */
    font-weight: 700;
    border-top: 2px solid #08D9D6 !important;            /* Strong bottom line */
}

/* Override standard green text for Gross Profit */
.text-profit-positive {
    color: #08D9D6 !important; 
}

/* 3. Fix the "Set Rate" Button */
.btn-set-rate {
    background-color: transparent !important;
    color: #08D9D6 !important; /* Brand Cyan */
    border: 1px solid #08D9D6 !important;
    transition: all 0.2s;
}

.btn-set-rate:hover {
    background-color: rgba(8, 217, 214, 0.1) !important;
    box-shadow: 0 0 8px rgba(8, 217, 214, 0.2) !important;
}

/* Fix the Yellow Icons */
.icon-fx, .icon-shield-warning {
    color: #08D9D6 !important; /* Switch from Yellow to Cyan */
}

/* 4. Fix the Transaction Count Badge */
.badge-transaction-count {
    background-color: transparent !important;
    color: #959FA8 !important; /* Secondary Grey */
    border: 1px solid #788195 !important;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
}

/* --- Payroll Page Fixes --- */

/* 1. Fix the Table Header and Total Row */
[data-bs-theme="dark"] .table-payroll thead th,
[data-bs-theme="dark"] .table-payroll .row-total td {
    background-color: #252A34 !important; /* Dark Gunmetal */
    color: #959FA8 !important;            /* Secondary Grey */
    border-bottom: 2px solid #38404B !important;
}

/* Make the Total values pop with White instead of a white background */
[data-bs-theme="dark"] .table-payroll .row-total td {
    color: #EAEAEA !important; 
    font-weight: 700;
    border-top: 2px solid #38404B !important;
}

/* 2. Fix the Employee Name Link */
.table-payroll a.person-link {
    color: #08D9D6 !important; /* Brand Cyan */
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.table-payroll a.person-link:hover {
    color: #FFFFFF !important; /* Glows white on hover */
    text-decoration: underline !important;
}

/* Fix the Progress Bar */
.progress-bar-payroll {
    background-color: #08D9D6 !important; 
}

/* 3. Override the yellow text class for taxes */
.text-employer-tax {
    color: #EAEAEA !important; /* Standard White */
}

/* Fix the yellow icon in the side panel */
.icon-payment-type {
    color: #959FA8 !important; /* Secondary Grey */
}

/* 4. Styling for Employment Type Tags */
.badge-employment-type {
    background-color: transparent !important;
    color: #959FA8 !important; /* Secondary Grey */
    border: 1px solid #788195 !important;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
}

/* --- Employee Detail Page Fixes --- */

/* 1. Fix the Breadcrumb Link */
.breadcrumb-link {
    color: #08D9D6 !important; /* Brand Cyan */
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumb-link:hover {
    color: #FFFFFF !important;
    text-decoration: underline !important;
}

/* 2. Fix the Flashbang Table Header */
[data-bs-theme="dark"] .table-employee-history thead th {
    background-color: #252A34 !important; /* Dark Gunmetal */
    color: #959FA8 !important;            /* Secondary Grey */
    border-bottom: 2px solid #38404B !important;
}

/* 3. Fix the White "Entry" Pill */
.badge-entry-item {
    background-color: transparent !important;
    color: #EAEAEA !important;
    border: 1px solid #788195 !important; /* Secondary Grey */
    border-radius: 4px;
    padding: 2px 8px;
}

/* 4. Fix the Top Badges */
.badge-job-title, .badge-employment-type {
    background-color: transparent !important;
    color: #959FA8 !important;
    border: 1px solid #788195 !important;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
}

/* 5. Fix the Charts and Progress Bars */
.chart-bar-fill, .progress-bar-payroll {
    background-color: #08D9D6 !important; /* Brand Cyan */
    fill: #08D9D6 !important; /* If SVG */
}

/* 6. Neutralize the Yellow Tax Text */
.text-employer-tax {
    color: #EAEAEA !important; 
}

/* Light Mode Override for Visibility */
[data-bs-theme="light"] .text-employer-tax {
    color: #4A5568 !important; /* High contrast Dark Grey/Gunmetal */
    text-shadow: none;
}

/* --- Settings Page / Team Directory Fixes --- */

/* 1. Fix the Employee / Contractor Tags (Ghost Badges) */
.badge-employment-type {
    background-color: transparent !important;
    color: #959FA8 !important;            /* Secondary Grey */
    border: 1px solid #788195 !important; /* Subtle border */
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
}

/* 2. Fix the White "active" Pills */
.badge-status-active {
    background-color: transparent !important;
    color: #009E9B !important;            /* Dark Teal (Readable but not glaring) */
    border: 1px solid #009E9B !important;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
    text-transform: uppercase;            /* technical look */
    letter-spacing: 0.5px;
}

/* 3. Restore the Sidebar Glow */
[data-bs-theme="dark"] .sidebar-item.active {
    background-color: rgba(8, 217, 214, 0.1) !important; /* 10% Cyan Tint */
    color: #08D9D6 !important;                           /* Neon Cyan Text */
    font-weight: 700;
    border-right: 3px solid #08D9D6 !important;          /* Cyberpunk Line */
}

/* 4. Ensure User Names pop */
.directory-user-name {
    color: #EAEAEA !important;           /* Bright white/grey */
    font-weight: 600;
}

/* --- Transactions Page Fixes --- */

/* 1. Fix the alignment for the summary badges */
.badge-summary {
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Forces perfect centering */
    gap: 8px;                /* Consistent space between icon and text */
    padding: 6px 12px;
}

/* 2. Fix the Amount Colors */
.text-amount-positive {
    color: #08D9D6 !important; /* Brand Cyan */
    font-weight: 600;
}

.text-amount-negative {
    color: #FF2E63 !important; /* Brand Pink */
    font-weight: 600;
}

/* 3. Fix the "Type" Badges */
.badge-type-cost {
    background-color: rgba(255, 46, 99, 0.15); /* Tinted Pink */
    color: #FF2E63;                            /* Neon Pink Text */
    border: 1px solid rgba(255, 46, 99, 0.5);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
}

.badge-type-revenue {
    background-color: rgba(8, 217, 214, 0.15); /* Tinted Cyan */
    color: #08D9D6;                            /* Neon Cyan Text */
    border: 1px solid rgba(8, 217, 214, 0.5);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.8rem;
}

/* 4. Fix the White Project Pills */
.badge-project-tag {
    background-color: transparent !important;
    color: #959FA8 !important; /* Secondary Grey */
    border: 1px solid #788195 !important;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-family: monospace; /* technical tracking code look */
}

/* 5. Clean up the Action Icons */
.table-transactions .btn-action {
    background: transparent;
    border: none; /* Removes the ugly square borders */
    color: #788195;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.table-transactions .btn-action.edit:hover {
    color: #08D9D6; /* Glows Cyan */
}

.table-transactions .btn-action.delete:hover {
    color: #FF2E63; /* Glows Pink */
}
/* --- User Profile Widget (Cyberpunk Finance) --- */

/* 2. Strip default margins from the avatar */
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%; /* Circle */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    background-color: #2F3640; /* Dark Surface */
    margin: 0 !important; 
    flex-shrink: 0;          /* Prevents the circle from squishing */
}

/* Dynamic Avatar Borders based on Role */
.user-avatar.role-admin {
    border: 1px solid #08D9D6; /* Neon Cyan for Admin */
    color: #08D9D6;
    box-shadow: 0 0 8px rgba(8, 217, 214, 0.2);
}

.user-avatar.role-finance {
    border: 1px solid #009E9B; /* Dark Teal for Standard Finance */
    color: #009E9B;
}

/* 3. Tighten the Text Stack */
.user-identity {
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0 !important;    /* Kills default paragraph/div margins */
    line-height: 1.1;        /* Squishes the Name and Role tightly together */
}

.user-name {
    color: #EAEAEA; /* Bright White/Grey */
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 !important;
    padding: 0 !important;
}

.user-role {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    margin: 0 !important;
    padding: 0 !important;
    margin-top: 2px !important; /* Tiny micro-adjustment for optical balance */
}

/* Dynamic Role Text Colors */
.text-cyan { color: #08D9D6 !important; } /* Admin */
.text-teal { color: #009E9B !important; } /* Finance / Editor */
.text-grey { color: #959FA8 !important; } /* View Only */

/* Responsive adjustment for small screens */
@media (max-width: 991.98px) {
    .nav-user-widget {
        border-right: none;
        padding-right: 0;
        margin-right: 0;
        margin-bottom: 1rem;
    }
}

/* --- Squished Badge Fixes --- */
.badge-health-track,
.badge-health-off,
.badge-health-risk,
.badge-status-active {
    white-space: nowrap !important; /* Forces text to stay on one line */
    display: inline-block !important; 
    text-align: center !important;
}

/* --- Payroll Link Contrast (Light Mode) --- */
[data-bs-theme="light"] .person-link,
[data-bs-theme="light"] .breadcrumb-link {
    color: #008080 !important; /* Dark Teal (readable on white) */
    font-weight: 600;
}

[data-bs-theme="light"] .person-link:hover,
[data-bs-theme="light"] .breadcrumb-link:hover {
    color: #005f5f !important;
    text-decoration: underline;
}

/* --- Ghost Badge Contrast (Light Mode) --- */
[data-bs-theme="light"] .badge-employment-type,
[data-bs-theme="light"] .badge-job-title {
    color: #4A5568 !important; 
    border-color: #CBD5E0 !important;
    background-color: #F7FAFC !important;
}

/* --- Tax Expense Color Logic --- */
.progress-bar-tax {
    background-color: #FF2E63 !important; /* Brand Pink for Expenses */
    box-shadow: 0 0 8px rgba(255, 46, 99, 0.3);
}

/* --- Attainment Bar Polish --- */
.progress-bar-attainment {
    background-color: #08D9D6 !important; /* Brand Cyan */
    min-width: 3px !important;            /* Ensures even tiny progress is visible */
}

/* --- Projects Page: Contrast & Aesthetic Refinements --- */

/* 1. Light Mode: Contrast Fixes (Critical) */
[data-bs-theme="light"] .card-net-pnl .metric-value {
    color: #009E9B !important; /* Dark Teal instead of Neon Cyan */
}

[data-bs-theme="light"] .badge-health-track {
    color: #009E9B !important; 
    border-color: rgba(0, 158, 155, 0.4) !important;
    background-color: rgba(0, 158, 155, 0.1) !important;
}

[data-bs-theme="light"] .badge-health-off {
    color: #D91C4E !important; /* Darker Pink/Crimson for readability on white */
    border-color: rgba(217, 28, 78, 0.4) !important;
    background-color: rgba(217, 28, 78, 0.1) !important;
}

[data-bs-theme="light"] .badge-health-risk {
    color: #4A5568 !important;            /* Strong dark grey */
    border-color: #959FA8 !important;     /* Visible grey dash */
    background-color: #F7FAFC !important;
}

/* 2. Dark Mode: Re-asserting Neon Glow (Anti-Muddy Fix) */
[data-bs-theme="dark"] .badge-health-track {
    background-color: rgba(8, 217, 214, 0.15) !important;
    color: #08D9D6 !important;
    border: 1px solid rgba(8, 217, 214, 0.4) !important;
}

[data-bs-theme="dark"] .badge-health-off {
    background-color: rgba(255, 46, 99, 0.15) !important;
    color: #FF2E63 !important;
    border: 1px solid rgba(255, 46, 99, 0.4) !important;
}

/* 3. Filter Bar Structure (Light Mode) */
[data-bs-theme="light"] .filter-bar-container {
    background-color: #F7F9FC !important; /* Very light cool-grey */
    border: 1px solid #EAEAEA !important;
    border-radius: 8px !important;
    padding: 8px !important;
}

/* --- Transactions Page: Unified Theme Fixes --- */

/* 1. LIGHT MODE OVERRIDES (High Contrast) */

/* Fix the unreadable Neon numbers */
[data-bs-theme="light"] .text-amount-positive { color: #009E9B !important; } /* Dark Teal */
[data-bs-theme="light"] .text-amount-negative { color: #D91C4E !important; } /* Crimson/Dark Pink */

/* Fix the unreadable Revenue/Net Badges */
[data-bs-theme="light"] .badge-type-revenue,
[data-bs-theme="light"] .badge-summary-positive {
    color: #009E9B !important;
    border-color: rgba(0, 158, 155, 0.4) !important;
    background-color: rgba(0, 158, 155, 0.1) !important;
}

/* Fix the unreadable Cost Badges */
[data-bs-theme="light"] .badge-type-cost,
[data-bs-theme="light"] .badge-summary-negative {
    color: #D91C4E !important;
    border-color: rgba(217, 28, 78, 0.4) !important;
    background-color: rgba(217, 28, 78, 0.1) !important;
}

/* Fix the faint Project ID tags */
[data-bs-theme="light"] .badge-project-tag {
    color: #4A5568 !important;            /* Strong dark grey text */
    border-color: #959FA8 !important;     /* Visible grey border */
}

/* 2. DARK MODE OVERRIDES (Neon Cyberpunk) */

/* Restore the Neon Glow to Revenue/Net Badges */
[data-bs-theme="dark"] .badge-type-revenue,
[data-bs-theme="dark"] .badge-summary-positive {
    color: #08D9D6 !important; /* Bright Neon Cyan */
    border-color: rgba(8, 217, 214, 0.4) !important;
    background-color: rgba(8, 217, 214, 0.15) !important;
}

/* Restore the Neon Glow to Cost Badges */
[data-bs-theme="dark"] .badge-type-cost,
[data-bs-theme="dark"] .badge-summary-negative {
    color: #FF2E63 !important; /* Bright Neon Pink */
    border-color: rgba(255, 46, 99, 0.4) !important;
    background-color: rgba(255, 46, 99, 0.15) !important;
}

/* 3. Transaction Table Styling */
.table-transactions td.col-amount {
    white-space: nowrap; /* Forces number and currency code to stay on one line */
    text-align: right;   /* Aligns numbers to the right edge */
    font-variant-numeric: tabular-nums; /* Keeps character widths uniform */
}

/* 4. Date Column: Stop the Wrapping */
.table-transactions td.col-date {
    white-space: nowrap;
}

/* --- CYBERPUNK FORM COMPONENTS --- */
.cyber-form-card {
    background-color: #252A34; /* Dark Gunmetal */
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    color: #EAEAEA;
    max-width: 800px;
    margin: 0 auto; /* Center the form */
}

/* Light Mode Overrides for the Card */
[data-bs-theme="light"] .cyber-form-card {
    background-color: #FFFFFF;
    color: #252A34;
    border: 1px solid #EAEAEA;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.form-header {
    border-bottom: 1px solid #38404B;
    margin-bottom: 24px;
    padding-bottom: 16px;
}
[data-bs-theme="light"] .form-header {
    border-bottom-color: #EAEAEA;
}

.form-header h3 { margin: 0 0 4px 0; color: inherit; font-size: 1.25rem; }
.form-header p { margin: 0; color: #959FA8; font-size: 0.85rem; }

/* --- THE GRID SYSTEM --- */
.transaction-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr); /* 12 uniform columns */
    gap: 16px 20px; /* 16px vertical gap, 20px horizontal gap */
}

/* Grid Spans */
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-9 { grid-column: span 9; }
.span-12 { grid-column: span 12; }

/* Form Groups & Labels */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: inherit;
    margin-bottom: 6px;
}

.label-sub {
    color: #788195;
    font-weight: 400;
}

/* --- THE INPUTS --- */
.cyber-input {
    width: 100%;
    background-color: transparent !important;
    border: 1px solid #38404B !important;
    border-radius: 6px !important;
    color: inherit !important;
    padding: 10px 14px !important; 
    font-size: 0.95rem !important;
    box-sizing: border-box !important;
    transition: border-color 0.2s !important;
    line-height: 1.5 !important;
}
[data-bs-theme="light"] .cyber-input {
    border-color: #959FA8 !important;
}

.cyber-input:focus {
    border-color: #08D9D6 !important; /* Brand Cyan Focus */
    outline: none !important;
    box-shadow: 0 0 0 0.25rem rgba(8, 217, 214, 0.2) !important;
}

/* Fixed Read-Only Box for the "Net" value */
.cyber-readonly-box {
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: 700;
    color: inherit;
    background-color: rgba(255, 255, 255, 0.03); /* Slight highlight */
    border-radius: 6px;
    white-space: nowrap; /* Never breaks to a new line */
    border: 1px solid transparent;
}
[data-bs-theme="light"] .cyber-readonly-box {
    background-color: #F7F9FC;
    border-color: #EAEAEA;
}

/* --- THE CONFIDENTIAL BOX --- */
.cyber-confidential-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px dashed #788195;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 8px; /* Extra breathing room */
}
[data-bs-theme="light"] .cyber-confidential-box {
    border-color: #959FA8;
}

.text-cyan { color: #08D9D6 !important; }
[data-bs-theme="light"] .text-cyan { color: #009E9B !important; }

/* --- THE BUTTONS --- */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 20px;
    border-top: 1px solid #38404B;
}
[data-bs-theme="light"] .form-actions {
    border-top-color: #EAEAEA;
}

/* =========================================================
   CYBERPUNK BUTTON SYSTEM 
   ========================================================= */

/* BASE CLASS: Geometry & Alignment (Applies to ALL buttons) */
.btn-cyber {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px; /* Perfect spacing for icons */
    padding: 10px 16px !important;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5 !important;
    border-radius: 6px;
    box-sizing: border-box !important;
    transition: all 0.2s ease;
    text-decoration: none !important; /* Keeps <a> tags looking like buttons */
    cursor: pointer;
}

/* ---------------------------------------------------------
   PRIMARY ACTION (The "Do It" Button)
   --------------------------------------------------------- */
.btn-cyber-primary {
    background-color: #08D9D6 !important;
    color: #252A34 !important; /* Dark text on neon background */
    border: 1px solid #08D9D6 !important; /* Border matches bg for sizing */
}
.btn-cyber-primary:hover {
    box-shadow: 0 0 12px rgba(8, 217, 214, 0.4) !important;
}

/* Light Mode: Primary */
[data-bs-theme="light"] .btn-cyber-primary {
    background-color: #009E9B !important; /* Dark Teal */
    color: #FFFFFF !important;            /* White text */
    border-color: #009E9B !important;
}
[data-bs-theme="light"] .btn-cyber-primary:hover {
    background-color: #007A78 !important;
    border-color: #007A78 !important;
    box-shadow: 0 4px 8px rgba(0, 158, 155, 0.2) !important;
}

/* ---------------------------------------------------------
   SECONDARY ACTION (The "Utility" Ghost Button)
   --------------------------------------------------------- */
.btn-cyber-secondary {
    background-color: transparent !important;
    color: #959FA8 !important;            /* Secondary Grey text */
    border: 1px solid #788195 !important; /* Technical border */
}
.btn-cyber-secondary:hover {
    color: #EAEAEA !important;            /* Brightens to white */
    border-color: #EAEAEA !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
}

/* Light Mode: Secondary */
[data-bs-theme="light"] .btn-cyber-secondary {
    color: #4A5568 !important;            /* Slate Grey */
    border-color: #959FA8 !important;
}
[data-bs-theme="light"] .btn-cyber-secondary:hover {
    color: #252A34 !important;            /* Darkest text */
    border-color: #4A5568 !important;
    background-color: #F7F9FC !important;
}

/* Audit Footer Integration */
.audit-footer-container {
    border-top: 1px solid #38404B !important;
    background-color: rgba(0,0,0,0.1) !important;
    border-radius: 0 0 8px 8px !important;
}
[data-bs-theme="light"] .audit-footer-container {
    border-top: 1px solid #EAEAEA !important;
    background-color: #F7F9FC !important;
}
