@charset "UTF-8";

/* --- Typography Imports (Local) --- */
@font-face {
    font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('/assets/webfonts/inter-v20-latin-regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
    src: url('/assets/webfonts/inter-v20-latin-600.woff2') format('woff2'); 
}
@font-face {
    font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap;
    src: url('/assets/webfonts/jetbrains-mono-v18-latin-regular.woff2') format('woff2');
}

/* =========================================================
   SOLO BASIS – PROFESSIONAL SAAS DESIGN SYSTEM
   Clean • Trustworthy • Data-First • High Contrast
   ========================================================= */

/* =========================================================
   LIGHT MODE (Default)
   ========================================================= */
:root, [data-bs-theme="light"] {
    /* Brand Core: Sapphire Blue */
    --bs-primary: #2563EB;
    --bs-primary-rgb: 37, 99, 235;
    --bs-primary-hover: #1D4ED8;
    
    /* Accents (Now unified to the Sapphire family instead of Indigo) */
    --sb-accent: #1D4ED8; 
    --sb-accent-hover: #1E40AF;
    --sb-accent-rgb: 29, 78, 216;

    /* Base Environment: Slate */
    --bs-body-bg: #F8FAFC;          
    --bs-body-color: #0F172A;       
    --bs-secondary-color: #64748B;  
    --bs-border-color: #E2E8F0;     

    /* Surfaces */
    --sb-surface: #FFFFFF;          
    --sb-surface-alt: #F1F5F9;
    --sb-surface-hover: #E2E8F0;

    /* SEMANTIC COLORS */
    --bs-success: #10B981;
    --bs-success-text-emphasis: #047857; 
    
    --bs-warning: #F59E0B;
    --bs-warning-text-emphasis: #B45309; 
    
    --bs-danger: #EF4444;
    --bs-danger-text-emphasis: #B91C1C;

    --bs-info: #0EA5E9;
    --bs-info-text-emphasis: #0369A1;

    /* Typography */
    --bs-body-font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --bs-font-monospace: 'JetBrains Mono', 'Courier New', monospace;
}

/* =========================================================
   DARK MODE (Structured Slate)
   ========================================================= */
[data-bs-theme="dark"] {
    /* Brand: Deeper Sapphire (Fixes the "glowing" button issue) */
    --bs-primary: #3B82F6;
    --bs-primary-rgb: 59, 130, 246;
    --bs-primary-hover: #60A5FA; /* Lightens on hover to show interaction */

    /* Accents (Tonal family) */
    --sb-accent: #60A5FA;
    --sb-accent-hover: #93C5FD;
    --sb-accent-rgb: 96, 165, 250;

    /* Base */
    --bs-body-bg: #0F172A;
    --bs-body-color: #F8FAFC;
    
    /* Fixed Contrast: Much brighter gray for readability */
    --bs-secondary-color: #CBD5E1; 
    --bs-border-color: #334155;

    /* Surfaces */
    --sb-surface: #1E293B;
    --sb-surface-alt: #131C2D; /* #334155 */
    --sb-surface-hover: #263348; /* #475569 */

    /* Semantic (Lighter for Dark Mode Contrast) */
    --bs-success: #34D399;
    --bs-success-text-emphasis: #6EE7B7;
    
    --bs-warning: #FBBF24;
    --bs-warning-text-emphasis: #FCD34D;
    
    --bs-danger: #F87171;
    --bs-danger-text-emphasis: #FCA5A5;

    --bs-info: #38BDF8;
    --bs-info-text-emphasis: #7DD3FC;
}

/* =========================================================
   STRUCTURE & COMPONENT STANDARDS
   ========================================================= */

/* Cards / Panels */
.card, .sb-surface {
    background-color: var(--sb-surface);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem; /* Slightly rounder for modern SaaS feel */
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
}

/* Data Tables (Ledger, Disposition, etc.) */
.table { 
    border-collapse: separate; 
    border-spacing: 0; 
    color: var(--bs-body-color); 
    margin-bottom: 0;
}
.table thead th { 
    font-weight: 600; 
    border-bottom: 1px solid var(--bs-border-color); 
    color: var(--bs-secondary-color); 
    text-transform: uppercase; 
    font-size: 0.75rem; 
    letter-spacing: 0.05em; 
    background-color: var(--sb-surface-alt);
    padding: 1rem;
}
.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--bs-border-color);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background-color: var(--sb-surface-hover); }

/* Monetary / Numeric Columns */
.amount, .ledger-number, .mono { 
    font-family: var(--bs-font-monospace); 
    letter-spacing: -0.01em; 
}

