/* Global styles for Automan Car Purchase Management */

/* Plus Jakarta Sans — self-hosted variable font (weights 400–700). */
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(fonts/plus-jakarta-sans-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url(fonts/plus-jakarta-sans-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
}

/* Rixo table — action cols from <colgroup>; data cols keep min-width and scroll */
.rixo-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    border-collapse: collapse;
}

.rixo-table thead tr {
    background: #f8f9fa;
}

.rixo-table th,
.rixo-table td {
    border: 1px solid #dee2e6;
    padding: 8px 10px;
}

.rixo-table thead th:not(.rixo-col-select):not(.rixo-col-view):not(.rixo-col-edit),
.rixo-table tbody td:not(.rixo-col-select):not(.rixo-col-view):not(.rixo-col-edit) {
    min-width: 112px;
}

.rixo-row { transition: background-color 140ms ease-in, box-shadow 140ms ease-in; }
.rixo-row:nth-child(even) { background: #f6f8ff; }
.rixo-row:hover { background: #e7f1ff; }
.rixo-row-selected { background: #efe2ff; box-shadow: inset 0 0 0 2px #6f42c1; }
.rixo-row-disabled { color: #adb5bd; background: #f8f9fa; }

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Focus styles for accessibility */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* Loading animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ============================================
   Sidebar Navigation - Responsive Styles
   ============================================ */

/* Base - Sidebar and Hamburger (desktop defaults) */
.app-sidebar {
    width: 250px;
    left: -250px;
}

/* When sidebar is open, always show it (overrides all breakpoints) */
#sidebar.app-sidebar.sidebar-open,
.app-sidebar.sidebar-open {
    left: 0 !important;
    z-index: 10001 !important; /* Above overlay (999) and hamburger (10000) */
}

.hamburger-container {
    top: 20px;
    left: 20px;
}

.hamburger-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.page-title-bar {
    padding-left: 16px;
    padding-right: 16px;
}

/* Mobile: Use transform for sidebar (avoids left overrides); narrower so content has more room */
@media (max-width: 767px) {
    /* Base: anchor at left edge, slide off-screen with transform */
    #sidebar.app-sidebar {
        left: 0 !important;
        width: 65% !important;
        max-width: 240px !important;
        transition: transform 0.3s ease, left 0s !important;
    }
    
    /* Closed: slide left by full width */
    #sidebar.app-sidebar:not(.sidebar-open) {
        transform: translateX(-100%) !important;
    }
    
    /* Open: slide in (overrides any inline left) */
    #sidebar.app-sidebar.sidebar-open,
    .app-sidebar.sidebar-open {
        transform: translateX(0) !important;
        left: 0 !important;
        z-index: 10001 !important;
        visibility: visible !important;
    }
    
    .hamburger-container,
    #hamburgerBtn {
        top: 8px !important;
        left: 8px !important;
    }
    
    /* Small hamburger on mobile – ID selector overrides any inline size */
    #hamburgerBtn,
    .hamburger-btn {
        min-width: 32px !important;
        max-width: 32px !important;
        min-height: 32px !important;
        max-height: 32px !important;
        width: 32px !important;
        height: 32px !important;
        padding: 4px !important;
        font-size: 14px !important;
        line-height: 1 !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        box-sizing: border-box !important;
    }
    
    .sidebar-inner {
        padding: 16px !important;
    }
    
    .sidebar-header {
        margin-bottom: 24px !important;
    }
    
    .sidebar-header h3 {
        font-size: 18px !important;
    }
    
    .sidebar-close-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 10px !important;
        font-size: 24px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* All sidebar buttons - min 44px touch target */
    #sidebar > .sidebar-inner > div > button,
    #sidebar .sidebar-btn {
        min-height: 44px !important;
        padding: 14px 20px !important;
        font-size: 15px !important;
    }
    
    #sidebar button:not(.sidebar-close-btn) {
        min-height: 44px !important;
        padding: 14px 20px !important;
        font-size: 15px !important;
    }
    
    /* Section headers (Rixo, Shipment, Invoice, Master) */
    #sidebar [id$="Header"] {
        min-height: 44px !important;
        padding: 12px 16px !important;
    }
    
    #sidebar [id$="Header"] h3,
    #sidebar [id$="Header"] .sidebar-section-title {
        font-size: 16px !important;
    }
    
    /* Sub-items */
    #sidebar .master-list-item,
    #sidebar .shipment-list-item,
    #sidebar .rixo-list-item,
    #sidebar .invoice-nav-list-item {
        min-height: 44px !important;
        padding: 12px 16px !important;
        font-size: 15px !important;
    }
    
    /* Page title - prevent overlap with hamburger (32px button + gap) */
    .page-title-bar {
        padding-left: 48px !important;
        padding-right: 12px !important;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
        min-height: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .page-title-bar h1 {
        font-size: 16px !important;
        line-height: 1.3 !important;
        margin: 0 !important;
    }
    
    /* Content area top spacing for fixed hamburger (32px + gap) */
    #content {
        padding-top: 48px !important;
    }
}

/* Tablet: Sidebar 250px */
@media (min-width: 768px) and (max-width: 1024px) {
    .app-sidebar:not(.sidebar-open) {
        width: 250px !important;
        left: -250px !important;
    }
    
    .hamburger-btn {
        min-width: 44px !important;
        min-height: 44px !important;
    }
    
    #sidebar button:not(.sidebar-close-btn) {
        min-height: 44px !important;
        padding: 12px 20px !important;
    }
    
    .sidebar-close-btn {
        min-width: 40px !important;
        min-height: 40px !important;
    }
}

/* Desktop: keep defaults */
@media (min-width: 1025px) {
    .app-sidebar {
        width: 250px !important;
    }
}

/* ============================================
   Login / Authentication Page - Full background & centered modal
   ============================================ */
/* Full-viewport overlay so background covers entire screen (above title bar, etc.) */
.auth-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100vh !important;
    min-height: 100dvh !important; /* mobile address bar */
    margin: 0 !important;
    padding: 0 !important;
    z-index: 99999 !important;
    overflow-x: hidden;
    box-sizing: border-box;
}
.auth-background {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    background-size: cover !important;
    background-position: center center !important;
    background-repeat: no-repeat !important;
}
.background-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
}

/* Auth signup/signin message, email error, password strength (all breakpoints) */
.auth-container .auth-message {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 12px;
    line-height: 1.4;
}
.auth-container .auth-field-error {
    font-size: 13px;
    color: #fecaca;
    margin-top: 4px;
}
.auth-container .auth-password-hints {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.auth-container .auth-password-hints .hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.72);
}
.auth-container .auth-password-hints .hint.hint-ok {
    color: #86efac;
}
.auth-container .auth-role-hint {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.72);
}
.auth-container .auth-button {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}
.auth-container .auth-button:hover:not(:disabled) {
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}
.auth-container .auth-button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* ============================================
   Login / Authentication Page - Responsive (mobile)
   ============================================ */
@media (max-width: 767px) {
    .auth-container {
        padding: 16px; /* inner spacing only; background still full viewport */
        align-items: center !important;
        justify-content: center !important;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        box-sizing: border-box;
    }
    .auth-modal {
        width: 90% !important;
        max-width: 340px !important;
        margin: auto !important;
        border-radius: 16px;
        padding: 16px;
        flex-shrink: 0;
    }
    .auth-modal .modal-header {
        padding: 16px 0 16px 0;
        margin-bottom: 20px;
    }
    .auth-modal .modal-title {
        font-size: 20px;
    }
    .auth-panel,
    .auth-modal .auth-panel {
        padding: 0 0 20px 0;
    }
    .auth-container .form-group {
        margin-bottom: 18px;
    }
    .auth-container .form-label {
        font-size: 15px;
    }
    .auth-container .form-input {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
        padding: 12px 16px 12px 40px;
        box-sizing: border-box;
    }
    .auth-container .auth-button {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
        padding: 14px 20px;
    }
    .auth-container .auth-message {
        padding: 10px 14px;
        border-radius: 8px;
        font-size: 14px;
        margin-bottom: 12px;
    }
    .auth-container .auth-field-error {
        display: block;
        font-size: 13px;
        color: #fecaca;
        margin-top: 4px;
    }
    .auth-container .auth-password-hints {
        margin-top: 8px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    .auth-container .auth-password-hints .hint {
        font-size: 12px;
        color: rgba(255, 255, 255, 0.72);
    }
    .auth-container .auth-password-hints .hint.hint-ok {
        color: #86efac;
    }
    .auth-container .switch-link,
    .auth-container .auth-switch {
        font-size: 15px;
    }
}

/* ============================================
   Global Components - Responsive (mobile)
   ============================================ */
@media (max-width: 767px) {
    /* Page headers/titles - prevent overflow, readable size */
    .page-title-bar h1,
    #content h1,
    .page-header h1 {
        font-size: 18px !important;
        line-height: 1.3 !important;
        word-wrap: break-word;
    }
    #content h2 {
        font-size: 16px !important;
    }
    /* Action buttons - full width where in stacked layout, min touch target */
    #content .btn-group,
    #content .action-buttons,
    #content div[style*="display: flex"][style*="gap"] {
        flex-wrap: wrap;
        gap: 10px;
    }
    #content button:not(.hamburger-btn):not(.sidebar-close-btn) {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 16px;
        font-size: 15px;
    }
    /* Form labels - readable, wrap */
    #content label,
    .form-label,
    .form-group label {
        font-size: 15px !important;
        min-height: 1.2em;
        word-wrap: break-word;
    }
}

/* ============================================
   Responsive Purchase List Table Styles
   ============================================ */

/* Purchase List Container */
#purchaseList {
    width: 100%;
    overflow-x: auto;
}

/* Purchase List Table - Base Styles (grid + chips; details in master map block) */
#purchaseTable table.purchase-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}

#purchaseTable table.purchase-list-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

#purchaseTable table.purchase-list-table th,
#purchaseTable table.purchase-list-table td {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

/* Purchase Date: keep text inside the cell; weekday wraps under the year when narrow */
#purchaseTable table.purchase-list-table td.purchase-list-date-td {
    overflow: hidden;
    max-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.purchase-list-date {
    display: block;
    max-width: 100%;
    overflow: hidden;
    line-height: 1.35;
}

.purchase-list-date-main {
    overflow-wrap: anywhere;
}

.purchase-list-date-day {
    display: inline-block;
    white-space: nowrap;
}

.purchase-cards-container .purchase-list-date-td {
    overflow: hidden;
    max-width: 100%;
}

.purchase-date-quick-filter-menu {
    position: fixed;
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 280px;
    min-width: 280px;
    padding: 10px;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 25000;
}

.purchase-date-quick-filter-menu__quick-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.purchase-date-quick-filter-menu__quick-row button {
    padding: 6px 10px;
    background: #f8f9fa;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.purchase-date-quick-filter-menu__quick-row button.is-muted {
    background: #6c757d;
    color: #fff;
    border-color: #6c757d;
}

.purchase-date-quick-filter-menu__quick-row button.is-primary {
    background: #007bff;
    color: #fff;
    border: none;
}

.purchase-date-quick-filter-menu__date-row {
    border-top: 1px solid #eee;
    padding-top: 8px;
}

.purchase-date-quick-filter-menu__date-row--to {
    border-top: none;
    padding-top: 0;
}

.purchase-date-quick-filter-menu__date-row label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: #666;
}

.purchase-date-quick-filter-menu__date-input-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
}

.purchase-date-quick-filter-menu__date-input-wrap input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
}

.purchase-date-quick-filter-menu__date-input-wrap button {
    padding: 6px 8px;
    border: 1px solid #ddd;
    background: #f9fafb;
    border-radius: 4px;
    cursor: pointer;
}

.purchase-date-quick-filter-menu__native-date {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    opacity: 0;
    border: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.purchase-adv-calendar-btn,
.purchase-adv-canon {
    cursor: pointer;
}

.purchase-adv-value-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    align-items: start;
}

@media (max-width: 640px) {
    .purchase-adv-value-filters {
        grid-template-columns: 1fr;
    }
}

#purchaseTable tbody tr:hover td {
    background-color: #fafafa;
}

/* Edit Button - Compact on all viewports */
#purchaseTable .edit-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#purchaseTable .edit-btn svg {
    width: 12px;
    height: 12px;
}

/* Column Filter Button - circular icon control */
#columnFilterBtn.purchase-column-filter-btn,
.purchase-column-filter-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    white-space: nowrap;
    padding: 0;
}

/* Purchase cards — used when JS renders compact layout (≤860px) */
.purchase-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.purchase-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.purchase-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.purchase-cards-container .card-header,
.purchase-card .card-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    gap: 8px;
}

.purchase-cards-container .card-title,
.purchase-card .card-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    flex: 1;
}

.purchase-cards-container .card-edit-btn,
.purchase-card .card-edit-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    padding: 4px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #4CC9FF;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(76, 201, 255, 0.25);
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
    order: -1;
}

.purchase-cards-container .card-edit-btn svg,
.purchase-card .card-edit-btn svg {
    width: 12px !important;
    height: 12px !important;
}

.purchase-cards-container .card-body,
.purchase-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.purchase-cards-container .card-field,
.purchase-card .card-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.purchase-cards-container .card-label,
.purchase-card .card-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.purchase-cards-container .card-value,
.purchase-card .card-value {
    font-size: 14px;
    color: #333;
    word-wrap: break-word;
}

/* Pagination Controls - Responsive */
#purchaseTable + div,
.purchase-list-pager {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

#purchaseTable + div button,
.purchase-list-pager-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 8px 16px;
}

/* ============================================
   Mobile Card Layout Styles (< 768px)
   ============================================ */
@media (max-width: 767px) {
    /* Purchase List Container */
    #purchaseList {
        padding: 12px;
        border-radius: 14px;
    }
    
    /* Header Section */
    #purchaseList .purchase-list-toolbar {
        gap: 12px;
    }
    
    #purchaseList h2,
    #purchaseList .purchase-list-title {
        font-size: 18px;
        margin: 0;
    }
    
    /* Column Filter — keep circular, do not stretch full width */
    #columnFilterBtn.purchase-column-filter-btn {
        width: 48px;
        justify-content: center;
    }
    
    /* Pagination Controls - Mobile */
    .pagination-controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 8px;
        margin-top: 20px;
        padding: 16px 0;
        flex-wrap: wrap;
    }
    
    .pagination-info {
        text-align: center;
        color: #666;
        font-size: 13px;
    }
    
    .pagination-buttons {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
    }
    
    .pagination-btn {
        flex: 0 0 auto;
        padding: 8px 12px;
        min-height: 36px;
        background-color: #007bff;
        color: white;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-size: 13px;
        font-weight: 500;
        transition: background-color 0.2s ease;
        white-space: nowrap;
    }
    
    .pagination-btn:not(.disabled):active {
        background-color: #0056b3;
        transform: scale(0.98);
    }
    
    .pagination-btn.disabled {
        background-color: #ccc;
        cursor: not-allowed;
        opacity: 0.6;
    }
    
    .pagination-page {
        padding: 0 8px;
        color: #666;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    /* Hide table on mobile - show cards instead */
    #purchaseTable table {
        display: none;
    }
    
    /* Column Filter Modal - Mobile Optimized */
    #columnFilterModal > div {
        width: 95%;
        max-width: 100%;
        padding: 16px;
        max-height: 90vh;
    }
    
    /* Modal Header - Ensure cross button is top right */
    #columnFilterModal > div > div:first-child {
        display: flex;
        justify-content: space-between;
        align-items: center;
        position: relative;
    }
    
    #columnFilterModal h3 {
        flex: 1;
        margin: 0;
    }
    
    /* Cross Button - Top Right, Touch Friendly */
    #columnFilterModal #closeColumnFilter {
        position: relative;
        top: 0;
        right: 0;
        font-size: 32px;
        min-width: 44px;
        min-height: 44px;
        padding: 4px 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        background: none;
        border: none;
        cursor: pointer;
        color: #666;
        line-height: 1;
    }
    
    #columnFilterModal #closeColumnFilter:active {
        color: #333;
        transform: scale(0.95);
    }
    
    #columnFilterModal #columnCheckboxes {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    #columnFilterModal button:not(#closeColumnFilter) {
        width: 100%;
        min-height: 44px;
        margin-bottom: 8px;
    }
}

/* ============================================
   Tablet Styles (768px - 1024px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Purchase List Container */
    #purchaseList {
        padding: 16px;
    }
    
    /* Header Section */
    #purchaseList .purchase-list-toolbar {
        gap: 12px;
    }
    
    #purchaseList h2,
    #purchaseList .purchase-list-title {
        font-size: 20px;
    }
    
    /* Table Styles - Optimized (cards shown when JS chooses compact ≤860) */
    #purchaseTable table {
        font-size: 14px;
        display: table;
    }
    
    #purchaseTable th,
    #purchaseTable td {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    #purchaseTable table.purchase-list-table td {
        max-width: none;
        white-space: normal;
        overflow: visible;
    }
    
    /* Edit Button - Tablet */
    #purchaseTable .edit-btn {
        width: 26px;
        height: 26px;
        min-width: 26px;
        min-height: 26px;
        padding: 4px;
    }
    
    #purchaseTable .edit-btn svg {
        width: 11px;
        height: 11px;
    }
    
    /* Column Filter Modal - Tablet Optimized */
    #columnFilterModal #columnCheckboxes {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

/* ============================================
   Desktop Styles (> 1024px)
   ============================================ */
@media (min-width: 1025px) {
    /* Purchase List Container */
    #purchaseList {
        padding: 20px;
    }
    
    /* Table Styles - Full Desktop (cards only when JS renders them) */
    #purchaseTable table {
        font-size: 16px;
        display: table;
    }
    
    #purchaseTable th,
    #purchaseTable td {
        padding: 12px;
        font-size: 16px;
    }
    
    /* No truncation on desktop - show full content */
    #purchaseTable td {
        max-width: none;
        white-space: normal;
    }
    
    /* Edit Button - Desktop */
    #purchaseTable .edit-btn {
        width: 24px;
        height: 24px;
        min-width: 24px;
        min-height: 24px;
        padding: 4px;
    }
    
    #purchaseTable .edit-btn svg {
        width: 10px;
        height: 10px;
    }
}

/* ============================================
   Add/Edit Purchase Form - Responsive Styles
   ============================================ */

/* Form Container - Base */
#addForm, #editForm {
    width: 100%;
}

/* Form Sections - Base */
#addForm h3, #editForm h3 {
    color: #333;
    margin: 20px 0 10px 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    font-size: 16px;
    font-weight: 600;
}

/* Form Grids - Base (Desktop) */
.form-grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.form-grid-4col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
    align-items: end;
}

/* Form Inputs - Base */
#addForm input[type="text"],
#addForm input[type="number"],
#addForm input[type="date"],
#addForm input[type="month"],
#addForm select,
#addForm textarea,
#editForm input[type="text"],
#editForm input[type="number"],
#editForm input[type="date"],
#editForm input[type="month"],
#editForm select,
#editForm textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

/* Currency Inputs - Base */
.currency-input {
    position: relative;
    width: 100%;
}

.currency-input .currency-symbol {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    z-index: 1;
    pointer-events: none;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
}

.currency-input input {
    padding-left: 32px;
    width: 100%;
    box-sizing: border-box;
}

/* Ensure currency symbol doesn't overlap with input value */
.currency-input input[type="number"],
.currency-input input[type="text"] {
    padding-left: 32px !important;
}

/* Options Buttons - Base */
.options-buttons-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.option-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.option-btn:hover {
    background: #f0f0f0;
}

.option-btn.selected {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* Action Buttons - Base */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

.form-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    flex: 0 1 auto;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Add/Edit Purchase page shell */
.purchase-form-page {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    box-sizing: border-box;
}

.purchase-form-page > h2 {
    margin: 0 0 16px 0;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.purchase-form-calendar-btn {
    flex-shrink: 0;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    cursor: pointer;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.purchase-form-calendar-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.purchase-form-calendar-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.manage-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    padding: 6px;
    min-width: 36px;
    min-height: 36px;
}

.manage-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.manage-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Add/Edit Form section headers - collapsible on all devices (wrapper = tap target like Master menu) */
#addForm .form-section-header-wrap,
#editForm .form-section-header-wrap {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}
#addForm .form-section-header,
#editForm .form-section-header {
    font-size: 17px;
    margin: 16px 0 8px 0;
    padding: 12px 14px;
    min-height: 44px; /* Touch target size for mobile */
    box-sizing: border-box;
    background-color: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    color: #0f172a;
    font-weight: 700;
    letter-spacing: -0.01em;
    /* Mobile: make tap fire click immediately (no 300ms delay), no double-tap zoom */
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}
#addForm .form-section-header::after,
#editForm .form-section-header::after {
    content: "▼";
    font-size: 14px;
    transition: transform 0.3s ease;
    color: #666;
}
#addForm .form-section-header.collapsed::after,
#editForm .form-section-header.collapsed::after {
    transform: rotate(-90deg);
}

/* ============================================
   Mobile Styles (< 768px) - Add/Edit Forms
   ============================================ */
@media (max-width: 767px) {
    /* Form Container */
    #addForm, #editForm {
        padding: 12px;
    }
    
    /* Form Title */
    #addForm h2, #editForm h2 {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    /* Section Headers - Collapsible (mobile: ensure tappable and click fires) */
    #addForm h3.form-section-header,
    #editForm h3.form-section-header {
        font-size: 18px;
        margin: 16px 0 8px 0;
        padding: 12px;
        min-height: 44px;
        box-sizing: border-box;
        background-color: #f8f9fa;
        border: 1px solid #dee2e6;
        border-radius: 6px;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        user-select: none;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    #addForm h3::after, #editForm h3::after {
        content: "▼";
        font-size: 14px;
        transition: transform 0.3s ease;
        color: #666;
    }
    
    #addForm h3.collapsed::after, #editForm h3.collapsed::after {
        transform: rotate(-90deg);
    }
    
    /* Form Grids - Single Column on Mobile */
    .form-grid-2col {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 16px;
    }
    
    .form-grid-4col {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    /* Form Inputs - Touch Friendly */
    #addForm input[type="text"],
    #addForm input[type="number"],
    #addForm input[type="date"],
    #addForm input[type="month"],
    #addForm select,
    #addForm textarea,
    #editForm input[type="text"],
    #editForm input[type="number"],
    #editForm input[type="date"],
    #editForm input[type="month"],
    #editForm select,
    #editForm textarea {
        padding: 12px 16px;
        font-size: 16px;
        min-height: 44px;
        border-radius: 6px;
    }
    
    /* Currency Inputs - Mobile */
    .currency-input {
        position: relative !important;
        width: 100% !important;
        display: block !important;
    }
    
    .currency-input .currency-symbol {
        position: absolute !important;
        left: 16px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        font-size: 18px !important;
        font-weight: 500 !important;
        color: #666 !important;
        z-index: 10 !important;
        pointer-events: none !important;
        line-height: 1 !important;
        display: inline-block !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .currency-input input {
        padding-left: 40px !important;
        padding-right: 16px;
        width: 100%;
        box-sizing: border-box;
        position: relative !important;
        display: block !important;
    }
    
    /* Fix for Rixo Price field - match Add New Purchase styling */
    #editRixoPriceInput {
        padding: 8px 40px 8px 20px !important;
    }
    
    /* Ensure Rixo Price container and yen symbol positioning */
    div[style*="position: relative"]:has(#editRixoPriceInput) {
        position: relative !important;
    }
    
    /* Rixo Price yen symbol - ensure correct positioning */
    div[style*="position: relative"]:has(#editRixoPriceInput) > span[style*="left: 8px"],
    div[style*="position: relative"]:has(#editRixoPriceInput) > span:first-child {
        position: absolute !important;
        left: 8px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 1 !important;
        pointer-events: none !important;
        color: #666 !important;
        font-size: inherit !important;
    }
    
    /* Labels - Mobile */
    #addForm label, #editForm label {
        font-size: 14px;
        font-weight: 500;
        margin-bottom: 6px;
        display: block;
    }
    
    /* Options Buttons - 2 Column Grid */
    .options-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .option-btn {
        min-height: 44px;
        padding: 12px 16px;
        font-size: 15px;
        border-radius: 6px;
    }
    
    /* Radio Buttons - Larger Touch Area */
    #addForm input[type="radio"],
    #editForm input[type="radio"] {
        width: 20px;
        height: 20px;
        margin-right: 8px;
    }
    
    /* Checkboxes - Larger Touch Area */
    #addForm input[type="checkbox"],
    #editForm input[type="checkbox"] {
        width: 20px;
        height: 20px;
        margin-right: 8px;
    }
    
    /* Manage Buttons (⚙️) - Larger */
    .manage-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
        font-size: 18px;
    }
    
    /* Action Buttons - Floating on Mobile */
    .form-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 12px 16px;
        border-top: 2px solid #dee2e6;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        display: flex;
        gap: 10px;
        justify-content: stretch;
        flex-wrap: nowrap;
    }
    
    .form-actions button {
        flex: 1;
        min-height: 44px;
        font-size: 15px;
        font-weight: 600;
        padding: 10px 16px;
        min-width: 0;
    }
    
    /* Add bottom padding to form to prevent content from being hidden behind floating buttons */
    #addForm, #editForm {
        padding-bottom: 80px;
    }
    
    /* Number Cut comboboxes (Add & Edit) - same as chassis on mobile */
    .form-section-content[data-section="numberCut"] div[style*="position: relative"][style*="width: 100%"] {
        min-height: 44px !important;
    }
    .form-section-content[data-section="numberCut"] div[style*="position: relative"] input[id$="Input"] {
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 44px 0 12px !important;
        line-height: 44px !important;
        font-size: 16px !important;
    }
    .form-section-content[data-section="numberCut"] div[id$="Button"] {
        width: 44px !important;
        min-height: 44px !important;
        height: 100% !important;
    }
    .form-section-content[data-section="numberCut"] div[style*="position: relative"] select {
        width: 44px !important;
        min-height: 44px !important;
        height: 100% !important;
    }
    
    /* Editable Combobox - Full Width */
    .editable-combobox {
        width: 100%;
    }
    
    .editable-combobox input {
        padding-right: 50px;
    }
    
    .editable-combobox .dropdown-button {
        width: 50px;
        min-height: 44px;
    }
}

