











/* VHM Procurement Dashboard CSS */

:root{--navy:#001f3f;--accent:#0b69d6;--light:#f5f7fb; --yellow-light: #fffbe6; --blue-light: #e7f3ff; --header-height: 35px;}
html, body {
    height: 100%;
    overflow: hidden; /* Prevent main page scrolling */
}
body{font-family:Segoe UI, Roboto, Arial; background:var(--light); margin:0; color:#0b2944; font-size: 13px;}

/* UI Locking styles */
body.ui-locked #viewContainer,
body.ui-locked .header,
body.ui-locked .toolbar > *:not(#btnConnectSharedFile) {
    pointer-events: none;
    opacity: 0.5;
    filter: grayscale(100%);
}

body.ui-locked #btnConnectSharedFile {
    pointer-events: auto;
    opacity: 1;
    filter: none;
    position: relative;
    z-index: 5001;
    box-shadow: 0 0 15px #ffc107;
    animation: pulse-attention 2s infinite;
    background-color: #0b69d6 !important;
    color: white !important;
}

@keyframes pulse-attention {
    0% { box-shadow: 0 0 0 0 rgba(11, 105, 214, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(11, 105, 214, 0); }
    100% { box-shadow: 0 0 0 0 rgba(11, 105, 214, 0); }
}

/* NEW: Selection Highlighting */
::selection {
    background: #fff3cd; /* Light yellow */
    color: #000;
}

.header{background:var(--navy); color:white; padding:12px 20px; display:flex;align-items:center;justify-content:space-between;}
.title{font-weight:700;font-size:18px;}
.toolbar{padding:14px 20px; display:flex; gap:8px; align-items:center; background:white; box-shadow:0 1px 4px rgba(2,6,23,0.06); flex-wrap: wrap; position: relative;}
.btn{background:var(--accent); color:white; border:none; padding:0 14px; border-radius:6px; cursor:pointer; font-weight:600; height: 34px; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; white-space: nowrap;}
.btn:disabled{background:#aab8c9; cursor:not-allowed;}
.btn.secondary{background:#6c757d;}
/* NEW: Home Button Style */
.btn.home-btn {
    background-color: #6f42c1; /* Purple distinctive color */
    margin-right: 12px;
}
.btn.home-btn:hover {
    background-color: #5a32a3;
}

/* NEW: Nav Arrow Buttons */
.btn.nav-arrow-btn {
    padding: 0 10px;
    font-size: 16px;
    font-weight: bold;
    min-width: 30px;
    margin-right: 4px;
}

.btn.text-btn {
    background: none;
    color: #0b2944;
    font-weight: 600;
}
.btn.text-btn:hover {
    background-color: #f1f7ff;
}
.btn.nav-btn.active {
    background-color: #6c757d;
    color: #fff;
    position: relative;
}
.btn.text-btn.nav-btn.active {
    background-color: #eef2ff;
    color: #0b2944;
}
.btn.nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -14px; /* Position it below the padding of the toolbar */
    left: 0;
    right: 0;
    height: 3px;
    background-color: #dc3545;
    border-radius: 2px;
}
/* Undo/Redo Button styles */
.toolbar .btn.text-btn:disabled {
    background: none;
    color: #aab8c9;
    cursor: not-allowed;
}
.toolbar button#btnRefreshView {
    margin-right: 8px; /* Add some space between refresh and undo */
    font-size: 16px; /* Make the icon a bit bigger to match others */
    cursor: pointer !important; /* Force pointer cursor to fix "disabled" appearance */
}
.container{max-width:1200px;margin:18px auto;padding:0 16px;}
.card{background:white;border-radius:8px;padding:12px;margin-bottom:16px;box-shadow:0 2px 8px rgba(2,6,23,0.04);}
.flex{display:flex;gap:12px;align-items:center;}
.small{font-size:12px;color:#475569;}
.table-wrap, .full-page-table-wrap {
    overflow: auto;
    flex-grow: 1;
    min-height: 0;
    border-radius: 6px;
    border: 1px solid #d0d7e5;
}
table{width:100%;border-collapse:collapse;font-size:11px; table-layout: auto;}
th,td{padding:6px 8px;border:1px solid #d0d7e5;text-align:left; white-space: nowrap; vertical-align: middle; background-color: white;}
th{background:#f1f7ff; position: sticky; top: 0; z-index: 2; cursor: pointer;}
thead tr:first-child th { top: 0; }

/* NEW: Alignment Classes for Report Columns */
.col-center { text-align: center !important; }
.col-right { text-align: right !important; }
.col-left { text-align: left !important; }

/* Style for PR grouping */
tr.pr-group-even td {
    background-color: #f8f9fa; /* A subtle light grey */
}
/* Special style for purchase history group header */
.purchase-history-group-header td {
    font-weight: bold;
    background-color: #fdf2e2; /* A light orange to distinguish from PR grouping */
    color: #5d3a00;
    position: sticky;
    top: 35px; /* Adjust if table header height changes */
    z-index: 2;
}

/* Row Hover Effect for item rows */
#compareTable tbody tr:not(.pr-group-header-row):not(.row-is-selected):not(.overdue-critical):not(.missing-info):not(.no-pr-item):hover td,
#purchaseHistoryTable tbody tr:not(.purchase-history-group-header):hover td {
    background-color: #f1f7ff; /* Lighter blue for hover */
}

/* Style for selected (frozen) rows */
tr.row-is-selected > td {
    background-color: var(--yellow-light) !important;
}

/* NEW: Style for "Nợ PR" items */
tr.no-pr-item > td {
    background-color: var(--yellow-light) !important;
}
.btn-delete-no-pr {
    background: #f8d7da;
    color: #dc3545;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 14px;
    line-height: 16px;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
    font-weight: bold;
    vertical-align: middle;
}
.btn-delete-no-pr:hover {
    background: #dc3545;
    color: white;
}


/* Style for overdue items */
tr.overdue-critical td {
    background-color: #fddede !important;
}

/* Style for items with missing info */
tr.missing-info td {
    color: #dc3545;
    font-weight: 600;
}
tr.missing-info td input, tr.missing-info td select {
    color: #dc3545;
    font-weight: 600;
}


/* Special header row within a PR group */
.pr-group-header-row td {
    font-weight: 600;
    background-color: #e7f3ff; /* Light blue from success modal */
    text-align: center;
    color: #004085;
    position: sticky;
    top: 35px; /* Height of the main header row */
    z-index: 2;
    border-bottom: 2px solid #a3c9f5;
}
.pr-group-header-row td.sticky-col {
    background-color: #e7f3ff;
}


/* Sticky Columns styles */
.sticky-col { position: sticky; left: 0; z-index: 1; border-right: 1px solid #d0d7e5;}
th.sticky-col { z-index: 3; }

td.sticky-col, th.sticky-col {
    left: var(--sticky-offset, 0);
}

.sticky-col-last { position: sticky; right: 0; z-index: 4; border-left: 2px solid #d0d8e8;}
th.sticky-col-last { z-index: 3; }


th .sort-indicator { margin-left: 5px; color: #999; }
th.sorted-asc .sort-indicator, th.sorted-desc .sort-indicator { color: #333; }
.checkbox-cent{text-align:center;}
.vendor-list{display:flex;gap:8px;flex-wrap:wrap;}
.pill{background:#eef2ff;padding:6px 10px;border-radius:999px;color:#03396c;font-weight:600;}
.input{padding:8px;border:1px solid #e6eef8;border-radius:6px; font-size: 13px; height: 34px; box-sizing: border-box;}
.filter-input { width: 100%; box-sizing: border-box; padding: 4px; border: 1px solid #ccc; border-radius: 4px; }
.right{margin-left:auto;}
.badge{background:#fde68a;padding:4px 8px;border-radius:6px;font-weight:600;}
.note{font-size:12px;color:#64748b;}

#appRoot { 
    display: none; 
    flex-direction: column;
    height: 100vh;
}
#viewContainer {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
}

#loginOverlay { 
    display: flex; 
    position:fixed;
    left:0;
    top:0;
    width:100%;
    height:100%;
    background:rgba(2,6,23,0.9);
    align-items:center;
    justify-content:center;
    z-index:5000;
}
.login-box { background: #fff; padding: 32px; border-radius: 8px; text-align: center; box-shadow: 0 4px 15px rgba(0,0,0,0.2); width: 320px; }
.login-box h2 { margin-top: 0; color: var(--navy); }
.login-box .user-btn { display: block; width: 280px; margin: 8px 0; padding: 12px; font-size: 16px; }
.login-box .login-actions { display: flex; gap: 10px; margin-bottom: 0px; }
.login-box .login-actions .btn { flex: 1; padding: 12px; font-size: 16px; height: 40px;}
.login-box .login-actions .btn.secondary { background-color: #6c757d; }

.view {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    overflow-y: hidden; /* Prevent scrolling on the view itself */
}
.view.active {
    display: flex; /* Make active view a flex container */
    flex-direction: column;
}

/* Make container/card fill the view for all layouts */
.view > .container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}
.view > .container > .card {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

/* On the main SAP data view, hide the secondary info cards to maximize space for the main table. */
#mainView > .container > .card:not(:first-child) {
    display: none;
}

/* Price comparison specific styles */
.price-cell { display: flex; align-items: center; gap: 4px; position: relative; }
.price-cell-container { border: 1.5px solid transparent; border-radius: 6px; margin: -2px; padding: 1px;}
td.selected-over-budget .price-cell-container {
    /* REMOVED OVER BUDGET STYLING */
    border-color: transparent; 
    background-color: transparent;
}
.price-cell input[type="radio"] {
    transform: scale(1.5);
    margin: 0 6px 0 4px;
    cursor: pointer;
}

/* Remove old background highlights and use indicators instead */
td.min-price { background-color: transparent !important; }
td.selected-price { background-color: transparent !important; }
.warning-bar { background-color: var(--yellow-light); color: #856404; padding: 15px; text-align: center; border-bottom: 1px solid #ffeeba; }

/* New visual indicators */
.price-indicator {
    display: inline-block; /* CHANGED: Force display so legend works */
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
    vertical-align: middle;
}
.min-price-indicator {
    background-color: #ffc107; /* yellow */
}
.selected-price-indicator {
    border: 2px solid #007bff; /* blue border */
    background-color: transparent;
}
.po-excel-indicator {
    background-color: #28a745; /* green */
}
.po-sap-indicator {
    background-color: #17a2b8; /* cyan */
}
/* NEW: Contract Price Indicator */
.contract-price-indicator { 
    background-color: #6f42c1; /* purple */ 
}

td.min-price .min-price-indicator,
td.selected-price .selected-price-indicator,
td.has-excel-po .po-excel-indicator,
td.has-sap-po .po-sap-indicator,
td.is-contract-price .contract-price-indicator {
    display: inline-block;
}

td.min-price.selected-price .min-price-indicator { margin-right: 0; }
td.min-price.selected-price .selected-price-indicator { margin-left: 2px; }

td .price-input {
    width: 90px;
    padding: 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    text-align: right;
    background-color: transparent;
    font-size: 11px;
    font-family: Segoe UI, Roboto, Arial;
    height: auto;
}
td .price-input:hover {
    border-color: #ccc;
}
td .price-input:focus {
    border-color: var(--accent);
    background-color: white;
    outline: none;
    box-shadow: 0 0 0 2px rgba(11, 105, 214, 0.2);
}

/* Ranking Number */
.price-rank {
    font-size: 9px;
    color: #666;
    font-weight: bold;
    margin-left: 4px;
    vertical-align: super;
    cursor: help;
}

/* Price history clock icon */
.price-history-icon {
    display: inline-block;
    cursor: pointer;
    width: 16px;
    height: 16px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%236c757d"><path d="M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z"></path><path d="M13 7h-2v6h6v-2h-4V7z"></path></svg>');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-left: 4px;
}
.price-history-icon:hover {
    opacity: 1;
}

/* Over-budget indicator style for Table Cells (HIDDEN) */
.price-over-budget-indicator {
    display: none !important; 
}

/* Over-budget legend specific style (VISIBLE IN LEGEND) */
.price-over-budget-indicator-legend {
    background-color: #dc3545; /* Red */
    display: inline-block !important; /* Force show in legend */
}


/* Dropdown styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    background-color: white;
    min-width: 220px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.15);
    z-index: 2001 !important; /* Ensure dropdowns are on top of everything */
    border-radius: 6px;
    border: 1px solid #eef2ff;
    overflow: hidden;
    margin-top: 4px;
}

.toolbar .right .dropdown-content {
    left: auto;
    right: 0;
}

.dropdown-content .dropdown-item {
    color: #0b2944;
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    font-family: Segoe UI, Roboto, Arial;
    line-height: 1.5;
}

.dropdown-content .dropdown-item:hover {
    background-color: #f1f7ff;
}

.dropdown-content.show {
    display: block;
}

/* Reset button-specific styles for dropdown items */
button.dropdown-item {
    font-weight: normal;
}

.info-icon {
    cursor: pointer;
    color: #0b69d6;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #0b69d6;
    user-select: none;
    font-style: normal;
    line-height: 14px;
    font-size: 12px;
}
.info-icon:hover {
    background-color: #e7f3ff;
}

.pagination-controls {
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 8px;
    border-top: 1px solid #eef2ff;
    /* flex-shrink: 0; is removed as its parent .table-footer handles it */
}
.pagination-controls .input {
    padding: 4px 8px;
    font-size: 12px;
    height: 32px;
}
.pagination-controls .btn {
    height: 32px;
    font-size: 12px;
}
.pagination-controls span {
    font-size: 12px;
    color: #475569;
}

/* Excel-like Filter Styles */
.filter-icon, .copy-col-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    display: inline-block;
    vertical-align: middle;
    width: 16px;
    height: 16px;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 4px;
    opacity: 0.7;
}

.filter-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%236c757d" width="14" height="14"><path d="M3 6h18v2H3V6zm3 7h12v-2H6v2zm3 5h6v-2H9v2z"/></svg>');
}

.copy-col-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%230b69d6" width="14" height="14"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>');
    opacity: 0.6;
}

.filter-icon:hover, .copy-col-icon:hover {
    opacity: 1;
    background-color: #e0eaf6;
}
.filter-icon.active {
    opacity: 1;
    background-color: #f8d7da; /* Light red */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23dc3545" width="14" height="14"><path d="M3 6h18v2H3V6zm3 7h12v-2H6v2zm3 5h6v-2H9v2z"/></svg>');
}

.filter-popup {
    position: absolute;
    z-index: 1010;
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 6px;
    width: 280px;
}
.filter-popup-content {
    display: flex;
    flex-direction: column;
}
.filter-search-container {
    padding: 8px;
    border-bottom: 1px solid #eee;
}
#filterSearchInput {
    width: 100%;
    box-sizing: border-box;
    height: 32px;
}
.filter-values-container {
    max-height: 250px;
    overflow-y: auto;
    padding: 8px;
}
.filter-value-item {
    display: block;
    margin-bottom: 5px;
    padding: 2px 4px;
    border-radius: 4px;
}
.filter-value-item:hover {
    background-color: #f1f7ff;
}
.filter-value-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
}
.filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px;
    border-top: 1px solid #eee;
    background-color: #f8f9fa;
}
.filter-group { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
}
.filter-group label { 
    display: flex; 
    align-items: center; 
    gap: 5px; 
    font-size: 13px; 
    cursor: pointer; 
}

/* Price Warning Toast */
.toast-warning {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    padding: 12px 16px;
    z-index: 2000;
    border-left: 5px solid #ffc107;
    min-width: 300px;
}
.toast-icon {
    font-size: 24px;
    margin-right: 12px;
}
.toast-content {
    font-size: 14px;
    color: #333;
}
.toast-content strong {
    color: #000;
}
.toast-content .price-value {
    font-weight: bold;
    color: #dc3545; /* Red for emphasis */
}
.toast-content .budget-value {
    font-weight: bold;
    color: #28a745; /* Green for emphasis */
}
.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    margin-left: auto;
    padding: 0 0 0 16px;
}
.toast-close:hover {
    color: #333;
}

/* Multi-select Status Dropdown */
.multiselect-status-container {
    position: relative;
    width: 100%;
}
.multiselect-status-container.active {
    z-index: 5; /* Ensure dropdown appears over sticky headers */
}
/* Enhanced Status Display as Input */
.multiselect-status-display-input {
    width: 100%;
    padding: 4px 8px;
    padding-right: 20px; /* Space for arrow */
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    box-sizing: border-box;
    font-family: inherit;
    font-size: inherit;
    min-height: 24px;
    cursor: text;
}
.multiselect-status-display-input:focus {
    border-color: var(--accent);
    outline: none;
}

/* New Explicit Arrow for Status Dropdown */
.status-dropdown-arrow {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #666;
    cursor: pointer;
    z-index: 6; /* Higher than input */
    padding: 4px; /* clickable area */
    user-select: none;
    line-height: 1;
}
.status-dropdown-arrow:hover {
    color: #0b69d6;
}

/* Status Tooltip */
.status-input-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background-color: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 2005;
    margin-bottom: 5px;
    pointer-events: none;
}
.multiselect-status-display-input:focus + .status-input-tooltip {
    display: block;
}

.multiselect-status-dropdown {
    display: none;
    position: absolute;
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 4px;
    z-index: 2001 !important;
    width: 250px;
    max-height: 300px;
    overflow-y: auto;
    top: 100%; /* Position below the cell */
    margin-top: 2px;
    left: 0;
}
/* NEW: Rule to fix dropdown alignment in the last column */
td.sticky-col-last .multiselect-status-dropdown {
    left: auto;
    right: 0;
}

.multiselect-status-dropdown.show {
    display: block;
}
.multiselect-status-dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: normal;
    position: relative; /* For absolute positioning of delete btn */
}
.multiselect-status-dropdown label:hover {
    background-color: #f1f7ff;
}
.multiselect-status-dropdown label input {
    vertical-align: middle;
}

/* Status Edit Button (Batch Modal) */
.edit-status-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #fff;
    color: #0b69d6; /* Blue */
    border: 1px solid #0b69d6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-left: auto; /* Push to right, before delete btn */
    margin-right: 4px;
}
.edit-status-btn:hover {
    background-color: #0b69d6;
    color: white;
}

/* Status Delete Button (Batch Modal) */
.delete-status-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #fff;
    color: #dc3545;
    border: 1px solid #dc3545;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-left: 0; 
}
.delete-status-btn:hover {
    background-color: #dc3545;
    color: white;
}