/* Buttons */
.btn { font-weight: 500; border-radius: 0.375rem; }
.btn-primary { 
    background-color: var(--bs-primary); 
    border-color: var(--bs-primary); 
    color: #ffffff; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-primary:hover { 
    background-color: var(--bs-primary-hover); 
    border-color: var(--bs-primary-hover); 
    color: #ffffff; 
}

/* Forms */
.form-control, .form-select { 
    background-color: var(--sb-surface); 
    border: 1px solid var(--bs-border-color); 
    color: var(--bs-body-color); 
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
}
.form-control:focus, .form-select:focus { 
    border-color: var(--bs-primary); 
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.15); 
    background-color: var(--sb-surface); 
    color: var(--bs-body-color); 
}
.form-label { 
    font-weight: 600; 
    color: var(--bs-body-color); 
    font-size: 0.85rem; 
}

/* Layout Elements */
.section-title { font-weight: 700; color: var(--bs-body-color); letter-spacing: -0.02em; }

/* Offset the fixed-top navbar so content doesn't hide behind it */
body main {
    padding-top: 76px; 
}

/* =========================================================
   UTILITY CLASS REFINEMENTS (No !important needed)
   Fixes specific text-color issues.
   ========================================================= */

/* Force Bootstrap to use our exact Hex variables for text */
.text-secondary { color: var(--bs-secondary-color) !important; }
.text-body { color: var(--bs-body-color) !important; }
.text-primary { color: var(--bs-primary) !important; }

/* Ensure text utilities use the high-contrast 'emphasis' versions */
.text-warning { color: var(--bs-warning-text-emphasis) !important; }
.text-success { color: var(--bs-success-text-emphasis) !important; }
.text-danger { color: var(--bs-danger-text-emphasis) !important; }
.text-info { color: var(--bs-info-text-emphasis) !important; }

/* Refined Badge Styling for Statuses */
.badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 0.25rem;
    letter-spacing: 0.02em;
}

/* Floating Alerts */
.sb-alert-floating {
    position: fixed;
    top: 80px;         
    right: 20px;       
    z-index: 9999;     
    min-width: 300px;
    max-width: 90vw;   
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
}

/* Dropdown Menus */
.dropdown-menu {
    background-color: var(--sb-surface);
    border: 1px solid var(--bs-border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.dropdown-item { color: var(--bs-body-color); }
.dropdown-item:hover, .dropdown-item:focus {
    background-color: var(--sb-surface-hover);
    color: var(--bs-body-color);
}

/* =========================================================
   FORM & CHECKBOX VISIBILITY
   ========================================================= */
.form-check-input {
    border-color: var(--bs-secondary-color);
    cursor: pointer;
}

[data-bs-theme="dark"] .form-check-input {
    background-color: var(--sb-surface-alt);
    border: 2px solid #64748B; /* Thick, visible border for unchecked state */
}

[data-bs-theme="dark"] .form-check-input:checked {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
}

/* =========================================================
   MOBILE OPTIMIZATIONS
   ========================================================= */

/* Hide scrollbars on swipeable containers but keep functionality */
.hide-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}
.hide-scrollbar::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

/* Card-style tables for mobile */
@media (max-width: 767.98px) {
    .table-responsive .table thead {
        display: none; /* Hide standard headers */
    }
    
    .table-responsive .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        background-color: var(--sb-surface);
        border: 1px solid var(--bs-border-color);
        border-radius: 0.75rem;
        padding: 0;
        overflow: hidden;
    }
    
    .table-responsive .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed var(--bs-border-color);
        padding: 0.75rem;
        text-align: right;
    }
    
    .table-responsive .table tbody td:last-child {
        border-bottom: none;
    }
    
    /* Inject the column header as a label on the left */
    .table-responsive .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--bs-secondary-color);
        font-size: 0.75rem;
        text-transform: uppercase;
        margin-right: 1rem;
        text-align: left;
    }
    
    /* Ensure the Item Details flex container doesn't break */
    .table-responsive .table tbody td[data-label="Item Details"] {
        flex-direction: column;
        align-items: flex-end;
    }
}

/* Ensure both Ledger and Disposition product cells stack vertically on mobile */
@media (max-width: 767.98px) {
    .table-responsive .table tbody td[data-label="Item Details"],
    .table-responsive .table tbody td[data-label="Product"] {
        flex-direction: column;
        align-items: flex-end;
    }
}

