
/* Mobile Styles for DeviceManagement */
/* Included only for screen width <= 768px via _Layout.cshtml */

/* === GENERAL MOBILE TWEAKS === */
.container, .container-fluid {
    padding-left: 10px;
    padding-right: 10px;
}

.card-body {
    padding: 1rem;
}

/* === INVOICE TABLE (Create/Edit) === */
#itemsTable.invoice-table {
    border: none !important;
    background: transparent !important;
}

#itemsTable.invoice-table thead {
    display: none !important;
}

#itemsTable.invoice-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 0.75rem;
    gap: 0;
    position: relative;
    border: 1px solid #e3e6f0;
    margin-bottom: 0.75rem;
    border-radius: 0.5rem;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

#itemsTable.invoice-table tbody td {
    position: static !important;
    border: none !important;
    padding: 0.25rem 0;
    background: transparent !important;
    box-shadow: none !important;
    display: block;
}

/* Specific Columns Order for Invoice */

/* 1. Name: Top, Full Width */
#itemsTable.invoice-table tbody td:nth-child(1) {
    width: 100% !important;
    font-weight: bold;
    color: #4e73df;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    order: 1;
}

/* 2. Unit: Under Name */
#itemsTable.invoice-table tbody td:nth-child(2) {
    width: 100% !important;
    font-size: 0.85rem;
    color: #858796;
    margin-bottom: 0.5rem;
    order: 2;
    border-bottom: 1px solid #eaecf4 !important;
    padding-bottom: 0.5rem;
}
#itemsTable.invoice-table tbody td:nth-child(2)::before {
    content: "ĐVT: ";
    display: inline-block;
    font-weight: normal;
    margin-right: 0.25rem;
}

/* 3. Inputs (Qty & Price) */
/* We use nth-last-child to target Qty and Price consistently */
#itemsTable.invoice-table tbody td:nth-last-child(3) { /* Qty */
    width: 50% !important;
    display: inline-block;
    padding-right: 5px;
    order: 3;
}
#itemsTable.invoice-table tbody td:nth-last-child(3)::before {
    content: attr(data-label);
    font-size: 0.7rem;
    color: #858796;
    display: block;
    margin-bottom: 2px;
}

#itemsTable.invoice-table tbody td:nth-last-child(2) { /* Price */
    width: 50% !important;
    display: inline-block;
    padding-left: 5px;
    order: 3;
}
#itemsTable.invoice-table tbody td:nth-last-child(2)::before {
    content: attr(data-label);
    font-size: 0.7rem;
    color: #858796;
    display: block;
    margin-bottom: 2px;
}

/* 4. Total: Last */
#itemsTable.invoice-table tbody td:last-child {
    width: 100% !important;
    text-align: right;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #eaecf4 !important;
    font-weight: bold;
    color: #1cc88a;
    font-size: 1.1rem;
    order: 4;
}
#itemsTable.invoice-table tbody td:last-child::before {
    content: "Thành tiền: ";
    font-size: 0.8rem;
    color: #858796;
    font-weight: normal;
}

/* Hide Request Info columns (Create Page only) to save space */
#itemsTable.invoice-table tbody td:nth-child(3):not(:has(input)), 
#itemsTable.invoice-table tbody td:nth-child(4):not(:has(input)) {
    display: none !important; 
}

/* Invoice Footer (Create Page) */
#itemsTable.invoice-table tfoot {
    display: block;
}
#itemsTable.invoice-table tfoot tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid #eaecf4;
    background: #f8f9fc;
}
#itemsTable.invoice-table tfoot td {
    border: none !important;
    padding: 0;
    margin: 0;
}
/* Ensure Label is on left, Value on right */
#itemsTable.invoice-table tfoot td:first-child {
    text-align: left;
    font-weight: bold;
    color: #5a5c69;
    font-size: 0.9rem;
}
#itemsTable.invoice-table tfoot td:last-child {
    text-align: right;
    min-width: 100px;
}
#itemsTable.invoice-table tfoot input {
    text-align: right;
    border: none;
    background: transparent;
    font-weight: bold;
    color: #2e59d9;
    padding: 0;
    width: 100%;
}

