.panel.active .table-wrap table tbody tr:hover td {
    background-color: #e0f2ff !important;
    transition: background-color 0.2s ease-in-out;
}

.egas-alert {
    color: red;
    font-weight: bold;
}

#globalSearch {
    min-width: 200px;
}

#scrollTopBtn {
    position: fixed;
    bottom: 32px;
    right: 32px;
    z-index: 9999;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    font-size: 22px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

td.highlight-bg {
    background-color: #eaf8fa !important;
    /* xanh nhạt */
    font-weight: bold;
}

#link-sanluong {
    font-size: 13px;
}

#scrollTopBtn:hover {
    background: #217dbb;
}

table th,
table td {
    border-right: 1px solid #e0e0e0;
    /* Màu xám nhạt */
}

table th:last-child,
table td:last-child {
    border-right: none;
    /* Không kẻ ở cột cuối */
}

:root {
    --bg: #ffffff;
    /* Nền chính */
    --card: #f9f9f9;
    /* Màu nền cho bảng, panel */
    --muted: #6b7280;
    /* Màu chữ phụ */
    --text: #111827;
    /* Màu chữ chính */
    --accent: #3b82f6;
    /* Màu nhấn xanh */
    --border: #e5e7eb;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    background: var(--bg);
    color: var(--text);
}

header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 50;
}

.wrap-main {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0px 12px;
}

.wrap-head {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding-top: 0px;
    padding-left: 14px;
    padding-right: 14px;
    padding-bottom: 7px
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--accent);
}

h1 {
    margin: 0;
    font-size: 18px;
}

button,
select,
input {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 14px;
}

button {
    cursor: pointer;
}

button.primary {
    background: var(--accent);
    color: white;
    border-color: transparent;
}

.hint {
    color: var(--muted);
    font-size: 12px;
}

.tabbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.tab {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
}

.tab.active {
    background: var(--accent);
    color: white;
    border-color: transparent;
}

.mobile-select {
    display: none;
}

.panel {
    display: none;
    padding: 14px;
    border: 1px solid var(--border);
    padding-top: 3px;
    border-radius: 14px;
    background: var(--card);
}

.panel.active {
    display: block;
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;

}

.table-wrap {
    max-height: 700px;
    /* Chiều cao cố định để bật cuộn */
    overflow-y: auto;
    /* Bắt buộc có dòng này */
    overflow-x: auto;
    /* Cho cuộn ngang nếu cần */
    position: relative;
    /* Cần thiết để sticky hoạt động */
    border-radius: 12px;
    border: 1px solid var(--border);
    background: white;
    width: 100%;
    max-width: 100%;
}

thead tr:nth-child(1) th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--card);
}

thead tr:nth-child(2) th {
    position: sticky;
    top: 42px;
    /* đúng bằng chiều cao dòng đầu tiên */
    z-index: 2;
    background: var(--card);
}


table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.search-box {
    position: relative;
    display: inline-block;
}
.search-box input[type="text"] {
    padding-left: 28px; /* Để chừa chỗ cho icon */
    height: 32px;
}
.search-box .bi-search {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: #db4f74; /* Màu xanh dương */
    font-size: 16px;
    pointer-events: none;
}
thead th {
    position: sticky;
    top: 0;
    background: var(--card);
    color: var(--text);
    text-align: center;
    z-index: 2;
}
.cell-link { cursor: pointer; text-decoration: none; }
.cell-link:hover { text-decoration: underline; }
#panel-HDDT {
    padding-left: 0px;
    padding-right: 0px;
    padding-top: 0px;
}

/* ===== Modal chung ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.modal {
  background: #fff; 
  border-radius: 12px; 
  padding: 14px;
  width: 520px; 
  max-width: calc(100% - 24px);
  box-shadow: 0 10px 40px rgba(0,0,0,.2);
}
.modal header { font-weight: 600; margin-bottom: 10px; }
.modal .row { gap: 8px; justify-content: flex-end; }
.modal .form { display: grid; grid-template-columns: 130px 1fr; gap: 8px 10px; margin: 12px 0; }
.modal label { color: var(--muted); font-size: 13px; align-self: center; }
.modal input { width: 100%; padding: 8px 10px; }
.modal .hint { margin-top: 6px; }

.pdf-viewer {
  width: 80vw; max-width: 1100px; height: 100vh;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: #fff;
}
.pdf-viewer iframe { width: 100%; height: 100%; border: 0; }
#loading-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #5c98f7;
  color: white;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  z-index: 9999;
  display: none;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    background: white;
}

td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 768px) {
    .tabbar {
        display: none;
    }

    .mobile-select {
        display: block;
    }

    .chart-row {
        flex-direction: column !important;
    }
}

.chart-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    flex-direction: row;
}

.chart-container {
    resize: vertical;
    overflow: auto;
    min-height: 150px;
    max-height: 500px;
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: #f8f9fa;
}

.linked-table td,
.linked-table th {
    text-align: center;
    vertical-align: middle;
}

.linked-table td.left {
    text-align: left;
}