/* Responsive Product Truncation */
.product-title-truncate {
    max-width: 300px; /* Safe limit for desktop tables */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ensure complex cells stack and align correctly on mobile */
@media (max-width: 767.98px) {
    .table-responsive .table tbody td[data-label="Item Details"],
    .table-responsive .table tbody td[data-label="Product"],
    .table-responsive .table tbody td[data-label="Subject / Ref"],
    .table-responsive .table tbody td[data-label="Category"],
    .table-responsive .table tbody td[data-label="Linked Orders"],
    .table-responsive .table tbody td[data-label="Baseline"],
    .table-responsive .table tbody td[data-label="Current"],
    .table-responsive .table tbody td[data-label="Action"],
    .table-responsive .table tbody td[data-label="Description"],
    .table-responsive .table tbody td[data-label="Payee & Details"],
    .table-responsive .table tbody td[data-label="Receipt"],
    .table-responsive .table tbody td[data-label="Route / Details"],
    .table-responsive .table tbody td[data-label="Type"],
    .table-responsive .table tbody td[data-label="Dist."],
    .table-responsive .table tbody td[data-label="Vehicle"],
    .table-responsive .table tbody td[data-label="Start"],
    .table-responsive .table tbody td[data-label="End"] {
        flex-direction: column;
        align-items: stretch; 
    }
    
    .table-responsive .table tbody td[data-label="Item Details"]::before,
    .table-responsive .table tbody td[data-label="Product"]::before,
    .table-responsive .table tbody td[data-label="Subject / Ref"]::before,
    .table-responsive .table tbody td[data-label="Category"]::before,
    .table-responsive .table tbody td[data-label="Linked Orders"]::before,
    .table-responsive .table tbody td[data-label="Baseline"]::before,
    .table-responsive .table tbody td[data-label="Current"]::before,
    .table-responsive .table tbody td[data-label="Action"]::before,
    .table-responsive .table tbody td[data-label="Description"]::before,
    .table-responsive .table tbody td[data-label="Payee & Details"]::before,
    .table-responsive .table tbody td[data-label="Receipt"]::before,
    .table-responsive .table tbody td[data-label="Route / Details"]::before,
    .table-responsive .table tbody td[data-label="Type"]::before,
    .table-responsive .table tbody td[data-label="Dist."]::before,
    .table-responsive .table tbody td[data-label="Vehicle"]::before,
    .table-responsive .table tbody td[data-label="Start"]::before,
    .table-responsive .table tbody td[data-label="End"]::before {
        align-self: flex-start;
        margin-bottom: 0.5rem;
    }
    
    .table-responsive .table tbody td[data-label="Item Details"] > div,
    .table-responsive .table tbody td[data-label="Product"] > div,
    .table-responsive .table tbody td[data-label="Subject / Ref"] > div,
    .table-responsive .table tbody td[data-label="Category"] > div,
    .table-responsive .table tbody td[data-label="Linked Orders"] > div,
    .table-responsive .table tbody td[data-label="Baseline"] > div,
    .table-responsive .table tbody td[data-label="Current"] > div,
    .table-responsive .table tbody td[data-label="Action"] > div,
    .table-responsive .table tbody td[data-label="Description"] > div,
    .table-responsive .table tbody td[data-label="Payee & Details"] > div,
    .table-responsive .table tbody td[data-label="Receipt"] > div,
    .table-responsive .table tbody td[data-label="Route / Details"] > div,
    .table-responsive .table tbody td[data-label="Type"] > div,
    .table-responsive .table tbody td[data-label="Dist."] > div,
    .table-responsive .table tbody td[data-label="Vehicle"] > div,
    .table-responsive .table tbody td[data-label="Start"] > div,
    .table-responsive .table tbody td[data-label="End"] > div {
        align-self: flex-end;
        text-align: right;
    }
    
    .product-title-truncate {
        max-width: calc(100vw - 4rem); 
    }
}

/* =========================================================
   STICKY TABLE HEADERS (Desktop Only)
   ========================================================= */
@media (min-width: 768px) {
    /* 1. Release the sticky trap by disabling overflow on desktop */
    .table-responsive {
        overflow: visible !important; 
    }

    /* 2. Pin the headers below the main navbar */
    .table thead th {
        position: sticky;
        /* 56px is standard Bootstrap navbar height. Adjust this up or down 
           (e.g., 60px or 65px) so it sits perfectly flush under your main nav. */
        top: 56px; 
        z-index: 10;
        
        /* 3. Ensure background is solid so scrolling text doesn't bleed through */
        background-color: var(--sb-surface-alt); 
        
        /* 4. Swap standard border for box-shadow so the line travels with the sticky element */
        border-bottom: none !important;
        box-shadow: inset 0 -1px 0 var(--bs-border-color);
    }
}

.plan-premium {
    border: 2px solid var(--bs-primary) !important;
    position: relative;
}

/* A small "best value" tag on the bottom for the top tier
.plan-premium::after {
    content: "Best Value for Business";
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bs-primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 10px;
    font-weight: bold;
} */

/* Styling for the Top Tier Badge */
.bg-premium-badge {
    background-color: var(--bs-primary);
    color: #ffffff;
    border-bottom: 1px solid var(--bs-primary);
}