/* ============================================
   Tablet Styles (768px - 1024px) - Add/Edit Forms
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Number Cut Information - Tablet Layout */
    .rixo-number-cut-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px !important;
    }
    
    .rixo-number-cut-label {
        font-size: 13px !important;
        white-space: normal !important;
    }
    
    .rixo-number-cut-input {
        min-height: 44px !important;
        padding: 12px !important;
    }
    /* Form Container */
    #addForm, #editForm {
        max-width: 900px;
        margin: 0 auto;
        padding: 16px;
    }
    
    /* Section Headers */
    #addForm h3, #editForm h3 {
        font-size: 16px;
        margin: 18px 0 10px 0;
    }
    
    /* Form Grids - 2 Column */
    .form-grid-2col {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
        margin-bottom: 18px;
    }
    
    .form-grid-4col {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    /* Form Inputs - Touch Friendly */
    #addForm input[type="text"],
    #addForm input[type="number"],
    #addForm input[type="date"],
    #addForm input[type="month"],
    #addForm select,
    #addForm textarea,
    #editForm input[type="text"],
    #editForm input[type="number"],
    #editForm input[type="date"],
    #editForm input[type="month"],
    #editForm select,
    #editForm textarea {
        padding: 10px 12px;
        font-size: 15px;
        min-height: 40px;
    }
    
    /* Currency Inputs - Tablet */
    .currency-input {
        position: relative;
        width: 100%;
    }
    
    .currency-input .currency-symbol {
        position: absolute;
        left: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 16px;
        font-weight: 500;
        color: #666;
        z-index: 1;
        pointer-events: none;
        line-height: 1;
    }
    
    .currency-input input {
        padding-left: 36px !important;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Fix for Rixo Price field specifically - match Add New Purchase */
    #editRixoPriceInput {
        padding: 8px 40px 8px 20px !important;
    }
    
    /* Options Buttons - 3 Column Grid */
    .options-buttons-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .option-btn {
        min-height: 40px;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    /* Action Buttons */
    .form-actions {
        margin-top: 20px;
    }
    
    .form-actions button {
        min-height: 40px;
        padding: 10px 20px;
        font-size: 15px;
    }
    
    /* Manage Buttons */
    .manage-btn {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
    }
}

/* ============================================
   Desktop Styles (> 1024px) - Add/Edit Forms
   ============================================ */
@media (min-width: 1025px) {
    /* Form Container */
    #addForm, #editForm {
        max-width: 1200px;
        margin: 0 auto;
        padding: 20px;
    }
    
    /* Section Headers - Enhanced */
    #addForm h3, #editForm h3 {
        font-size: 16px;
        margin: 20px 0 10px 0;
        padding-bottom: 8px;
        background: linear-gradient(to right, #f8f9fa, transparent);
        padding-left: 12px;
        padding-right: 12px;
    }
    
    /* Form Grids - 2 Column (can be 3 for some sections) */
    .form-grid-2col {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        margin-bottom: 20px;
    }
    
    .form-grid-4col {
        grid-template-columns: 1fr 1fr 1fr 1fr;
        gap: 12px;
    }
    
    /* Options Buttons - 4-5 Column Grid */
    .options-buttons-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .option-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    /* Action Buttons */
    .form-actions button {
        padding: 10px 24px;
        font-size: 16px;
    }
}

/* ============================================
   Rixo Request Generator - Responsive Styles
   ============================================ */

/* Base Styles */
.rixo-request-container {
    width: 100%;
    min-height: calc(100vh - 140px);
    padding: 20px;
    box-sizing: border-box;
}

.rixo-request-layout {
    display: flex;
    gap: 20px;
    height: 100%;
    width: 100%;
    box-sizing: border-box; /* Ensure gap doesn't cause overflow */
    align-items: stretch;
}

.rixo-request-form-panel,
.rixo-rows-preview-panel {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.rixo-request-form-panel {
    flex: 0.9;
}

.rixo-rows-preview-panel {
    flex: 1.45;
}

.rixo-request-title,
.rixo-rows-title {
    margin: 0 0 24px 0;
    color: #111827;
    font-size: 24px;
    font-weight: 600;
}

.rixo-form-field {
    margin-bottom: 20px;
}

.rixo-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.rixo-input,
.rixo-select,
.rixo-textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
    position: relative;
    z-index: 1;
}

/* Select elements should have dropdown arrow, not calendar */
.rixo-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Date inputs get calendar icon */
.rixo-input[type="date"],
.rixo-input[type="month"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/path%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.rixo-input:focus,
.rixo-select:focus,
.rixo-textarea:focus {
    outline: none;
    border-color: #8e44ad;
    box-shadow: 0 0 0 3px rgba(142, 68, 173, 0.1);
}

/* Ensure select focus doesn't change background image */
.rixo-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.rixo-select {
    background: white;
    cursor: pointer;
    position: relative;
    z-index: 1;
}

/* Ensure dropdown options appear above other elements */
.rixo-select option {
    z-index: 1000;
}

/* Fix for select dropdown overlap */
select.rixo-select {
    z-index: 10;
}

select.rixo-select:focus {
    z-index: 100;
}

/* Fix native select dropdown positioning */
/* Base select styling - dropdown arrow for all selects */
select {
    position: relative;
    z-index: 1;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    padding-right: 30px;
}

/* Date inputs get calendar icon, not dropdown arrow */
input[type="date"],
input[type="month"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/path%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E");
    background-position: right 8px center;
    background-size: 16px;
}

select:focus {
    z-index: 100;
    outline: 2px solid #007bff;
    outline-offset: 2px;
    border-color: #007bff;
}

/* Ensure select dropdowns appear correctly */
select option {
    z-index: 10000;
    background-color: #ffffff;
    color: #333333;
    padding: 8px 12px;
}

/* Number Cut comboboxes: same design as chassis (Add & Edit forms) - base */
.form-section-content[data-section="numberCut"] div[style*="position: relative"][style*="width: 100%"] {
    position: relative !important;
    min-height: 40px;
}
.form-section-content[data-section="numberCut"] div[style*="position: relative"] input[id$="Input"] {
    width: 100%;
    padding: 8px 40px 8px 8px;
    box-sizing: border-box;
}
.form-section-content[data-section="numberCut"] div[style*="position: relative"] select {
    position: absolute !important;
    top: 0; right: 0; width: 40px; height: 100%;
}
.form-section-content[data-section="numberCut"] div[id$="Button"] {
    position: absolute !important;
    top: 0; right: 0; width: 40px; height: 100%;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Ensure dropdown container has proper positioning */
.form-section-content[data-section="numberCut"] {
    position: relative;
    z-index: 1;
}

/* Fix for combobox dropdown positioning */
div[id$="_dropdown"] {
    position: fixed !important;
    z-index: 10002 !important; /* Higher than modal (10001) */
    box-sizing: border-box !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    background: white !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    /* Ensure dropdown doesn't extend beyond viewport */
    max-width: calc(100vw - 20px) !important;
}

/* Dropdowns inside modals - ensure proper containment */
.modal-content div[id$="_dropdown"] {
    max-height: 250px !important; /* Smaller max height in modals */
}

/* Mobile-specific dropdown fixes */
@media (max-width: 767px) {
    select {
        z-index: 10;
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        /* Prevent native mobile picker */
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    select:focus {
        z-index: 100;
    }
    
    /* Ensure custom dropdowns don't get cut off */
    div[id$="_dropdown"] {
        max-width: calc(100vw - 20px) !important;
        max-height: 200px !important; /* Smaller on mobile */
        /* Ensure proper scrolling on mobile */
        -webkit-overflow-scrolling: touch !important;
        /* Better positioning for mobile */
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* Dropdowns in modals on mobile - even smaller */
    .modal-content div[id$="_dropdown"] {
        max-height: 180px !important;
    }
    
    /* Native select elements in modals - better styling */
    .modal-content select,
    .rixo-number-cut-input {
        position: relative;
        z-index: 1;
    }
    
    .modal-content select:focus,
    .rixo-number-cut-input:focus {
        z-index: 2;
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }
    
    /* Ensure selects have dropdown arrow (not calendar) */
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: right 8px center !important;
        background-size: 12px !important;
        padding-right: 30px !important;
    }
    
    /* Date inputs get calendar icon */
    input[type="date"],
    input[type="month"] {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/path%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") !important;
        background-position: right 8px center !important;
        background-size: 16px !important;
    }
}

/* Tablet-specific dropdown fixes */
@media (min-width: 768px) and (max-width: 1024px) {
    div[id$="_dropdown"] {
        max-width: 90vw !important;
        max-height: 250px !important;
    }
    
    /* Dropdowns in modals on tablet */
    .modal-content div[id$="_dropdown"] {
        max-height: 220px !important;
    }
    
    /* Native select elements in modals */
    .modal-content select,
    .rixo-number-cut-input {
        position: relative;
        z-index: 1;
    }
    
    .modal-content select:focus,
    .rixo-number-cut-input:focus {
        z-index: 2;
    }
}

.rixo-textarea {
    resize: vertical;
    line-height: 1.5;
}

.rixo-textarea-head,
.rixo-textarea-footer {
    min-height: 120px;
    max-height: none;
    overflow-y: auto;
}

/* Auto-resize textareas to fit content */
.rixo-textarea-head,
.rixo-textarea-footer {
    resize: vertical;
    min-height: 120px;
}

.rixo-textarea-extra {
    min-height: 80px;
}

.rixo-textarea-contact {
    background-color: #ffffff;
    cursor: text;
}

/* Contact Details Collapsible */
.rixo-contact-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.rixo-contact-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    color: #6b7280;
    font-size: 12px;
    display: none; /* Hidden on desktop */
}

.rixo-toggle-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.rixo-contact-toggle[aria-expanded="false"] .rixo-toggle-icon {
    transform: rotate(-90deg);
}

.rixo-contact-content {
    transition: max-height 0.3s ease, opacity 0.3s ease;
    overflow: hidden;
}

.rixo-contact-content.collapsed {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

/* Preview + Print row (Rixo Request Generator) */
.rixo-print-actions {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    flex-wrap: wrap;
}

.rixo-preview-btn {
    flex: 1;
    min-width: 120px;
    padding: 14px;
    background: #fff;
    color: #6b21a8;
    border: 2px solid #9b59b6;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rixo-preview-btn:hover {
    background: #faf5ff;
    border-color: #8e44ad;
}

.rixo-save-history-btn {
    flex: 1;
    min-width: 120px;
    padding: 14px;
    background: #fff;
    color: #0f766e;
    border: 2px solid #14b8a6;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rixo-save-history-btn:hover {
    background: #f0fdfa;
    border-color: #0d9488;
}

.rixo-preview-icon {
    font-size: 18px;
}

/* Print Button */
.rixo-print-btn {
    flex: 1;
    min-width: 120px;
    width: auto;
    padding: 14px;
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rixo-print-btn:hover {
    background: linear-gradient(135deg, #7d3c98, #8e44ad);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(142, 68, 173, 0.3);
}

.rixo-print-btn:active {
    transform: translateY(0);
}

.rixo-print-icon {
    font-size: 18px;
}

/* Rows Preview */
.rixo-rows-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

.rixo-generator-col-filter-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.rixo-generator-col-filter-btn:hover {
    background: #e8eaed;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.rixo-generator-col-filter-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Number cut inline edit (Cars to Rixo) */
.rixo-nc-cell {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.rixo-nc-shaken-edit label {
    font-size: 12px;
    color: #374151;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.rixo-nc-collapsed {
    font-size: 13px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #f9fafb;
    word-break: break-word;
}

.rixo-nc-expanded {
    margin-top: 8px;
}

.rixo-nc-expanded-grid {
    display: grid;
    grid-template-columns: 1fr 56px;
    gap: 6px;
}

.rixo-nc-expanded-grid .rixo-nc-place-row,
.rixo-nc-expanded-grid .rixo-nc-hira-row {
    grid-column: 1 / -1;
}

.rixo-nc-n1,
.rixo-nc-n2 {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    min-height: 40px;
}

/* ============================================
   Rixo Generator — compact cars list (≤860px)
   ============================================ */
@media (max-width: 860px) {
    #rixoGeneratorPage .rixo-rows-content {
        overflow-x: visible;
        border: none;
        background: transparent;
    }

    #rixoGeneratorPage .rixo-table {
        font-size: 14px;
        display: block;
    }

    #rixoGeneratorPage .rixo-table thead {
        display: none;
    }

    #rixoGeneratorPage .rixo-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    #rixoGeneratorPage .rixo-table tr {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-start;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        padding: 12px 14px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    }

    #rixoGeneratorPage .rixo-table td {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        width: 100%;
        padding: 10px 0;
        border: none;
        border-bottom: 1px solid #f1f5f9;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    #rixoGeneratorPage .rixo-table td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }

    #rixoGeneratorPage .rixo-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        color: #64748b;
        text-transform: none;
        letter-spacing: 0.02em;
    }

    #rixoGeneratorPage .rixo-table td[data-label=""]::before,
    #rixoGeneratorPage .rixo-table td[data-label=":"]::before {
        content: none;
    }

    #rixoGeneratorPage .rixo-table td.rixo-col-select,
    #rixoGeneratorPage .rixo-table td.rixo-col-view,
    #rixoGeneratorPage .rixo-table td.rixo-col-edit {
        flex: 0 0 auto;
        width: auto;
        flex-direction: row;
        align-items: center;
        border-bottom: none;
        padding: 0 12px 10px 0;
    }

    #rixoGeneratorPage .rixo-table td.rixo-col-view {
        order: 1;
    }

    #rixoGeneratorPage .rixo-table td.rixo-col-select {
        order: 2;
    }

    #rixoGeneratorPage .rixo-table td.rixo-col-edit {
        order: 3;
        margin-left: auto;
        padding-right: 0;
    }

    #rixoGeneratorPage .rixo-table td:not(.rixo-col-select):not(.rixo-col-view):not(.rixo-col-edit) {
        flex: 1 1 100%;
        order: 10;
    }

    #rixoGeneratorPage .rixo-table td .rixo-inline-control,
    #rixoGeneratorPage .rixo-table td .rixo-inline-combowrap,
    #rixoGeneratorPage .rixo-table td .rixo-nc-cell {
        width: 100%;
        max-width: 100%;
    }

    #rixoGeneratorPage .rixo-nc-expanded-grid {
        grid-template-columns: 1fr;
    }

    #rixoGeneratorPage .rixo-nc-n1,
    #rixoGeneratorPage .rixo-nc-n2 {
        grid-column: 1 / -1;
    }

    #rixoGeneratorPage .rixo-edit-btn,
    #rixoGeneratorPage .rixo-update-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }
}

@media (min-width: 861px) and (max-width: 1024px) {
    #rixoGeneratorPage .rixo-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.rixo-selected-count {
    margin-bottom: 16px;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

.rixo-rows-content {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    overflow-x: auto;
    flex: 1;
    min-height: 0;
}

.rixo-updater-delete-wrap {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
}

.rixo-updater-delete-wrap.hidden {
    display: none;
}

.rixo-empty-state {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
    font-size: 14px;
}

/* ============================================
   Mobile Styles (< 768px) - Rixo Request
   ============================================ */
@media (max-width: 767px) {
    .rixo-request-container {
        padding: 12px;
    }
    
    .rixo-request-layout {
        flex-direction: column;
        gap: 16px;
    }
    
    .rixo-request-form-panel,
    .rixo-rows-preview-panel {
        padding: 16px;
        border-radius: 8px;
    }
    
    .rixo-request-title,
    .rixo-rows-title {
        font-size: 20px;
        margin-bottom: 16px;
    }
    
    .rixo-form-field {
        margin-bottom: 16px;
    }
    
    .rixo-form-field label {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .rixo-input,
    .rixo-select,
    .rixo-textarea {
        padding: 12px 16px;
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px; /* Touch-friendly */
        border-radius: 6px;
    }
    
    .rixo-textarea-head,
    .rixo-textarea-footer {
        min-height: 140px;
        font-size: 16px;
        line-height: 1.6;
        padding: 12px 16px;
        overflow-y: auto;
    }
    
    /* Ensure textareas show full content */
    .rixo-textarea-head,
    .rixo-textarea-footer {
        white-space: pre-wrap;
        word-wrap: break-word;
    }
    
    .rixo-textarea-extra {
        min-height: 80px;
        font-size: 16px;
    }
    
    .rixo-textarea-contact {
        min-height: 100px;
        font-size: 14px;
        line-height: 1.6;
    }
    
    /* Fix dropdown z-index on mobile */
    .rixo-select {
        z-index: 10;
    }
    
    .rixo-select:focus {
        z-index: 100;
    }
    
    /* Ensure proper spacing between fields */
    .rixo-form-field {
        margin-bottom: 20px;
    }
    
    /* Contact Details - Collapsible on Mobile */
    .rixo-contact-toggle {
        display: block;
        min-width: 44px;
        min-height: 44px;
        font-size: 16px;
    }
    
    .rixo-contact-content {
        max-height: 500px;
    }
    
    .rixo-contact-content.collapsed {
        max-height: 0;
        margin-bottom: 0;
    }
    
    /* Preview + Print - Fixed at Bottom */
    .rixo-print-actions {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        gap: 0;
        z-index: 1000;
        box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    }
    
    .rixo-print-actions .rixo-preview-btn,
    .rixo-print-actions .rixo-save-history-btn,
    .rixo-print-actions .rixo-print-btn {
        flex: 1;
        min-width: 0;
        border-radius: 0;
        min-height: 52px;
        padding: 14px 12px;
    }
    
    /* Add padding to form to prevent content from being hidden behind button */
    #rixoRequestForm {
        padding-bottom: 90px;
    }
    
    /* Ensure proper spacing between form fields */
    .rixo-form-field {
        margin-bottom: 20px;
    }
    
    /* Better spacing for date and company fields */
    .rixo-form-field:first-of-type,
    .rixo-form-field:nth-of-type(2) {
        margin-bottom: 20px;
    }
    
    /* Rows Preview - Full Width Below Form */
    .rixo-rows-preview-panel {
        order: 2;
    }
    
    .rixo-rows-content {
        max-height: 400px;
    }
    
    .rixo-selected-count {
        font-size: 13px;
        padding: 8px 12px;
        background: #f3f4f6;
        border-radius: 6px;
        display: inline-block;
    }

    .rixo-rows-preview-panel {
        padding-bottom: 80px;
    }

    #rixoGeneratorPage .rixo-generator-toolbar {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 14px;
    }

    #rixoGeneratorPage .rixo-rows-title {
        text-align: center;
        margin-bottom: 0;
    }

    #rixoGeneratorPage .rixo-generator-col-filter-btn {
        width: 48px;
        align-self: end;
    }
}

/* ============================================
   Tablet Styles (768px - 1024px) - Rixo Request
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
    .rixo-request-container {
        padding: 16px;
    }
    
    .rixo-request-layout {
        flex-direction: column;
        gap: 16px;
    }
    
    .rixo-request-form-panel,
    .rixo-rows-preview-panel {
        padding: 20px;
    }
    
    .rixo-request-title,
    .rixo-rows-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .rixo-form-field {
        margin-bottom: 18px;
    }
    
    .rixo-input,
    .rixo-select,
    .rixo-textarea {
        padding: 10px 12px;
        font-size: 15px;
        min-height: 40px;
    }
    
    .rixo-textarea-head,
    .rixo-textarea-footer {
        min-height: 100px;
    }
    
    .rixo-textarea-extra {
        min-height: 60px;
    }
    
    /* Preview + Print - Inline */
    .rixo-print-actions {
        max-width: 420px;
        margin: 0 auto;
    }
    
    .rixo-print-actions .rixo-preview-btn,
    .rixo-print-actions .rixo-save-history-btn,
    .rixo-print-actions .rixo-print-btn {
        min-height: 44px;
    }
    
    /* Contact Details - Always Visible */
    .rixo-contact-toggle {
        display: none;
    }
    
    .rixo-contact-content {
        max-height: none !important;
    }
    
    /* Rows Preview */
    .rixo-rows-preview-panel {
        order: 2;
    }
    
    .rixo-rows-content {
        max-height: 500px;
        overflow-x: auto;
    }

    #rixoGeneratorPage .rixo-generator-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    #rixoGeneratorPage .rixo-rows-title {
        text-align: center;
        margin-bottom: 0;
    }

    #rixoGeneratorPage .rixo-generator-col-filter-btn {
        width: 48px;
        align-self: end;
    }
    
    /* Table responsive on tablet */
    .rixo-table {
        font-size: 13px;
    }
    
    .rixo-table th,
    .rixo-table td {
        padding: 10px 8px;
    }
    
    .rixo-col-select {
        width: 90px;
    }
}

/* ============================================
   Desktop Styles (> 1024px) - Rixo Request
   ============================================ */
@media (min-width: 1025px) {
    .rixo-request-container {
        max-width: 1920px; /* Wider desktop container for Cars to Rixo table */
        margin: 0 auto;
        padding: 20px 18px;
        box-sizing: border-box; /* Ensure padding is included in width calculation */
    }
    
    .rixo-request-layout {
        flex-direction: row;
        gap: 16px;
    }
    
    .rixo-request-form-panel {
        flex: 0 0 36%;
        max-width: 560px;
    }
    
    .rixo-rows-preview-panel {
        flex: 1 1 64%;
        min-width: 0;
    }

    #rixoGeneratorPage .rixo-generator-toolbar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    #rixoGeneratorPage .rixo-rows-title {
        margin-bottom: 0;
        text-align: left;
    }
    
    .rixo-request-title,
    .rixo-rows-title {
        font-size: 24px;
    }
    
    .rixo-input,
    .rixo-select,
    .rixo-textarea {
        font-size: 14px;
    }
    
    .rixo-textarea-head,
    .rixo-textarea-footer {
        min-height: 120px;
    }
    
    .rixo-textarea-extra {
        min-height: 80px;
    }
    
    /* Preview + Print - Inline, Right-aligned */
    .rixo-print-actions {
        max-width: 420px;
        margin-left: auto;
        gap: 12px;
    }
    
    .rixo-print-actions .rixo-preview-btn,
    .rixo-print-actions .rixo-save-history-btn,
    .rixo-print-actions .rixo-print-btn {
        min-height: 40px;
        padding: 12px 20px;
        font-size: 15px;
    }
    
    /* Contact Details - Always Visible */
    .rixo-contact-toggle {
        display: none;
    }
    
    .rixo-contact-content {
        max-height: none !important;
    }
    
    /* Rows Preview - Sticky Header */
    .rixo-rows-content {
        max-height: calc(100vh - 220px);
        overflow-x: auto;
    }
    
    /* Table optimized for desktop */
    .rixo-table {
        font-size: 14px;
    }
    
    .rixo-table th,
    .rixo-table td {
        padding: 12px;
    }
}

/* ============================================
   Legacy Responsive Table (for other tables)
   ============================================ */
@media (max-width: 768px) {
    .responsive-table {
        font-size: 12px;
    }
    
    .responsive-table th,
    .responsive-table td {
        padding: 8px 4px;
    }
}

@media (max-width: 480px) {
    .responsive-table {
        font-size: 11px;
    }
    
    .responsive-table th,
    .responsive-table td {
        padding: 6px 2px;
    }
}

/* ============================================
   Supplier Page - Responsive Styles
   ============================================ */

/* Supplier Cards Container (Mobile) */
.supplier-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

/* Individual Supplier Card */
.supplier-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.supplier-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Card Header */
.supplier-card .card-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    gap: 12px;
}

.supplier-card .card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

/* Card Edit Button */
.supplier-card .card-edit-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #4CC9FF;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(76, 201, 255, 0.30);
    padding: 0;
}

.supplier-card .card-edit-btn:active {
    transform: scale(0.95);
}

/* Card Body */
.supplier-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}


/* ============================================
   Consignee Page - Responsive Styles
   ============================================ */

/* Consignee Cards Container (Mobile) */
.consignee-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

/* Individual Consignee Card */
.consignee-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.consignee-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Consignee table grid: merged with master map table block (see .car-brand-table below) */

/* Mobile Styles for Consignee Page */
@media (max-width: 767px) {
    /* Consignee List Container */
    #consigneeList {
        padding: 12px !important;
        border-radius: 4px;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Header Section */
    #consigneeList > div:first-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    #consigneeList h2 {
        font-size: 18px;
        margin: 0;
    }
    
    /* Column Filter Button - Full Width on Mobile */
    #consigneeColumnFilterBtn {
        width: 100%;
        justify-content: center;
        font-size: 14px;
        min-height: 44px;
    }
    
    /* Legacy #consigneeList only — #consigneeMapRoot uses JS breakpoint (860px) for table vs cards */
    #consigneeList .consignee-table {
        display: none;
    }
    
    #consigneeList .consignee-cards-container {
        display: flex;
    }

    #consigneeMapRoot .consignee-cards-container {
        display: flex !important;
    }
    
    /* Search Section - Mobile */
    #consigneeList > div:nth-child(2) {
        padding: 16px;
    }
    
    /* Add Button - Full Width on Mobile */
    #addConsigneeBtn {
        width: 100%;
        min-height: 44px;
    }
    
    /* Column Filter Modal - Mobile Optimized */
    #consigneeColumnFilterModal > div {
        width: 95%;
        max-width: 100%;
        padding: 16px;
        max-height: 90vh;
    }
    
    #consigneeColumnFilterModal #consigneeColumnCheckboxes {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    #consigneeColumnFilterModal button:not(#closeConsigneeColumnFilter) {
        width: 100%;
        min-height: 44px;
        margin-bottom: 8px;
    }
    
    /* Consignee Table Pagination - Mobile */
    .consignee-pagination-controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .consignee-pagination-btn {
        padding: 6px 10px;
        min-height: 32px;
        font-size: 12px;
        background-color: #007bff;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        flex: 0 0 auto;
        white-space: nowrap;
    }
    
    .consignee-pagination-btn:disabled {
        background-color: #ccc;
        cursor: not-allowed;
        opacity: 0.6;
    }
    
    .consignee-pagination-page {
        padding: 0 6px;
        color: #666;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Tablet Styles for Consignee Page */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Consignee List Container */
    #consigneeList {
        padding: 16px;
        margin: 0 auto;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Legacy #consigneeList: tablet table mode. #consigneeMapRoot keeps cards visible when rendered (≤860px). */
    #consigneeList .consignee-cards-container {
        display: none;
    }
    
    #consigneeList .consignee-table {
        font-size: 14px;
        display: table;
    }

    #consigneeMapRoot .consignee-cards-container {
        display: flex !important;
    }
    
    /* Table Styles - Optimized */
    .consignee-table {
        font-size: 14px;
        display: table;
    }
    
    .consignee-table th,
    .consignee-table td {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    .consignee-table td {
        max-width: none;
        white-space: normal;
        overflow: visible;
    }
    
    /* Column Filter Modal - Tablet Optimized */
    #consigneeColumnFilterModal #consigneeColumnCheckboxes {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    /* Consignee Table Pagination - Tablet */
    .consignee-pagination-controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    
    .consignee-pagination-btn {
        padding: 8px 14px;
        min-height: 36px;
        font-size: 13px;
    }
    
    .consignee-pagination-page {
        padding: 0 10px;
        font-size: 13px;
    }
}

