:root {
    --primary-color: #007AFF;
    --secondary-color: #5856D6;
    --success-color: #34C759;
    --danger-color: #FF3B30;
    --warning-color: #FF9500;
    --info-color: #5AC8FA;
    --bg-color: #F5F5F7;
    --card-bg: #FFFFFF;
    --text-main: #1D1D1F;
    --text-muted: #86868B;
    --border-color: #D2D2D7;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 10px 30px rgba(0,0,0,0.06);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Glassmorphism & Cards */
.premium-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    padding: 2rem;
}

.premium-card:hover {
    box-shadow: 0 15px 40px rgba(0,0,0,0.08);
}

/* Headers */
.page-header {
    margin-bottom: 3rem;
    text-align: center;
}

.page-header h1 {
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
    border-radius: var(--radius-md);
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    transition: var(--transition);
    border: none;
}

.btn-primary { background-color: var(--primary-color); }
.btn-primary:hover { background-color: #0066CC; transform: translateY(-1px); }

.btn-success { background-color: var(--success-color); }
.btn-danger { background-color: var(--danger-color); }
.btn-danger:hover { background-color: #DF3324; transform: translateY(-1px); }
.btn-secondary { background-color: var(--secondary-color); color: white; }
.btn-secondary:hover { background-color: #4342B5; transform: translateY(-1px); }
.btn-warning { background-color: var(--warning-color); color: white; }

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

/* Tables */
.table-responsive {
    border-radius: var(--radius-md);
    overflow-x: auto;
    overflow-y: visible;
    background: white;
    box-shadow: var(--shadow-sm);
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #FBFBFD;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.4px;
    padding: 0.75rem 0.6rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 0.6rem;
    vertical-align: middle;
    border-bottom: 1px solid #F2F2F7;
    font-size: 0.82rem;
}

.table-row-sold, 
.table-row-sold td {
    background-color: #D1D1D6 !important;
}

.table-row-sold td {
    color: var(--text-main); /* Keep text readable */
}

/* Badges */
.badge {
    padding: 0.5em 1em;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.8rem;
}

.badge-ordered { background-color: #EBF5FF; color: #007AFF; }
.badge-not-ordered { background-color: #F2F2F7; color: #86868B; }
.badge-sold { background-color: #E8F9EE; color: #34C759; }

/* Forms */
.form-control, .form-select {
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    transition: var(--transition);
    background-color: #FBFBFD;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1);
    background-color: white;
}

.form-label {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

/* Search Bar */
.search-container {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

/* Navbar/Back Button */
.nav-link-back {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.nav-link-back:hover {
    color: var(--primary-color);
}

.nav-link-back i {
    margin-right: 0.5rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding-top: 1rem !important;
        padding-bottom: 2rem !important;
        background-color: #F8F9FA !important; /* Soft premium off-white page background */
    }

    .premium-card {
        padding: 1rem !important;
        border-radius: 16px !important;
        background: transparent !important; /* Let body background flow */
        border: none !important;
        box-shadow: none !important;
    }

    .page-header {
        margin-bottom: 1.5rem !important;
    }

    .page-header h1 {
        font-size: 1.5rem !important;
        color: #1C1C1E !important;
    }

    .search-container {
        padding: 1rem !important;
        border-radius: 12px !important;
        margin-bottom: 1.5rem !important;
        background: #FFFFFF !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02) !important;
    }

    /* Stack buttons on mobile — but NOT inside forms or specific inline rows */
    .d-flex.gap-2:not(.order-form-actions):not(.receipt-row):not(.horizontal-actions):not([class*="justify-content-"]),
    .d-flex.gap-3:not(.order-form-actions):not(.receipt-row):not(.horizontal-actions):not([class*="justify-content-"]) {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Order form card: keep white background on mobile (not transparent like table) */
    #orderFormContainer.premium-card,
    #formCard.premium-card {
        background: #ffffff !important;
        border: 1px solid rgba(0, 0, 0, 0.07) !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05) !important;
        padding: 1rem 0.85rem !important;
        border-radius: 16px !important;
    }

    /* Form action buttons stay side-by-side on mobile */
    .order-form-actions {
        flex-direction: row !important;
    }

    .order-form-actions .btn {
        width: auto !important;
        flex: 1 !important;
        margin-bottom: 0 !important;
    }

    /* Compact form labels on mobile — both forms */
    #orderFormContainer .form-label,
    #formCard .form-label {
        font-size: 0.72rem !important;
        margin-bottom: 0.15rem !important;
        font-weight: 600 !important;
    }

    /* Compact inputs on mobile — both forms */
    #orderFormContainer .form-control,
    #orderFormContainer .form-select,
    #formCard .form-control,
    #formCard .form-select {
        font-size: 0.78rem !important;
        padding: 0.35rem 0.5rem !important;
    }

    /* Compact input-group-text on mobile — both forms */
    #orderFormContainer .input-group-text,
    #formCard .input-group-text {
        font-size: 0.78rem !important;
        padding: 0.35rem 0.45rem !important;
    }

    /* Compact Remaining Balance box on mobile */
    #balanceBox {
        padding: 0.35rem 0.7rem !important;
    }

    #balanceBox .form-label {
        font-size: 0.68rem !important;
        margin-bottom: 0 !important;
    }

    #balanceBox .h5 {
        font-size: 0.9rem !important;
    }

    /* Keep search & filter buttons inline on mobile for clean space utilization! */
    .responsive-btns {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
        width: 100% !important;
        margin-top: 15px !important;
    }

    .responsive-btns .btn {
        width: auto !important;
        flex: 1 !important;
        margin-bottom: 0 !important;
        height: 38px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .d-flex.justify-content-between:not(.form-card-header) {
        flex-direction: column;
        align-items: stretch !important;
    }

    .d-flex.justify-content-between:not(.form-card-header) > * {
        margin-bottom: 1rem;
    }

    /* Form card header: always keep title + close button in a horizontal row */
    .form-card-header {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        margin-bottom: 0.5rem !important;
    }

    .form-card-header > * {
        margin-bottom: 0 !important;
    }

    /* High-End Mobile 5-Column Grid Card Layout for Tables */
    .table-responsive {
        border: none !important;
        background: transparent !important;
        overflow: visible !important;
    }

    .table thead {
        display: none;
    }

    .table {
        display: block !important;
        width: 100% !important;
    }

    .table tbody {
        display: block !important;
        width: 100% !important;
    }

    #carTable tr {
        display: grid !important;
        grid-template-columns: repeat(12, 1fr) !important; /* mathematically perfect 12 columns! */
        gap: 0.6rem 0.45rem !important; /* perfect layout gap for clean text spacing! */
        background: #ffffff !important; /* pure white card background for active cars */
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        border-radius: 14px !important;
        margin-bottom: 0.55rem !important; /* perfect gap between cards */
        padding: 0.65rem 0.5rem !important; /* comfortable padding inside card edges */
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02) !important;
        position: relative !important;
        width: 100% !important;
        transition: all 0.2s ease !important;
    }

    /* Sleek Sold Card unified grey background override */
    #carTable tr.table-row-sold {
        background: #E5E5EA !important; /* a bit darker iOS grey to clearly distinguish sold cars! */
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        box-shadow: none !important;
    }

    #carTable tr.table-row-sold td {
        background: transparent !important;
        background-color: transparent !important;
        color: #8E8E93 !important; /* subtle grey text color for sold details */
    }

    /* Stacked Label & Value Alignment with vertical baseline alignment */
    #carTable td:not([colspan]) {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        border: none !important;
        text-align: center !important;
        font-size: 0.72rem !important;
        color: #1C1C1E !important;
        overflow: hidden !important;
        min-height: 44px !important;
        background: transparent !important;
        background-color: transparent !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* Empty-state cell: reset all mobile overrides */
    #carTable td[colspan] {
        display: table-cell !important;
        text-align: center !important;
        padding: 2rem 1rem !important;
        white-space: normal !important;
        word-break: normal !important;
        overflow: visible !important;
        min-height: unset !important;
        background: transparent !important;
    }

    /* High-fidelity capitalized uppercase labels with premium letter spacing */
    #carTable td:not([colspan])::before {
        content: attr(data-label) !important;
        display: block !important;
        font-weight: 700 !important;
        color: #8E8E93 !important;
        font-size: 0.55rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.4px !important;
        margin-bottom: 0.15rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        width: 100% !important;
        text-align: center;
    }

    /* Explicit 12-column grid mapping for beautiful proportion alignments! */
    #carTable tr td[data-label="Option"] {
        grid-column: span 3 !important; /* Option takes 3 columns of Row 1 */
        grid-row: 1 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.18) !important;
        padding-bottom: 0.55rem !important;
        margin-bottom: 0.2rem !important;
        height: 100% !important;
        align-self: stretch !important;
    }
    #carTable tr td[data-label="Code"] {
        grid-column: span 4 !important; /* Code takes 4 columns of Row 1 */
        grid-row: 1 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.18) !important;
        padding-bottom: 0.55rem !important;
        margin-bottom: 0.2rem !important;
        height: 100% !important;
        align-self: stretch !important;
    }
    #carTable tr td[data-label="Name"] {
        grid-column: span 5 !important; /* Name takes 5 columns of Row 1 */
        grid-row: 1 !important;
        font-weight: 600 !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.18) !important;
        padding-bottom: 0.55rem !important;
        margin-bottom: 0.2rem !important;
        height: 100% !important;
        align-self: stretch !important;
    }

    #carTable tr td[data-label="Price"] {
        grid-column: span 3 !important; /* Price takes 3 columns of Row 2 */
        grid-row: 2 !important;
        color: var(--success-color) !important;
        font-weight: 700 !important;
    }
    #carTable tr td[data-label="Status"] {
        grid-column: span 3 !important; /* Status takes 3 columns of Row 2 */
        grid-row: 2 !important;
    }
    #carTable tr td[data-label="Color"] {
        grid-column: span 3 !important; /* Color takes 3 columns of Row 2 */
        grid-row: 2 !important;
    }
    #carTable tr td[data-label="Date"] {
        grid-column: span 3 !important; /* Date takes 3 columns of Row 2 */
        grid-row: 2 !important;
    }

    /* Force values of Name, Option, Color, and Date to be pure black for high contrast */
    #carTable tr td[data-label="Name"],
    #carTable tr td[data-label="Option"],
    #carTable tr td[data-label="Color"],
    #carTable tr td[data-label="Date"] {
        color: #000000 !important;
    }
    
    /* Sleek full-width bottom spanned Action Bar inside Row 3! */
    #carTable tr td[data-label="Action"] {
        grid-column: span 12 !important; /* span full 12 columns in Row 3! */
        grid-row: 3 !important;
        background-color: transparent !important; /* clean transparent bottom bar! */
        border-radius: 0 !important;
        border-top: 1px solid rgba(0, 0, 0, 0.18) !important; /* thin, delicate horizontal divider */
        padding-top: 0.45rem !important;
        margin-top: 0.2rem !important;
        min-height: auto !important;
    }

    /* Bold Customer tag in orders */
    #carTable td[data-label="Customer"] {
        font-weight: 600 !important;
    }

    #carTable td[data-label="Action"]::before {
        display: none !important; /* hide action label on bottom spanned bar */
    }

    #carTable td[data-label="Action"] > .d-flex {
        flex-direction: row !important;
        justify-content: center !important; /* perfectly center ESD buttons at the bottom */
        gap: 0.65rem !important;
        width: 100% !important;
    }

    /* Sleek compact pill-shaped action buttons! */
    #carTable td[data-label="Action"] .btn {
        flex: 1 !important; /* let them stretch to occupy equal widths! */
        max-width: 80px !important; /* perfectly proportioned compact width */
        height: 28px !important; /* sleeker, smaller height! */
        border-radius: 14px !important; /* gorgeous compact pill shape */
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
        font-size: 0.68rem !important; /* compact, readable font size */
        font-weight: 700 !important;
        text-transform: uppercase !important; /* high-fidelity capitalized labels */
        letter-spacing: 0.3px !important;
        color: #ffffff !important;
        box-shadow: none !important;
        line-height: 1 !important;
        transition: all 0.2s ease !important;
    }

    /* Status badge compact formatting */
    .table tbody td[data-label="Status"] .badge {
        font-size: 0.65rem !important;
        padding: 0.15rem 0.35rem !important;
        border-radius: 4px !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 0.2rem !important;
        white-space: nowrap !important; /* prevent any text wrapping! */
        max-width: none !important; /* allow natural width to fill horizontal space */
        line-height: 1.1 !important;
    }

    /* Premium 2-line (row) wrapped Car Code badge exactly like the image! */
    .table tbody td[data-label="Code"] span,
    .table tbody td[data-label="Code"] .badge {
        max-width: 140px !important;
        white-space: normal !important; /* allow natural line break */
        word-break: break-all !important; /* wrap at character level */
        display: inline-block !important;
        font-size: 0.65rem !important;
        padding: 0.15rem 0.25rem !important;
        text-align: center !important;
        line-height: 1.1 !important;
    }

    /* Order details adaptive grid support */
    .table tbody td[data-label="Customer"],
    .table tbody td[data-label="Car Info"],
    .table tbody td[data-label="Date"] {
        grid-column: span 1 !important;
    }

    .table tbody td[data-label="Car Info"] {
        display: block !important;
        background: #F8F9FA !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        border-radius: 6px !important;
        padding: 0.25rem 0.35rem !important;
        font-size: 0.68rem !important;
        overflow-y: auto !important;
        min-height: auto !important; /* grow naturally */
    }

    .table tbody td[data-label="Car Info"]::before {
        display: block !important;
        content: "Car Info" !important;
    }

    .table tbody td[data-label="Car Info"] .badge {
        font-size: 0.65rem !important;
        padding: 0.08rem 0.25rem !important;
    }

    .table tbody td[data-label="Car Info"] .small {
        font-size: 0.68rem !important;
    }

    /* Adaptive order action row bottom span (11th cell handler) */
    .table tbody td[data-label="Deposit"] ~ td[data-label="Action"] {
        grid-column: 1 / -1 !important;
        border-top: 1px solid rgba(0, 0, 0, 0.18) !important;
        padding-top: 0.4rem !important;
        margin-top: 0.2rem !important;
        min-height: auto !important;
    }

    .table tbody td[data-label="Deposit"] ~ td[data-label="Action"]::before {
        display: none !important; /* Hide action label when spanned full width at bottom */
    }

    .table tbody td[data-label="Deposit"] ~ td[data-label="Action"] > .d-flex {
        justify-content: flex-end !important;
    }

    /* Prevent text/badge overflow in narrow cards */
    .table tbody td[data-label] span,
    .table tbody td[data-label] div {
        max-width: 100%;
        word-break: break-all;
        white-space: normal;
    }

    /* Empty state cell — must NOT break words or collapse */
    .table tbody tr td[colspan] {
        display: table-cell !important;
        width: 100% !important;
        text-align: center !important;
        white-space: normal !important;
        word-break: normal !important;
        overflow: visible !important;
    }

    /* Mobile Action Buttons Formatting */
    .mb-4.animate-fade-in {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }
    
    .mb-4.animate-fade-in .d-flex.gap-2 {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        width: 100%;
        gap: 0.5rem !important;
    }
    
    .mb-4.animate-fade-in .btn {
        width: auto !important;
        flex: 1;
        justify-content: center;
        padding: 0.5rem 0.25rem;
        font-size: 0.85rem;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* Keep Save & Cancel buttons side-by-side on mobile, with Cancel on the right */
    #carForm .d-flex.gap-3,
    #orderForm .d-flex.gap-3 {
        flex-direction: row !important;
        gap: 0.5rem !important;
    }
    
    #carForm .d-flex.gap-3 .btn,
    #orderForm .d-flex.gap-3 .btn {
        width: auto !important;
        flex: 1 !important;
        margin-bottom: 0 !important;
    }


    /* ==========================================================================
       PREMIUM APPLE-INSPIRED MOBILE CARD LAYOUT (ORDERS LIST)
       ========================================================================== */
    /* ==========================================================================
       PREMIUM APPLE-INSPIRED MOBILE GOLD RECEIPT CARD (ORDERS LIST)
       ========================================================================== */


    .gold-receipt-card {
        background: #ffffff !important;
        border-radius: 14px !important;
        padding: 0.75rem !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04) !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        color: #1C1C1E !important;
        font-family: 'Outfit', sans-serif !important;
        margin-bottom: 0.85rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .table-row-sold .gold-receipt-card {
        background: #F2F2F7 !important;
        border-color: rgba(0, 0, 0, 0.04) !important;
    }

    .receipt-row {
        display: flex !important;
        gap: 0.5rem !important;
        margin-bottom: 0.45rem !important;
    }

    .receipt-row:last-child {
        margin-bottom: 0 !important;
    }

    .flex-1 { flex: 1 !important; }
    .flex-2 { flex: 2 !important; }

    .receipt-input {
        background: #F8F9FA !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        border-radius: 8px !important;
        padding: 0.35rem 0.5rem !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
    }

    .table-row-sold .receipt-input {
        background: #E5E5EA !important;
        border-color: rgba(0, 0, 0, 0.03) !important;
    }

    .input-label {
        display: block !important;
        font-size: 0.52rem !important;
        font-weight: 700 !important;
        color: #8E8E93 !important;
        text-transform: uppercase !important;
        margin-bottom: 0.05rem !important;
        letter-spacing: 0.2px !important;
        line-height: 1 !important;
        text-align: center !important;
    }

    .input-val {
        font-size: 0.78rem !important;
        font-weight: 600 !important;
        color: #000000 !important;
        line-height: 1.2 !important;
        text-align: center !important;
    }

    .receipt-action-row {
        background: #F8F9FA !important;
        border: 1px solid rgba(0, 0, 0, 0.05) !important;
        border-radius: 8px !important;
        padding: 0.2rem 0.4rem !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
    }

    .table-row-sold .receipt-action-row {
        background: #E5E5EA !important;
        border-color: rgba(0, 0, 0, 0.03) !important;
    }

    .action-label-row {
        display: block !important;
        font-size: 0.52rem !important;
        font-weight: 700 !important;
        color: #8E8E93 !important;
        text-transform: uppercase !important;
        margin-bottom: 0.05rem !important;
        letter-spacing: 0.2px !important;
        line-height: 1 !important;
        text-align: center !important;
    }

    .horizontal-actions {
        display: flex !important;
        gap: 0.45rem !important;
        width: 100% !important;
        justify-content: space-between !important;
    }

    .btn-action-horizontal {
        flex: 1 !important;
        height: 26px !important;
        border-radius: 6px !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        font-size: 0.82rem !important;
        border: none !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
        transition: transform 0.15s ease, opacity 0.15s ease !important;
    }

    .btn-action-horizontal:active {
        transform: scale(0.95) !important;
        opacity: 0.9 !important;
    }

    .btn-cyan {
        background-color: #00C2EE !important;
        color: #ffffff !important;
    }

    .btn-cyan:hover, .btn-cyan:active {
        background-color: #00B5E2 !important;
        color: #ffffff !important;
    }

    /* Reset Orders Table to standard layout on mobile, preventing dashboard grid bleed */
    .table:has(#orderTable) {
        display: table !important;
        width: 100% !important;
        border-collapse: collapse !important;
        background: transparent !important;
    }

    #orderTable {
        display: table-row-group !important;
        width: 100% !important;
        background: transparent !important;
    }

    #orderTable tr {
        display: table-row !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }

    #orderTable td {
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        min-height: auto !important;
    }

    #orderTable td.d-none {
        display: none !important;
    }

    #orderTable td::before {
        display: none !important; /* completely hide any grid data-label elements */
    }
}