/* Fix VAT Row specific layout */
#itemsTable.invoice-table tfoot tr:nth-child(2) td:first-child {
    display: flex;
    align-items: center;
    white-space: nowrap;
}
#itemsTable.invoice-table tfoot #taxRate {
    width: 40px !important;
    text-align: center;
    border: 1px solid #d1d3e2;
    background: #fff;
    border-radius: 3px;
    margin-left: 5px;
    padding: 2px;
    font-size: 0.85rem;
    color: #333;
}


/* === ACCEPTANCE TABLE (Create/Edit) === */
.acceptance-table {
    border: none !important;
    background: transparent !important;
}
.acceptance-table thead {
    display: none !important;
}
.acceptance-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
}
.acceptance-table tbody td {
    display: block;
    border: none !important;
    padding: 2px 0;
}

/* 1. Name: Top, Full Width */
.acceptance-table tbody td:nth-child(1) {
    width: 100%;
    order: 1;
    margin-bottom: 5px;
}
.acceptance-table tbody td:nth-child(1) textarea,
.acceptance-table tbody td:nth-child(1) input {
    font-weight: bold;
    color: #4e73df;
    border: none;
    background: transparent !important;
    padding: 0;
    resize: none;
    min-height: auto;
    width: 100%;
}
.acceptance-table tbody td:nth-child(1)::before { display: none; }

/* Mobile Labels for Inputs (2,3,4,5) */
.acceptance-table tbody td:nth-child(2), /* Unit */
.acceptance-table tbody td:nth-child(3), /* Qty */
.acceptance-table tbody td:nth-child(4), /* Price */
.acceptance-table tbody td:nth-child(5) { /* Total */
    position: relative;
    padding-top: 1.2rem !important; /* Space for label */
}

.acceptance-table tbody td:nth-child(2)::before { /* Unit */
    content: "ĐVT";
    position: absolute;
    top: 0;
    left: 0;
    font-size: 0.75rem;
    font-weight: bold;
    color: #858796;
    text-transform: uppercase;
}

.acceptance-table tbody td:nth-child(3)::before { /* Qty */
    content: "SỐ LƯỢNG";
    position: absolute;
    top: 0;
    left: 5px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #858796;
    text-transform: uppercase;
}

.acceptance-table tbody td:nth-child(4)::before { /* Price */
    content: "ĐƠN GIÁ";
    position: absolute;
    top: 0;
    left: 0;
    font-size: 0.75rem;
    font-weight: bold;
    color: #858796;
    text-transform: uppercase;
}

.acceptance-table tbody td:nth-child(5)::before { /* Total */
    content: "THÀNH TIỀN";
    position: absolute;
    top: 0;
    left: 5px;
    font-size: 0.75rem;
    font-weight: bold;
    color: #858796;
    text-transform: uppercase;
}

/* 2. Unit */
.acceptance-table tbody td:nth-child(2) { 
    width: 50%;
    order: 2;
    display: inline-block;
    padding-right: 5px;
}

/* 3. Qty */
.acceptance-table tbody td:nth-child(3) { 
    width: 50%;
    order: 2;
    display: inline-block;
    padding-left: 5px;
}

/* 4. Price */
.acceptance-table tbody td:nth-child(4) { 
    width: 50%;
    order: 3;
    display: inline-block;
    padding-right: 5px;
    margin-top: 5px;
}

/* 5. Total */
.acceptance-table tbody td:nth-child(5) { 
    width: 50%;
    order: 3;
    display: inline-block;
    padding-left: 5px;
    margin-top: 5px;
}