/* Desktop Styles for Consignee Page */
@media (min-width: 1025px) {
    /* Consignee List Container */
    #consigneeList {
        padding: 20px;
        margin: 0 auto;
        max-width: 1400px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Legacy #consigneeList: desktop table mode */
    #consigneeList .consignee-cards-container {
        display: none;
    }
    
    /* Table Styles - Full Desktop */
    .consignee-table {
        font-size: 16px;
        display: table;
    }
    
    .consignee-table th,
    .consignee-table td {
        padding: 12px;
        font-size: 16px;
    }
    
    /* No truncation on desktop - show full content */
    .consignee-table td {
        max-width: none;
        white-space: normal;
    }
    
    /* Consignee Table Pagination - Desktop */
    .consignee-pagination-controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 12px;
    }
    
    .consignee-pagination-btn {
        padding: 8px 16px;
        min-height: 36px;
        font-size: 14px;
    }
    
    .consignee-pagination-page {
        padding: 0 12px;
        font-size: 14px;
    }
}

/* ============================================
   Consignee Modal - Responsive Styles
   ============================================ */

/* Consignee Modal Grid */
.consignee-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Consignee Modal Actions */
.consignee-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

/* Consignee Modal Buttons */
.consignee-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    min-height: 44px;
    transition: opacity 0.2s, transform 0.1s;
}

.consignee-modal-btn:active {
    transform: scale(0.98);
}

.consignee-modal-btn-cancel {
    background-color: #6b7280;
    color: white;
}

.consignee-modal-btn-delete {
    background-color: #ef4444;
    color: white;
    font-weight: 600;
}

.consignee-modal-btn-save {
    background-color: #059669;
    color: white;
    font-weight: 600;
}

/* Mobile Styles for Consignee Modal */
@media (max-width: 767px) {
    /* Modal Container */
    #consigneeModal > div {
        width: 95% !important;
        max-width: 100% !important;
        max-height: 90vh;
    }
    
    /* Modal Grid - Single Column on Mobile */
    .consignee-modal-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    /* Modal Actions - Stack Vertically on Mobile */
    .consignee-modal-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Modal Buttons - Full Width on Mobile */
    .consignee-modal-btn {
        width: 100%;
    }
    
    /* Modal Padding - Reduced on Mobile */
    #consigneeModal > div > div {
        padding: 16px !important;
    }
}

/* Tablet Styles for Consignee Modal */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Modal Container */
    #consigneeModal > div {
        max-width: 600px;
    }
    
    /* Modal Grid - Two Columns on Tablet */
    .consignee-modal-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    /* Modal Actions - Horizontal on Tablet */
    .consignee-modal-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}

/* Desktop Styles for Consignee Modal */
@media (min-width: 1025px) {
    /* Modal Container */
    #consigneeModal > div {
        max-width: 700px;
    }
    
    /* Modal Grid - Two Columns on Desktop */
    .consignee-modal-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    /* Modal Actions - Horizontal on Desktop */
    .consignee-modal-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}

/* ============================================
   Car Brands Page - Responsive Styles
   ============================================ */

/* Car Brands Cards Container (Mobile) */
.car-brand-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

/* Individual Car Brand Card */
.car-brand-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.car-brand-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* Car Brand card header and edit button - match Purchase List mobile (image 4) */
.car-brand-card .card-header {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    gap: 8px;
}

.car-brand-card .card-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    flex: 1;
}

.car-brand-cards-container .card-edit-btn,
.car-brand-card .card-edit-btn {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    padding: 4px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #4CC9FF;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(76, 201, 255, 0.25);
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
    order: -1;
}

.car-brand-cards-container .card-edit-btn svg,
.car-brand-card .card-edit-btn svg {
    width: 10px !important;
    height: 10px !important;
}

.car-brand-card .card-edit-btn:active {
    transform: scale(0.95);
    background-color: #3ab8e0;
}

/* Master map tables + Purchase List — full grid (row + column borders), Datahub-style */
.car-brand-table,
.consignee-table,
.purchase-list-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    border: 1px solid #d1d5db;
    background-color: #ffffff;
}

.car-brand-table th,
.car-brand-table td,
.consignee-table th,
.consignee-table td,
.purchase-list-table th,
.purchase-list-table td {
    padding: 14px 16px;
    text-align: left;
    font-size: 14px;
    border: 1px solid #e5e7eb;
    vertical-align: top;
}

.car-brand-table th,
.consignee-table th,
.purchase-list-table th {
    background-color: #f3f4f6;
    font-weight: 700;
    color: #111827;
}

.car-brand-table td,
.consignee-table td,
.purchase-list-table td {
    color: #111827;
    background-color: #ffffff;
}

.car-brand-table th:first-child,
.car-brand-table td:first-child,
.consignee-table th:first-child,
.consignee-table td:first-child,
.purchase-list-table th:first-child,
.purchase-list-table td:first-child {
    vertical-align: middle;
}

.car-brand-table tbody tr:hover td,
.consignee-table tbody tr:hover td,
.purchase-list-table tbody tr:hover td {
    background-color: #fafafa;
}

/* Shipping History: Create Invoice (per booking row), glossy pill style */
button.shipping-history-invoice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    cursor: pointer;
    vertical-align: middle;
    border: 3px solid #b8bec8;
    box-shadow:
        inset 0 2px 6px rgba(255, 255, 255, 0.55),
        inset 0 -4px 8px rgba(0, 0, 0, 0.18),
        0 2px 8px rgba(0, 0, 0, 0.2);
    background: radial-gradient(circle at 32% 24%, #c8f5b8 0%, #4abf52 42%, #1a6e22 100%);
}

button.shipping-history-invoice-btn:hover {
    filter: brightness(1.07);
}

button.shipping-history-invoice-btn:active {
    transform: scale(0.96);
}

.shipping-history-invoice-btn__text {
    display: block;
    font-size: 6.5px;
    font-weight: 800;
    line-height: 1.05;
    color: #fff;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    font-family: Georgia, "Times New Roman", serif;
    max-width: 34px;
}

/* Shipping History: Client-Based Shipment Details (next to INVOICE) */
button.shipping-history-shipment-details-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    cursor: pointer;
    vertical-align: middle;
    border: 3px solid #93c5fd;
    box-shadow:
        inset 0 2px 6px rgba(255, 255, 255, 0.5),
        inset 0 -4px 8px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(37, 99, 235, 0.25);
    background: radial-gradient(circle at 32% 24%, #93c5fd 0%, #3b82f6 45%, #1d4ed8 100%);
}

button.shipping-history-shipment-details-btn:hover {
    filter: brightness(1.07);
}

button.shipping-history-shipment-details-btn:active {
    transform: scale(0.96);
}

.shipping-history-shipment-details-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Invoice History: inline Edit + PDF action buttons */
.invoice-history-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* History tables: stack Edit/PDF/(Ship|Invoice) in one Actions column */
.history-table-actions-stack {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button.invoice-history-pdf-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    vertical-align: middle;
}

button.invoice-history-pdf-btn img {
    width: 36px;
    height: 36px;
    display: block;
    border-radius: 50%;
}

button.invoice-history-pdf-btn:hover {
    filter: brightness(1.08);
}

button.invoice-history-pdf-btn:active {
    transform: scale(0.96);
}

button.invoice-history-pdf-btn:disabled {
    cursor: wait;
    opacity: 0.6;
}

#purchaseTable table.purchase-list-table th,
#purchaseTable table.purchase-list-table td {
    font-size: 16px;
}

/* Mobile Styles for Car Brands Page */
@media (max-width: 767px) {
    /* Car Brand List Container */
    #carBrandList {
        padding: 12px !important;
        border-radius: 4px;
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    
    /* Header Section */
    #carBrandList > div:first-child {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    #carBrandList h2 {
        font-size: 18px;
        margin: 0;
    }
    
    /* Column Filter Button - Full Width on Mobile */
    #carBrandColumnFilterBtn {
        width: 100%;
        justify-content: center;
        font-size: 14px;
        min-height: 44px;
    }
    
    /* Hide table on mobile - show cards instead */
    .car-brand-table {
        display: none;
    }
    
    /* Show cards container */
    .car-brand-cards-container {
        display: flex;
    }
    
    /* Search Section - Mobile */
    #carBrandList > div:nth-child(2) {
        padding: 16px;
    }
    
    /* Add Button - Full Width on Mobile */
    #addCarBrandBtn {
        width: 100%;
        min-height: 44px;
    }
    
    /* Clear Filter Button - Full Width on Mobile */
    #clearCarBrandFilterBtn {
        width: 100%;
        min-height: 44px;
    }
    
    /* Column Filter Modal - Mobile Optimized */
    #carBrandColumnFilterModal > div {
        width: 95%;
        max-width: 100%;
        padding: 16px;
        max-height: 90vh;
    }
    
    #carBrandColumnFilterModal #carBrandColumnCheckboxes {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    #carBrandColumnFilterModal button:not(#closeCarBrandColumnFilter) {
        width: 100%;
        min-height: 44px;
        margin-bottom: 8px;
    }
    
    /* Car Brand Table Pagination - Mobile */
    .car-brand-pagination-controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .car-brand-pagination-btn {
        padding: 6px 10px;
        min-height: 32px;
        font-size: 12px;
        background-color: #007bff;
        color: white;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        flex: 0 0 auto;
        white-space: nowrap;
    }
    
    .car-brand-pagination-btn:disabled {
        background-color: #ccc;
        cursor: not-allowed;
        opacity: 0.6;
    }
    
    .car-brand-pagination-page {
        padding: 0 6px;
        color: #666;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Tablet Styles for Car Brands Page */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Car Brand List Container */
    #carBrandList {
        padding: 16px;
        margin: 0 auto;
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Hide cards on tablet - show table */
    .car-brand-cards-container {
        display: none;
    }
    
    /* Table Styles - Optimized */
    .car-brand-table {
        font-size: 14px;
        display: table;
    }
    
    .car-brand-table th,
    .car-brand-table td {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    /* Allow wrapped chips / multi-line cells (no horizontal-only truncation) */
    .car-brand-table td {
        max-width: none;
        white-space: normal;
        overflow: visible;
    }
    
    /* Column Filter Modal - Tablet Optimized */
    #carBrandColumnFilterModal #carBrandColumnCheckboxes {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    /* Car Brand Table Pagination - Tablet */
    .car-brand-pagination-controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    
    .car-brand-pagination-btn {
        padding: 8px 14px;
        min-height: 36px;
        font-size: 13px;
    }
    
    .car-brand-pagination-page {
        padding: 0 10px;
        font-size: 13px;
    }
}

/* Desktop Styles for Car Brands Page */
@media (min-width: 1025px) {
    /* Car Brand List Container */
    #carBrandList {
        padding: 20px;
        margin: 0 auto;
        max-width: 1400px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Hide cards on desktop - show table */
    .car-brand-cards-container {
        display: none;
    }
    
    /* Table Styles - Full Desktop */
    .car-brand-table {
        font-size: 16px;
        display: table;
    }
    
    .car-brand-table th,
    .car-brand-table td {
        padding: 12px;
        font-size: 16px;
    }
    
    /* No truncation on desktop - show full content */
    .car-brand-table td {
        max-width: none;
        white-space: normal;
    }
    
    /* Car Brand Table Pagination - Desktop */
    .car-brand-pagination-controls {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 12px;
    }
    
    .car-brand-pagination-btn {
        padding: 8px 16px;
        min-height: 36px;
        font-size: 14px;
    }
    
    .car-brand-pagination-page {
        padding: 0 12px;
        font-size: 14px;
    }
}

/* ============================================
   Car Brand Modal - Responsive Styles
   ============================================ */

/* Car Brand Modal Grid */
.car-brand-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Let grid columns shrink and fill: Car Name uses full width of the left column ("pane"). */
.car-brand-modal-grid > div {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.car-brand-modal-grid--car-name-row {
    align-items: start;
}

.car-brand-modal-grid__car-name,
.car-brand-modal-grid__vehicle-type {
    max-width: 100%;
}

.car-brand-modal-grid__car-name .chip-input-inner-wrap {
    width: 100%;
    max-width: 100%;
}

/* Car Brand Modal Actions */
.car-brand-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

/* Car Brand Modal Buttons */
.car-brand-modal-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    min-height: 44px;
    transition: opacity 0.2s, transform 0.1s;
}

.car-brand-modal-btn:active {
    transform: scale(0.98);
}

.car-brand-modal-btn-cancel {
    background-color: #6b7280;
    color: white;
}

.car-brand-modal-btn-delete {
    background-color: #ef4444;
    color: white;
    font-weight: 600;
}

.car-brand-modal-btn-save {
    background-color: #059669;
    color: white;
    font-weight: 600;
}

/* Mobile Styles for Car Brand Modal */
@media (max-width: 767px) {
    /* Modal Container */
    #carBrandModal > div {
        width: 95% !important;
        max-width: 100% !important;
        max-height: 90vh;
    }
    
    /* Modal Grid - Single Column on Mobile */
    .car-brand-modal-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    /* Modal Actions - Stack Vertically on Mobile */
    .car-brand-modal-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Modal Buttons - Full Width on Mobile */
    .car-brand-modal-btn {
        width: 100%;
    }
    
    /* Modal Padding - Reduced on Mobile */
    #carBrandModal > div > div {
        padding: 16px !important;
    }
}

/* Tablet Styles for Car Brand Modal */
@media (min-width: 768px) and (max-width: 1024px) {
    /* Modal Container */
    #carBrandModal > div {
        max-width: 600px;
    }
    
    /* Modal Grid - Two Columns on Tablet */
    .car-brand-modal-grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    
    /* Modal Actions - Horizontal on Tablet */
    .car-brand-modal-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}

/* Desktop Styles for Car Brand Modal */
@media (min-width: 1025px) {
    /* Modal Container */
    #carBrandModal > div {
        max-width: 700px;
    }
    
    /* Modal Grid - Two Columns on Desktop */
    .car-brand-modal-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    /* Modal Actions - Horizontal on Desktop */
    .car-brand-modal-actions {
        flex-direction: row;
        justify-content: flex-end;
    }
}

/* ============================================
   Client Map table — fixed layout, borders, narrow Bank Info
   ============================================ */
.client-map-table-wrap {
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    overflow-x: hidden;
    max-width: 100%;
}

.client-map-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.client-map-th-actions {
    padding: 12px 10px;
    text-align: left;
    vertical-align: middle;
    border: 1px solid #d1d5db;
    border-bottom: 2px solid #9ca3af;
    background: #f3f4f6;
}

.client-map-th {
    padding: 12px 12px;
    text-align: left;
    font-weight: 700;
    color: #111827;
    font-size: 13px;
    vertical-align: middle;
    border: 1px solid #d1d5db;
    border-bottom: 2px solid #9ca3af;
    background: #f3f4f6;
}

.client-map-td-actions {
    padding: 10px 10px;
    vertical-align: middle;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.client-map-td {
    padding: 10px 12px;
    color: #374151;
    font-size: 14px;
    vertical-align: top;
    border: 1px solid #e5e7eb;
    background: #fff;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.client-map-table tbody tr:nth-child(even) .client-map-td,
.client-map-table tbody tr:nth-child(even) .client-map-td-actions {
    background: #fafafa;
}

.client-map-bank-text {
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.client-map-bank-chips {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.client-map-bank-text > span,
.client-map-bank-chips > span {
    display: block;
    width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
}

/* Consignee (and similar): wrap long chip labels inside fixed table columns */
.client-map-td[data-col="consignee"] {
    overflow: hidden;
}

.client-map-consignee-plain {
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.client-map-debit-limit {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.client-map-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.client-map-chip-wrap {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Client Map modal: chip multi-select pills wrap instead of overflowing the dialog */
#clientMapMmBankInfoWrap,
#clientMapMmConsigneeWrap {
    min-width: 0;
}

#clientMapMmBankInfoChips > span,
#clientMapMmConsigneeChips > span {
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal !important;
    word-break: break-word;
    overflow-wrap: anywhere;
    align-items: flex-start !important;
}

#clientMapMmBankInfoChips > span > span:last-child,
#clientMapMmConsigneeChips > span > span:last-child {
    min-width: 0;
    word-break: break-word;
}


/* Generic modal styling shared across mapping dialogs */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    padding: 40px 16px;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
}

.modal .modal-content {
    background: #ffffff;
    margin: auto;
    width: min(960px, 100%);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
    border: none;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    animation: fadeIn 0.25s ease-out;
}

.modal .modal-header,
.modal .modal-footer {
    padding: 18px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal .modal-footer {
    border-top: 1px solid #e5e7eb;
    border-bottom: none;
    justify-content: flex-end;
}

.modal .modal-body {
    padding: 24px;
}

.modal .modal-body .mapping-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal .modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.modal .close {
    font-size: 24px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #6b7280;
    transition: color 0.2s ease;
}

.modal .close:hover {
    color: #111827;
}

.modal-open {
    overflow: hidden;
}

/* PDF download modal - mobile */
@media (max-width: 767px) {
    #pdfDownloadModal {
        padding: 16px;
        align-items: flex-start;
        padding-top: 24px;
    }
    #pdfDownloadModal > div {
        width: 100% !important;
        max-width: 100% !important;
        padding: 24px 20px !important;
    }
    #pdfDownloadModal h3 {
        font-size: 20px !important;
    }
    #pdfDownloadModal p {
        font-size: 15px !important;
    }
    #pdfDownloadModal > div > div:last-child {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
    }
    #pdfDownloadModal #downloadPdfBtn,
    #pdfDownloadModal #closePdfModal {
        width: 100% !important;
        min-height: 44px !important;
        justify-content: center !important;
    }
}

@media (max-width: 767px) {
    .modal {
        padding: 16px 8px;
    }
    
    .modal .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        border-radius: 12px;
        max-height: calc(100vh - 32px);
    }
    
    .modal .modal-header,
    .modal .modal-footer {
        padding: 14px 16px;
        flex-wrap: wrap;
    }
    
    .modal .modal-body {
        padding: 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal .close {
        min-width: 44px;
        min-height: 44px;
        font-size: 28px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Single-column form layouts in modals on mobile */
    .modal .modal-body .mapping-form,
    .modal .modal-body form[class*="grid"],
    .modal .modal-body .form-grid {
        grid-template-columns: 1fr !important;
    }
    
    .modal .modal-body .mapping-section {
        gap: 16px;
    }
}

/* Mapping management UI */
.mapping-section h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.mapping-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.mapping-form input,
.mapping-form select,
.mapping-form textarea {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mapping-form input:focus,
.mapping-form select:focus,
.mapping-form textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.mapping-form button {
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.mapping-form button:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.current-mappings {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.mapping-item {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr)) 140px;
    gap: 0;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}

.mapping-item:nth-child(even) {
    background: #f9fafb;
}

.mapping-header {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
}

.mapping-field {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #1f2937;
}

.mapping-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.mapping-actions button,
.mapping-actions .edit-mapping-btn,
.mapping-actions .delete-mapping-btn {
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.mapping-actions .edit-mapping-btn {
    background: #f97316;
    color: #fff;
}

.mapping-actions .delete-mapping-btn {
    background: #dc2626;
    color: #fff;
}

.mapping-empty {
    padding: 20px;
    text-align: center;
    color: #6b7280;
}

/* ============================================
   Car Booking Page - Responsive Styles
   ============================================ */

/* Main Booking Container */
.booking-page-container {
    width: 100%;
    min-height: calc(100vh - 140px);
    padding: 20px;
    box-sizing: border-box;
    background: linear-gradient(165deg, #f0f9ff 0%, #f8fafc 38%, #f1f5f9 100%);
}

/* Booking Header */
.booking-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    border-radius: 16px;
    padding: 22px 28px;
    margin-bottom: 22px;
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08), 0 1px 0 rgba(255,255,255,0.8) inset;
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-left: 4px solid #3b82f6;
}

.booking-header-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.booking-title {
    margin: 0;
    color: #0f172a;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.booking-header-sub {
    margin: 0;
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
    line-height: 1.45;
    max-width: 52ch;
}

.booking-header h1 {
    margin: 0;
    color: #111827;
    font-size: 28px;
    font-weight: 700;
}

/* Main Content Container */
.booking-main-content {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    padding: 28px 32px;
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.07);
    border: 1px solid rgba(226, 232, 240, 0.95);
    backdrop-filter: blur(8px);
}

.booking-panel {
    background: linear-gradient(180deg, #fafcff 0%, #ffffff 55%);
    border-radius: 14px;
    padding: 20px 22px;
    border: 1px solid #e8eef5;
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

/* Two Column Layout */
.booking-columns {
    display: flex;
    gap: 30px;
    min-height: 600px;
    align-items: stretch;
    min-width: 0;
}

/* Left Section: Booking Details — capped so long Notify/In-transit cannot steal table space */
.booking-details-section {
    flex: 1 1 0;
    min-width: 0;
    max-width: 50%;
    padding-right: 20px;
    border-right: 2px solid #e5e7eb;
    overflow-x: hidden;
}

/* Right Section: Chassis List */
.booking-list-section {
    flex: 1 1 0;
    min-width: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.booking-list-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #dbeafe;
}

.booking-list-header-row .booking-section-header {
    margin: 0;
    padding: 0;
    border: none;
}

.booking-list-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.booking-col-filter-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    padding: 0;
    color: #4b5563;
    flex-shrink: 0;
}

.booking-col-filter-btn:hover {
    background: #e8eaed;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.booking-col-filter-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.booking-cars-selected-count {
    font-size: 14px;
    font-weight: 600;
    color: #2563eb;
    white-space: nowrap;
    flex-shrink: 0;
}

.booking-cars-selected-count.is-empty {
    color: #9ca3af;
    font-weight: 500;
}

/* Section Headers */
.booking-section-header {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    color: #0f172a;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    border-bottom: 2px solid #dbeafe;
}

/* Form Groups */
.booking-form-group {
    margin-bottom: 20px;
}

.booking-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.booking-req {
    color: #dc2626;
    font-weight: 700;
}

.booking-field-hint {
    margin-top: 6px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.booking-form-group input,
.booking-form-group select,
.booking-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14px;
    box-sizing: border-box;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.booking-form-group input:focus,
.booking-form-group select:focus,
.booking-form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.booking-chassis-search-wrap {
    position: relative;
}

.booking-chassis-search {
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.booking-chassis-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #9ca3af;
    display: flex;
}

.booking-chassis-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 36px 11px 40px !important;
    border: none !important;
    border-radius: 999px !important;
    font-size: 14px !important;
    background: transparent !important;
    box-shadow: none !important;
}

.booking-chassis-search-input:focus {
    outline: none !important;
    box-shadow: none !important;
}

.booking-chassis-search:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.booking-chassis-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 20px;
    padding: 6px 8px;
    min-height: 36px;
    min-width: 36px;
    border-radius: 8px;
}

.booking-chassis-search-clear:hover {
    background: #f3f4f6;
    color: #111827;
}

.booking-chassis-search-clear.is-hidden {
    display: none;
}

.booking-chassis-search-clear:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.booking-chassis-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.booking-chassis-suggestion-item {
    padding: 11px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #334155;
    transition: background 0.15s;
}

.booking-chassis-suggestion-item:last-child {
    border-bottom: none;
}

.booking-chassis-suggestion-item--hover {
    background: #eff6ff !important;
    color: #1e3a8a;
}

/* Consignee Row */
.booking-consignee-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.booking-consignee-row select {
    flex: 1;
}

/* Car booking dropdowns — same speed-dial FAB UI as Rixo Company (Rixo Transport page) */
.booking-fab-field.rixo-company-fab-wrap {
    width: 100%;
}
.booking-details-section .booking-fab-field .rixo-fab-action-label {
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 600;
}
.booking-details-section .booking-fab-field .rixo-fab-action-row--text-only {
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 600;
}
.rixo-company-fab-native-select {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.rixo-company-fab-wrap {
    position: relative;
    width: 100%;
}
.rixo-company-fab {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}
.booking-details-section .rixo-fab-trigger {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    max-width: 100%;
    align-items: flex-start;
}

/* Long Notify party / In-transit values wrap inside the Booking column only */
.booking-details-section .rixo-fab-trigger-label {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}

.booking-details-section .rixo-fab-trigger-text-wrap {
    min-width: 0;
    max-width: 100%;
}

.booking-details-section .rixo-fab-action-label {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
}

.booking-details-section .booking-fab-field.rixo-company-fab-wrap,
.booking-details-section .rixo-company-fab {
    max-width: 100%;
    min-width: 0;
}

.rixo-fab-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    box-sizing: border-box;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.rixo-fab-trigger:hover {
    border-color: #3abff8;
    box-shadow: 0 4px 14px rgba(58, 191, 248, 0.2);
}
.rixo-company-fab-wrap.rixo-company-fab--open .rixo-fab-trigger {
    border-color: #3abff8;
    box-shadow: 0 4px 14px rgba(58, 191, 248, 0.25);
}
.rixo-fab-trigger-circle {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(145deg, #3abff8, #0891b2);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(8, 145, 178, 0.35);
}
.rixo-fab-trigger-text-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.rixo-fab-trigger-label {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rixo-fab-trigger-hint {
    font-size: 12px;
    color: #6b7280;
}
.rixo-company-fab-wrap.rixo-company-fab--open .rixo-fab-trigger-hint {
    display: none;
}
/* Rixo Request Generator — Buying date FAB (distinct from Rixo Company blue) */
.rixo-buying-date-fab-wrap .rixo-buying-date-fab-circle {
    background: linear-gradient(145deg, #a855f7, #7c3aed);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
}
.rixo-buying-date-fab-row-btn {
    border-color: #e9d5ff;
    background: #faf5ff;
    color: #5b21b6;
}
.rixo-buying-date-fab-row-btn:hover {
    background: #f3e8ff;
    border-color: #a855f7;
}
.rixo-fab-trigger-chevron {
    flex-shrink: 0;
    font-size: 12px;
    color: #6b7280;
    transition: transform 0.2s;
}
.rixo-company-fab-wrap.rixo-company-fab--open .rixo-fab-trigger-chevron {
    transform: rotate(180deg);
}
.rixo-fab-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 0 4px;
}
.rixo-fab-action-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-direction: row;
    gap: 12px;
    animation: rixoFabDownBooking 0.28s ease-out both;
}
.rixo-fab-action-row:nth-child(1) { animation-delay: 0.03s; }
.rixo-fab-action-row:nth-child(2) { animation-delay: 0.06s; }
.rixo-fab-action-row:nth-child(3) { animation-delay: 0.09s; }
.rixo-fab-action-row:nth-child(4) { animation-delay: 0.12s; }
.rixo-fab-action-row:nth-child(5) { animation-delay: 0.15s; }
.rixo-fab-action-row:nth-child(6) { animation-delay: 0.18s; }
.rixo-fab-action-row:nth-child(7) { animation-delay: 0.21s; }
.rixo-fab-action-row:nth-child(8) { animation-delay: 0.24s; }
.rixo-fab-action-label {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    text-align: left;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rixo-fab-action-btn {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    color: #111827;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.15s, background 0.15s;
}
.rixo-fab-action-btn:hover {
    background: #e0f2fe;
    border-color: #3abff8;
    transform: scale(1.06);
}
/* Booking FAB dropdown: full-width text rows (no circle + letter buttons) */
.rixo-fab-action-row--text-only {
    display: block;
    width: 100%;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.15s, border-color 0.15s;
}
.rixo-fab-action-row--text-only:hover {
    background: #e0f2fe;
    border-color: #3abff8;
}
@keyframes rixoFabDownBooking {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Selection Options (C&F/FOB) */
.booking-selection-options {
    margin-top: 30px;
    padding-top: 4px;
}

.booking-checkbox-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.booking-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
}

.booking-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #3b82f6;
}

/* Calculate Button */
.booking-calculate-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    min-height: 48px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.booking-calculate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.booking-calculate-btn:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
}

/* Action Buttons Row */
.booking-action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 15px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.booking-cancel-link {
    text-decoration: underline;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 0;
    background: none;
    border: none;
    cursor: pointer;
}

.booking-action-btn {
    padding: 10px 16px;
    background: #fff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.booking-action-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.booking-table-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    overflow-x: auto;
    margin-bottom: 0;
    overflow-y: auto;
    background: #fff;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
    flex: 1;
    min-height: 0;
    position: relative;
}

.booking-table-card.is-empty .booking-chassis-table {
    display: none;
}

.booking-list-empty {
    display: none;
    padding: 36px 20px;
    text-align: center;
}

.booking-table-card.is-empty .booking-list-empty {
    display: block;
}

.booking-list-empty-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 700;
    color: #334155;
}

.booking-list-empty-hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: #64748b;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

.booking-row-sold-locked {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #f3f4f6;
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
    user-select: none;
}

.booking-row-remove-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: #fee2e2;
    color: #b91c1c;
    cursor: pointer;
    line-height: 1;
    font-size: 18px;
    font-weight: 700;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.booking-row-remove-btn:hover {
    background: #fecaca;
}

/* Booking List Footer */
.booking-list-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    gap: 12px;
    border-top: 1px solid #e5e7eb;
}