@media (max-width: 576px) {
    .premium-card {
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 400px) {
    /* Fallback to 1 column of cards on extremely tiny viewports */
    .table tbody {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
}

/* Action buttons in table for laptops/desktops */
@media (min-width: 769px) {
    .table tbody td[data-label="Action"] .btn {
        padding: 0.3rem 0.65rem !important;
        font-size: 0.78rem !important;
        border-radius: var(--radius-sm) !important;
        font-weight: 600 !important;
        width: auto !important;
        margin-bottom: 0 !important;
    }

    /* Restore outline button borders (overridden by global .btn { border: none }) */
    .table tbody td[data-label="Action"] .btn-outline-info {
        border: 1.5px solid #0dcaf0 !important;
        color: #0dcaf0 !important;
        background: transparent !important;
    }
    .table tbody td[data-label="Action"] .btn-outline-info:hover {
        background: #0dcaf0 !important;
        color: #fff !important;
    }

    .table tbody td[data-label="Action"] .btn-outline-warning {
        border: 1.5px solid #FF9500 !important;
        color: #FF9500 !important;
        background: transparent !important;
    }
    .table tbody td[data-label="Action"] .btn-outline-warning:hover {
        background: #FF9500 !important;
        color: #fff !important;
    }

    .table tbody td[data-label="Action"] .btn-outline-danger {
        border: 1.5px solid #FF3B30 !important;
        color: #FF3B30 !important;
        background: transparent !important;
    }
    .table tbody td[data-label="Action"] .btn-outline-danger:hover {
        background: #FF3B30 !important;
        color: #fff !important;
    }

    /* Action buttons side-by-side in flex row */
    .table tbody td[data-label="Action"] .d-flex {
        flex-direction: row !important;
        gap: 0.4rem !important;
    }
}

/* ==========================================================================
   Order Details Page Styles (Sleek Apple-inspired Responsive Elements)
   ========================================================================== */

/* Status Timeline Container */
.status-timeline-container {
    background: #FAF9F6;
    border-radius: 16px;
    padding: 1.5rem 1rem;
    border: 1px solid rgba(212, 175, 55, 0.12);
}

.status-timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

.status-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #E5E5EA;
    color: #8E8E93;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 700;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid #FAF9F6;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.step-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #8E8E93;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
}

.status-line {
    height: 4px;
    background: #E5E5EA;
    flex-grow: 1;
    position: relative;
    top: -12px;
    margin: 0 -15px;
    z-index: 1;
    transition: all 0.4s ease;
}

/* Active Step */
.status-step.active .step-circle {
    background: #D4AF37;
    color: #ffffff;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.4);
}

.status-step.active .step-label {
    color: #AA771C;
}

/* Completed Step */
.status-step.completed .step-circle {
    background: #4CD964;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(76, 217, 100, 0.25);
}

.status-step.completed .step-label {
    color: #28a745;
}

/* Active Line */
.status-line.active {
    background: #4CD964;
}

/* Detail Section Card styling */
.detail-section-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid rgba(212, 175, 55, 0.15);
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.04);
    overflow: hidden;
    transition: all 0.3s ease;
}