/* 6. Note (Row 4) */
.acceptance-table tbody td:nth-child(6) {
    width: 100%;
    order: 4;
    margin-top: 8px;
    border-top: 1px dashed #eaecf4 !important;
    padding-top: 8px;
    position: relative;
    padding-top: 1.5rem !important; /* Space for label */
}
.acceptance-table tbody td:nth-child(6)::before {
    content: "GHI CHÚ";
    position: absolute;
    top: 5px;
    left: 0;
    font-size: 0.75rem;
    font-weight: bold;
    color: #858796;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0;
}

/* Acceptance Footer */
.acceptance-table tfoot { display: block; }
.acceptance-table tfoot tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eaecf4;
    background: #f8f9fc;
}
.acceptance-table tfoot td { border: none !important; padding: 0; }
.acceptance-table tfoot td:nth-child(3) { display: none; } /* Hide empty cell */
.acceptance-table tfoot td:first-child { font-weight: bold; color: #5a5c69; }
.acceptance-table tfoot td:last-child { font-weight: bold; color: #4e73df; }


/* === PURCHASE REQUEST ITEMS TABLE === */
.pr-items-table {
    border: none !important;
    background: transparent !important;
}
.pr-items-table thead {
    display: none !important;
}
.pr-items-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
}
.pr-items-table tbody td {
    display: block;
    border: none !important;
    padding: 2px 0;
}

/* 1. Index (#) - Hide */
.pr-items-table tbody td:nth-child(1) { display: none; }

/* 2. Name (Search) - Top, Full Width */
.pr-items-table tbody td:nth-child(2) {
    width: 100%;
    order: 1;
    margin-bottom: 5px;
    padding-right: 30px; /* Space for delete button */
}
.pr-items-table tbody td:nth-child(2) input {
    font-weight: bold;
    color: #4e73df;
    border: 1px solid #d1d3e2;
}

/* 8. Delete Button - Absolute Top Right */
.pr-items-table tbody td:last-child {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto !important;
    padding: 0;
    order: 0;
}
.pr-items-table tbody td:last-child button {
    padding: 0.25rem 0.5rem;
}

/* 3. Code - Row 2 Left */
.pr-items-table tbody td:nth-child(3) {
    width: 50%;
    order: 2;
    display: inline-block;
    padding-right: 5px;
}

/* 4. Unit - Row 2 Right */
.pr-items-table tbody td:nth-child(4) {
    width: 50%;
    order: 2;
    display: inline-block;
    padding-left: 5px;
}

/* 5. Qty - Row 3 Left */
.pr-items-table tbody td:nth-child(5) {
    width: 50%;
    order: 3;
    display: inline-block;
    padding-right: 5px;
    margin-top: 5px;
}

/* 6. Price - Row 3 Right */
.pr-items-table tbody td:nth-child(6) {
    width: 50%;
    order: 3;
    display: inline-block;
    padding-left: 5px;
    margin-top: 5px;
}

/* 7. Note - Row 4 Full */
.pr-items-table tbody td:nth-child(7) {
    width: 100%;
    order: 4;
    margin-top: 8px;
    border-top: 1px dashed #eaecf4 !important;
    padding-top: 8px;
}

/* Labels */
.pr-items-table tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    color: #858796;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 2px;
}
.pr-items-table tbody td:nth-child(2)::before { display: none; } /* Hide Name label */
.pr-items-table tbody td:last-child::before { display: none; } /* Hide Delete label */


/* === PURCHASE REQUEST COMPARISON TABLE === */
.pr-comparison-table {
    border: none !important;
    background: transparent !important;
}
.pr-comparison-table thead {
    display: none !important;
}
.pr-comparison-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    background: #fdfdfe; /* Slightly different bg to distinguish */
    border: 1px solid #b7b9cc;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.pr-comparison-table tbody td {
    display: block;
    border: none !important;
    padding: 2px 0;
}

/* 1. Index (#) - Hide */
.pr-comparison-table tbody td:nth-child(1) { display: none; }

/* 2. Code - Row 1 Left (Small) */
.pr-comparison-table tbody td:nth-child(2) {
    width: 30%;
    order: 1;
    display: inline-block;
    padding-right: 5px;
}
.pr-comparison-table tbody td:nth-child(2) input {
    background: #eaecf4;
    border: none;
    font-size: 0.85rem;
}