.booking-recreate-delete-btn {
    padding: 10px 20px;
    border: 1px solid #b91c1c;
    border-radius: 8px;
    background: #fff;
    color: #b91c1c;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    min-height: 40px;
}

.booking-recreate-delete-btn:hover {
    background: #fef2f2;
}

.booking-recreate-update-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    min-height: 40px;
}

.booking-recreate-update-btn:hover {
    background: #1d4ed8;
}

.booking-field-icon {
    color: #6b7280;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.booking-map-btn {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    padding: 6px;
    color: #6b7280;
    min-width: 36px;
    min-height: 36px;
}

.booking-map-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.booking-map-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.booking-date-field {
    position: relative;
    width: 100%;
}

.booking-date-field-row {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.booking-date-text-input {
    flex: 1;
    min-width: 0;
    color: #111827;
}

.booking-calendar-btn {
    flex-shrink: 0;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    cursor: pointer;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.booking-calendar-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.booking-calendar-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.booking-date-native-input {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    opacity: 0;
    border: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.booking-textarea {
    width: 100%;
    color: #111827;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}

.booking-price-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.booking-price-mode-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    padding: 6px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    margin: 0;
    font-weight: 500;
}

.booking-price-mode-option:has(input:checked) {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e40af;
}

.booking-price-mode-option input {
    width: auto;
    margin: 0;
    accent-color: #2563eb;
}

/* Chassis Search Table */
.booking-chassis-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.booking-chassis-table .purchase-list-cell-chip {
    white-space: nowrap !important;
    word-break: normal !important;
    max-width: none;
}

.booking-chassis-table th:nth-child(3),
.booking-chassis-table td:nth-child(3) {
    min-width: 120px;
}

.booking-chassis-table th,
.booking-chassis-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eef2f7;
    white-space: nowrap;
    vertical-align: middle;
}

.booking-th,
.booking-chassis-table th {
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    white-space: nowrap;
}

.booking-th-data {
    min-width: 88px;
}

.booking-col-chassis {
    min-width: 120px;
}

.booking-col-name {
    min-width: 140px;
}

.booking-th-select {
    white-space: nowrap;
    width: 40px;
    min-width: 40px;
    max-width: 44px;
    padding: 8px 4px !important;
    text-align: center;
}

.booking-select-all-cb {
    margin: 0;
    vertical-align: middle;
    accent-color: #2563eb;
}

.booking-list-sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #475569;
    min-height: 32px;
    white-space: nowrap;
}

.booking-list-sort-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 4px;
}

.booking-list-sort-btn.is-active .booking-list-sort-icon {
    color: #0f766e;
    font-weight: 800;
}

.booking-list-sort-icon {
    font-size: 12px;
    color: #64748b;
}

.booking-td {
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    font-size: 14px;
}

.booking-td-select {
    width: 40px;
    min-width: 40px;
    max-width: 44px;
    text-align: center;
    padding: 8px 4px !important;
}

.booking-th-view,
.booking-td-view {
    width: 40px;
    min-width: 40px;
    max-width: 44px;
    text-align: center;
    padding: 8px 2px 8px 8px !important;
}

.booking-td-view .purchase-view-btn {
    vertical-align: middle;
}

.booking-td-select .car-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
    cursor: pointer;
}

.booking-chassis-table tbody tr:hover {
    background: #f8fafc;
}

.booking-chassis-table tbody tr:last-child td {
    border-bottom: none;
}

/* Mobile Styles for Car Booking Page */
@media (max-width: 767px) {
    .booking-page-container {
        padding: 12px;
    }
    
    .booking-header {
        padding: 16px;
    }
    
    .booking-title {
        font-size: 18px;
    }
    .booking-header-sub {
        font-size: 13px;
    }
    
    /* On mobile, main content becomes transparent wrapper */
    .booking-main-content {
        padding: 0;
        background: transparent;
        box-shadow: none;
        border: none;
    }
    
    /* Stack columns vertically on mobile */
    .booking-columns {
        flex-direction: column;
        gap: 16px;
        min-height: auto;
    }
    
    /* Booking Details as its own card on mobile */
    .booking-details-section {
        flex: 1 1 auto;
        max-width: none;
        min-width: 0;
        padding: 16px;
        border-right: none;
        border-bottom: none;
        background: white;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border: 1px solid #e5e7eb;
        overflow-x: hidden;
    }
    
    /* LIST as its own card on mobile */
    .booking-list-section {
        flex: 1 1 auto;
        max-width: none;
        min-width: 0;
        padding: 16px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border: 1px solid #e5e7eb;
    }
    
    .booking-section-header {
        font-size: 16px;
        margin-bottom: 16px;
    }
    
    /* Form inputs - larger touch targets */
    .booking-form-group input,
    .booking-form-group select,
    .booking-form-group textarea {
        min-height: 44px;
        font-size: 16px;
    }
    
    /* Combobox dropdown fix for mobile - ensure dropdown shows below input */
    .booking-form-group > div[style*="position: relative"] {
        position: relative !important;
        z-index: 100;
    }
    
    /* Action buttons - stack vertically */
    .booking-action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .booking-action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .booking-cancel-link {
        text-align: center;
        padding: 12px;
    }
    
    /* Chassis table - simplified */
    .booking-chassis-table th,
    .booking-chassis-table td {
        padding: 8px 6px;
        font-size: 13px;
    }
    
    /* Hide YEAR column on mobile (class-based; Column Filter may reorder columns) */
    .booking-chassis-table th.booking-col-year,
    .booking-chassis-table td.booking-col-year {
        display: none;
    }
    
    /* Chassis table as cards on mobile */
    .booking-list-section .booking-chassis-table,
    .booking-list-section table.booking-chassis-table {
        display: block;
    }
    .booking-list-section .booking-chassis-table thead {
        display: none;
    }
    .booking-list-section .booking-chassis-table tbody,
    .booking-list-section .booking-chassis-table tr {
        display: block;
    }
    .booking-list-section .booking-chassis-table tr {
        margin-bottom: 12px;
        padding: 12px;
        background: #f9fafb;
        border-radius: 8px;
        border: 1px solid #e5e7eb;
    }
    .booking-list-section .booking-chassis-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px 0;
        border: none;
        font-size: 14px;
        white-space: normal;
        min-width: 0;
        max-width: none;
        width: auto;
    }
    .booking-list-section .booking-chassis-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #374151;
        margin-right: 8px;
    }
    .booking-list-section .booking-chassis-table td[data-label=""]::before {
        content: none;
    }
    .booking-list-section .booking-chassis-table tbody td.booking-col-year {
        display: none !important;
    }
    .booking-list-section .booking-chassis-table td:first-child,
    .booking-list-section .booking-chassis-table td.booking-td-view {
        flex-wrap: wrap;
        gap: 8px;
        width: auto;
        max-width: none;
        justify-content: flex-start;
    }
    /* Form group spacing on mobile */
    .booking-form-group {
        margin-bottom: 18px;
    }
    .booking-details-section .booking-form-group:last-of-type,
    .booking-list-section .booking-form-group:last-of-type {
        margin-bottom: 16px;
    }

    .booking-selection-options {
        position: sticky;
        bottom: 0;
        z-index: 6;
        margin: 12px -16px -16px;
        padding: 12px 16px 16px;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, #ffffff 35%);
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -8px 20px rgba(15, 23, 42, 0.06);
    }

    .booking-list-header-row {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .booking-list-header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
}

/* ============================================
   Global Combobox Dropdown Styles
   ============================================ */

/* Combobox dropdown container - global styles */
[id$="_dropdown"] {
    position: fixed !important;
    z-index: 999999 !important;
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15) !important;
    max-height: 300px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

/* Dropdown items */
[id$="_dropdown"] > div {
    padding: 10px 14px !important;
    cursor: pointer !important;
    border-bottom: 1px solid #f3f4f6 !important;
    font-size: 14px !important;
    color: #1f2937 !important;
    background-color: #ffffff !important;
    transition: background-color 0.15s ease !important;
}

[id$="_dropdown"] > div:last-child {
    border-bottom: none !important;
}

[id$="_dropdown"] > div:hover {
    background-color: #f3f4f6 !important;
}

/* Keyboard-active / ash hover — must beat [id$="_dropdown"] > div { background: #fff !important } */
[id$="_dropdown"] > div.combobox-option-ash-hover,
[id$="_dropdown"] > div[data-keyboard-active="1"] {
    background-color: #e9ecef !important;
    color: #333333 !important;
}

/* ChassisSearch dropdown specific styles */
#chassisSearch_dropdown {
    position: fixed !important;
    z-index: 999999 !important;
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2) !important;
    min-height: 50px !important;
}

/* Mobile specific dropdown styles */
@media (max-width: 767px) {
    [id$="_dropdown"] {
        max-height: 200px !important;
        min-width: 200px !important;
    }
    
    [id$="_dropdown"] > div {
        padding: 14px 16px !important;
        min-height: 48px !important;
        font-size: 16px !important;
        display: flex !important;
        align-items: center !important;
    }
    
    /* ChassisSearch dropdown - force position below input on mobile */
    #chassisSearch_dropdown {
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        max-width: calc(100vw - 32px) !important;
    }
}

/* Tablet Styles for Car Booking Page */
@media (min-width: 768px) and (max-width: 1024px) {
    .booking-page-container {
        padding: 16px;
    }
    
    .booking-title {
        font-size: 22px;
    }
    
    .booking-main-content {
        padding: 20px;
    }
    
    /* Stack columns — side-by-side crushes chassis table on iPad */
    .booking-columns {
        flex-direction: column;
        gap: 20px;
        min-height: auto;
    }
    
    .booking-details-section {
        flex: 1 1 auto;
        max-width: none;
        padding-right: 0;
        border-right: none;
    }
    
    .booking-list-section {
        flex: 1 1 auto;
        max-width: none;
        padding-left: 0;
    }
    
    .booking-chassis-table th,
    .booking-chassis-table td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .booking-selection-options {
        position: sticky;
        bottom: 0;
        z-index: 6;
        margin-top: 20px;
        padding: 12px 0 4px;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, #ffffff 40%);
        border-top: 1px solid #e2e8f0;
    }
}

/* ============================================
   C&F/FOB Calculation Page - Responsive Styles
   ============================================ */

/* Calculation Container */
.cnf-calculation-container {
    padding: 20px;
    background-color: #f8fafc;
    min-height: 100vh;
}

.cnf-back-row {
    margin-bottom: 16px;
}

/* Back Button */
.cnf-back-btn {
    padding: 8px 14px;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    min-height: 44px;
}

.cnf-back-btn:hover {
    background-color: #e5e7eb;
    color: #111827;
}

.cnf-back-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Main Card */
.cnf-card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 28px;
    max-width: min(1200px, calc(100vw - 40px));
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    width: 100%;
    box-sizing: border-box;
}

/* Header */
.cnf-header {
    text-align: center;
    margin-bottom: 20px;
}

.cnf-header h1 {
    color: #0f172a;
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

/* Chassis Selector */
.cnf-chassis-selector {
    margin-bottom: 20px;
}

.cnf-chassis-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 16px;
}

.cnf-chassis-selector select {
    width: 100%;
    padding: 12px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    background-color: white;
    min-height: 44px;
}

/* Cost Fields Grid */
.cnf-cost-fields {
    background-color: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.cnf-cost-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.cnf-cost-field {
    margin-bottom: 15px;
}

.cnf-cost-field label,
.cnf-total-box-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
}

.cnf-total-box label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.cnf-cost-field .input-with-prefix {
    display: flex;
    align-items: center;
}

.cnf-cost-field .input-with-prefix span {
    margin-right: 5px;
    font-weight: bold;
}

.cnf-cost-field input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    min-height: 40px;
}

/* Total Calculations */
.cnf-totals {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e5e7eb;
}

.cnf-totals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.cnf-total-box {
    text-align: center;
}

.cnf-total-box label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #374151;
    font-size: 16px;
}

.cnf-total-value {
    font-size: 20px;
    font-weight: bold;
    padding: 15px;
    border-radius: 8px;
    display: inline-block;
    min-width: 150px;
}

.cnf-total-value.green {
    color: #059669;
    background-color: #f0fdf4;
    border: 2px solid #22c55e;
}

.cnf-total-value.red {
    color: #dc2626;
    background-color: #fef2f2;
    border: 2px solid #ef4444;
}

/* Action Buttons */
.cnf-action-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.cnf-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cnf-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.cnf-btn-save {
    background-color: #059669;
    color: white;
}

.cnf-btn-save:hover {
    background-color: #047857;
}

.cnf-btn-preview {
    background-color: #4b5563;
    color: white;
}

.cnf-btn-preview:hover {
    background-color: #374151;
}

.cnf-btn-download {
    background-color: #2563eb;
    color: white;
}

.cnf-btn-download:hover {
    background-color: #1d4ed8;
}

.cnf-btn-finish {
    background-color: #059669;
    color: white;
}

.cnf-freight-action-wrap {
    margin: 16px 0 20px;
    width: 100%;
}

.cnf-btn-freight {
    background-color: #1e40af;
    color: white;
    width: 100%;
    margin-top: 0;
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.35;
    border-radius: 8px;
}

.cnf-btn-freight:hover {
    background-color: #1e3a8a;
}

/* Mobile Styles for C&F Page */
@media (max-width: 767px) {
    .cnf-calculation-container {
        padding: 12px;
    }
    
    .cnf-card {
        padding: 16px;
        max-width: 100%;
    }
    
    .cnf-header h1 {
        font-size: 18px;
    }
    
    /* Single column for cost fields */
    .cnf-cost-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Totals side by side but smaller */
    .cnf-totals-grid {
        gap: 10px;
    }
    
    .cnf-total-box label {
        font-size: 12px;
    }
    
    .cnf-total-value {
        font-size: 16px;
        padding: 10px;
        min-width: 100px;
    }
    
    /* Stack buttons vertically */
    .cnf-action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .cnf-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Tablet Styles for C&F Page */
@media (min-width: 768px) and (max-width: 1024px) {
    .cnf-card {
        padding: 24px;
        max-width: min(1200px, calc(100vw - 32px));
    }
    
    .cnf-cost-grid {
        gap: 12px;
    }
    
    /* 2x2 button grid */
    .cnf-action-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .cnf-btn {
        justify-content: center;
    }
}

/* ============================================
   Calculate Freight Page - Responsive Styles
   ============================================ */

/* Freight Container */
.freight-container {
    padding: 20px;
    background-color: #f9fafb;
    min-height: 100vh;
}

/* Freight Card */
.freight-card {
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 30px;
    max-width: min(1200px, calc(100vw - 40px));
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    width: 100%;
    box-sizing: border-box;
}

/* Freight Header */
.freight-header {
    text-align: center;
    margin-bottom: 24px;
}

.freight-header h1 {
    color: #0f172a;
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

/* Price Calculation Section */
.freight-price-section {
    background-color: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

/* Price Calculation Row */
.freight-price-row {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.freight-price-row label {
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.freight-price-row input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    width: 120px;
    min-height: 40px;
}

.freight-price-row input[readonly] {
    background-color: #f3f4f6;
    font-weight: bold;
}

.freight-price-row .operator {
    font-size: 18px;
    font-weight: bold;
}

/* Container Sections */
.freight-container-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
    margin-top: 20px;
}

.freight-container-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.freight-container-row label {
    font-weight: 600;
    color: #374151;
}

.freight-container-row input,
.freight-container-row select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    min-height: 40px;
}

/* Confirm Button */
.freight-confirm-btn {
    padding: 16px 32px;
    background-color: #374151;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    min-height: 48px;
}

/* Mobile Styles for Freight Page */
@media (max-width: 767px) {
    .freight-container {
        padding: 12px;
    }
    
    .freight-card {
        padding: 16px;
        max-width: 100%;
    }
    
    .freight-header h1 {
        font-size: 18px;
    }
    
    .freight-price-section {
        padding: 16px;
    }
    
    /* Stack price calculation vertically */
    .freight-price-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .freight-price-row input {
        width: 100%;
    }
    
    .freight-price-row .operator {
        display: none;
    }
    
    /* Add mobile-friendly labels */
    .freight-price-row label {
        width: 100%;
    }
    
    /* Container sections */
    .freight-container-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .freight-container-row input,
    .freight-container-row select {
        width: 100%;
    }
    
    /* Full width confirm button */
    .freight-confirm-btn {
        width: 100%;
    }
}

/* Tablet Styles for Freight Page */
@media (min-width: 768px) and (max-width: 1024px) {
    .freight-card {
        padding: 24px;
        max-width: min(1200px, calc(100vw - 32px));
    }
    
    .freight-price-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .freight-price-row input {
        width: 100%;
        max-width: 100%;
    }
    
    .freight-price-row .operator {
        display: none;
    }
    
    .freight-container-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .freight-container-row input,
    .freight-container-row select {
        width: 100%;
    }
}

/* ============================================
   Invoice Page - Responsive Styles
   ============================================ */

/* Invoice Page Container */
.invoice-page-container {
    width: 100%;
    min-height: calc(100vh - 60px);
    padding: 20px;
    background: #f8fafc;
    box-sizing: border-box;
}

/* Invoice Main Card */
.invoice-card {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    border: 1px solid #e5e7eb;
}

/* Invoice Header */
.invoice-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.01em;
}

/* Invoice Two-Column Layout */
.invoice-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: stretch;
}

/* Invoice Form Section */
.invoice-form-section {
    display: flex;
    flex-direction: column;
}

/* Invoice LIST Section */
.invoice-list-section {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.invoice-list-section h2 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

/* Invoice Form Fields */
.invoice-field {
    margin-bottom: 16px;
}

.invoice-field label,
.invoice-field-legend {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.invoice-date-wrap {
    position: relative;
    width: 100%;
}

.invoice-date-row {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.invoice-date-row .invoice-input {
    flex: 1;
    min-width: 0;
}

.invoice-calendar-btn {
    flex-shrink: 0;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    cursor: pointer;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.invoice-calendar-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.invoice-calendar-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.invoice-field .invoice-input,
.invoice-field .invoice-select,
.invoice-field .invoice-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    min-height: 44px;
}

.invoice-field .invoice-input:focus,
.invoice-field .invoice-select:focus,
.invoice-field .invoice-textarea:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5,150,105,0.1);
}

/* Shipping Location Grid */
.invoice-shipping-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.invoice-shipping-grid label {
    font-size: 12px;
    color: #6b7280;
}

/* Invoice Number Row */
.invoice-number-row {
    display: flex;
    gap: 8px;
}

.invoice-number-row .invoice-input {
    flex: 1;
}

.invoice-generate-btn {
    padding: 10px 16px;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    min-height: 44px;
}

.invoice-generate-btn:hover {
    background: #1e3a8a;
}

.invoice-generate-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Radio Group */
.invoice-radio-group {
    display: flex;
    gap: 24px;
    margin-top: 8px;
}

.invoice-radio {
    display: flex;
    align-items: center;
    gap: 8px;
}

.invoice-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #059669;
}

.invoice-radio label {
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

/* Invoice Table */
.invoice-list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

/* Invoice Table Container - grows only as needed for content, scrolls if too large */
.invoice-table-container {
    overflow-y: auto;
    max-height: 50vh;
}

.invoice-list-table th,
.invoice-list-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-list-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

/* Invoice Total */
.invoice-total {
    margin-top: 0;
    padding: 16px;
    background: #059669;
    color: white;
    border-radius: 8px;
    text-align: right;
    font-size: 18px;
    font-weight: 700;
}

/* Invoice List Footer */
.invoice-list-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    gap: 12px;
}

/* Invoice Action Buttons */
.invoice-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.invoice-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.invoice-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.invoice-btn-primary {
    background: #059669;
    color: white;
}

.invoice-btn-primary:hover {
    background: #047857;
}

.invoice-btn-secondary {
    background: #4b5563;
    color: white;
}

.invoice-btn-secondary:hover {
    background: #374151;
}

.invoice-btn-danger {
    background: #dc2626;
    color: white;
}

.invoice-btn-danger-outline {
    padding: 10px 20px;
    border: 1px solid #b91c1c;
    border-radius: 8px;
    background: #fff;
    color: #b91c1c;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    min-height: 44px;
}

.invoice-btn-danger-outline:hover {
    background: #fef2f2;
}

.invoice-btn-danger-outline:focus-visible {
    outline: 2px solid #ef4444;
    outline-offset: 2px;
}

/* Invoice Cards for Mobile */
.invoice-cards-container {
    display: none;
}

.invoice-card-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.invoice-card-item .card-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.invoice-card-item .card-row:last-child {
    margin-bottom: 0;
}

.invoice-card-item .card-label {
    font-weight: 600;
    color: #6b7280;
    font-size: 12px;
}

.invoice-card-item .card-value {
    font-weight: 500;
    color: #111827;
}

.invoice-card-item .card-amount {
    font-weight: 700;
    color: #059669;
    font-size: 16px;
}

