/* --- THE MAGIC FIX: Forces all boxes to stay exactly inside their borders --- */
*, *::before, *::after {
    box-sizing: border-box;
}

/* High-end Boutique Styling */
:root { --primary: #1c1c1c; --accent: #c4a052; --bg: #f9f8f6; --surface: #ffffff; --text: #333333; --border: #e5e5e5; }

/* Added max-width and overflow-x hidden to the body to physically prevent screen spilling */
body { font-family: 'Inter', sans-serif; background-color: var(--bg); color: var(--text); margin: 0; padding: 0; line-height: 1.6; max-width: 100vw; overflow-x: hidden; }
.container { max-width: 1100px; margin: auto; padding: 40px 20px; width: 100%; }

/* Navigation Bar */
.top-nav { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 20px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.nav-brand { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 600; color: var(--primary); letter-spacing: 2px; }
.nav-links { display: flex; gap: 10px; }

.nav-btn { background-color: transparent; border: none; padding: 20px 15px; font-family: 'Inter', sans-serif; font-size: 0.9rem; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 1px; cursor: pointer; border-bottom: 2px solid transparent; transition: color 0.3s ease; white-space: nowrap; text-decoration: none; display: inline-block;}
.nav-btn:hover { color: var(--accent); background-color: transparent; }
.nav-btn.active { color: var(--primary); border-bottom-color: var(--accent); cursor: default; background-color: transparent; }
.nav-btn.active:hover { color: var(--primary); background-color: transparent; }

/* Typography */
h1, h2, h3 { font-family: 'Playfair Display', serif; color: var(--primary); font-weight: 600; margin-top: 0; }
.page-title { font-size: 2rem; margin-bottom: 30px; border-bottom: 1px solid var(--border); padding-bottom: 15px; }

/* Header Controls */
.controls-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; background: white; padding: 15px 25px; border-radius: 8px; border: 1px solid var(--border); width: 100%; }
.month-selector { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.month-selector input { width: auto; padding: 8px; margin: 0; cursor: pointer; }

/* Layout Grids */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Forces exactly 4 equal columns */
    gap: 20px;
}
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr); /* 2x2 grid on tablets/small screens */
    }
}

@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: 1fr; /* 1 single column on mobile phones */
    }
}
.split-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 30px; width: 100%; }