/* 3. Name - Row 1 Right (Large) */
.pr-comparison-table tbody td:nth-child(3) {
    width: 70%;
    order: 1;
    display: inline-block;
    padding-left: 5px;
}
.pr-comparison-table tbody td:nth-child(3) input {
    background: #eaecf4;
    border: none;
    font-weight: bold;
    color: #4e73df;
}

/* 4, 5, 6. Quotes - Stacked */
.pr-comparison-table tbody td:nth-child(4),
.pr-comparison-table tbody td:nth-child(5),
.pr-comparison-table tbody td:nth-child(6) {
    width: 100%;
    order: 2;
    margin-top: 5px;
    border-top: 1px solid #f8f9fc;
    padding-top: 5px;
}

.pr-comparison-table tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    color: #858796;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 2px;
}


/* === MANUAL IMPORT TABLE (Mobile) === */
.manual-import-table,
.repair-details-table {
    border: none !important;
    background: transparent !important;
}
.manual-import-table thead,
.repair-details-table thead {
    display: none !important;
}
.manual-import-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
}
.manual-import-table tbody td {
    display: block;
    border: none !important;
    padding: 2px 0;
}

/* 1. Name: Top, Full Width */
.manual-import-table tbody td:nth-child(2) { /* Name */
    width: 100% !important;
    order: 1;
    font-weight: bold;
    color: #4e73df;
    font-size: 1rem;
    border-bottom: 1px solid #eaecf4 !important;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem !important;
    display: block !important;
}
.manual-import-table tbody td:nth-child(2)::before { display: none; }

/* 2. Code (Hidden) */
.manual-import-table tbody td:nth-child(1) {
    display: none !important;
}

/* Common style for data cells (3,4,5,6) */
.manual-import-table tbody td:nth-child(3), /* Unit */
.manual-import-table tbody td:nth-child(4), /* Qty */
.manual-import-table tbody td:nth-child(5), /* Price */
.manual-import-table tbody td:nth-child(6) { /* Total */
    width: 50% !important;
    display: inline-block !important;
    position: relative;
    padding-top: 1.3rem !important; /* Space for label */
    padding-bottom: 0.5rem !important;
    border: none !important;
    vertical-align: top;
}

/* Labels */
.manual-import-table tbody td:nth-child(3)::before,
.manual-import-table tbody td:nth-child(4)::before,
.manual-import-table tbody td:nth-child(5)::before,
.manual-import-table tbody td:nth-child(6)::before {
    content: attr(data-label);
    position: absolute;
    top: 0;
    left: 0;
    font-size: 0.75rem;
    font-weight: bold;
    color: #858796;
    text-transform: uppercase;
}

/* Specific Adjustments */
/* 3. Unit */
.manual-import-table tbody td:nth-child(3) {
    order: 2;
    padding-right: 5px !important;
    color: #5a5c69;
}

/* 4. Qty */
.manual-import-table tbody td:nth-child(4) {
    order: 2;
    padding-left: 5px !important;
}
.manual-import-table tbody td:nth-child(4)::before { left: 5px; }

/* 5. Price */
.manual-import-table tbody td:nth-child(5) {
    order: 3;
    padding-right: 5px !important;
}

/* 6. Total */
.manual-import-table tbody td:nth-child(6) {
    order: 3;
    padding-left: 5px !important;
    color: #1cc88a;
    font-weight: bold;
    font-size: 1.1rem;
}
.manual-import-table tbody td:nth-child(6)::before { left: 5px; }

/* 7. Delete */
.manual-import-table tbody td:last-child {
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto !important;
    padding: 0 !important;
    border: none !important;
    order: 0;
}
.manual-import-table tbody td:last-child::before { display: none; }

/* Empty Row */
.manual-import-table tbody #emptyRow td {
    width: 100%;
    text-align: center;
    font-style: italic;
    color: #858796;
}