/* Mobile Styles for Invoice Page */
@media (max-width: 767px) {
    .invoice-page-container {
        padding: 12px;
    }
    
    .invoice-card {
        padding: 0;
        background: transparent;
        box-shadow: none;
        border: none;
    }
    
    .invoice-page-header {
        background: white;
        border-radius: 12px;
        padding: 16px;
        margin-bottom: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border: 1px solid #e5e7eb;
    }
    
    .invoice-page-header h1 {
        font-size: 16px;
    }
    
    /* Stack columns vertically */
    .invoice-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Form section as its own card */
    .invoice-form-section {
        background: white;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border: 1px solid #e5e7eb;
    }
    
    /* LIST section as its own card */
    .invoice-list-section {
        background: white;
        border-radius: 12px;
        padding: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border: 1px solid #e5e7eb;
    }
    
    /* Shipping location stack vertically */
    .invoice-shipping-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Invoice number row stack */
    .invoice-number-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .invoice-generate-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Radio buttons larger touch targets */
    .invoice-radio-group {
        flex-direction: column;
        gap: 12px;
    }
    
    .invoice-radio {
        padding: 12px;
        background: #f9fafb;
        border-radius: 8px;
        border: 1px solid #e5e7eb;
    }
    
    .invoice-radio input[type="radio"] {
        width: 20px;
        height: 20px;
    }
    
    /* Show cards, hide table on mobile */
    .invoice-list-table {
        display: none;
    }
    
    .invoice-cards-container {
        display: block;
    }
    
    /* Total styling */
    .invoice-total {
        font-size: 16px;
        padding: 14px;
    }
    
    /* Action buttons in 2 rows, 3 per row */
    .invoice-actions {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-rows: auto auto;
        gap: 10px;
        background: white;
        border-radius: 12px;
        padding: 16px;
        margin-top: 16px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border: 1px solid #e5e7eb;
    }
    
    .invoice-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 8px;
        font-size: 11px;
    }
    
    /* Row 1: SHIP, EMAIL, EXPORT */
    #shipCarsBtn {
        order: 1;
    }
    #emailInvoiceBtn {
        order: 2;
    }
    #exportExcelBtn {
        order: 3;
    }
    
    /* Row 2: SAVE, PREVIEW, PDF */
    #invoiceSaveBtn {
        order: 4;
    }
    #showFullPreviewBtn {
        order: 5;
    }
    #invoicePdfBtn {
        order: 6;
    }
}

/* Tablet Styles for Invoice Page */
@media (min-width: 768px) and (max-width: 1024px) {
    .invoice-page-container {
        padding: 16px;
    }
    
    .invoice-card {
        padding: 20px;
    }
    
    .invoice-page-header h1 {
        font-size: 20px;
    }
    
    /* 60/40 split */
    .invoice-layout {
        grid-template-columns: 1.2fr 1fr;
        gap: 20px;
    }
    
    /* Table with fewer columns */
    .invoice-list-table th:nth-child(4),
    .invoice-list-table td:nth-child(4) {
        display: none; /* Hide YEAR column */
    }
    
    /* Action buttons wrap */
    .invoice-actions {
        justify-content: flex-start;
    }
    
    .invoice-btn {
        flex: 0 0 auto;
    }
}

/* ============================================
   Client Management Pages - Responsive Styles
   ============================================ */

/* Client Page Container */
.client-page-container {
    padding: 20px;
    min-height: calc(100vh - 60px);
    background: #f8fafc;
    box-sizing: border-box;
}

#clientTransactionsPage.client-page-container,
#clientDetailsPage.client-details-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Client Page Card */
.client-page-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    border: 1px solid #e5e7eb;
}

/* Client Page Header */
.client-page-header {
    margin-bottom: 24px;
}

.client-page-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
}

.client-page-title,
.client-page-header h2,
.client-details-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.client-page-header h2 {
    margin: 0 0 20px 0;
}

.client-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.client-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.client-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.client-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.client-btn-primary {
    background: #2563eb;
    color: white;
}

.client-btn-primary:hover {
    background: #1d4ed8;
}

.client-btn-warning {
    background: #f59e0b;
    color: #111827;
}

.client-btn-warning:hover {
    background: #d97706;
}

.client-btn-info {
    background: #0f766e;
    color: white;
}

.client-btn-info:hover {
    background: #0d9488;
}

.client-btn-secondary {
    background: #4b5563;
    color: white;
}

.client-btn-secondary:hover {
    background: #374151;
}

.client-btn-success {
    background: #059669;
    color: white;
}

.client-btn-success:hover {
    background: #047857;
}

.client-btn-danger {
    background: #dc2626;
    color: white;
}

.client-status-block {
    text-align: center;
    color: #6b7280;
    padding: 24px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.client-status-block--error {
    color: #dc2626;
}

.client-alert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-right: 6px;
    border-radius: 50%;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 12px;
    font-weight: 800;
    vertical-align: middle;
}

.client-alert-icon--warn {
    background: #fef3c7;
    color: #b45309;
}

.client-list-pager {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.client-list-pager-meta {
    color: #6b7280;
    font-size: 14px;
}

.client-list-pager-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.client-list-pager-btn {
    padding: 8px 16px;
    background-color: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    min-height: 40px;
    font-size: 14px;
    font-weight: 600;
}

.client-list-pager-btn:disabled,
.client-list-pager-btn.is-disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.client-list-pager-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.client-list-pager-page {
    color: #374151;
    font-size: 14px;
    padding: 0 8px;
}

.client-date-wrap {
    position: relative;
    width: 100%;
}

.client-date-row {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.client-date-row .client-form-input {
    flex: 1;
    min-width: 0;
}

.client-calendar-btn {
    flex-shrink: 0;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    cursor: pointer;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.client-calendar-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.client-calendar-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Client Alerts Section */
.client-alerts-section {
    display: none;
    margin-bottom: 24px;
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 20px;
    background-color: #fffbf0;
}

.client-alerts-section h3 {
    color: #856404;
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
}

/* Client List Section */
.client-list-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}

.client-list-section h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

/* Client Search Input */
.client-search-container {
    margin-bottom: 16px;
}

.client-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    min-height: 44px;
    box-sizing: border-box;
}

.client-search-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.client-search-input:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Client List Container */
.client-list-container {
    max-height: 500px;
    overflow-y: auto;
}

/* Client Item Card */
.client-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.client-item:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.client-item-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.client-info-flex {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.client-credit-limit-btn {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 12px;
    padding: 6px 10px;
}

.client-limit-summary {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.client-limit-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
    padding: 2px 6px;
    border-radius: 4px;
}

.client-limit-over {
    background: #fee2e2;
    color: #b91c1c;
}

.client-form-readonly {
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
}

input.client-form-readonly,
input.client-form-readonly:read-only {
    cursor: not-allowed;
    width: 100%;
    box-sizing: border-box;
}

.client-form-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.client-edit-btn {
    background: #007bff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.client-edit-btn:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.client-info {
    flex: 1;
    cursor: pointer;
}

.client-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.client-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.client-number {
    font-size: 12px;
    color: #6b7280;
}

.client-balance {
    font-weight: 700;
    text-align: right;
}

.client-status {
    font-size: 12px;
    color: #6b7280;
    text-align: right;
}

/* Client Details Page */
.client-details-container {
    padding: 20px;
    min-height: calc(100vh - 60px);
    background: #f8fafc;
}

.client-details-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    border: 1px solid #e5e7eb;
}

.client-details-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 24px;
    gap: 16px;
}

.client-details-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.client-details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Client info summary — side-by-side on tablet+ */
.client-info-card {
    margin-bottom: 24px;
}

@media (min-width: 768px) {
    .client-info-card {
        display: grid;
        grid-template-columns: 1fr minmax(220px, 300px);
        grid-template-areas:
            "name name"
            "info balance"
            "actions actions";
        gap: 16px 24px;
        align-items: start;
    }

    .client-info-name {
        grid-area: name;
    }

    .client-info-grid {
        grid-area: info;
        margin-bottom: 0;
    }

    .client-balance-card {
        grid-area: balance;
        margin-bottom: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .client-info-card > .client-action-buttons {
        grid-area: actions;
        margin-bottom: 0;
    }
}

.client-info-name {
    font-size: 20px;
    font-weight: 700;
    color: #333;
    margin: 0 0 16px 0;
}

.client-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.client-info-item {
    font-size: 14px;
    color: #4b5563;
}

.client-info-item strong {
    color: #111827;
}

/* Client Balance Card */
.client-balance-card {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
}

.client-balance-amount {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.client-balance-label {
    color: #6b7280;
    font-size: 14px;
}

.client-balance-sub {
    color: #6b7280;
    font-size: 12px;
    margin-top: 2px;
}

.client-ledger-hint {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.45;
    margin: 0 0 12px 0;
}

.ledger-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ledger-type-invoice {
    background: #dcfce7;
    color: #166534;
}

.ledger-type-reversal {
    background: #fef3c7;
    color: #92400e;
}

.ledger-type-payment {
    background: #dbeafe;
    color: #1e40af;
}

.ledger-type-adjustment {
    background: #fef3c7;
    color: #92400e;
}

.ledger-type-opening {
    background: #e8f5e9;
    color: #2e7d32;
}

.ledger-actions-cell {
    white-space: nowrap;
}

.ledger-actions-cell .client-btn {
    padding: 4px 8px;
    font-size: 12px;
    margin-right: 4px;
}

.ledger-type-shipment {
    background: #e0e7ff;
    color: #3730a3;
}

.ledger-type-legacy {
    background: #f3f4f6;
    color: #4b5563;
}

/* Transaction Table */
.client-transactions-section {
    margin-top: 24px;
}

.client-transactions-section h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.transactions-table-container {
    overflow-x: auto;
}

.transactions-table {
    width: 100%;
    border-collapse: collapse;
}

.transactions-table th {
    padding: 12px;
    text-align: left;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.transactions-table td {
    padding: 12px;
    border-bottom: 1px solid #f1f3f4;
}

.transactions-table tr:hover {
    background: #f8f9fa;
}

/* Transaction Cards for Mobile (shown ≤860px on Client Details) */
.transactions-cards-container {
    display: none;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.transaction-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.transaction-card-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.transaction-card-header .ledger-type-badge {
    flex-shrink: 0;
}

.transaction-date {
    font-weight: 600;
    color: #333;
    flex: 1 1 auto;
    min-width: 0;
}

.transaction-event {
    font-size: 12px;
    color: #6b7280;
}

.transaction-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.transaction-card-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    width: 100%;
}

.transaction-card-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.transaction-card-value {
    font-weight: 500;
    font-size: 14px;
    color: #111827;
    width: 100%;
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.transaction-balance {
    width: 100%;
    max-width: 100%;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
    font-weight: 700;
    font-size: 15px;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

/* ============================================
   Quick Purchase Modal
   ============================================ */
.qp-modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    box-sizing: border-box;
}

.qp-modal {
    background: #fff;
    border-radius: 12px;
    width: min(720px, 100%);
    max-height: min(90vh, 900px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

.qp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 18px 24px 14px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.qp-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

.qp-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    min-width: 40px;
    min-height: 40px;
    border-radius: 8px;
}

.qp-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.qp-modal-body {
    padding: 18px 24px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.qp-form-grid {
    margin-bottom: 8px;
}

.qp-field {
    min-width: 0;
}

.qp-field-span {
    grid-column: 1 / -1;
}

.qp-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.qp-input,
.qp-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 15px;
    font-family: inherit;
}

.qp-input:focus,
.qp-textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.qp-textarea {
    min-height: 72px;
    resize: vertical;
}

.qp-date-wrap {
    position: relative;
    width: 100%;
}

.qp-date-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.qp-calendar-btn {
    flex-shrink: 0;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    min-height: 40px;
}

.qp-date-hidden {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 0;
    opacity: 0;
    border: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.qp-month-hint {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    font-size: 15px;
}

.qp-currency {
    display: flex;
    gap: 8px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.qp-currency-symbol {
    font-weight: 600;
    color: #374151;
}

.qp-price-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.qp-negotiate {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    margin: 0;
}

.qp-negotiate input {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
}

.qp-pictures {
    margin-top: 8px;
}

.qp-section-title {
    color: #333;
    margin: 16px 0 10px 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    font-size: 16px;
}

.qp-number-cut {
    margin-top: 4px;
}

.qp-options {
    margin: 8px 0;
}

.qp-options-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.qp-options-custom {
    flex: 1;
}

.qp-shaken-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
    margin-bottom: 12px;
}

.qp-shaken-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
}

.qp-shaken-check input {
    width: 18px;
    height: 18px;
    accent-color: #2563eb;
}

.qp-number-cut-fields {
    margin-bottom: 8px;
}

.qp-number-cut-readonly {
    background: #f9f9f9;
}

.qp-pictures-box {
    padding: 16px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    background: #f9fafb;
}

.qp-pictures-actions {
    text-align: center;
}

.qp-upload-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #2563eb;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.qp-upload-btn:hover {
    background: #1d4ed8;
}

.qp-file-input {
    display: none;
}

.qp-picture-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.qp-upload-progress {
    margin-top: 12px;
}

.qp-progress-track {
    background: #e5e7eb;
    border-radius: 4px;
    height: 10px;
    overflow: hidden;
}

.qp-progress-bar {
    background: #2563eb;
    height: 100%;
    width: 0%;
    transition: width 0.3s;
}

.qp-progress-text {
    text-align: center;
    margin-top: 6px;
    font-size: 13px;
    color: #6b7280;
}

.qp-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 14px 24px 18px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

.qp-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    min-height: 40px;
}

.qp-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.qp-btn-secondary {
    background: #6b7280;
    color: #fff;
}

.qp-btn-teal {
    background: #0d9488;
    color: #fff;
}

.qp-btn-primary {
    background: #2563eb;
    color: #fff;
}

@media (max-width: 767px) {
    .qp-modal-overlay {
        padding: 8px;
        align-items: flex-start;
    }

    .qp-modal {
        max-height: 96vh;
        margin-top: 8px;
    }

    .qp-modal-header,
    .qp-modal-body,
    .qp-modal-actions {
        padding-left: 16px;
        padding-right: 16px;
    }

    .qp-modal-actions {
        justify-content: stretch;
    }

    .qp-modal-actions .qp-btn {
        flex: 1 1 auto;
    }

    .qp-field-span {
        grid-column: auto;
    }
}

/* ============================================
   Import CSV Modal
   ============================================ */
.import-modal-overlay {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 16px;
    box-sizing: border-box;
}

.import-modal {
    background: #fff;
    border-radius: 12px;
    width: min(520px, 100%);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

.import-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid #e5e7eb;
}

.import-modal-title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.import-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
    min-width: 40px;
    min-height: 40px;
    border-radius: 8px;
}

.import-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.import-modal-body {
    padding: 18px 22px;
}

.import-modal-lead {
    margin: 0 0 8px;
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

.import-modal-hint {
    margin: 0 0 16px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.45;
}

.import-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px 16px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.import-dropzone:hover,
.import-dropzone:focus-within,
.import-dropzone.import-dropzone-active {
    border-color: #16a34a;
    background: #f0fdf4;
}

.import-dropzone-label {
    display: inline-block;
    padding: 10px 18px;
    background: #16a34a;
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.import-dropzone-sub {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.import-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

.import-file-info {
    margin-top: 14px;
    min-height: 1.25em;
    font-size: 14px;
    color: #0f172a;
    font-weight: 500;
}

.import-file-info:empty {
    display: none;
}

.import-status {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.4;
    display: none;
}

.import-status[data-kind="error"] {
    display: block;
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.import-status[data-kind="info"] {
    display: block;
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.import-status[data-kind="success"] {
    display: block;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.import-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 14px 22px 18px;
    border-top: 1px solid #e5e7eb;
}

.import-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    min-height: 40px;
}

.import-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.import-btn-secondary {
    background: #6b7280;
    color: #fff;
}

.import-btn-primary {
    background: #16a34a;
    color: #fff;
}

@media (max-width: 767px) {
    .import-modal-actions {
        flex-direction: column-reverse;
    }

    .import-modal-actions .import-btn {
        width: 100%;
    }
}

/* Modal Styles */
.client-modal {
    display: block;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow-y: auto;
}

.client-modal-content {
    background: white;
    margin: 5% auto;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
}

.client-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.client-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.client-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.client-modal-close:hover {
    color: #6b7280;
}

/* Form Styles */
.client-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.client-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.client-form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.client-form-field {
    display: flex;
    flex-direction: column;
}

.client-form-field.full-width {
    grid-column: span 2;
}

.client-form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.client-form-input,
.client-form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    min-height: 44px;
    box-sizing: border-box;
}

.client-form-input:focus,
.client-form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* Modal Action Buttons */
.client-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.client-modal-actions-split {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.client-modal-actions-right {
    display: flex;
    gap: 12px;
}

/* Mobile + tablet (≤1024px) — Client Transactions & Details */
@media (max-width: 1024px) {
    #clientTransactionsPage.client-page-container,
    #clientDetailsPage.client-details-container {
        padding: 14px;
    }

    #clientTransactionsPage .client-page-card,
    #clientDetailsPage .client-details-card {
        padding: 18px;
    }

    #clientTransactionsPage .client-page-title,
    #clientDetailsPage .client-page-title,
    #clientTransactionsPage .client-page-header h2,
    #clientDetailsPage .client-details-header h2 {
        font-size: 20px;
        text-align: center;
        width: 100%;
    }

    #clientTransactionsPage .client-page-toolbar,
    #clientDetailsPage .client-details-header {
        gap: 14px;
    }

    #clientTransactionsPage .client-toolbar-actions,
    #clientDetailsPage .client-details-actions,
    #clientDetailsPage .client-info-card > .client-action-buttons {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    #clientTransactionsPage .client-toolbar-actions .client-btn,
    #clientDetailsPage .client-details-actions .client-btn,
    #clientDetailsPage .client-info-card > .client-action-buttons .client-btn {
        width: 100%;
        justify-content: center;
    }

    #clientTransactionsPage .client-list-section {
        padding: 16px;
    }

    #clientTransactionsPage .client-list-section h3 {
        font-size: 17px;
        text-align: center;
    }

    #clientTransactionsPage .client-search-input {
        font-size: 16px;
    }

    #clientDetailsPage .client-info-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Ledger cards on compact widths (≤860px) */
@media (max-width: 860px) {
    #clientDetailsPage .transactions-table-container {
        display: none;
    }

    #clientDetailsPage .transactions-cards-container {
        display: block;
    }

    #clientDetailsPage .client-transactions-section {
        min-width: 0;
        overflow: hidden;
    }

    /* Description + Reference full width; Debit/Credit side-by-side on slightly wider phones */
    #clientDetailsPage .transaction-card-body {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    #clientDetailsPage .transaction-card-row:nth-child(1),
    #clientDetailsPage .transaction-card-row:nth-child(2),
    #clientDetailsPage .transaction-balance {
        grid-column: 1 / -1;
    }
}

@media (min-width: 480px) and (max-width: 860px) {
    #clientDetailsPage .transaction-card-body {
        grid-template-columns: 1fr 1fr;
    }

    #clientDetailsPage .transaction-card-row:nth-child(3) {
        grid-column: 1;
    }

    #clientDetailsPage .transaction-card-row:nth-child(4) {
        grid-column: 2;
    }
}

/* Mobile (≤767px) */
@media (max-width: 767px) {
    #clientTransactionsPage.client-page-container,
    #clientDetailsPage.client-details-container {
        padding: 12px;
    }

    #clientTransactionsPage .client-page-card,
    #clientDetailsPage .client-details-card {
        padding: 16px;
    }

    #clientTransactionsPage .client-page-title,
    #clientDetailsPage .client-page-title,
    #clientTransactionsPage .client-page-header h2,
    #clientDetailsPage .client-details-header h2 {
        font-size: 18px;
    }

    #clientTransactionsPage .client-item-content {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    #clientTransactionsPage .client-credit-limit-btn {
        width: 100%;
        justify-content: center;
    }

    #clientTransactionsPage .client-info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    #clientTransactionsPage .client-info-row > div:last-child {
        text-align: left;
        width: 100%;
    }

    #clientTransactionsPage .client-balance,
    #clientTransactionsPage .client-status {
        text-align: left;
    }

    #clientDetailsPage .client-balance-card {
        padding: 16px;
    }

    #clientDetailsPage .client-balance-amount {
        font-size: 28px;
        word-break: break-word;
    }

    #clientDetailsPage .client-info-card {
        display: block;
    }

    /* Modal full screen on mobile */
    .client-modal-content {
        margin: 0;
        width: 100%;
        min-height: 100vh;
        border-radius: 0;
        padding: 16px;
    }

    .client-form-row,
    .client-form-row-3 {
        grid-template-columns: 1fr;
    }

    .client-form-field.full-width {
        grid-column: span 1;
    }

    .client-modal-actions {
        flex-direction: column;
    }

    .client-modal-actions-split {
        flex-direction: column;
        gap: 16px;
    }

    .client-modal-actions-right {
        flex-direction: column;
    }

    .client-modal-actions .client-btn,
    .client-modal-actions-right .client-btn {
        width: 100%;
        justify-content: center;
    }

    .client-modal-actions-split .client-btn-danger {
        order: 3;
        margin-top: 8px;
    }
}

/* Desktop (≥1025px) — toolbar row, table ledger */
@media (min-width: 1025px) {
    #clientTransactionsPage .client-page-toolbar,
    #clientDetailsPage .client-details-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 16px;
    }

    #clientTransactionsPage .client-page-title,
    #clientDetailsPage .client-page-title {
        text-align: left;
        flex: 1;
        min-width: 200px;
    }

    #clientTransactionsPage .client-toolbar-actions,
    #clientDetailsPage .client-details-actions {
        flex-direction: row;
        justify-content: flex-end;
        flex-wrap: wrap;
        width: auto;
    }

    #clientTransactionsPage .client-toolbar-actions .client-btn,
    #clientDetailsPage .client-details-actions .client-btn {
        width: auto;
        min-width: 0;
    }

    #clientDetailsPage .client-info-card > .client-action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    #clientDetailsPage .transactions-table-container {
        display: block;
    }

    #clientDetailsPage .transactions-cards-container {
        display: none;
    }
}

/* Tablet Styles for Client Pages */
@media (min-width: 768px) and (max-width: 1024px) {
    #clientTransactionsPage .client-toolbar-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    #clientTransactionsPage .client-toolbar-actions .client-btn {
        flex: 1 1 calc(50% - 6px);
        min-width: 160px;
        width: auto;
    }

    #clientDetailsPage .client-details-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }

    #clientDetailsPage .client-details-actions .client-btn {
        flex: 1 1 calc(33.333% - 8px);
        min-width: 140px;
        width: auto;
    }

    #clientDetailsPage .client-info-card > .client-action-buttons .client-btn {
        flex: 1 1 auto;
        width: auto;
        min-width: 140px;
    }

    .client-modal-content {
        width: 85%;
        margin: 10% auto;
    }

    .client-form-row-3 {
        grid-template-columns: 1fr 1fr;
    }

    #clientDetailsPage .transactions-table th:nth-child(4),
    #clientDetailsPage .transactions-table td:nth-child(4) {
        display: none;
    }
}

/* Legacy mobile block removed — rules merged above */

/* ============================================
   User Management Pages - Responsive Styles
   ============================================ */

/* User Page Container */
.user-page-container {
    padding: 20px;
    min-height: calc(100vh - 60px);
    background: #f8fafc;
}

/* User Page Card */
.user-page-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
    border: 1px solid #e5e7eb;
}

/* User Page Header */
.user-page-header {
    margin-bottom: 24px;
}