/* Cards (Added 100% width lock so they can't spill) */
.card { background: var(--surface); padding: 25px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.04); border: 1px solid var(--border); margin-bottom: 30px; width: auto; overflow: hidden; }
.stat-card { text-align: center; position: relative; overflow: hidden; margin-bottom: 0; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--accent); }
.stat-card h3 { margin: 0; font-family: 'Inter', sans-serif; font-size: 0.8rem; color: #888; text-transform: uppercase; letter-spacing: 1px; }
.stat-card p { margin: 15px 0 0; font-size: 2.5rem; font-weight: 600; }

/* Forms & Buttons */
.form-group { margin-bottom: 15px; width: 100%; }
label { display: block; font-size: 0.8rem; color: #666; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
input, select { width: 100%; padding: 12px 15px; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; font-size: 0.9rem; background: #fafafa; transition: border 0.3s; }
input:focus, select:focus { outline: none; border-color: var(--accent); }

.btn-group { display: flex; gap: 10px; margin-top: 10px; width: 100%; }
button { width: 100%; padding: 14px; background-color: var(--primary); color: white; border: none; border-radius: 6px; cursor: pointer; transition: background-color 0.3s, border-color 0.3s, color 0.3s; font-family: inherit; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; font-size: 0.85rem; }
button:hover { background-color: #000000; }

.btn-secondary { background-color: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background-color: var(--border); border-color: var(--border); color: var(--primary); }

.btn-export { background-color: white; color: var(--primary); border: 1px solid var(--primary); width: auto; margin: 0; padding: 10px 20px; }
.btn-export:hover { background-color: var(--accent); color: white; border-color: var(--accent); }

/* Action Links inside Tables */
.action-link { background: none; border: none; padding: 0; color: var(--accent); font-family: inherit; font-size: 0.75rem; text-transform: uppercase; font-weight: 600; cursor: pointer; letter-spacing: 0.5px; margin-right: 10px; width: auto; display: inline; transition: color 0.2s; }
.action-link:hover { color: var(--primary); background: none; }
.action-link.danger { color: #c62828; }
.action-link.danger:hover { color: #8e0000; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.9rem; }
th, td { text-align: left; padding: 15px 10px; border-bottom: 1px solid var(--border); }
th { color: #888; font-weight: 600; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 1px; }

.amount-pos { color: #2e7d32; font-weight: 600; }
.amount-neg { color: #c62828; font-weight: 600; }
.empty-state { text-align: center; padding: 30px; color: #888; font-style: italic; }

/* Hide the ugly default browser input completely */
        .custom-file-upload input[type="file"] {
            display: none; 
        }

        /* Style the label to look like a modern upload box */
        .custom-file-upload {
            display: block;
            border: 2px dashed #ccc;
            padding: 12px;
            text-align: center;
            border-radius: 6px;
            cursor: pointer;
            background-color: #fafafa;
            color: #777;
            font-size: 14px;
            transition: all 0.2s ease-in-out;
            margin-top: 5px;
        }

        /* Add a nice hover effect using your boutique styling */
        .custom-file-upload:hover {
            border-color: #d4af37; /* Gold accent */
            background-color: #fdfbf5;
            color: #333;
        }

/* --- MOBILE RESPONSIVENESS --- */
/* --- THE NUCLEAR MOBILE FIX --- */
html, body { 
    max-width: 100vw; 
    overflow-x: hidden; 
    width: 100%; 
    position: relative;
}

@media (max-width: 768px) {
    .container { padding: 15px 10px; overflow-x: hidden; }
    
    /* The Fix: min-width: 0 forces grids to respect screen bounds */
    .dashboard-grid, .split-grid { 
        grid-template-columns: 1fr; 
        gap: 20px; 
        min-width: 0; 
        width: 100%;
    }
    
    .card, .split-grid > div { 
        min-width: 0; 
        max-width: 100%; 
    }
    
    .card { padding: 15px; margin-bottom: 20px; overflow: hidden; }
    
    /* Constrain all inputs and buttons */
    input, select, button { max-width: 100%; }
    .btn-group { flex-direction: column; gap: 10px; width: 100%; }
    
    /* Navigation adjustments */
    .top-nav { flex-direction: column; padding: 10px 10px 0; gap: 5px; }
    .nav-links { width: 100%; display: flex; justify-content: space-between; overflow-x: auto; padding-bottom: 5px; }
    .nav-btn { padding: 12px 5px; font-size: 0.75rem; }
    
    /* Header constraints */
    .page-title { font-size: 1.5rem; margin-bottom: 20px; text-align: center; word-wrap: break-word; }
    .controls-header { flex-direction: column; gap: 15px; align-items: stretch; padding: 15px; width: 100%; }
    .month-selector { justify-content: space-between; flex-wrap: wrap; }
    .btn-export { width: 100%; text-align: center; }
    
    /* Ultimate Table Containment */
    table { 
        display: block; 
        width: 100%; 
        max-width: 100%;
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; 
        white-space: nowrap; 
        font-size: 0.85rem; 
    }
    th, td { padding: 12px 10px; }
}

/* @media print {
    body { background: white; padding: 0; overflow: visible; }
    .top-nav, .no-print, .action-cell { display: none !important; }
    .split-grid { grid-template-columns: 1fr; }
    .card { box-shadow: none; border: 1px solid #ddd; page-break-inside: avoid; margin-bottom: 20px; overflow: visible; }
} */
/* --- PDF EXPORT STATE --- */
body.pdf-export-mode .no-print,
body.pdf-export-mode .controls-header,
body.pdf-export-mode .action-cell {
    display: none !important;
}

/* Force the grid to become a single, full-width column for the table */
body.pdf-export-mode .split-grid {
    grid-template-columns: 1fr !important;
}
/* --- VERTICAL SIDEBAR & MOBILE HEADER --- */

/* --- THE UNBREAKABLE GRID HEADER --- */
        .mobile-header {
            background: #ffffff;
            padding: 15px 20px;
            
            /* 1. Use Grid instead of Flexbox */
            display: grid !important;
            /* 2. Left column gets all remaining space (1fr), right column fits the button (auto) */
            grid-template-columns: 1fr auto !important; 
            align-items: center;
            
            /* 3. Force it to be exactly the width of the screen */
            width: 100vw !important; 
            max-width: 100%;
            box-sizing: border-box !important;
            
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
            position: sticky;
            top: 0;
            z-index: 900;
        }

        .nav-brand { 
            display: flex; 
            align-items: center; 
            gap: 8px; 
            justify-self: start; /* Locks logo to the left */
        }
        
        .nav-brand h1 { 
            font-family: 'Playfair Display', serif; 
            margin: 0; 
            font-size: 22px; 
            color: #000000; 
        }

        .menu-btn { 
            background: transparent; 
            border: none; 
            font-size: 28px; 
            color: #333; 
            cursor: pointer; 
            padding: 5px; 
            
            justify-self: end !important; /* Locks button to the absolute right */
            
            /* Overriding the old absolute positioning */
            position: static !important;
            transform: none !important;
            margin: 0 !important;
            
            /* The mobile tap fixes */
            -webkit-tap-highlight-color: transparent; 
            outline: none; 
        }

        .menu-btn:active, .menu-btn:focus {
            background: transparent !important;
            outline: none;
        }

/* The Sidebar Drawer */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px; /* Hidden off-screen by default */
    width: 260px;
    height: 100vh;
    background: #ffffff;
    box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar.open { left: 0; } /* Slides in when active */

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.sidebar-header h2 { margin: 0; font-size: 18px; color: #000000; }
.close-btn { background: none; border: none; font-size: 28px; color: #aaa; cursor: pointer; }

/* Dark Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 950;
    display: none; /* Hidden by default */
}
.sidebar-overlay.open { display: block; }

/* Sidebar Links */
.sidebar-menu { padding: 15px 0; }
.sidebar-menu a, .dropdown-btn {
    display: block;
    padding: 15px 20px;
    color: #555;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 1px solid #f9f9f9;
    transition: background 0.2s;
}
.sidebar-menu a:hover, .sidebar-menu a.active, .dropdown-btn:hover { background: #fdfbf5; color: #000000; }

/* Dropdown/Accordion Styling */
.dropdown-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.arrow { font-size: 10px; transition: transform 0.2s; }
.arrow.rotate { transform: rotate(180deg); }

.dropdown-content {
    display: none; /* Hidden by default */
    background: #fcfcfc;
    border-left: 3px solid #ffffff;
}
.dropdown-content.show { display: block; } /* Shows when clicked */

.dropdown-content a {
    padding: 12px 20px 12px 40px; /* Indented to show it's a sub-menu */
    font-size: 13px;
    border-bottom: none;
}

/* Desktop Adjustments (Locked Sidebar for large screens) */
        @media (min-width: 1024px) {
            /* 1. Hide the mobile header and overlay completely */
            .mobile-header, 
            .sidebar-overlay, 
            .sidebar-overlay.open { 
                display: none !important; 
            }
            
            /* 2. Lock the sidebar to the left */
            .sidebar { 
                left: 0 !important; 
            } 
            
            /* 3. Hide the X button because the sidebar is permanent here */
            .close-btn { 
                display: none; 
            } 
            
            /* 4. Push the dashboard over so it doesn't hide behind the sidebar */
            .main-content { 
                margin-left: 260px; 
                padding: 20px; 
            }
        }

/* --- SMOOTH MODALS & BLURRED BACKGROUND --- */
        
        /* The Dark, Blurred Background */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.4);
            backdrop-filter: blur(6px); /* The magic blur effect */
            -webkit-backdrop-filter: blur(6px); /* For Safari support */
            z-index: 2000;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .modal-overlay.show {
            opacity: 1;
            visibility: visible;
        }

        /* The Form Card Animation */
        .modal-card {
            position: fixed;
            top: 50%;
            left: 50%;
            /* Starts slightly lower and invisible for a slide-up effect */
            transform: translate(-50%, -40%); 
            opacity: 0;
            visibility: hidden;
            
            background: #fff;
            width: 90%;
            max-width: 500px;
            padding: 25px;
            border-radius: 12px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.2);
            max-height: 85vh; 
            overflow-y: auto; 
            z-index: 2001;
            
            /* The cubic-bezier gives it that premium 'app bounce' */
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
            /* If the modal has a table, we give it more breathing room */
            #modal-clients, #modal-workers {
                max-width: 700px; 
            }
        }

        .modal-card.show {
            /* Snaps to the exact dead-center */
            transform: translate(-50%, -50%);
            opacity: 1;
            visibility: visible;
        }

        .close-modal {
            background: transparent;
            border: none;
            color: #aaa;
            cursor: pointer;
            transition: color 0.2s;
            
            display: flex;
            align-items: center;
            justify-content: center;
            
            font-size: 32px;
            line-height: 0;
            height: 32px;
            width: 32px;
            padding: 0;
            margin: 0;
            
            /* --- THE PIXEL NUDGE --- */
            /* Negative Y moves it UP, positive Y moves it DOWN */
            transform: translateY(-15px); 
            
            -webkit-tap-highlight-color: transparent;
            outline: none;
        }
        .close-modal:hover {
            background-color: #fff;
            color: #d32f2f;
        }

        /* --- MODAL HEADER GRID --- */
        .modal-header {
            display: flex !important;
            justify-content: space-between;
            align-items: center; /* This is the vertical anchor */
            width: 100%;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 1px solid #f0f0f0; /* Optional: adds a nice clean separator */
        }

        .modal-header h3 {
            margin: 0 !important;
            padding: 0 !important;
            font-family: 'Playfair Display', serif;
            color: #333;
            font-size: 22px;
            line-height: 1.2; /* Gives the heading a predictable height */
        }

        /* --- TABLE ACTION BUTTONS FIX --- */
.manager-table .action-btn {
    width: auto !important;         /* Stops the button from stretching */
    display: inline-block;          /* Allows them to sit side-by-side */
    padding: 6px 12px;              /* Nice, tight internal spacing */
    margin-right: 6px;              /* Space between the Edit and Delete buttons */
    font-size: 13px;                /* Slightly smaller font for table rows */
    white-space: nowrap;            /* Prevents the word "Delete" from wrapping to two lines */
    border-radius: 4px;             /* Keeps the edges slightly rounded */
}

/* Optional: Remove the margin from the very last button so it doesn't push the cell wider */
.manager-table .action-btn:last-child {
    margin-right: 0;
}

/* Optional Colors if you want them to look distinct */
.manager-table .edit-btn {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
}

.manager-table .del-btn {
    background-color: #fff0f0;
    color: #d32f2f;
    border: 1px solid #ffcdd2;
}

/* 1. Force the cards to stretch all the way down */
.dash-card-jailbreak {
    height: auto !important;
    max-height: none !important;
    display: block !important; 
    
    /* THE KNOCKOUT PUNCH: */
    overflow: visible !important; 
    min-height: min-content !important; 
}
/* 2. The magic wrapper: Scrolls left/right, NEVER up/down */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    /* We add 5px padding to prevent the scrollbar from eating the bottom border */
    padding-bottom: 5px; 
}

/* 3. Force table data to wrap neatly */
.table-responsive table {
    width: 100%;
    border-collapse: collapse !important;
    white-space: normal !important;
}

.table-responsive th, 
.table-responsive td {
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Container for the whole bar */
.dashboard-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end; /* Keeps labels on top and button aligned with inputs */
    background: #f9f9f9;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    margin-bottom: 30px;
}

/* Grouping Label + Input */
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    font-weight: 600;
}

/* The Month Inputs */
.range-input {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    color: #333;
    background: white;
    outline: none;
    transition: border-color 0.3s;
}

.range-input:focus {
    border-color: #000; /* Matches your black button theme */
}

/* The sleek Apply Button */
.btn-apply {
    background: #111;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 40px;
    display: inline-flex; /* Use inline-flex instead of flex */
    align-items: center;
    justify-content: center;

    /* THE FIX: Override global stretching */
    width: auto !important; 
    flex-grow: 0 !important;
}

.btn-apply:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-apply:active {
    transform: translateY(0);
}

/* Sidebar General Links */
.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    text-decoration: none;
    color: #4b5563;
    font-size: 14px;
    transition: 0.2s;
}

/* Square Icon Styling for all links */
.sidebar-menu i {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 12px;
}

/* Header (Dropdown Button) Styling */
.dropdown-btn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 15px;
    border-radius: 4px;
}

/* --- COLOR CODING --- */

/* Entry: Blue */
.entry-sect .dropdown-btn { color: #0284c7; background: #f0f9ff; border-left: 4px solid #0284c7; }
.entry-sect .dropdown-content a i { background: #0284c7; color: #fff; }

/* Masters: Purple */
.master-sect .dropdown-btn { color: #7c3aed; background: #f5f3ff; border-left: 4px solid #7c3aed; }
.master-sect .dropdown-content a i { background: #7c3aed; color: #fff; }

/* Production: Amber/Orange */
.prod-sect .dropdown-btn { color: #d97706; background: #fffbeb; border-left: 4px solid #d97706; }
.prod-sect .dropdown-content a i { background: #d97706; color: #fff; }

/* Dropdown Content Hover */
.dropdown-content a:hover {
    background-color: #f3f4f6;
    color: #000;
}

.dropdown-content a:hover i {
    transform: scale(1.1);
}

/* Icon in the main Header Button (transparent style) */
.dropdown-btn i {
    background: transparent !important;
    margin-right: 5px;
    font-size: 14px;
}

/* --- FINAL ONE-PAGE P&L PRINT LOGIC --- */
@media print {
    /* 1. Hide EVERY section except the ones we want */
    nav, .navbar, .sidebar-menu, .sidebar, 
    .table-responsive, #dash-so-list, #dash-po-list,
    .card:not(.financial-overview-container .card),
    .btn-apply, .btn-primary, button, hr, footer {
        display: none !important;
    }

    /* 1. Add 'h2' and 'h3' to the hide list, but we'll exempt the P&L title */
    nav, .navbar, .sidebar, .sidebar-menu, 
    .table-responsive, #dash-so-list, #dash-po-list,
    .btn-apply, .btn-primary, button, hr, footer,
    
    /* THE FIX: Hide headers that aren't part of the P&L */
    .main-content h2:not(:first-of-type), 
    .production-title, /* If you have a specific class on that text */
    h2:last-of-type { 
        display: none !important;
    }

    /* 2. Ensure your P&L title stays visible */
    .main-content h2:first-of-type {
        visibility: visible !important;
        display: block !important;
        margin-top: 10px !important;
    }

    /* 2. Lock the page height to exactly one sheet */
    html, body {
        height: 100%;
        overflow: hidden !important; /* Prevents scrolling/printing page 2 */
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .main-content {
        width: 100% !important;
        padding: 20px !important;
        margin: 0 !important;
    }

    /* 3. Style the P&L Cards into a 2x2 grid for the paper */
    .financial-overview-container {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important; /* 2x2 is best for A4 paper */
        gap: 15px !important;
        width: 100% !important;
        visibility: visible !important;
    }

    /* 4. Format the Date Range bar */
    .dashboard-filter-bar {
        display: flex !important;
        border: none !important;
        background: none !important;
        margin-bottom: 20px !important;
        visibility: visible !important;
    }

    .range-input {
        border: none !important;
        font-size: 16px !important;
    }

    /* 5. Force the browser to respect your colors */
    .card {
        border: 1px solid #eee !important;
        box-shadow: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
/* THE DASHBOARD GRID */
.financial-overview-container {
    display: grid;
    /* This forces 4 equal columns on desktop */
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

/* Responsiveness: On tablets/small screens, do 2x2 */
@media (max-width: 1024px) {
    .financial-overview-container {
        grid-template-columns: 1fr 1fr;
    }
}

/* Responsiveness: On mobile phones, stack them vertically */
@media (max-width: 600px) {
    .financial-overview-container {
        grid-template-columns: 1fr;
    }
}

/* --- EXACT MOBILE TABLE ALIGNMENT --- */
@media (max-width: 768px) {
    /* 1. Force the table to expand to the edges of the white card */
    .card table {
        width: 100% !important;
        display: table !important; 
    }

    /* 2. Target the headers (th) and the data cells (td) in the last column */
    .card table thead tr th:last-child,
    .card table tbody tr td:last-child {
        text-align: right !important;
        padding-right: 5px !important; /* Keeps the text from touching the absolute edge */
    }

    /* Shrink the table to force it to fit */
    .card table th, 
    .card table td {
        font-size: 11px !important; /* Make text smaller */
        padding: 8px 4px !important; /* Reduce the breathing room between words */
        letter-spacing: -0.5px !important; /* Squeeze letters slightly */
    }
}