/* Footer (Total) */
.manual-import-table tfoot {
    display: block;
}
.manual-import-table tfoot tr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fc;
    padding: 10px;
    border: 1px solid #eaecf4;
    border-radius: 8px;
}
.manual-import-table tfoot td {
    border: none !important;
    padding: 0;
}
.manual-import-table tfoot td:nth-child(1) { /* Label "Tổng cộng" merged cell */
    text-align: left;
    font-weight: bold;
    color: #5a5c69;
}
.manual-import-table tfoot td:nth-child(2) { /* Value */
    text-align: right;
    font-weight: bold;
    color: #e74a3b;
    font-size: 1.2rem;
}
.manual-import-table tfoot td:last-child { display: none; } /* Hide empty cell */


/* REPAIR CREATE: Item(1), Unit(2), Qty(3), Price(4), Total(5), Delete(6) */
.repair-create-table {
    border: none !important;
    background: transparent !important;
}
.repair-create-table thead {
    display: none !important;
}
.repair-create-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: relative;
}
.repair-create-table tbody td {
    display: block;
    border: none !important;
    padding: 2px 0;
}

/* Item Name/Search */
.repair-create-table tbody td:nth-child(1) { 
    width: 100%;
    order: 1;
    margin-bottom: 5px;
    padding-right: 30px;
}
.repair-create-table tbody td:nth-child(1)::before { display: none; }

/* Mobile Labels for Inputs */
.repair-create-table tbody td:nth-child(2), /* Unit */
.repair-create-table tbody td:nth-child(3), /* Qty */
.repair-create-table tbody td:nth-child(4), /* Price */
.repair-create-table tbody td:nth-child(5) { /* Total */
    position: relative;
    padding-top: 1.2rem !important; /* Make space for label */
}

.repair-create-table tbody td:nth-child(2)::before { /* Unit */
    content: attr(data-label);
    position: absolute;
    top: 0;
    left: 0;
    font-size: 0.75rem;
    font-weight: bold;
    color: #858796;
    text-transform: uppercase;
}

.repair-create-table tbody td:nth-child(3)::before { /* Qty */
    content: attr(data-label);
    position: absolute;
    top: 0;
    left: 5px; /* Offset due to padding-left */
    font-size: 0.75rem;
    font-weight: bold;
    color: #858796;
    text-transform: uppercase;
}

.repair-create-table tbody td:nth-child(4)::before { /* Price */
    content: attr(data-label);
    position: absolute;
    top: 0;
    left: 0;
    font-size: 0.75rem;
    font-weight: bold;
    color: #858796;
    text-transform: uppercase;
}

.repair-create-table tbody td:nth-child(5)::before { /* Total */
    content: attr(data-label);
    position: absolute;
    top: 0;
    left: 5px; /* Offset due to padding-left */
    font-size: 0.75rem;
    font-weight: bold;
    color: #858796;
    text-transform: uppercase;
}

.repair-create-table tbody td:nth-child(2) { /* Unit */
    width: 50%;
    order: 2;
    display: inline-block;
    padding-right: 5px;
}
.repair-create-table tbody td:nth-child(3) { /* Qty */
    width: 50%;
    order: 2;
    display: inline-block;
    padding-left: 5px;
}

.repair-create-table tbody td:nth-child(4) { /* Price */
    width: 50%;
    order: 3;
    display: inline-block;
    padding-right: 5px;
}
.repair-create-table tbody td:nth-child(5) { /* Total */
    width: 50%;
    order: 3;
    display: inline-block;
    padding-left: 5px;
}

.repair-create-table tbody td:last-child { /* Delete */
    position: absolute;
    top: 10px;
    right: 10px;
    width: auto !important;
    padding: 0;
    order: 0;
}
.repair-create-table tbody td:last-child::before { display: none; }

/* Repair Footer (Mobile) - For CREATE/EDIT Page */
.repair-create-table tfoot {
    display: block !important; /* Force show tfoot */
}