.user-page-header h2 {
    margin: 0 0 20px 0;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

/* User Action Buttons */
.user-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.user-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.user-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.user-btn-primary {
    background: #2563eb;
    color: white;
}

.user-btn-primary:hover {
    background: #1d4ed8;
}

.user-btn-warning {
    background: #f59e0b;
    color: #111827;
}

.user-btn-warning:hover {
    background: #d97706;
}

.user-btn-secondary {
    background: #4b5563;
    color: white;
}

.user-btn-secondary:hover {
    background: #374151;
}

.user-btn-success {
    background: #059669;
    color: white;
}

.user-btn-danger {
    background: #dc2626;
    color: white;
}

.user-status-block {
    text-align: center;
    color: #6b7280;
    padding: 40px 16px;
    font-size: 14px;
    line-height: 1.5;
}

.pending-signups-table-wrap {
    margin-top: 20px;
    padding: 16px;
}

.edit-user-btn {
    width: 36px;
    height: 36px;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.edit-user-btn:hover {
    background-color: #1d4ed8;
}

.edit-user-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Role Requests Section */
.role-requests-section {
    display: none;
    margin-bottom: 24px;
    border: 1px solid #ffc107;
    border-radius: 12px;
    padding: 20px;
    background-color: #fffbf0;
}

.role-requests-section h3 {
    color: #856404;
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
}

/* Users Section */
.users-section {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}

.users-section h3 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

/* Users Table Container */
.users-table-container {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th {
    padding: 12px;
    text-align: left;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
    color: #374151;
}

.users-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.users-table tr:hover {
    background-color: #f8f9fa;
}

/* User Card for Mobile */
.users-cards-container {
    display: none;
}

.user-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.user-card-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-card-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: #007bff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.user-card-info {
    flex: 1;
}

.user-card-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.user-card-email {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
}

.user-card-role {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: white;
}

.user-card-role.admin {
    background: #dc3545;
}

.user-card-role.editor {
    background: #28a745;
}

.user-card-role.viewer {
    background: #6c757d;
}

/* Role Badge */
.role-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

/* User Form Page */
.user-form-container {
    padding: 20px;
    min-height: calc(100vh - 60px);
    background: #f5f5f5;
}

.user-form-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    max-width: 600px;
    margin: 0 auto;
}

.user-form-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.user-form-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.user-back-btn {
    padding: 8px 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 40px;
}

/* User Form Fields */
.user-form {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.user-form-field {
    margin-bottom: 20px;
}

.user-form-field:last-of-type {
    margin-bottom: 0;
}

.user-form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.user-form-input,
.user-form-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    min-height: 44px;
}

.user-form-input:focus,
.user-form-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.user-form-input.readonly {
    background-color: #e9ecef;
    color: #6c757d;
}

.user-form-hint {
    color: #6c757d;
    font-size: 12px;
    margin-top: 4px;
}

.user-form-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* User Form Actions */
.user-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.user-form-actions-split {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.user-form-actions-right {
    display: flex;
    gap: 12px;
}

/* Role Request Cards for Mobile */
.role-requests-cards-container {
    display: none;
}

.role-request-card {
    background: white;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.role-request-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.role-request-user {
    font-weight: 600;
    color: #333;
}

.role-request-email {
    font-size: 12px;
    color: #6b7280;
}

.role-request-date {
    font-size: 11px;
    color: #6b7280;
}

.role-request-roles {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.role-request-arrow {
    color: #666;
}

.role-request-reason {
    font-size: 13px;
    color: #4b5563;
    padding: 8px;
    background: #f9fafb;
    border-radius: 4px;
    margin-bottom: 12px;
}

.role-request-actions {
    display: flex;
    gap: 8px;
}

/* Mobile Styles for User Pages */
@media (max-width: 767px) {
    .user-page-container,
    .user-form-container {
        padding: 12px;
    }
    
    .user-page-card {
        padding: 16px;
    }
    
    .user-page-header h2 {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    /* Action buttons stack */
    .user-action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .user-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Users section */
    .users-section {
        padding: 16px;
    }
    
    .users-section h3 {
        font-size: 16px;
    }
    
    /* Show cards, hide table on mobile */
    .users-table-container {
        display: none;
    }
    
    .users-cards-container {
        display: block;
    }
    
    /* Role requests */
    .role-requests-section {
        padding: 16px;
    }
    
    .role-requests-table-container {
        display: none;
    }
    
    .role-requests-cards-container {
        display: block;
    }
    
    /* User Form Page */
    .user-form-card {
        padding: 16px;
        max-width: 100%;
    }
    
    .user-form-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .user-back-btn {
        width: 100%;
        justify-content: center;
    }
    
    .user-form {
        padding: 16px;
    }
    
    /* Form actions stack */
    .user-form-actions {
        flex-direction: column;
    }
    
    .user-form-actions-split {
        flex-direction: column;
        gap: 16px;
    }
    
    .user-form-actions-right {
        flex-direction: column;
    }
    
    .user-form-actions .user-btn,
    .user-form-actions-right .user-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Delete button at bottom on mobile */
    .user-form-actions-split .user-btn-danger {
        order: 3;
    }
    
    /* Role request actions */
    .role-request-actions {
        flex-direction: column;
    }
    
    .role-request-actions .user-btn {
        flex: 1;
    }
}

/* Tablet Styles for User Pages */
@media (min-width: 768px) and (max-width: 1024px) {
    .user-page-container,
    .user-form-container {
        padding: 16px;
    }
    
    .user-page-card {
        padding: 20px;
    }
    
    .user-page-header h2 {
        font-size: 20px;
    }
    
    /* Action buttons wrap */
    .user-action-buttons {
        flex-wrap: wrap;
    }
    
    /* Form adjustments */
    .user-form-card {
        max-width: 90%;
    }
    
    /* Table hide some columns */
    .users-table th:nth-child(5),
    .users-table td:nth-child(5) {
        display: none; /* Hide Created column */
    }
}

/* ============================================
   Edit Purchase Page - Mobile Fixes
   ============================================ */

/* Edit Purchase Container */
.edit-purchase-container {
    position: relative;
    overflow: visible;
}

/* Ensure no input fields appear at the top of the page */
@media (max-width: 767px) {
    /* Fix content container positioning */
    #content {
        position: relative;
        overflow-x: hidden;
    }
    
    /* Form card: reduce width, add side margin on mobile */
    .edit-purchase-container {
        position: relative;
        margin: 0 12px;
        margin-top: 0;
        padding: 16px;
        padding-top: 16px;
        padding-bottom: 20px;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Page title + 'Edit Purchase' heading: spacing and size */
    .edit-purchase-container h2 {
        position: relative;
        margin-top: 0;
        margin-bottom: 20px;
        font-size: 1.35rem;
        line-height: 1.3;
    }
    
    /* Action buttons: same row on mobile, equal width, touch-friendly */
    .edit-purchase-container .form-actions {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 12px 16px;
        justify-content: stretch;
    }
    .edit-purchase-container .form-actions button {
        flex: 1;
        min-width: 0;
        min-height: 44px;
        padding: 10px 8px;
        font-size: 14px;
        font-weight: 600;
    }
    
    /* .form-grid-4col → single column on mobile */
    .edit-purchase-container .form-grid-4col {
        grid-template-columns: 1fr;
        gap: 16px;
        margin-bottom: 16px;
    }
    
    /* Chassis row: keep input + dropdown + gear in one line on mobile */
    .edit-purchase-container .chassis-input-row {
        flex-direction: row;
        align-items: center;
    }
    .edit-purchase-container .chassis-input-row .chassis-input-wrap {
        flex: 1;
        min-width: 0;
    }
    .edit-purchase-container .chassis-input-row .manage-btn {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Combobox wrappers: fixed height so dropdown button aligns with form field */
    .edit-purchase-container .chassis-input-wrap,
    .edit-purchase-container #editForm div[style*="position: relative"][style*="width: 100%"] {
        position: relative !important;
        min-height: 44px;
    }
    /* All combobox inputs: fixed height so dropdown aligns with field */
    .edit-purchase-container .chassis-input-wrap input,
    .edit-purchase-container #editChassisInput,
    .edit-purchase-container #editCarNameInput,
    .edit-purchase-container #editForm div[style*="position: relative"] input[id$="Input"] {
        min-height: 44px;
        height: 44px;
        padding: 0 44px 0 12px;
        width: 100%;
        box-sizing: border-box;
        line-height: 44px;
    }
    /* Dropdown buttons: same level as form field (vertically aligned with input) */
    .edit-purchase-container #editChassisButton,
    .edit-purchase-container #editCarNameButton,
    .edit-purchase-container #editShipmentSizeButton,
    .edit-purchase-container #editRixoCompanyButton,
    .edit-purchase-container #editStockLocationButton,
    .edit-purchase-container #editRixoPriceDropdownButton,
    .edit-purchase-container #editForm div[id$="Button"][id^="edit"] {
        position: absolute !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        left: auto !important;
        width: 44px !important;
        height: 100% !important;
        min-height: 44px !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    /* Venue ID: plain text entry (no dropdown arrow) */
    .edit-purchase-container #editForm #editVenueIdButton,
    .edit-purchase-container #editForm #editVenueId,
    #venueIdButton,
    #venueId,
    #supTreeVenueEditComboButton,
    #supTreeVenueEditCombo,
    #supTreeBranchEditVenueButton,
    #supTreeBranchEditVenue {
        display: none !important;
    }
    .edit-purchase-container #editVenueIdInput,
    #venueIdInput,
    #supTreeVenueEditComboInput,
    #supTreeBranchEditVenueInput {
        padding-right: 12px !important;
    }
    /* Invisible select overlay - same area as dropdown button (do not override to position:relative) */
    .edit-purchase-container .chassis-input-wrap select,
    .edit-purchase-container #editForm div[style*="position: relative"] select {
        position: absolute !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 44px !important;
        height: 100% !important;
        min-height: 44px !important;
    }
    
    /* Section header size and long label wrapping */
    .edit-purchase-container .form-section-header,
    .edit-purchase-container h3.form-section-header {
        font-size: 1rem;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    .edit-purchase-container #editForm label {
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100%;
    }
    
    /* Ensure edit form container is properly positioned */
    #content > div {
        position: relative;
        margin-top: 0;
        padding-top: 20px;
    }
    
    /* Hide any stray price displays that might appear at top */
    .edit-purchase-container:before,
    #content > div:before {
        content: none !important;
    }
    
    /* Rixo Price: keep yen symbol same level as value inside form field on mobile */
    .edit-purchase-container div[style*="position: relative"]:has(#editRixoPriceInput) {
        min-height: 44px;
        position: relative !important;
    }
    .edit-purchase-container div:has(#editRixoPriceInput) > span:first-child {
        position: absolute !important;
        left: 12px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        margin: 0 !important;
        line-height: 1 !important;
    }
    #editRixoPriceInput {
        min-height: 44px !important;
        padding: 12px 44px 12px 32px !important;
        box-sizing: border-box !important;
    }
    
    /* Ensure hidden Rixo Price field stays hidden */
    #editRixoPrice {
        display: none !important;
    }
    
    /* Ensure form sections are properly displayed */
    .form-section-content {
        display: grid !important;
        position: relative !important;
    }
    
    /* Fix for any absolute positioned elements in edit form */
    #editForm input[type="number"],
    #editForm input[type="text"],
    #editForm input[type="date"],
    #editForm input[type="month"] {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
    }
    
    /* Ensure edit form wrapper doesn't have positioning issues */
    #editForm {
        position: relative;
    }
    
    /* Fix for rixo price container - ensure parent div is relative */
    #editForm div[style*="position: relative"] {
        position: relative !important;
    }
    
    /* Ensure inputs in edit form are properly positioned (do not set select to relative - combobox selects must stay absolute) */
    #editForm input {
        position: relative !important;
    }
    
    /* Ensure no elements float to top */
    .edit-purchase-container > * {
        position: relative !important;
    }
}

/* ============================================
   C&F / FOB Calculation - Table-Based UI
   ============================================ */

.cnf-cars-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.cnf-cars-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 14px;
}

.cnf-cars-table thead {
    background: linear-gradient(135deg, #ecf0f1 0%, #f8f9fa 100%);
    border-bottom: 2px solid #bdc3c7;
}

.cnf-cars-table thead th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-right: 1px solid #bdc3c7;
}

.cnf-cars-table thead th:last-child {
    border-right: none;
}

.cnf-table-row {
    background-color: #ffffff;
    border-bottom: 1px solid #ecf0f1;
    transition: all 0.2s ease;
}

.cnf-table-row:hover {
    background-color: #f8f9fa;
}

.cnf-table-row td {
    padding: 12px;
    vertical-align: middle;
    border-right: 1px solid #ecf0f1;
}

.cnf-table-row td:last-child {
    border-right: none;
}

/* C&F table: per-row “saved” indicator (light green when costs persisted) */
.cnf-row-saved-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: #f8fafc;
    box-sizing: border-box;
    vertical-align: middle;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.cnf-row-saved-indicator--on {
    border-color: #86efac;
    background: #dcfce7;
    box-shadow: inset 0 0 0 1px #bbf7d0;
}

.cnf-row-saved-indicator--on::after {
    content: "";
    display: block;
    width: 5px;
    height: 9px;
    border: solid #166534;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.cnf-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
    min-width: 36px;
    min-height: 36px;
    color: #6b7280;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cnf-expand-btn:hover {
    color: #111827;
    background: #f3f4f6;
}

.cnf-expand-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.cnf-quick-save-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #1e40af;
    border-radius: 50%;
    background: #2563eb;
    color: white;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.cnf-quick-save-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16);
}

.cnf-quick-save-btn:active {
    transform: translateY(1px);
}

.cnf-quick-save-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.cnf-expanded-row-hidden {
    display: none;
}

.cnf-expanded-row {
    background: linear-gradient(to right, #f0f7ff 0%, #ffffff 100%);
    border: 2px solid #3498db;
}

.cnf-expanded-row td {
    padding: 20px;
}

.cnf-expanded-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cnf-expanded-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 1200px) {
    .cnf-expanded-grid {
        grid-template-columns: 1fr;
    }
}

.cnf-expanded-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cnf-cost-field {
    display: flex;
    flex-direction: column;
}

.cnf-cost-field label {
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.input-with-prefix {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-with-prefix span {
    font-weight: 600;
    color: #7f8c8d;
    width: 20px;
    text-align: center;
}

.cnf-expanded-input,
.money-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 14px;
    font-family: monospace;
    transition: all 0.2s ease;
}

.cnf-expanded-input:focus,
.money-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 4px rgba(52, 152, 219, 0.2);
}

.cnf-expanded-totals {
    margin: 10px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.cnf-totals-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.cnf-total-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cnf-total-box label,
.cnf-total-box-label {
    font-weight: 600;
    font-size: 13px;
    color: #64748b;
}

.cnf-total-box-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cnf-expense-lock-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 14px;
    color: #374151;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.cnf-expense-lock-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.cnf-expense-lock-btn--locked {
    background: #fef2f2;
    border-color: #f1a9a0;
    color: #c0392b;
}

.cnf-expense-lock-btn--unlocked {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #64748b;
}

.cnf-expense-lock-icon {
    pointer-events: none;
}

.cnf-expanded-total-value {
    font-size: 18px;
    font-weight: 700;
    font-family: monospace;
    padding: 8px 12px;
    border-radius: 4px;
}

.cnf-expanded-total-value.green {
    color: #27ae60;
    background: rgba(39, 174, 96, 0.1);
}

.cnf-expanded-total-value.red {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.cnf-total-display {
    font-weight: 700;
    font-family: monospace;
    color: #27ae60;
}

.cnf-expanded-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.cnf-expanded-save-btn,
.cnf-expanded-preview-btn,
.cnf-expanded-download-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cnf-expanded-save-btn {
    background: #27ae60;
    color: white;
}

.cnf-expanded-save-btn:hover {
    background: #229954;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cnf-expanded-preview-btn {
    background: #8e44ad;
    color: white;
}

.cnf-expanded-preview-btn:hover {
    background: #7d3c98;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cnf-expanded-download-btn {
    background: #3498db;
    color: white;
}

.cnf-expanded-download-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Rixo Price Mapping tree (was inline in MasterList) */
.rixo-tree-page {
    max-width: 1280px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px 32px;
}
.rixo-tree-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.rixo-tree-title {
    margin: 0;
    color: #0f172a;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.rixo-tree-btn {
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.rixo-tree-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.rixo-tree-btn--add {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}
.rixo-tree-btn--danger {
    background: #ef4444;
    border-color: #ef4444;
    color: #fff;
}
.rixo-tree-root {
    background: linear-gradient(180deg, #eef2f7 0%, #e8edf5 100%);
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 18px 16px 24px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
    overflow-x: auto;
}
.rixo-tree-loading {
    text-align: center;
    color: #64748b;
    padding: 48px 16px;
    font-size: 15px;
}
.rixo-tree {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 1020px;
}
.rixo-tree-headers {
    display: grid;
    grid-template-columns: 270px 200px 240px 160px 200px 1fr 1fr;
    gap: 14px;
    align-items: end;
    margin-bottom: 4px;
}
/* Shared search + column sort for Supplier Map / Rixo Price Map trees */
#supplierMapTreePage .tree-map-search-toolbar,
#rixoPriceMapTreePage .tree-map-search-toolbar {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin: 0 0 16px;
    box-sizing: border-box;
}
#supplierMapTreePage .tree-map-search-pill,
#rixoPriceMapTreePage .tree-map-search-pill {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 720px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
#supplierMapTreePage .tree-map-search-icon,
#rixoPriceMapTreePage .tree-map-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #9ca3af;
    display: flex;
}
#supplierMapTreePage .tree-map-search-pill input,
#rixoPriceMapTreePage .tree-map-search-pill input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 40px 12px 44px;
    border: none;
    font-size: 14px;
    background: transparent;
    border-radius: 999px;
    outline: none;
    color: #111827;
}
#supplierMapTreePage .tree-map-search-clear,
#rixoPriceMapTreePage .tree-map-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 8px;
}
#supplierMapTreePage .tree-map-search-clear:hover,
#rixoPriceMapTreePage .tree-map-search-clear:hover {
    color: #4b5563;
    background: #f3f4f6;
}
#supplierMapTreePage .rixo-tree-header--with-sort,
#rixoPriceMapTreePage .rixo-tree-header--with-sort {
    padding-left: 10px;
}
#supplierMapTreePage .tree-map-col-sort-btn,
#rixoPriceMapTreePage .tree-map-col-sort-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #64748b;
    font-family: inherit;
}
#supplierMapTreePage .tree-map-col-sort-btn:hover,
#rixoPriceMapTreePage .tree-map-col-sort-btn:hover {
    color: #334155;
}
#supplierMapTreePage .tree-map-col-sort-icon,
#rixoPriceMapTreePage .tree-map-col-sort-icon {
    font-size: 13px;
    line-height: 1;
    color: #94a3b8;
}

.supplier-map-tree-headers {
    min-width: 1380px;
}
.rixo-tree-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #64748b;
    box-sizing: border-box;
}
/* Company card: match card padding-left (10px) so label lines up with the card content */
.rixo-tree-header:nth-child(1) { padding-left: 10px; }
/* Nested columns: card starts 34px right of the plain grid column start per nesting level
   (tree uses node gap 14 + .rixo-tree-children margin 8 + padding 30; grid gap is 18). */
.rixo-tree-header:nth-child(2) { padding-left: 34px; }
.rixo-tree-header:nth-child(3) { padding-left: 68px; }
.rixo-tree-header:nth-child(4) { padding-left: 102px; }
/* Price sits in the right part of the leaf row (with >>); center over value + control */
.rixo-tree-header--price {
    text-align: center;
    padding-left: 0;
    padding-right: 8px;
}
.rixo-tree-node {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.rixo-tree-children {
    position: relative;
    margin-left: 8px;
    padding-left: 30px;
    padding-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
/* Main vertical spine for this branch column */
.rixo-tree-children::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, #94a3b8 0%, #cbd5e1 100%);
    border-radius: 1px;
    pointer-events: none;
}
/* Horizontal branch from spine to each row card (does not overlap the color ball) */
.rixo-tree-children > .rixo-tree-node::before {
    content: "";
    position: absolute;
    left: -20px;
    top: 26px;
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, #94a3b8 0%, #cbd5e1 100%);
    border-radius: 1px;
    z-index: 0;
    pointer-events: none;
}
.rixo-tree-card:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}
.rixo-tree-add-btn:focus-visible,
.rixo-tree-card-menu-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.rixo-tree-card {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 8px 12px 8px 10px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 1px 5px rgba(15, 23, 42, 0.08);
    cursor: pointer;
    user-select: none;
    position: relative;
    z-index: 1;
}
.rixo-tree-card-wrapper {
    display: flex;
    align-items: stretch;
    gap: 2px;
    flex-shrink: 0;
    box-sizing: border-box;
}
.rixo-tree-card-wrapper .rixo-tree-card:not(.rixo-tree-card--inline-editing) {
    flex: 1;
    min-width: 0;
    width: auto !important;
}
.rixo-tree-card-wrapper--company { width: 270px; }
.rixo-tree-card-wrapper--auction { width: 240px; }
.rixo-tree-card-wrapper--stock { width: 240px; }
.rixo-tree-card-wrapper--venue { width: 200px; }
.rixo-tree-card-wrapper--pol { width: 160px; }
.rixo-tree-card-wrapper--field { width: 200px; }
.rixo-tree-card-menu-wrap {
    position: relative;
    flex-shrink: 0;
    align-self: center;
    z-index: 20;
}
.rixo-tree-card-menu-btn {
    width: 28px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.rixo-tree-card-menu-btn:hover {
    background: rgba(148, 163, 184, 0.2);
    color: #0f172a;
}
.rixo-tree-card-menu-panel {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 148px;
    padding: 4px 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    z-index: 200;
}
.rixo-tree-card-menu-wrap.is-open .rixo-tree-card-menu-panel {
    display: block;
}
.rixo-tree-card-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 14px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
}
.rixo-tree-card-menu-item:hover {
    background: #f1f5f9;
}
.rixo-tree-card-menu-item--danger {
    color: #b91c1c;
}
.rixo-tree-card-menu-item--danger:hover {
    background: #fef2f2;
}
.rixo-tree-card--company { width: 270px; }
.rixo-tree-card--auction { width: 240px; }
.rixo-tree-card--stock { width: 240px; }
.rixo-tree-card--inline-editing {
    cursor: default;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    position: relative;
    z-index: 40;
    isolation: isolate;
}
.rixo-tree-card--inline-editing-with-actions {
    flex-wrap: wrap;
    align-items: stretch;
}
.rixo-tree-card-inline-actions {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}
.rixo-tree-card-inline-cancel {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}
.rixo-tree-card-inline-save {
    padding: 6px 14px;
    border: none;
    background: #58B98C;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}
/* Inline "+ Add" for company / auction / stock: compact sizing aligned with card inline edit */
.rixo-tree-inline-add-outer {
    flex-shrink: 0;
    cursor: default;
    position: relative;
    z-index: 40;
    isolation: isolate;
    box-sizing: border-box;
}
.rixo-tree-inline-add-outer--company { width: 270px; }
.rixo-tree-inline-add-outer--auction,
.rixo-tree-inline-add-outer--stock { width: 240px; }
.rixo-tree-inline-add-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 10px;
    padding: 8px 10px;
    box-shadow: 0 1px 5px rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
}
.rixo-tree-inline-add-box:focus-within {
    border-color: #4CC9FF;
    box-shadow: 0 0 0 3px rgba(76, 201, 255, 0.2);
}
.rixo-tree-inline-add-row--inputs {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}
.rixo-tree-inline-add-field-primary {
    flex: 1;
    min-width: 0;
    position: relative;
    z-index: 50;
}
.rixo-tree-inline-add-field-primary.rixo-tree-card-combobox-wrap {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}
.rixo-tree-inline-add-row--inputs > .rixo-tree-inline-add-field-primary:only-child {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
}
.rixo-tree-inline-add-box .rixo-tree-inline-add-field-primary input[type="text"] {
    width: 100% !important;
    box-sizing: border-box !important;
}
.rixo-tree-inline-add-plain input[type="text"] {
    min-height: 34px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    padding: 8px 10px !important;
    border-radius: 8px !important;
    border: 1px solid #d1d5db !important;
}
.rixo-tree-inline-add-plain input[type="text"]:focus {
    outline: none !important;
    border-color: #4CC9FF !important;
    box-shadow: 0 0 0 3px rgba(76, 201, 255, 0.2) !important;
}
.rixo-tree-inline-add-box .rixo-tree-card-combobox-wrap input[type="text"] {
    min-height: 34px !important;
    padding: 8px 40px 8px 10px !important;
}
.rixo-tree-inline-add-row--actions {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin-top: 2px;
}
.rixo-tree-inline-add-box .rixo-tree-card-inline-add-cancel {
    padding: 6px 12px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}