/* Small edit button for filter popup */
.edit-status-btn-small {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #fff;
    color: #0b69d6;
    border: 1px solid #0b69d6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    margin-right: 4px;
}
.edit-status-btn-small:hover {
    background-color: #0b69d6;
    color: white;
}

/* Small delete button for filter popup */
.delete-status-btn-small {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #f8d7da;
    color: #dc3545;
    border: 1px solid #f5c6cb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}
.delete-status-btn-small:hover {
    background-color: #dc3545;
    color: white;
}


/* Fix for table cell dropdowns clipping */
td.dropdown-active {
    z-index: 3001 !important; /* Must be higher than other sticky cols and header */
    overflow: visible !important;
}
td.td-overflow-visible {
    overflow: visible;
    z-index: 5;
}

/* Officer-specific row colors for Compare View */
tr.officer-giang {
    color: #551a8b; /* Purple */
}
tr.officer-huyen {
    color: #001f3f; /* Navy */
}
tr.officer-an {
    color: #1c1e21; /* Black */
}

tr.officer-giang td, tr.officer-huyen td, tr.officer-an td {
    font-weight: 500;
}
tr.officer-giang .input, tr.officer-giang .multiselect-status-display,
tr.officer-huyen .input, tr.officer-huyen .multiselect-status-display,
tr.officer-an .input, tr.officer-an .multiselect-status-display {
    color: inherit;
    font-weight: 500;
}

/* Background color for officer cell */
tr.officer-giang .supply-officer-cell {
    background-color: #f2e6ff; /* Light Purple */
}
tr.officer-huyen .supply-officer-cell {
    background-color: #e7f3ff; /* Light Blue */
}
tr.officer-an .supply-officer-cell {
    background-color: #f0f0f0; /* Light Grey for Black */
}


/* Reset text color to black inside the specific officer cell and its select element */
tr.officer-giang .supply-officer-cell,
tr.officer-huyen .supply-officer-cell,
tr.officer-an .supply-officer-cell,
tr.officer-giang .supply-officer-cell select,
tr.officer-huyen .supply-officer-cell select,
tr.officer-an .supply-officer-cell select {
    color: #0b2944; /* Default dark text color */
}


/* Stale Data Warning Animation */
@keyframes blink-animation {
    50% { opacity: 0.2; }
}
@keyframes blink-text-animation {
    50% { color: #fff; }
}

/* Delay Risk animation */
.flashing-red-square {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #dc3545;
    margin-right: 5px;
    animation: blink-red-square 1s infinite;
    vertical-align: middle;
}
@keyframes blink-red-square {
    50% { opacity: 0; }
}

/* Framed Button Group */
.export-group {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #dc3545;
    padding: 4px 8px;
    border-radius: 6px;
}
.export-group-label {
    font-weight: 600;
    font-size: 13px;
    color: #343a40;
}

/* Increase size of radio buttons in RFQ Management's supplier list */
#nccTable tbody input[type="radio"],
#nccTable tbody input[type="checkbox"] {
    transform: scale(1.4);
    cursor: pointer;
}

/* NEW: Styles for the manual copy section in modals */
.copy-field {
    display: flex;
    align-items: center;
    gap: 8px;
}
.copy-field label {
    flex-basis: 80px;
    flex-shrink: 0;
    font-weight: 600;
}
.copy-field input, .copy-field textarea {
    flex-grow: 1;
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 6px 8px;
    font-family: Segoe UI, Roboto, Arial;
    font-size: 13px;
    border-radius: 4px;
}
.copy-field textarea {
    height: 100px;
    resize: vertical;
}
.copy-field button {
    flex-shrink: 0;
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.external-item td {
    color: #dc3545 !important;
}
.external-item td input, .external-item td select {
    color: #dc3545 !important;
}

/* NEW: Style for external-only items in Compare View */
tr.external-only-item td {
    color: var(--navy) !important;
    font-weight: 600;
}
tr.external-only-item td input, tr.external-only-item td select {
    color: var(--navy) !important;
    font-weight: 600;
}


/* NEW: Table Footer and Resizer Styles */
.table-footer {
    flex-shrink: 0;
    background-color: white;
}
.table-resizer {
    height: 10px;
    background-color: #f1f7ff;
    cursor: ns-resize;
    user-select: none;
    border-top: 1px solid #d0d7e5;
}
.table-resizer:hover {
    background-color: #e0eaf6;
}
.table-resizer:active {
    background-color: #c8daF3;
}

/* Styles for expandable text cells */
.expandable-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.expandable-cell .text-content {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
}
.expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #0b69d6;
    font-weight: bold;
    padding: 0 4px;
    margin-left: 5px;
    flex-shrink: 0;
}
.expand-tooltip {
    display: none;
    position: fixed; /* Use fixed positioning to escape table overflow */
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    padding: 8px;
    border-radius: 4px;
    z-index: 1100;
    max-width: 400px;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.6;
}
.expand-tooltip.show {
    display: block;
}

/* Action Groups in Compare View Toolbar */
.action-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
    height: 32px;
    padding: 0 10px;
    font-size: 12px;
}
.btn-icon:hover {
    background-color: #e9ecef;
}
.btn-icon .icon {
    font-size: 14px;
}
.action-group-separator {
    width: 1px;
    height: 20px;
    background-color: #dee2e6;
    margin: 0 4px;
}
.btn-icon-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}
.btn-icon-success:hover {
    background-color: #c3e6cb;
}
.btn-icon-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}
.btn-icon-danger:hover {
    background-color: #f5c6cb;
}