/* Specific styling for the Total Row inside TFOOT */
.repair-create-table tfoot tr {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: #f8f9fc !important;
    padding: 0.75rem !important;
    border-top: 2px solid #eaecf4;
}

.repair-create-table tfoot td {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Label "Tổng chi phí ước tính:" */
.repair-create-table tfoot td:first-child {
    width: auto !important;
    text-align: left !important;
    font-weight: bold;
    color: #5a5c69;
    font-size: 0.95rem;
}

/* Value Input */
.repair-create-table tfoot td:nth-child(2) {
    width: auto !important;
    flex-grow: 1;
    text-align: right !important;
}

.repair-create-table tfoot input {
    text-align: right;
    border: none;
    background: transparent;
    font-weight: bold;
    color: #e74a3b; /* Red-ish color */
    font-size: 1.1rem;
    width: 100%;
}

/* Empty Cell - Hide */
.repair-create-table tfoot td:last-child {
    display: none !important;
}

/* Hide the old tbody total row rule if it exists to avoid conflict */
.repair-create-table tbody tr:last-child {
    /* Reset or ignore if we moved it to tfoot */
}



/* === REPAIR & ACCEPTANCE & POPUP DETAILS TABLE (Mobile) === */

/* Common Table Reset */
.repair-details-table,
.acceptance-details-table,
.invoice-details-table,
.pr-popup-table,
.invoice-popup-table {
    border: none !important;
    background: transparent !important;
}

.repair-details-table thead,
.acceptance-details-table thead,
.invoice-details-table thead,
.pr-popup-table thead,
.invoice-popup-table thead {
    display: none !important;
}

/* Common Row Style (Card) */
.repair-details-table tbody tr,
.acceptance-details-table tbody tr,
.invoice-details-table tbody tr,
.pr-popup-table tbody tr,
.invoice-popup-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #e3e6f0;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 0.75rem;
    position: relative;
}

/* Common Cell Style */
.repair-details-table tbody tr td,
.acceptance-details-table tbody tr td,
.invoice-details-table tbody tr td,
.pr-popup-table tbody tr td,
.invoice-popup-table tbody tr td {
    border: none !important;
    padding: 0.25rem 0;
    display: block;
    width: 100% !important;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed #f0f2f8 !important;
    padding: 0.5rem 0 !important;
    margin: 0 !important;
}

.repair-details-table tbody tr td:last-child,
.acceptance-details-table tbody tr td:last-child,
.invoice-details-table tbody tr td:last-child,
.pr-popup-table tbody tr td:last-child,
.invoice-popup-table tbody tr td:last-child {
    border-bottom: none !important;
}

/* === SPECIFIC COLUMN MAPPINGS === */

/* --- REPAIR & ACCEPTANCE (Shared 1-5) --- */
/* 1. Name */
.repair-details-table tbody tr td:nth-child(1),
.acceptance-details-table tbody tr td:nth-child(1) {
    font-weight: bold;
    color: #4e73df;
    font-size: 1rem;
    border-bottom: 1px solid #eaecf4 !important;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem !important;
    order: 1;
    display: block !important; /* Name is block, not flex space-between */
}
.repair-details-table tbody tr td:nth-child(1)::before,
.acceptance-details-table tbody tr td:nth-child(1)::before { display: none; }

/* 2. Unit */
.repair-details-table tbody tr td:nth-child(2),
.acceptance-details-table tbody tr td:nth-child(2) {
    order: 2;
    color: #5a5c69;
}
.repair-details-table tbody tr td:nth-child(2)::before,
.acceptance-details-table tbody tr td:nth-child(2)::before {
    content: attr(data-label) ": ";
    font-weight: normal;
    color: #858796;
}

/* 3. Qty */
.repair-details-table tbody tr td:nth-child(3),
.acceptance-details-table tbody tr td:nth-child(3) {
    order: 3;
    font-weight: bold;
    color: #333;
    text-align: right;
}
.repair-details-table tbody tr td:nth-child(3)::before,
.acceptance-details-table tbody tr td:nth-child(3)::before {
    content: attr(data-label) ": ";
    font-weight: normal;
    color: #858796;
}