.rixo-tree-inline-add-box .rixo-tree-card-inline-add-cancel:hover {
    background: #f9fafb;
}
.rixo-tree-inline-add-box .rixo-tree-card-inline-add-save {
    padding: 6px 14px;
    border: none;
    background: #58B98C;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
}
.rixo-tree-inline-add-box .rixo-tree-card-inline-add-save:hover {
    filter: brightness(0.95);
}
.rixo-tree-leaf-inline-add-cancel {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #111827;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}
.rixo-tree-leaf-inline-add-cancel:hover {
    background: #f9fafb;
}
.rixo-tree-leaf-inline-add-save {
    padding: 8px 12px;
    border: none;
    background: #58B98C;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}
.rixo-tree-leaf-inline-add-save:hover {
    filter: brightness(0.95);
}
.rixo-tree-leaf-edit--inline-add-stack {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
}
.rixo-tree-leaf-edit--inline-add-stack .rixo-tree-leaf-vtype-wrap {
    flex: 1;
    min-width: 0;
    max-width: none;
}
.rixo-tree-card-combobox-wrap {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    position: relative;
    z-index: 50;
    pointer-events: auto;
}
.rixo-tree-card-combobox-wrap > div[style*="position: relative"] {
    width: 100% !important;
    z-index: 1;
}
/* Editable combobox: input below hit targets (select + ▼); styling matches inline-edit cards */
.rixo-tree-card-combobox-wrap input[type="text"] {
    position: relative;
    z-index: 1 !important;
    border-radius: 8px !important;
    border: 1px solid #d1d5db !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    padding: 8px 40px 8px 10px !important;
    min-height: 36px !important;
    box-sizing: border-box !important;
}
.rixo-tree-card-combobox-wrap select {
    z-index: 12 !important;
}
.rixo-tree-card-combobox-wrap div[id$="Button"] {
    z-index: 13 !important;
    pointer-events: auto !important;
    touch-action: manipulation;
}
.rixo-tree-card-combobox-wrap input[type="text"]:focus {
    outline: none !important;
    border-color: #4CC9FF !important;
    box-shadow: 0 0 0 3px rgba(76,201,255,0.2) !important;
}
.rixo-tree-leaf-vtype-wrap {
    flex: 1;
    min-width: 0;
    max-width: 220px;
    position: relative;
    z-index: 50;
    pointer-events: auto;
}
.rixo-tree-leaf-vtype-wrap > div[style*="position: relative"] {
    width: 100% !important;
    z-index: 1;
}
.rixo-tree-leaf-vtype-wrap input[type="text"] {
    position: relative;
    z-index: 1 !important;
    border-radius: 8px !important;
    border: 1px solid #d1d5db !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    min-height: 34px !important;
    box-sizing: border-box !important;
}
.rixo-tree-leaf-vtype-wrap select {
    z-index: 12 !important;
}
.rixo-tree-leaf-vtype-wrap div[id$="Button"] {
    z-index: 13 !important;
    pointer-events: auto !important;
    touch-action: manipulation;
}
.rixo-tree-leaf-vtype-wrap input[type="text"]:focus {
    outline: none !important;
    border-color: #4CC9FF !important;
    box-shadow: 0 0 0 3px rgba(76,201,255,0.2) !important;
}
.rixo-tree-card:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
    border-color: #cbd5e1;
}
.rixo-tree-card.rixo-tree-card--selected {
    border-color: #6478d7;
    box-shadow: 0 0 0 2px rgba(100, 120, 215, 0.22);
    background: linear-gradient(180deg, #fafbff 0%, #f4f6ff 100%);
}
.rixo-tree-exp-indicator {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex-shrink: 0;
    background: #cbd5e1;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.45);
    transition: background 0.15s ease, box-shadow 0.15s ease;
    font-size: 0;
    line-height: 0;
    overflow: hidden;
}
.rixo-tree-card--selected .rixo-tree-exp-indicator {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.45);
}
.rixo-tree-label {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.35;
    word-break: break-word;
}
.rixo-tree-leaf-wrap {
    min-width: 320px;
    max-width: 580px;
    box-sizing: border-box;
}
.rixo-tree-leaf-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rixo-tree-leaf-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 9px 10px;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}
.rixo-tree-leaf-cells {
    width: 100%;
    min-width: 0;
}
.rixo-tree-leaf-view {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.rixo-tree-leaf-price-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
    max-width: 58%;
}
.rixo-tree-leaf-edit {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.rixo-tree-leaf-row--inline-editing .rixo-tree-leaf-view {
    display: none !important;
}
.rixo-tree-leaf-row--inline-editing .rixo-tree-leaf-edit {
    display: flex !important;
    position: relative;
    z-index: 35;
    isolation: isolate;
}
.rixo-tree-leaf-inline-price {
    width: 104px;
    height: 34px;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    box-sizing: border-box;
}
.rixo-tree-leaf-inline-price:focus {
    outline: none;
    border-color: #4CC9FF;
    box-shadow: 0 0 0 3px rgba(76,201,255,0.2);
}
.rixo-tree-leaf-edit-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 999px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #7dd3fc 0%, #4cc9ff 100%);
    box-shadow: 0 1px 4px rgba(14, 165, 233, 0.45);
    color: #fff;
}
.rixo-tree-leaf-edit-btn:hover {
    filter: brightness(1.05);
}
.rixo-tree-leaf-edit-btn:active {
    transform: scale(0.96);
}
.rixo-tree-leaf-delete-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 999px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #fecaca 0%, #f87171 100%);
    box-shadow: 0 1px 4px rgba(220, 38, 38, 0.35);
    color: #fff;
}
.rixo-tree-leaf-delete-btn:hover {
    filter: brightness(1.06);
}
.rixo-tree-leaf-delete-btn:active {
    transform: scale(0.96);
}
.rixo-tree-leaf-update-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 999px;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 25%, #f8fafc 0%, #cbd5e1 38%, #94a3b8 100%);
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,0.85),
        inset 0 -2px 3px rgba(15, 23, 42, 0.18),
        0 2px 4px rgba(15, 23, 42, 0.2);
    color: #1e3a8a;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
}
.rixo-tree-leaf-update-btn:hover {
    filter: brightness(1.04);
}
.rixo-tree-leaf-update-icon {
    display: block;
    letter-spacing: -0.12em;
    text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.rixo-tree-leaf-row--selectable {
    cursor: pointer;
}
.rixo-tree-leaf-row--selected {
    border-color: #8ea2f2;
    box-shadow: 0 0 0 2px rgba(100, 120, 215, 0.20);
    background: linear-gradient(180deg, #fafbff 0%, #f4f6ff 100%);
}
.rixo-tree-leaf-type {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    min-width: 0;
    flex: 1;
}
.rixo-tree-leaf-price {
    font-size: 13px;
    color: #0f172a;
    text-align: right;
    word-break: break-all;
}
.rixo-tree-note {
    width: 320px;
    background: rgba(255,255,255,0.75);
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: #64748b;
    font-size: 12px;
    padding: 12px;
}
.rixo-tree-add-wrap {
    position: relative;
    margin-top: 10px;
    padding-top: 4px;
    padding-left: 0;
}
.rixo-tree-add-wrap--leaf {
    margin-top: 10px;
    padding-top: 4px;
}
.rixo-tree-col-footer {
    margin-top: 14px;
    padding-top: 8px;
    position: relative;
}
.rixo-tree-children > .rixo-tree-col-footer::before {
    content: "";
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 2px;
    background: linear-gradient(90deg, #94a3b8 0%, #cbd5e1 100%);
    border-radius: 1px;
    z-index: 0;
    pointer-events: none;
}
.rixo-tree-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #111827;
    background: #fff;
    border: 1px solid #7dd3fc;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
}
.rixo-tree-add-btn:hover {
    background: #f8fafc;
    border-color: #38bdf8;
}

    flex: 1;
    min-width: 140px;
}

/* ============================================
   Booking flow — compact layout (≤860px)
   ============================================ */

@media (max-width: 1024px) {
    .booking-columns {
        flex-direction: column;
        gap: 20px;
        min-height: auto;
    }

    .booking-details-section {
        flex: 1 1 auto;
        max-width: none;
        padding-right: 0;
        border-right: none;
    }

    .booking-list-section {
        flex: 1 1 auto;
        max-width: none;
        padding-left: 0;
    }
}

@media (max-width: 860px) {
    .booking-list-section .booking-chassis-table,
    .booking-list-section table.booking-chassis-table {
        display: block;
    }

    .booking-list-section .booking-chassis-table thead {
        display: none;
    }

    .booking-list-section .booking-chassis-table tbody,
    .booking-list-section .booking-chassis-table tr {
        display: block;
    }

    .booking-list-section .booking-chassis-table tr {
        margin-bottom: 12px;
        padding: 12px;
        background: #f9fafb;
        border-radius: 8px;
        border: 1px solid #e5e7eb;
    }

    .booking-list-section .booking-chassis-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 6px 0;
        border: none;
        font-size: 14px;
        white-space: normal;
        min-width: 0;
        max-width: none;
        width: auto;
    }

    .booking-list-section .booking-chassis-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #374151;
        margin-right: 8px;
        flex-shrink: 0;
    }

    .booking-list-section .booking-chassis-table td[data-label=""]::before {
        content: none;
    }

    .booking-list-section .booking-chassis-table td.booking-td-view,
    .booking-list-section .booking-chassis-table td.booking-td-select {
        width: auto;
        max-width: none;
        justify-content: flex-start;
    }

    .booking-list-section .booking-chassis-table tbody td.booking-col-year {
        display: none !important;
    }

    .booking-list-section .booking-chassis-table .purchase-list-cell-chip {
        white-space: normal !important;
        word-break: break-word;
    }

    /* C&F / FOB cars table → cards */
    .cnf-cars-table-wrapper {
        overflow-x: visible;
        border: none;
        box-shadow: none;
    }

    .cnf-cars-table {
        display: block;
    }

    .cnf-cars-table thead {
        display: none;
    }

    .cnf-cars-table tbody {
        display: block;
    }

    .cnf-cars-table tr.cnf-table-row {
        display: block;
        margin-bottom: 12px;
        padding: 12px 14px;
        background: #f8fafc;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
    }

    .cnf-cars-table tr.cnf-table-row td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100% !important;
        border: none;
        padding: 8px 0;
        text-align: left !important;
    }

    .cnf-cars-table tr.cnf-table-row td::before {
        font-weight: 600;
        font-size: 12px;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        flex-shrink: 0;
    }

    .cnf-cars-table tr.cnf-table-row td:nth-child(1)::before { content: "Expand"; }
    .cnf-cars-table tr.cnf-table-row td:nth-child(2)::before { content: "Saved"; }
    .cnf-cars-table tr.cnf-table-row td:nth-child(3)::before { content: "Chassis"; }
    .cnf-cars-table tr.cnf-table-row td:nth-child(4)::before { content: "Car Name"; }
    .cnf-cars-table tr.cnf-table-row td:nth-child(5)::before { content: "Car Price"; }
    .cnf-cars-table tr.cnf-table-row td:nth-child(6)::before { content: "Total"; }
    .cnf-cars-table tr.cnf-table-row td:nth-child(7)::before { content: "Save"; }

    .cnf-cars-table tr.cnf-detail-row {
        display: none;
        margin: -4px 0 16px;
        border: 1px solid #bfdbfe;
        border-radius: 10px;
        background: linear-gradient(to right, #f0f7ff 0%, #ffffff 100%);
    }

    .cnf-cars-table tr.cnf-detail-row.cnf-detail-row--open {
        display: block;
    }

    .cnf-cars-table tr.cnf-detail-row td {
        display: block;
        width: 100% !important;
        padding: 16px;
        border: none;
    }

    .cnf-back-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    /* Freight / shipping charge calculation */
    .freight-price-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .freight-price-row input {
        width: 100% !important;
        max-width: 100%;
    }

    .freight-price-row .operator {
        display: none;
    }

    .freight-price-row label {
        width: 100%;
        white-space: normal;
    }

    .freight-container-row {
        flex-direction: column;
        align-items: stretch;
    }

    .freight-container-row input,
    .freight-container-row select {
        width: 100%;
    }

    .freight-confirm-btn {
        width: 100%;
    }
}

/* C&F detail row visibility (table vs card) */
.cnf-detail-row {
    display: none;
}

@media (min-width: 861px) {
    .cnf-detail-row.cnf-detail-row--open {
        display: table-row;
    }
}

/* ============================================
   Rixo Price Mapping — vertical tree (≤1024px)
   Desktop keeps horizontal L→R flow; tablet/mobile T→B.
   ============================================ */
@media (max-width: 1024px) {
    #rixoMappingPage.rixo-tree-page {
        padding: 12px 12px 24px;
    }

    #rixoMappingPage .rixo-tree-topbar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        margin-bottom: 12px;
    }

    #rixoMappingPage .rixo-tree-title {
        font-size: 20px;
    }

    #rixoMappingPage .rixo-tree-root--mapping {
        overflow-x: visible;
        overflow-y: auto;
        max-height: calc(100vh - 160px);
        -webkit-overflow-scrolling: touch;
        padding: 14px 12px 20px;
    }

    #rixoMappingPage .rixo-tree {
        min-width: 0;
        width: 100%;
        gap: 14px;
    }

    #rixoMappingPage .rixo-tree-headers {
        display: none;
    }

    #rixoMappingPage .rixo-tree-note {
        width: 100%;
        max-width: none;
        box-sizing: border-box;
    }

    /* Stack card above children (top → bottom) */
    #rixoMappingPage .rixo-tree-node {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0;
    }

    #rixoMappingPage .rixo-tree-card-wrapper,
    #rixoMappingPage .rixo-tree-card-wrapper--company,
    #rixoMappingPage .rixo-tree-card-wrapper--auction,
    #rixoMappingPage .rixo-tree-card-wrapper--stock {
        width: 100%;
        max-width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        align-items: center;
        gap: 4px 8px;
    }

    #rixoMappingPage .rixo-tree-card-wrapper[data-card-level]::before {
        grid-column: 1 / -1;
    }

    #rixoMappingPage .rixo-tree-card-wrapper > .rixo-tree-card {
        grid-column: 1;
        grid-row: 2;
        position: relative;
    }

    #rixoMappingPage .rixo-tree-card-wrapper > .rixo-tree-card-menu-wrap {
        grid-column: 2;
        grid-row: 2;
        align-self: center;
    }

    #rixoMappingPage .rixo-tree-card-wrapper[data-card-level="company"]::before {
        content: "Rixo Company";
    }

    #rixoMappingPage .rixo-tree-card-wrapper[data-card-level="auction"]::before {
        content: "Auction House";
    }

    #rixoMappingPage .rixo-tree-card-wrapper[data-card-level="stock"]::before {
        content: "Stock Location";
    }

    #rixoMappingPage .rixo-tree-card-wrapper[data-card-level]::before,
    #rixoMappingPage .rixo-tree-inline-add-outer[data-level]::before {
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #64748b;
        margin-bottom: 4px;
        padding-left: 2px;
    }

    #rixoMappingPage .rixo-tree-inline-add-outer[data-level="company"]::before {
        content: "Rixo Company";
    }

    #rixoMappingPage .rixo-tree-inline-add-outer[data-level="auction"]::before {
        content: "Auction House";
    }

    #rixoMappingPage .rixo-tree-inline-add-outer[data-level="stock"]::before {
        content: "Stock Location";
    }

    #rixoMappingPage .rixo-tree-inline-add-outer--company,
    #rixoMappingPage .rixo-tree-inline-add-outer--auction,
    #rixoMappingPage .rixo-tree-inline-add-outer--stock {
        width: 100%;
        max-width: 100%;
    }

    #rixoMappingPage .rixo-tree-card--company,
    #rixoMappingPage .rixo-tree-card--auction,
    #rixoMappingPage .rixo-tree-card--stock {
        width: 100%;
        max-width: 100%;
        min-height: 48px;
        justify-content: flex-start;
        gap: 10px;
    }

    /* Selected / open branch — light blue chip */
    #rixoMappingPage .rixo-tree-card.rixo-tree-card--selected {
        background: #eff6ff;
        border-color: #3b82f6;
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.28);
    }

    #rixoMappingPage .rixo-tree-leaf-row.rixo-tree-leaf-row--selected {
        background: #eff6ff;
        border-color: #3b82f6;
        box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.28);
    }

    #rixoMappingPage .rixo-tree-card--inline-editing {
        width: 100%;
        max-width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    #rixoMappingPage .rixo-tree-card--inline-editing[data-level="company"]::before {
        content: "Rixo Company";
    }

    #rixoMappingPage .rixo-tree-card--inline-editing[data-level="auction"]::before {
        content: "Auction House";
    }

    #rixoMappingPage .rixo-tree-card--inline-editing[data-level="stock"]::before {
        content: "Stock Location";
    }

    #rixoMappingPage .rixo-tree-card--inline-editing[data-level]::before {
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #64748b;
        margin-bottom: 6px;
    }

    /* Branch column: vertical spine + downward flow */
    #rixoMappingPage .rixo-tree-children {
        margin-left: 14px;
        margin-top: 10px;
        padding-left: 18px;
        padding-top: 4px;
        padding-bottom: 4px;
        border-left: 2px solid #94a3b8;
        width: calc(100% - 14px);
        box-sizing: border-box;
        position: relative;
    }

    #rixoMappingPage .rixo-tree-children::before {
        left: -2px;
        top: -10px;
        width: 2px;
        height: 10px;
        bottom: auto;
        background: #94a3b8;
    }

    /* Connector tick from spine to each child row */
    #rixoMappingPage .rixo-tree-children > .rixo-tree-node::before {
        left: -20px;
        top: 24px;
        width: 18px;
        height: 2px;
        background: linear-gradient(90deg, #94a3b8 0%, #cbd5e1 100%);
    }

    #rixoMappingPage .rixo-tree-children > .rixo-tree-col-footer::before {
        left: -20px;
        top: 22px;
        width: 18px;
        height: 2px;
    }

    /* No extra arrow under chips — expand state shown by left chevron only */
    #rixoMappingPage .rixo-tree-node:has(> .rixo-tree-children) > .rixo-tree-card-wrapper .rixo-tree-card[aria-expanded="true"]::after,
    #rixoMappingPage .rixo-tree-node:has(> .rixo-tree-children) > .rixo-tree-card--inline-editing[aria-expanded="true"]::after {
        content: none;
        display: none;
    }

    /* Blue expand chevron on the left only (company / auction / stock cards) */
    #rixoMappingPage .rixo-tree-card.rixo-tree-card--company .rixo-tree-exp-indicator,
    #rixoMappingPage .rixo-tree-card.rixo-tree-card--auction .rixo-tree-exp-indicator,
    #rixoMappingPage .rixo-tree-card.rixo-tree-card--stock .rixo-tree-exp-indicator {
        order: 0;
        width: auto;
        height: auto;
        min-width: 28px;
        min-height: 28px;
        margin-left: 0;
        margin-right: 4px;
        border-radius: 6px;
        background: transparent;
        box-shadow: none;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        font-weight: 700;
        line-height: 1;
        overflow: visible;
        color: #2563eb;
        flex-shrink: 0;
    }

    #rixoMappingPage .rixo-tree-card.rixo-tree-card--company .rixo-tree-exp-indicator::before,
    #rixoMappingPage .rixo-tree-card.rixo-tree-card--auction .rixo-tree-exp-indicator::before,
    #rixoMappingPage .rixo-tree-card.rixo-tree-card--stock .rixo-tree-exp-indicator::before {
        content: "▼";
    }

    #rixoMappingPage .rixo-tree-card.rixo-tree-card--company[aria-expanded="false"] .rixo-tree-exp-indicator::before,
    #rixoMappingPage .rixo-tree-card.rixo-tree-card--auction[aria-expanded="false"] .rixo-tree-exp-indicator::before,
    #rixoMappingPage .rixo-tree-card.rixo-tree-card--stock[aria-expanded="false"] .rixo-tree-exp-indicator::before {
        content: "▶";
    }

    #rixoMappingPage .rixo-tree-card--selected .rixo-tree-exp-indicator {
        background: rgba(37, 99, 235, 0.12);
        color: #1d4ed8;
        box-shadow: none;
    }

    #rixoMappingPage .rixo-tree-label {
        order: 0;
        flex: 1;
    }

    /* Leaf block */
    #rixoMappingPage .rixo-tree-leaf-wrap {
        min-width: 0;
        max-width: 100%;
        width: 100%;
    }

    #rixoMappingPage .rixo-tree-leaf-wrap::before {
        content: "Supported Vehicle Type · Rixo Price";
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #64748b;
        margin-bottom: 8px;
        padding-left: 2px;
    }

    #rixoMappingPage .rixo-tree-leaf-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 12px;
    }

    #rixoMappingPage .rixo-tree-leaf-view {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    #rixoMappingPage .rixo-tree-leaf-type {
        font-size: 13px;
    }

    #rixoMappingPage .rixo-tree-leaf-price-cell {
        max-width: none;
        width: 100%;
        justify-content: space-between;
    }

    #rixoMappingPage .rixo-tree-leaf-price {
        text-align: left;
    }

    #rixoMappingPage .rixo-tree-leaf-edit--inline-add-stack {
        gap: 12px;
    }

    #rixoMappingPage .rixo-tree-leaf-inline-price {
        width: 100%;
        max-width: none;
    }

    #rixoMappingPage .rixo-tree-add-wrap,
    #rixoMappingPage .rixo-tree-col-footer {
        width: 100%;
        margin-top: 12px;
        padding-left: 0;
    }

    #rixoMappingPage .rixo-tree-add-btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
        font-size: 13px;
    }

    #rixoMappingPage .rixo-tree-card-inline-actions {
        display: flex;
        gap: 8px;
        width: 100%;
        margin-top: 8px;
    }

    #rixoMappingPage .rixo-tree-card-inline-actions button {
        flex: 1;
        min-height: 40px;
    }
}

@media (max-width: 767px) {
    #rixoMappingPage .rixo-tree-root--mapping {
        max-height: calc(100vh - 140px);
        padding: 12px 10px 16px;
    }

    #rixoMappingPage .rixo-tree-title {
        font-size: 18px;
    }

    #rixoMappingPage .rixo-tree-children {
        margin-left: 10px;
        padding-left: 14px;
    }
}

/* Supplier Map tree — reuse Rixo tree layout; mobile labels for 7-level hierarchy */
@media (max-width: 1024px) {
    #supplierMapTreePage .rixo-tree-headers {
        display: none;
    }

    #supplierMapTreePage .rixo-tree {
        min-width: 0;
        width: 100%;
    }

    #supplierMapTreePage .rixo-tree-node {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    #supplierMapTreePage .rixo-tree-card-wrapper,
    #supplierMapTreePage .rixo-tree-card-wrapper--company,
    #supplierMapTreePage .rixo-tree-card-wrapper--venue,
    #supplierMapTreePage .rixo-tree-card-wrapper--stock,
    #supplierMapTreePage .rixo-tree-card-wrapper--pol,
    #supplierMapTreePage .rixo-tree-card-wrapper--field {
        width: 100%;
        max-width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }

    #supplierMapTreePage .rixo-tree-card-wrapper[data-card-level="supplier"]::before { content: "Supplier Name"; }
    #supplierMapTreePage .rixo-tree-card-wrapper[data-card-level="venue"]::before { content: "Venue ID"; }
    #supplierMapTreePage .rixo-tree-card-wrapper[data-card-level="stock"]::before { content: "Stock Location"; }
    #supplierMapTreePage .rixo-tree-card-wrapper[data-card-level="pol"]::before { content: "POL"; }
    #supplierMapTreePage .rixo-tree-card-wrapper[data-card-level="rixo_company"]::before { content: "Rixo Company"; }

    #supplierMapTreePage .rixo-tree-card-wrapper[data-card-level]::before {
        display: block;
        grid-column: 1 / -1;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #64748b;
        margin-bottom: 4px;
    }

    #supplierMapTreePage .rixo-tree-card-wrapper > .rixo-tree-card {
        grid-column: 1;
        grid-row: 2;
        width: 100% !important;
    }

    #supplierMapTreePage .rixo-tree-card-wrapper > .rixo-tree-card-menu-wrap {
        grid-column: 2;
        grid-row: 2;
    }

    #supplierMapTreePage .sm-tree-full-row-add {
        background: #fff;
        border: 1px solid rgba(76, 201, 255, 0.45);
        border-radius: 12px;
        padding: 12px;
        margin-bottom: 14px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #supplierMapTreePage .sm-tree-full-row-add-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        margin-bottom: 0;
        box-shadow: none;
    }

    #supplierMapTreePage .sm-tree-full-row-col::before {
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #64748b;
        margin-bottom: 4px;
    }

    #supplierMapTreePage .sm-tree-full-row-col--supplier::before { content: "Supplier Name"; }
    #supplierMapTreePage .sm-tree-full-row-col--venue::before { content: "Venue ID"; }
    #supplierMapTreePage .sm-tree-full-row-col--stock::before { content: "Stock Location"; }
    #supplierMapTreePage .sm-tree-full-row-col--pol::before { content: "POL"; }
    #supplierMapTreePage .sm-tree-full-row-col--company::before { content: "Rixo Company"; }
    #supplierMapTreePage .sm-tree-full-row-col--vtype::before { content: "Vehicle Type"; }
    #supplierMapTreePage .sm-tree-full-row-col--price::before { content: "Rixo Price"; }

    #supplierMapTreePage .sm-tree-full-row-actions {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        padding-top: 4px;
    }
}

#supplierMapTreePage .rixo-tree-root--supplier-map {
    overflow-x: visible;
    width: 100%;
}