/* Status colors */
.status-waiting {
    background-color: #fff3cd !important;
    color: #856404 !important;
    font-weight: bold;
}

/* Multi-filter modal styling */
#multiFilterInputContainer {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.multi-filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.multi-filter-item input {
    flex-grow: 1;
}
.btn-delete-search-item {
    background: #f8d7da;
    color: #dc3545;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 24px;
    cursor: pointer;
    padding: 0;
    font-weight: bold;
}
.btn-delete-search-item:hover {
    background: #dc3545;
    color: white;
}

/* Batch Status Modal */
.batch-status-container {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}
.batch-status-column {
    flex: 1;
    border: 1px solid #eef2ff;
    border-radius: 6px;
    padding: 15px;
}
.batch-status-column h4 {
    margin-top: 0;
}
.status-checklist {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}
.status-checklist label {
    display: block;
    margin-bottom: 8px;
    padding: 4px;
    border-radius: 4px;
}
.status-checklist label:hover {
    background-color: #f1f7ff;
}

/* NEW: Reports View */
#reportsView .container {
    max-width: 100%;
    margin: 0;
    padding: 0;
}
.report-sidebar {
    flex: 0 0 10%; /* Fixed width 10% */
    max-width: 10%;
    min-width: 120px; /* Prevent too small width */
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
.report-tab-btn {
    background: none;
    border: none;
    text-align: left;
    padding: 12px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    border-left: 3px solid transparent;
}
.report-tab-btn:hover {
    background-color: #e9ecef;
}
.report-tab-btn.active {
    font-weight: 600;
    color: var(--accent);
    background-color: #e7f3ff;
    border-left-color: var(--accent);
}
.report-main-content {
    flex: 1; /* Takes remaining space (30% when detail visible, 90% when not) */
    min-width: 0; /* Critical for shrinking below content size */
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.report-content {
    flex-grow: 1;
}
.report-detail-pane {
    flex: 0 0 60%; /* Fixed width 60% */
    max-width: 60%;
    border-left: 1px solid #dee2e6;
    background-color: #fff;
    overflow-y: auto;
    padding: 20px;
    display: none;
}
.report-detail-pane.visible {
    display: block;
}
.report-tab {
    display: none;
}
.report-tab.active {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.report-filters {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    flex-shrink: 0;
}
.report-chart-container {
    height: 55vh; /* Adjusted height for better aspect ratio in narrow column */
    min-height: 350px;
    position: relative;
    flex-shrink: 0;
    width: 100%;
}
.report-detail-container {
    margin-top: 20px;
    flex-grow: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.report-detail-container h4 {
    margin-bottom: 10px;
    color: var(--navy);
}
.report-detail-table {
    overflow: auto;
    max-height: 70vh;
    border: 1px solid #eef2ff;
    border-radius: 4px;
    flex-grow: 1;
}
.report-detail-table table {
    font-size: 12px;
    width: 100%;
    border-collapse: collapse;
}
.report-detail-table th, .report-detail-table td {
    padding: 8px;
    border: 1px solid #d0d7e5;
    white-space: nowrap;
}
/* Sticky Header for Report Detail Tables */
.report-detail-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f1f7ff;
    box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
}


/* PD Trinh View Styles */
#pdTrinhView {
    display: none; /* Hidden by default */
    flex-direction: column;
    height: 100%;
    background-color: #f0f2f5;
}
.pd-trinh-toolbar {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: white;
    border-bottom: 1px solid #ddd;
}
.pd-trinh-toolbar h3 {
    margin: 0;
    color: var(--navy);
}
.pd-trinh-editor-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
}
#pdTrinhEditor {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    outline: none;
    line-height: 1.6;
    font-size: 11pt;
}
#pdTrinhEditor table {
    border-collapse: collapse;
    width: 100%;
    font-size: 9pt; /* Smaller font for tables */
    margin: 15px 0;
}
#pdTrinhEditor th, #pdTrinhEditor td {
    border: 1px solid #999;
    padding: 4px 6px;
    vertical-align: top;
}
#pdTrinhEditor th {
    background-color: #f2f2f2;
    font-weight: bold;
}
#pdTrinhEditor .manual-input {
    color: #dc3545;
    font-weight: bold;
}