/* 4. Price */
.repair-details-table tbody tr td:nth-child(4),
.acceptance-details-table tbody tr td:nth-child(4) {
    order: 4;
    color: #5a5c69;
    text-align: right;
}
.repair-details-table tbody tr td:nth-child(4)::before,
.acceptance-details-table tbody tr td:nth-child(4)::before {
    content: attr(data-label) ": ";
    font-weight: normal;
    color: #858796;
}

/* 5. Total */
.repair-details-table tbody tr td:nth-child(5),
.acceptance-details-table tbody tr td:nth-child(5) {
    order: 5;
    font-weight: bold;
    color: #1cc88a;
    font-size: 1.1rem;
    text-align: right;
}
.repair-details-table tbody tr td:nth-child(5)::before,
.acceptance-details-table tbody tr td:nth-child(5)::before {
    content: attr(data-label) ": ";
    font-weight: normal;
    color: #858796;
}

/* 6. Note (Acceptance Only) */
.acceptance-details-table tbody tr td:nth-child(6) {
    order: 6;
    color: #858796;
    font-style: italic;
    display: block !important;
    text-align: left;
}
.acceptance-details-table tbody tr td:nth-child(6)::before {
    content: attr(data-label) ": ";
    font-weight: bold;
    font-style: normal;
    margin-right: 5px;
}


/* --- INVOICE DETAILS & INVOICE POPUP & PR POPUP (Shifted Indices) --- */
/* 1. Code - Hide or Small */
.invoice-details-table tbody tr td:nth-child(1),
.invoice-popup-table tbody tr td:nth-child(1),
.pr-popup-table tbody tr td:nth-child(1) {
    display: none !important;
}

/* 2. Name */
.invoice-details-table tbody tr td:nth-child(2),
.invoice-popup-table tbody tr td:nth-child(2),
.pr-popup-table tbody tr td:nth-child(2) {
    font-weight: bold;
    color: #4e73df;
    font-size: 1rem;
    border-bottom: 1px solid #eaecf4 !important;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem !important;
    order: 1;
    display: block !important;
}
.invoice-details-table tbody tr td:nth-child(2)::before,
.invoice-popup-table tbody tr td:nth-child(2)::before,
.pr-popup-table tbody tr td:nth-child(2)::before { display: none; }

/* 3. Unit */
.invoice-details-table tbody tr td:nth-child(3),
.invoice-popup-table tbody tr td:nth-child(3),
.pr-popup-table tbody tr td:nth-child(3) {
    order: 2;
    color: #5a5c69;
}
.invoice-details-table tbody tr td:nth-child(3)::before,
.invoice-popup-table tbody tr td:nth-child(3)::before,
.pr-popup-table tbody tr td:nth-child(3)::before {
    content: attr(data-label) ": ";
    font-weight: normal;
    color: #858796;
}

/* 4. Qty */
.invoice-details-table tbody tr td:nth-child(4),
.invoice-popup-table tbody tr td:nth-child(4),
.pr-popup-table tbody tr td:nth-child(4) {
    order: 3;
    font-weight: bold;
    color: #333;
    text-align: right;
}
.invoice-details-table tbody tr td:nth-child(4)::before,
.invoice-popup-table tbody tr td:nth-child(4)::before,
.pr-popup-table tbody tr td:nth-child(4)::before {
    content: attr(data-label) ": ";
    font-weight: normal;
    color: #858796;
}

/* 5. Price */
.invoice-details-table tbody tr td:nth-child(5),
.invoice-popup-table tbody tr td:nth-child(5),
.pr-popup-table tbody tr td:nth-child(5) {
    order: 4;
    color: #5a5c69;
    text-align: right;
}
.invoice-details-table tbody tr td:nth-child(5)::before,
.invoice-popup-table tbody tr td:nth-child(5)::before,
.pr-popup-table tbody tr td:nth-child(5)::before {
    content: attr(data-label) ": ";
    font-weight: normal;
    color: #858796;
}