/* Supplier Map PC: shared narrow 7-col system (headers + Add + tree) */
@media (min-width: 1025px) {
    #supplierMapTreePage.rixo-tree-page {
        --sm-col-supplier: minmax(150px, 1.25fr);
        --sm-col-venue: minmax(72px, 0.7fr);
        --sm-col-stock: minmax(110px, 1fr);
        --sm-col-pol: minmax(80px, 0.85fr);
        --sm-col-company: minmax(100px, 1fr);
        --sm-col-vtype: minmax(100px, 1fr);
        --sm-col-price: minmax(80px, 0.85fr);
        --sm-col-gap: 8px;
        --sm-card-supplier: 170px;
        --sm-card-venue: 90px;
        --sm-card-stock: 130px;
        --sm-card-pol: 100px;
        --sm-card-company: 120px;
        max-width: none;
        width: 100%;
        padding: 8px 16px 32px;
        box-sizing: border-box;
    }

    #supplierMapTreePage .rixo-tree-root--supplier-map {
        overflow-x: auto;
        width: 100%;
    }

    #supplierMapTreePage .supplier-map-tree {
        min-width: 0;
        width: 100%;
    }

    #supplierMapTreePage .supplier-map-tree-headers {
        min-width: 0;
        width: 100%;
        display: grid;
        grid-template-columns:
            var(--sm-col-supplier)
            var(--sm-col-venue)
            var(--sm-col-stock)
            var(--sm-col-pol)
            var(--sm-col-company)
            var(--sm-col-vtype)
            var(--sm-col-price);
        gap: var(--sm-col-gap);
        padding-right: 4px;
        box-sizing: border-box;
        align-items: end;
    }

    #supplierMapTreePage .rixo-tree-header {
        font-size: 10px;
        letter-spacing: 0.04em;
        line-height: 1.25;
        overflow: hidden;
        word-break: break-word;
        hyphens: auto;
        padding-left: 0 !important;
        padding-right: 0 !important;
        text-align: left;
    }

    #supplierMapTreePage .rixo-tree-header:nth-child(1) {
        padding-left: 8px !important;
    }

    #supplierMapTreePage .rixo-tree-header:nth-child(7).rixo-tree-header--price {
        text-align: right;
        padding-right: 4px !important;
    }

    /* Tighter nest chrome — layout alignment comes from subgrid, not indent */
    #supplierMapTreePage .rixo-tree-node {
        gap: 0;
    }

    /* Collapsed + expanded tree: same 7-col grid as headers (subgrid keeps cards under columns) */
    #supplierMapTreePage .supplier-map-tree > .rixo-tree-node {
        display: grid;
        grid-template-columns:
            var(--sm-col-supplier)
            var(--sm-col-venue)
            var(--sm-col-stock)
            var(--sm-col-pol)
            var(--sm-col-company)
            var(--sm-col-vtype)
            var(--sm-col-price);
        column-gap: var(--sm-col-gap);
        row-gap: 8px;
        align-items: start;
        width: 100%;
        max-width: 100%;
        flex: none;
        min-width: 0;
        box-sizing: border-box;
    }

    #supplierMapTreePage .supplier-map-tree > .rixo-tree-node > .rixo-tree-card-wrapper {
        grid-column: 1;
        width: auto !important;
        max-width: none !important;
        flex: none !important;
        min-width: 0;
    }

    #supplierMapTreePage .supplier-map-tree > .rixo-tree-node > .rixo-tree-children {
        grid-column: 2 / -1;
        display: grid;
        grid-template-columns: subgrid;
        margin: 0;
        padding: 0 0 6px;
        gap: 10px;
        min-width: 0;
        flex: none;
        max-width: none;
        position: relative;
        box-sizing: border-box;
    }

    #supplierMapTreePage .supplier-map-tree > .rixo-tree-col-footer {
        width: auto;
        max-width: none;
        justify-self: start;
    }

    /* Nested nodes inherit remaining columns via subgrid */
    #supplierMapTreePage .rixo-tree-children > .rixo-tree-node {
        display: grid;
        grid-template-columns: subgrid;
        grid-column: 1 / -1;
        column-gap: var(--sm-col-gap);
        row-gap: 8px;
        align-items: start;
        width: auto;
        min-width: 0;
        box-sizing: border-box;
    }

    #supplierMapTreePage .rixo-tree-children > .rixo-tree-node > .rixo-tree-card-wrapper {
        grid-column: 1;
        width: auto !important;
        max-width: none !important;
        flex: none !important;
        min-width: 0;
    }

    #supplierMapTreePage .rixo-tree-children > .rixo-tree-node > .rixo-tree-children {
        grid-column: 2 / -1;
        display: grid;
        grid-template-columns: subgrid;
        margin: 0;
        padding: 0 0 6px;
        gap: 10px;
        min-width: 0;
        flex: none;
        max-width: none;
        position: relative;
        box-sizing: border-box;
    }

    #supplierMapTreePage .rixo-tree-children > .rixo-tree-col-footer,
    #supplierMapTreePage .rixo-tree-children > .rixo-tree-node > .rixo-tree-inline-add-outer,
    #supplierMapTreePage .rixo-tree-children > .rixo-tree-inline-add-outer {
        grid-column: 1;
        width: auto;
        max-width: none;
        min-width: 0;
    }

    /* Connectors: decorative only — do not push columns */
    #supplierMapTreePage .rixo-tree-children::before {
        left: -6px;
        top: 4px;
        bottom: 4px;
        opacity: 0.7;
    }

    #supplierMapTreePage .rixo-tree-children > .rixo-tree-node::before {
        left: -6px;
        width: 6px;
        top: 18px;
    }

    #supplierMapTreePage .rixo-tree-children > .rixo-tree-col-footer::before {
        left: -6px;
        width: 6px;
    }

    /* Cards fill their grid track (header-aligned widths) */
    #supplierMapTreePage .rixo-tree-card-wrapper {
        flex-shrink: 0;
        flex-grow: 0;
        min-width: 0;
        box-sizing: border-box;
        width: auto;
        max-width: none;
    }

    #supplierMapTreePage .rixo-tree-card-wrapper--company,
    #supplierMapTreePage .rixo-tree-card-wrapper--venue,
    #supplierMapTreePage .rixo-tree-card-wrapper--stock,
    #supplierMapTreePage .rixo-tree-card-wrapper--pol,
    #supplierMapTreePage .rixo-tree-card-wrapper--field {
        width: auto !important;
        max-width: none !important;
        flex: none !important;
    }

    #supplierMapTreePage .rixo-tree-card--company,
    #supplierMapTreePage .rixo-tree-card--auction,
    #supplierMapTreePage .rixo-tree-card--stock {
        width: 100% !important;
        min-width: 0;
        padding: 5px 6px;
        min-height: 36px;
        gap: 6px;
    }

    #supplierMapTreePage .rixo-tree-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
        font-size: 12px;
    }

    /* Leaf: one card across Vehicle + Price (no nested subgrid) */
    #supplierMapTreePage .rixo-tree-leaf-wrap {
        grid-column: 1 / -1;
        display: block;
        width: 100%;
        min-width: 0;
        max-width: none;
        flex: none;
        box-sizing: border-box;
    }

    #supplierMapTreePage .rixo-tree-leaf-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-width: 0;
        width: 100%;
    }

    #supplierMapTreePage .rixo-tree-leaf-row {
        display: block;
        width: 100%;
        box-sizing: border-box;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 8px 10px;
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
        gap: 0;
    }

    #supplierMapTreePage .rixo-tree-leaf-row--selected {
        border-color: #4CC9FF;
        box-shadow: 0 0 0 2px rgba(76, 201, 255, 0.25);
    }

    #supplierMapTreePage .rixo-tree-leaf-cells {
        display: block;
        width: 100%;
        min-width: 0;
    }

    #supplierMapTreePage .rixo-tree-leaf-view {
        display: grid;
        grid-template-columns: 1fr 0.85fr;
        column-gap: var(--sm-col-gap);
        align-items: center;
        width: 100%;
        min-width: 0;
    }

    #supplierMapTreePage .rixo-tree-leaf-type {
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
        background: none;
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    #supplierMapTreePage .rixo-tree-leaf-price-cell {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
        max-width: none;
        flex-shrink: 0;
        min-width: 0;
        background: none;
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    #supplierMapTreePage .rixo-tree-leaf-price {
        font-size: 12px;
        white-space: nowrap;
    }

    #supplierMapTreePage .rixo-tree-leaf-edit {
        display: none;
    }

    #supplierMapTreePage .rixo-tree-leaf-row--inline-editing .rixo-tree-leaf-view {
        display: none;
    }

    #supplierMapTreePage .rixo-tree-leaf-row--inline-editing .rixo-tree-leaf-edit {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    #supplierMapTreePage .rixo-tree-col-footer,
    #supplierMapTreePage .rixo-tree-add-wrap {
        flex-shrink: 0;
        min-width: 0;
    }

    #supplierMapTreePage .rixo-tree-add-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    #supplierMapTreePage .rixo-tree-children > .rixo-tree-add-wrap--leaf {
        grid-column: 1 / -1;
    }

    /* Full-row Add: 7 fields one row; Cancel/Save under */
    #supplierMapTreePage .sm-tree-full-row-add {
        margin: 8px 0 14px;
        width: 100%;
        box-sizing: border-box;
        background: #fff;
        border: 1px solid rgba(76, 201, 255, 0.45);
        border-radius: 12px;
        padding: 10px 12px;
        box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08);
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #supplierMapTreePage .sm-tree-full-row-add-grid {
        display: grid;
        grid-template-columns:
            var(--sm-col-supplier)
            var(--sm-col-venue)
            var(--sm-col-stock)
            var(--sm-col-pol)
            var(--sm-col-company)
            var(--sm-col-vtype)
            var(--sm-col-price);
        gap: var(--sm-col-gap);
        align-items: center;
        width: 100%;
        box-sizing: border-box;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    #supplierMapTreePage .sm-tree-full-row-col {
        min-width: 0;
    }

    #supplierMapTreePage .sm-tree-full-row-col .rixo-tree-card-combobox-wrap,
    #supplierMapTreePage .sm-tree-full-row-col > div {
        width: 100%;
        min-width: 0;
    }

    #supplierMapTreePage .sm-tree-full-row-col input[type="text"] {
        font-size: 12px !important;
        min-height: 32px !important;
        padding: 6px 8px !important;
    }

    #supplierMapTreePage .sm-tree-full-row-col .rixo-tree-card-combobox-wrap input[type="text"] {
        padding-right: 32px !important;
    }

    #supplierMapTreePage .sm-full-row-price-input {
        width: 100%;
        box-sizing: border-box;
        min-height: 32px;
        padding: 6px 8px;
        border: 1px solid #d1d5db;
        border-radius: 8px;
        font-size: 12px;
        font-weight: 600;
    }

    #supplierMapTreePage .sm-tree-full-row-actions {
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 8px;
        width: 100%;
        flex-shrink: 0;
    }

    #supplierMapTreePage .sm-full-row-add-cancel {
        border: 1px solid #cbd5e1;
        background: #fff;
        color: #475569;
        border-radius: 8px;
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
    }

    #supplierMapTreePage .sm-full-row-add-save {
        padding: 8px 14px;
        font-size: 12px;
    }
}

.rixo-price-map-tree-headers {
    min-width: 1280px;
}

/* Rixo Price Map tree — 5-col company → stock → supplier → vehicle + price */
@media (max-width: 1024px) {
    #rixoPriceMapTreePage .rixo-tree-headers {
        display: none;
    }

    #rixoPriceMapTreePage .rixo-tree {
        min-width: 0;
        width: 100%;
    }

    #rixoPriceMapTreePage .rixo-tree-node {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    #rixoPriceMapTreePage .rixo-tree-card-wrapper,
    #rixoPriceMapTreePage .rixo-tree-card-wrapper--company,
    #rixoPriceMapTreePage .rixo-tree-card-wrapper--stock,
    #rixoPriceMapTreePage .rixo-tree-card-wrapper--field {
        width: 100%;
        max-width: 100%;
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }

    #rixoPriceMapTreePage .rixo-tree-card-wrapper[data-card-level="rixo_company"]::before { content: "Rixo Company"; }
    #rixoPriceMapTreePage .rixo-tree-card-wrapper[data-card-level="stock"]::before { content: "Stock Location"; }
    #rixoPriceMapTreePage .rixo-tree-card-wrapper[data-card-level="supplier"]::before { content: "Supplier Name"; }

    #rixoPriceMapTreePage .rixo-tree-card-wrapper[data-card-level]::before {
        display: block;
        grid-column: 1 / -1;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #64748b;
        margin-bottom: 4px;
    }

    #rixoPriceMapTreePage .rixo-tree-card-wrapper > .rixo-tree-card {
        grid-column: 1;
        grid-row: 2;
        width: 100% !important;
    }

    #rixoPriceMapTreePage .rixo-tree-card-wrapper > .rixo-tree-card-menu-wrap {
        grid-column: 2;
        grid-row: 2;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-add {
        background: #fff;
        border: 1px solid rgba(76, 201, 255, 0.45);
        border-radius: 12px;
        padding: 12px;
        margin-bottom: 14px;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-add-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        margin-bottom: 0;
        box-shadow: none;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-col::before {
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #64748b;
        margin-bottom: 4px;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-col--company::before { content: "Rixo Company"; }
    #rixoPriceMapTreePage .rpm-tree-full-row-col--stock::before { content: "Stock Location"; }
    #rixoPriceMapTreePage .rpm-tree-full-row-col--supplier::before { content: "Supplier Name"; }
    #rixoPriceMapTreePage .rpm-tree-full-row-col--vtype::before { content: "Vehicle Type"; }
    #rixoPriceMapTreePage .rpm-tree-full-row-col--price::before { content: "Rixo Price"; }

    #rixoPriceMapTreePage .rpm-tree-full-row-actions {
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        gap: 8px;
        width: 100%;
    }
}

#rixoPriceMapTreePage .rixo-tree-root--rixo-price-map {
    overflow-x: visible;
    width: 100%;
}

@media (min-width: 1025px) {
    #rixoPriceMapTreePage.rixo-tree-page {
        --rpm-col-company: minmax(110px, 1.1fr);
        --rpm-col-stock: minmax(100px, 1fr);
        --rpm-col-supplier: minmax(110px, 1.1fr);
        --rpm-col-vtype: minmax(100px, 1fr);
        --rpm-col-price: minmax(80px, 0.85fr);
        --rpm-col-gap: 8px;
        --rpm-card-company: 140px;
        --rpm-card-stock: 120px;
        max-width: none;
        width: 100%;
        padding: 8px 16px 32px;
        box-sizing: border-box;
    }

    #rixoPriceMapTreePage .rixo-tree-root--rixo-price-map {
        overflow-x: auto;
        width: 100%;
    }

    #rixoPriceMapTreePage .rixo-price-map-tree {
        min-width: 0;
        width: 100%;
    }

    #rixoPriceMapTreePage .rixo-price-map-tree-headers {
        min-width: 0;
        width: 100%;
        display: grid;
        grid-template-columns:
            var(--rpm-col-company)
            var(--rpm-col-stock)
            var(--rpm-col-supplier)
            var(--rpm-col-vtype)
            var(--rpm-col-price);
        gap: var(--rpm-col-gap);
        padding-right: 4px;
        box-sizing: border-box;
        align-items: end;
    }

    #rixoPriceMapTreePage .rixo-tree-header {
        font-size: 10px;
        letter-spacing: 0.04em;
        line-height: 1.25;
        overflow: hidden;
        word-break: break-word;
        hyphens: auto;
        padding-left: 0 !important;
        padding-right: 0 !important;
        text-align: left;
    }

    #rixoPriceMapTreePage .rixo-tree-header:nth-child(1) {
        padding-left: 8px !important;
    }

    #rixoPriceMapTreePage .rixo-tree-header:nth-child(5).rixo-tree-header--price {
        text-align: right;
        padding-right: 4px !important;
    }

    #rixoPriceMapTreePage .rixo-tree-node {
        gap: 0;
    }

    #rixoPriceMapTreePage .rixo-price-map-tree > .rixo-tree-node {
        display: grid;
        grid-template-columns:
            var(--rpm-col-company)
            var(--rpm-col-stock)
            var(--rpm-col-supplier)
            var(--rpm-col-vtype)
            var(--rpm-col-price);
        column-gap: var(--rpm-col-gap);
        row-gap: 8px;
        align-items: start;
        width: 100%;
        max-width: 100%;
        flex: none;
        min-width: 0;
        box-sizing: border-box;
    }

    #rixoPriceMapTreePage .rixo-price-map-tree > .rixo-tree-node > .rixo-tree-card-wrapper {
        grid-column: 1;
        width: auto !important;
        max-width: none !important;
        flex: none !important;
        min-width: 0;
    }

    #rixoPriceMapTreePage .rixo-price-map-tree > .rixo-tree-node > .rixo-tree-children {
        grid-column: 2 / -1;
        display: grid;
        grid-template-columns: subgrid;
        margin: 0;
        padding: 0 0 6px;
        gap: 10px;
        min-width: 0;
        flex: none;
        max-width: none;
        position: relative;
        box-sizing: border-box;
    }

    #rixoPriceMapTreePage .rixo-price-map-tree > .rixo-tree-col-footer {
        width: auto;
        max-width: none;
        justify-self: start;
    }

    #rixoPriceMapTreePage .rixo-tree-children > .rixo-tree-node {
        display: grid;
        grid-template-columns: subgrid;
        grid-column: 1 / -1;
        column-gap: var(--rpm-col-gap);
        row-gap: 8px;
        align-items: start;
        width: auto;
        min-width: 0;
        box-sizing: border-box;
    }

    #rixoPriceMapTreePage .rixo-tree-children > .rixo-tree-node > .rixo-tree-card-wrapper {
        grid-column: 1;
        width: auto !important;
        max-width: none !important;
        flex: none !important;
        min-width: 0;
    }

    #rixoPriceMapTreePage .rixo-tree-children > .rixo-tree-node > .rixo-tree-children {
        grid-column: 2 / -1;
        display: grid;
        grid-template-columns: subgrid;
        margin: 0;
        padding: 0 0 6px;
        gap: 10px;
        min-width: 0;
        flex: none;
        max-width: none;
        position: relative;
        box-sizing: border-box;
    }

    #rixoPriceMapTreePage .rixo-tree-children > .rixo-tree-col-footer,
    #rixoPriceMapTreePage .rixo-tree-children > .rixo-tree-node > .rixo-tree-inline-add-outer,
    #rixoPriceMapTreePage .rixo-tree-children > .rixo-tree-inline-add-outer {
        grid-column: 1;
        width: auto;
        max-width: none;
        min-width: 0;
    }

    #rixoPriceMapTreePage .rixo-tree-children::before {
        left: -6px;
        top: 4px;
        bottom: 4px;
        opacity: 0.7;
    }

    #rixoPriceMapTreePage .rixo-tree-children > .rixo-tree-node::before {
        left: -6px;
        width: 6px;
        top: 18px;
    }

    #rixoPriceMapTreePage .rixo-tree-children > .rixo-tree-col-footer::before {
        left: -6px;
        width: 6px;
    }

    #rixoPriceMapTreePage .rixo-tree-card-wrapper {
        flex-shrink: 0;
        flex-grow: 0;
        min-width: 0;
        box-sizing: border-box;
        width: auto;
        max-width: none;
    }

    #rixoPriceMapTreePage .rixo-tree-card-wrapper--company,
    #rixoPriceMapTreePage .rixo-tree-card-wrapper--stock,
    #rixoPriceMapTreePage .rixo-tree-card-wrapper--field {
        width: auto !important;
        max-width: none !important;
        flex: none !important;
    }

    #rixoPriceMapTreePage .rixo-tree-card--company,
    #rixoPriceMapTreePage .rixo-tree-card--stock {
        width: 100% !important;
        min-width: 0;
        padding: 5px 6px;
        min-height: 36px;
        gap: 6px;
    }

    #rixoPriceMapTreePage .rixo-tree-label {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
        font-size: 12px;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-wrap {
        grid-column: 1 / -1;
        display: block;
        width: 100%;
        min-width: 0;
        max-width: none;
        flex: none;
        box-sizing: border-box;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-width: 0;
        width: 100%;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-row {
        display: block;
        width: 100%;
        box-sizing: border-box;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        padding: 8px 10px;
        box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
        gap: 0;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-row--selected {
        border-color: #4CC9FF;
        box-shadow: 0 0 0 2px rgba(76, 201, 255, 0.25);
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-cells {
        display: block;
        width: 100%;
        min-width: 0;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-view {
        display: grid;
        grid-template-columns: 1fr 0.85fr;
        column-gap: var(--rpm-col-gap);
        align-items: center;
        width: 100%;
        min-width: 0;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-type {
        font-size: 12px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
        background: none;
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-price-cell {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
        max-width: none;
        flex-shrink: 0;
        min-width: 0;
        background: none;
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-price {
        font-size: 12px;
        white-space: nowrap;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-edit {
        display: none;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-row--inline-editing .rixo-tree-leaf-view {
        display: none;
    }

    #rixoPriceMapTreePage .rixo-tree-leaf-row--inline-editing .rixo-tree-leaf-edit {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        width: 100%;
        box-sizing: border-box;
    }

    #rixoPriceMapTreePage .rixo-tree-col-footer,
    #rixoPriceMapTreePage .rixo-tree-add-wrap {
        flex-shrink: 0;
        min-width: 0;
    }

    #rixoPriceMapTreePage .rixo-tree-add-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    #rixoPriceMapTreePage .rixo-tree-children > .rixo-tree-add-wrap--leaf {
        grid-column: 1 / -1;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-add {
        margin: 8px 0 14px;
        width: 100%;
        box-sizing: border-box;
        background: #fff;
        border: 1px solid rgba(76, 201, 255, 0.45);
        border-radius: 12px;
        padding: 10px 12px;
        box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08);
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-add-grid {
        display: grid;
        grid-template-columns:
            var(--rpm-col-company)
            var(--rpm-col-stock)
            var(--rpm-col-supplier)
            var(--rpm-col-vtype)
            var(--rpm-col-price);
        gap: var(--rpm-col-gap);
        align-items: center;
        width: 100%;
        box-sizing: border-box;
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-col {
        min-width: 0;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-col .rixo-tree-card-combobox-wrap,
    #rixoPriceMapTreePage .rpm-tree-full-row-col > div {
        width: 100%;
        min-width: 0;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-col input[type="text"] {
        font-size: 12px !important;
        min-height: 32px !important;
        padding: 6px 8px !important;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-col .rixo-tree-card-combobox-wrap input[type="text"] {
        padding-right: 32px !important;
    }

    #rixoPriceMapTreePage .rpm-full-row-price-input {
        width: 100%;
        box-sizing: border-box;
        min-height: 32px;
        padding: 6px 8px;
        border: 1px solid #d1d5db;
        border-radius: 8px;
        font-size: 12px;
        font-weight: 600;
    }

    #rixoPriceMapTreePage .rpm-tree-full-row-actions {
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        gap: 8px;
        width: 100%;
        flex-shrink: 0;
    }

    #rixoPriceMapTreePage .rpm-full-row-add-cancel {
        border: 1px solid #cbd5e1;
        background: #fff;
        color: #475569;
        border-radius: 8px;
        padding: 8px 12px;
        font-size: 12px;
        font-weight: 600;
        cursor: pointer;
    }

    #rixoPriceMapTreePage .rpm-full-row-add-save {
        padding: 8px 14px;
        font-size: 12px;
    }
}

/* ==========================================================================
   Home operations dashboard
   ========================================================================== */

.home-dash {
    --home-dash-bg: #f1f5f9;
    --home-dash-card: #ffffff;
    --home-dash-border: #e2e8f0;
    --home-dash-text: #0f172a;
    --home-dash-muted: #64748b;
    --home-dash-accent: #2563eb;
    --home-dash-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
    padding: 20px 24px 40px;
    max-width: 1400px;
    margin: 0 auto;
    color: var(--home-dash-text);
}

.home-dash-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.home-dash-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--home-dash-text);
}

.home-dash-subtitle {
    margin: 6px 0 0;
    font-size: 14px;
    color: var(--home-dash-muted);
}

.home-dash-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.home-dash-period-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--home-dash-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.home-dash-select,
.home-dash-date {
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--home-dash-border);
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    color: var(--home-dash-text);
}

.home-dash-custom-range {
    display: flex;
    align-items: center;
    gap: 6px;
}

.home-dash-custom-range[hidden] {
    display: none !important;
}

.home-dash-range-sep {
    color: var(--home-dash-muted);
}

.home-dash-btn {
    min-height: 36px;
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.home-dash-btn-secondary {
    background: #fff;
    border-color: var(--home-dash-border);
    color: #334155;
}

.home-dash-btn-secondary:hover {
    background: #f8fafc;
}

.home-dash-status {
    padding: 24px;
    text-align: center;
    color: var(--home-dash-muted);
    font-size: 14px;
}

.home-dash-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--home-dash-muted);
}

.home-dash-meta-sep {
    opacity: 0.5;
}

.home-dash-section {
    margin-bottom: 20px;
}

.home-dash-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.home-dash-kpi {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 16px 16px 14px;
    background: var(--home-dash-card);
    border: 1px solid var(--home-dash-border);
    border-radius: 12px;
    box-shadow: var(--home-dash-shadow);
    text-align: left;
    cursor: default;
}

.home-dash-kpi:hover {
    border-color: var(--home-dash-border);
    transform: none;
}

.home-dash-kpi-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eff6ff;
    color: var(--home-dash-accent);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 4px;
}

.home-dash-kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--home-dash-muted);
}

.home-dash-kpi-value {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--home-dash-text);
    line-height: 1.2;
}

.home-dash-kpi-cta {
    margin-top: 4px;
    padding: 0;
    border: none;
    background: none;
    color: #059669;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
}

.home-dash-kpi-cta:hover {
    text-decoration: underline;
}

.home-dash-charts-primary {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}

.home-dash-delta {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

.home-dash-delta-up { color: #059669; }
.home-dash-delta-down { color: #dc2626; }
.home-dash-delta-flat { color: var(--home-dash-muted); }

.home-dash-card {
    background: var(--home-dash-card);
    border: 1px solid var(--home-dash-border);
    border-radius: 12px;
    box-shadow: var(--home-dash-shadow);
    padding: 16px 18px 18px;
}

.home-dash-card-head {
    margin-bottom: 12px;
}

.home-dash-card-head-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.home-dash-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--home-dash-text);
}

.home-dash-card-hint {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--home-dash-muted);
}

.home-dash-workflow {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
}

.home-dash-workflow-stage {
    flex: 1 1 120px;
    min-width: 110px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--home-dash-border);
    background: #f8fafc;
    cursor: default;
    text-align: left;
}

.home-dash-workflow-stage:hover {
    border-color: var(--home-dash-border);
}

.home-dash-workflow-arrow {
    align-self: center;
    color: #94a3b8;
    font-size: 16px;
    padding: 0 2px;
}

.home-dash-wf-count {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.home-dash-wf-label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.home-dash-wf-pct {
    font-size: 11px;
    color: var(--home-dash-muted);
}

.home-dash-wf-purchased { border-left: 3px solid #64748b; }
.home-dash-wf-rixo_requested { border-left: 3px solid #d97706; }
.home-dash-wf-rixo_confirmed { border-left: 3px solid #0f766e; }
.home-dash-wf-booking_requested { border-left: 3px solid #2563eb; }
.home-dash-wf-invoice_confirmed { border-left: 3px solid #059669; }

.home-dash-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.home-dash-chart-body {
    min-height: 140px;
}

.home-dash-svg {
    width: 100%;
    height: auto;
    display: block;
}

.home-dash-chart-axis {
    fill: #94a3b8;
    font-size: 9px;
}

.home-dash-donut {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.home-dash-donut-svg {
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.home-dash-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12px;
    color: #334155;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.home-dash-legend-swatch {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    margin-right: 6px;
}

.home-dash-hbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.home-dash-hbar-row {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) minmax(48px, auto);
    gap: 8px;
    align-items: center;
}

.home-dash-hbar-label {
    font-size: 12px;
    color: #334155;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-dash-hbar-track {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.home-dash-hbar-fill {
    height: 100%;
    border-radius: 999px;
}

.home-dash-hbar-value {
    font-size: 12px;
    font-weight: 600;
    text-align: right;
    color: #0f172a;
}

.home-dash-split {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 12px;
}

.home-dash-alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.home-dash-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--home-dash-border);
    background: #f8fafc;
    cursor: pointer;
    text-align: left;
}

.home-dash-alert:hover {
    border-color: #cbd5e1;
}

.home-dash-alert-count {
    min-width: 36px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
}

.home-dash-alert-msg {
    font-size: 13px;
    color: #334155;
}

.home-dash-alert-info .home-dash-alert-count { background: #dbeafe; color: #1d4ed8; }
.home-dash-alert-warning .home-dash-alert-count { background: #ffedd5; color: #c2410c; }
.home-dash-alert-critical .home-dash-alert-count { background: #fee2e2; color: #b91c1c; }

.home-dash-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.home-dash-action {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--home-dash-border);
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
}

.home-dash-action:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.home-dash-tables {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.home-dash-tables-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.home-dash-analytics {
    background: var(--home-dash-card);
    border: 1px solid var(--home-dash-border);
    border-radius: 12px;
    box-shadow: var(--home-dash-shadow);
    padding: 16px 18px 18px;
}

.home-dash-analytics-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--home-dash-text);
}

.home-dash-analytics-grid {
    margin-top: 4px;
}

.home-dash-link-btn {
    border: none;
    background: none;
    color: var(--home-dash-accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.home-dash-link-btn:hover {
    text-decoration: underline;
}

.home-dash-table-wrap {
    overflow-x: auto;
}

.home-dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.home-dash-table th {
    text-align: left;
    padding: 8px 6px;
    color: var(--home-dash-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--home-dash-border);
    white-space: nowrap;
}

.home-dash-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    vertical-align: top;
}

.home-dash-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 11px;
}

.home-dash-status-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.home-dash-empty,
.home-dash-empty-cell {
    color: var(--home-dash-muted);
    font-size: 13px;
    text-align: center;
    padding: 16px 8px;
}

@media (max-width: 1100px) {
    .home-dash-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .home-dash-charts,
    .home-dash-charts-primary,
    .home-dash-tables,
    .home-dash-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .home-dash {
        padding: 14px 12px 28px;
    }
    .home-dash-title {
        font-size: 22px;
    }
    .home-dash-kpi-grid {
        grid-template-columns: 1fr;
    }
    .home-dash-workflow-arrow {
        display: none;
    }
}