/* NEW: Weekly Report Compact Styles */
#weeklyReportContainer .report-detail-table table {
    font-size: 11px; /* Smaller font for compact view */
}
#weeklyReportContainer .report-detail-table th,
#weeklyReportContainer .report-detail-table td {
    padding: 4px 6px; /* Reduced padding */
}
.weekly-report-group-header td {
    background-color: #e9ecef;
    font-weight: bold;
    color: #343a40;
}
a.report-drilldown-link {
    text-decoration: underline;
    color: #0056b3;
    font-weight: bold;
    cursor: pointer;
}
a.report-drilldown-link:hover {
    color: #007bff;
}

/* NEW: Breadcrumb Context Styles for Compare View */
.breadcrumb-context-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #f1f7ff;
    padding: 6px 10px;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
}
.breadcrumb-label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
}
.breadcrumb-pill {
    background-color: #fff;
    border: 1px solid #d0d7e5;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #495057;
}
.breadcrumb-pill.active {
    font-weight: bold;
    color: var(--navy);
    background-color: #d1e7fd;
    border-color: #a3c9f5;
}
.breadcrumb-separator {
    color: #6c757d;
}
.breadcrumb-clear-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 20px;
    font-weight: bold;
    color: #6c757d;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}
.breadcrumb-clear-btn:hover {
    color: #dc3545;
}