.detail-section-card:hover {
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.25);
}

.section-card-header {
    background: #FCFBF9;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
}

.section-card-body {
    padding: 1.25rem;
}

/* Info Bubble styling inside detail card */
.info-bubble {
    background: #FCFBF9;
    border: 1px solid rgba(212, 175, 55, 0.08);
    border-radius: 12px;
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
}

.info-bubble-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: #8E8E93;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
    letter-spacing: 0.5px;
}

.info-bubble-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1C1C1E;
}

/* Financial elements inside detail page */
.financial-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

.financial-row > * {
    margin-bottom: 0 !important;
}

.financial-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8E8E93;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.financial-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1C1C1E;
}

.financial-label-highlight {
    font-size: 0.8rem;
    font-weight: 800;
    color: #AA771C;
    letter-spacing: 0.5px;
}

.financial-value-highlight {
    font-size: 1.25rem;
    font-weight: 800;
}

/* Receipt tear-off dashed separator */
.receipt-divider {
    height: 1px;
    border-top: 2px dashed rgba(212, 175, 55, 0.25);
    position: relative;
}

@media (max-width: 480px) {
    /* Compact Page padding */
    body {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
    
    .container {
        padding-left: 0.65rem !important;
        padding-right: 0.65rem !important;
    }

    .premium-card {
        padding: 0.8rem !important;
        border-radius: 18px !important;
    }

    /* Compact Header Section */
    .premium-card h2 {
        font-size: 1.25rem !important;
    }
    
    .premium-card p.text-muted {
        font-size: 0.75rem !important;
    }

    #display_status {
        font-size: 0.72rem !important;
        padding: 0.25rem 0.65rem !important;
        border-radius: 6px !important;
    }

    .border-bottom {
        padding-bottom: 0.65rem !important;
        margin-bottom: 0.75rem !important;
    }

    /* Highly Compact Status Timeline */
    .status-timeline-container {
        padding: 0.5rem 0.45rem !important;
        margin-bottom: 0.95rem !important;
        border-radius: 10px !important;
    }
    .step-circle {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.8rem !important;
        border-width: 1.5px !important;
    }
    .step-label {
        font-size: 0.6rem !important;
        margin-top: 0.2rem !important;
    }
    .status-line {
        height: 1.5px !important;
        top: -11px !important;
    }

    /* Detail Section Cards */
    .detail-section-card {
        border-radius: 10px !important;
        margin-bottom: 0.65rem !important;
    }
    .section-card-header {
        padding: 0.45rem 0.65rem !important;
    }
    .section-card-body {
        padding: 0.65rem !important;
    }

    /* Compact Info Bubbles */
    .info-bubble {
        padding: 0.45rem 0.6rem !important;
        border-radius: 8px !important;
    }
    .info-bubble-label {
        font-size: 0.52rem !important;
        margin-bottom: 0.05rem !important;
    }
    .info-bubble-val {
        font-size: 0.78rem !important;
    }

    /* Invoice Elements */
    .financial-row {
        margin-bottom: 0.45rem !important;
    }
    .receipt-divider {
        margin: 0.65rem 0 !important;
    }
    .financial-row.p-3 {
        padding: 0.55rem 0.65rem !important;
    }
    .financial-label {
        font-size: 0.72rem !important;
    }
    .financial-value {
        font-size: 0.85rem !important;
    }
    .financial-label-highlight {
        font-size: 0.75rem !important;
    }
    .financial-value-highlight {
        font-size: 1.05rem !important;
    }

    /* Horizontal actions row instead of vertical stacking */
    .premium-card .d-flex.gap-3 {
        flex-direction: row !important;
        width: 100% !important;
        gap: 0.5rem !important;
        margin-top: 0.95rem !important;
        padding-top: 0.65rem !important;
    }
    
    .premium-card .d-flex.gap-3 button {
        flex: 1 !important;
        width: auto !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        font-size: 0.8rem !important;
        height: 36px !important;
        border-radius: 8px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .premium-card .d-flex.gap-3 button i {
        margin-right: 0.25rem !important;
    }
}

/* Cohesive Horizontal Action Buttons inside receipt cards */
.horizontal-actions {
    display: flex !important;
    gap: 0.65rem !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    margin-top: 0.25rem !important;
}

.btn-action-horizontal {
    flex: 1 !important;
    max-width: 60px !important;
    height: 32px !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    font-size: 0.95rem !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s ease !important;
}

.btn-action-horizontal:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.btn-cyan {
    background: #00A3C4 !important;
    color: #ffffff !important;
    border: none !important;
}
.btn-cyan:hover {
    background: #008CA6 !important;
}