/* 6. Total (Invoice Details & Popup) */
.invoice-details-table tbody tr td:nth-child(6),
.invoice-popup-table tbody tr td:nth-child(6) {
    order: 5;
    font-weight: bold;
    color: #1cc88a;
    font-size: 1.1rem;
    text-align: right;
}
.invoice-details-table tbody tr td:nth-child(6)::before,
.invoice-popup-table tbody tr td:nth-child(6)::before {
    content: attr(data-label) ": ";
    font-weight: normal;
    color: #858796;
}

/* --- PR POPUP SPECIFIC (Quotes & Total) --- */
/* Quotes (6, 7, 8) */
.pr-popup-table tbody tr td:nth-child(6),
.pr-popup-table tbody tr td:nth-child(7),
.pr-popup-table tbody tr td:nth-child(8) {
    order: 6;
    color: #858796;
    font-size: 0.9rem;
}
.pr-popup-table tbody tr td:nth-child(6)::before,
.pr-popup-table tbody tr td:nth-child(7)::before,
.pr-popup-table tbody tr td:nth-child(8)::before {
    content: attr(data-label) ": ";
    font-weight: normal;
    color: #858796;
    margin-right: 5px;
}

/* Total (9) */
.pr-popup-table tbody tr td:last-child {
    order: 10;
    font-weight: bold;
    color: #1cc88a;
    font-size: 1.1rem;
    text-align: right;
}
.pr-popup-table tbody tr td:last-child::before {
    content: attr(data-label) ": ";
    font-weight: normal;
    color: #858796;
}


/* === TOTAL ROWS (Footer Style) === */
.repair-details-table tbody tr.repair-total-row,
.acceptance-details-table tbody tr.acceptance-total-row,
.pr-popup-table tbody tr.pr-popup-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fc;
    border: 1px solid #e3e6f0;
    border-radius: 0.5rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.repair-details-table tbody tr.repair-total-row td,
.acceptance-details-table tbody tr.acceptance-total-row td,
.pr-popup-table tbody tr.pr-popup-total-row td {
    border: none !important;
    padding: 0 !important;
    display: block !important; /* Reset flex from common cell style */
    width: auto !important;
    border-bottom: none !important;
}

/* Label "Tổng cộng" */
.repair-details-table tbody tr.repair-total-row td:first-child,
.acceptance-details-table tbody tr.acceptance-total-row td:nth-child(1),
.pr-popup-table tbody tr.pr-popup-total-row td:nth-child(1) {
    order: 1;
    text-align: left !important;
    font-weight: bold;
    color: #5a5c69;
    font-size: 1rem;
}

/* Value */
.repair-details-table tbody tr.repair-total-row td:last-child,
.acceptance-details-table tbody tr.acceptance-total-row td:nth-child(2),
.pr-popup-table tbody tr.pr-popup-total-row td:nth-child(2) {
    order: 2;
    text-align: right !important;
    font-weight: bold;
    color: #e74a3b;
    font-size: 1.2rem;
}

/* Hide empty cells in Total Row */
.acceptance-details-table tbody tr.acceptance-total-row td:last-child {
    display: none !important;
}

/* Empty Row Style */
.repair-details-table tbody tr.repair-empty-row td,
.acceptance-details-table tbody tr td.text-muted { /* Generic target for empty/loading */
    display: block;
    width: 100% !important;
    text-align: center !important;
    padding: 1rem !important;
    color: #858796;
    font-style: italic;
    border: none !important;
}


/* User Search Dropdowns */
.user-search-results, #prSearchResults, #supplierSearchResults {
    position: absolute;
    z-index: 9999 !important; /* Extremely high z-index */
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: white;
    border: 1px solid #d1d3e2;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0.35rem;
}

/* Stacking Context Fix */
.position-relative:focus-within {
    z-index: 1050; /* Bring container forward when searching */
}

/* List Items Visibility */
.list-group-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #3a3b45;
}