/* Copy on Hover Styles */
.cell-copy-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: relative;
    min-height: 20px; /* Ensure height for hover target */
}
.cell-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-grow: 1;
    display: block;
}
.btn-cell-copy {
    display: none; /* Hidden by default */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 6px;
    width: 16px;
    height: 16px;
    /* Green copy icon */
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%2328a745"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0.8;
    flex-shrink: 0;
    vertical-align: middle;
}
.cell-copy-wrapper:hover .btn-cell-copy {
    display: inline-block;
}
.btn-cell-copy:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Copy Success Tooltip */
.copy-success-tooltip {
    position: fixed; /* Fixed to screen to avoid overflow clipping */
    background-color: #28a745;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    white-space: nowrap;
    animation: fadeOut 1.5s forwards;
}
@keyframes fadeOut {
    0% { opacity: 1; transform: translateY(0); }
    70% { opacity: 1; transform: translateY(-10px); }
    100% { opacity: 0; transform: translateY(-20px); }
}
/* Legend Box */
.legend-box {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #555;
    flex-wrap: wrap;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.legend-item .price-indicator {
    display: inline-block; /* Ensure display */
}

/* NEW: Fix Dropdown Visibility */
.filter-controls {
    position: relative;
    z-index: 5; /* Ensure dropdowns appear over table headers */
}

/* General Notification Overlay Styles (Global) */
.notification-overlay { 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(2,6,23,0.9); 
    z-index: 5000; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}
.notification-popup { 
    background: white; 
    padding: 20px; 
    border-radius: 8px; 
    max-width: 600px; 
    width: 90%; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
    position: relative; 
    max-height: 80vh; 
    overflow-y: auto; 
}
.notification-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 10px; 
    margin-bottom: 15px; 
}

/* Clean Input for Editable Tables (Supplier Manager) */
.clean-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 6px 8px; /* Match standard td padding */
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    box-sizing: border-box;
    display: block;
}
.clean-input:hover {
    border-color: #d0d7e5;
    background-color: #fff;
}
.clean-input:focus {
    border-color: var(--accent);
    background-color: #fff;
    outline: none;
}

/* Remove padding from cells containing clean-input to ensure full fill */
#supplierTable td {
    padding: 0;
    height: 32px; /* Ensure minimum height */
}
#supplierTable td input.clean-input,
#supplierTable td select.clean-input {
    height: 100%;
    margin: 0;
}

/* NEW: Warning Modal for Status Deletion */
.status-warning-modal-content {
    text-align: center;
}
.status-warning-modal-content h3 {
    color: #dc3545;
    margin-top: 0;
}
.status-warning-modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}]]