/* Giao diện theo VFC Brand Guidelines. Màu và font lấy từ config/hub_config.py (THEME),
   được base.html đưa vào dạng biến CSS. */
@font-face { font-family: 'Encode Sans'; font-weight: 400; font-style: normal; font-display: swap; src: url('fonts/EncodeSans-Regular.ttf') format('truetype'); }
@font-face { font-family: 'Encode Sans'; font-weight: 600; font-style: normal; font-display: swap; src: url('fonts/EncodeSans-SemiBold.ttf') format('truetype'); }
@font-face { font-family: 'Encode Sans'; font-weight: 700; font-style: normal; font-display: swap; src: url('fonts/EncodeSans-Bold.ttf') format('truetype'); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: var(--font); font-weight: 400; font-size: 14px; color: var(--text); background: var(--bg); line-height: 1.5; text-align: left; }
a { color: var(--accent); }

.banner { background: var(--highlight); color: var(--text); font-weight: 600; padding: 6px 16px; font-size: 14px; text-align: center; }

/* Logo: bản kèm khẩu hiệu hiển thị tối thiểu cao 60,6 px (guideline trang 23). Ảnh có viền trống, phần nhìn thấy
   chiếm khoảng 79% chiều cao ảnh, nên đặt cao 80 px. Không kéo giãn, không đổi màu, không thêm viền hay bóng. */
.brandbar { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; background: var(--surface); color: var(--text); padding: 2px 28px; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--accent); }
.logo { height: 96px; width: auto; max-width: 100%; display: block; }
.brand-name { font-weight: 700; font-size: 19px; color: var(--accent); }
.who { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.who form { margin: 0; }
.login-box input[type=password] { width: 100%; min-width: 0; }
button.linklike { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

/* Nút chuyển chế độ sáng/tối: nằm trên thanh logo nên dùng màu bản sáng */
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.theme-toggle:hover { background: var(--hover); filter: none; }
.theme-toggle svg { width: 16px; height: 16px; fill: currentColor; }
.theme-toggle .ic-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: inline; }

/* Thanh điều hướng tối giản: nền phẳng, mục đang mở gạch chân màu chủ đạo */
.navbar { display: flex; flex-wrap: wrap; background: var(--surface); padding: 0 20px; border-bottom: 1px solid var(--border); }
.navbar a { color: var(--muted); font-weight: 600; font-size: 13px; text-decoration: none; padding: 10px 12px; border-bottom: 3px solid transparent; text-transform: uppercase; letter-spacing: 0.02em; }
.navbar a:hover { color: var(--text); border-bottom-color: var(--highlight); }
.navbar a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

main { max-width: 1600px; margin: 0 auto; padding: 22px 28px 56px; }
td, th, .num, .big, .kpi-value { font-variant-numeric: tabular-nums; }
h1 { font-size: 24px; font-weight: 700; color: var(--accent); margin: 0 0 14px; }
h2 { font-size: 18px; font-weight: 600; color: var(--accent); margin: 26px 0 8px; }
/* Tên hub và các tiêu đề viết hoa (chủ hub yêu cầu 02/11/2026). Chỉ đổi cách hiển thị, nội dung gốc giữ nguyên. */
.brand-name, h1, h2, h3, summary { text-transform: uppercase; letter-spacing: 0.02em; }
h1 { font-size: 20px; } h2 { font-size: 15px; } h3 { font-size: 14px; }

.card { background: var(--surface); border: 0; border-radius: 10px; padding: 16px 20px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 13px; }
th, td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: var(--tint); font-weight: 600; }
.num { text-align: right; }
.muted { color: var(--muted); font-size: 13px; }

.msg { padding: 8px 12px; border: 1px solid var(--border); background: var(--surface); margin-bottom: 12px; border-radius: 4px; }
.msg-success { border-left: 4px solid var(--accent); }
.msg-error { border-left: 4px solid var(--error); }
.errors li { color: var(--error); }
.warn-row td { background: var(--tint); }
.warn-row td:first-child { border-left: 4px solid var(--highlight); }

form.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
label { display: block; font-size: 14px; margin-bottom: 2px; }
input[type=text], input[type=password], select, input[type=file] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); font: inherit; min-width: 220px; }
button, .btn { padding: 7px 14px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 600; border-radius: 4px; cursor: pointer; font-family: inherit; font-size: inherit; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { filter: brightness(1.12); }
.btn-plain { background: var(--surface); color: var(--accent); }

.tag { display: inline-block; border: 1px solid var(--border); border-radius: 3px; padding: 0 6px; font-size: 12px; background: var(--tint); }
.tag-high { border-color: var(--error); color: var(--error); background: var(--surface); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.big { font-size: 28px; font-weight: 700; color: var(--accent); }
.login-box { max-width: 380px; margin: 40px auto; }

/* Trang chân dung (M3) */
h3 { font-size: 16px; font-weight: 600; color: var(--accent); margin: 0 0 8px; }
.card-warn { border-left: 4px solid var(--highlight); background: var(--tint); }
form.inline { display: inline; margin-left: 12px; }
.progress { height: 10px; background: var(--tint); border: 1px solid var(--border); border-radius: 5px; margin: 8px 0; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); }
details { margin-bottom: 10px; }
summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: 6px 0; }
table.bars td { vertical-align: middle; }
.bar { height: 14px; border-radius: 3px; min-width: 2px; }
.bar-sell { background: var(--accent); }
.bar-thu { background: var(--green); }
.year-cell { font-weight: 600; white-space: nowrap; }
.money-main { font-size: 17px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; margin-top: 3px; }
.money-full { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
input[type=date], textarea { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); font: inherit; min-width: 220px; }
textarea { width: 100%; max-width: 520px; }
form p label { font-weight: 600; }
.errorlist { color: var(--error); list-style: none; padding: 0; margin: 4px 0; }

.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
.rate-main { font-size: 18px; font-weight: 700; color: var(--accent); }
.stars { color: var(--highlight); letter-spacing: 1px; white-space: nowrap; }
h3 { font-size: 16px; margin: 4px 0 8px; }
.radio { display: inline-block; margin-right: 18px; font-size: 15px; }
.review-form { margin-top: 8px; }

/* ===== Lưới 12 cột kiểu Bento (Tổng quan) ===== */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.col-span-3 { grid-column: span 3; } .col-span-4 { grid-column: span 4; } .col-span-5 { grid-column: span 5; }
.col-span-6 { grid-column: span 6; } .col-span-7 { grid-column: span 7; } .col-span-8 { grid-column: span 8; }
.col-span-12 { grid-column: span 12; }
/* Thẻ là mảng màu trên nền trang, không viền; độ nổi khối (bóng mềm, hiệu ứng rê chuột) nằm ở cuối file */
.tile { background: var(--surface); border: 0; border-radius: 12px; padding: 16px 18px; min-width: 0; }
.tile h3 { margin: 0 0 4px; }
.tile-note { color: var(--muted); font-size: 12.5px; margin: 0 0 8px; }
.tile p { margin: 6px 0; }

/* Thẻ KPI nhỏ */
.kpi { position: relative; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.kpi-value { font-size: 38px; font-weight: 700; color: var(--vfc-primary); line-height: 1.05; margin: 6px 0 8px; letter-spacing: -0.01em; }
.kpi-help { color: var(--muted); font-size: 13px; }
.kpi-icon { position: absolute; top: 14px; right: 14px; width: 26px; height: 26px; }
/* Điểm nhấn táo bạo: mỗi trang chỉ một thẻ cần chú ý nhất, tô mảng Cam VFC đặc */
.kpi-alert { background: var(--vfc-accent); }
.kpi-alert .kpi-label, .kpi-alert .kpi-value, .kpi-alert .kpi-help, .kpi-alert button.info-btn { color: #1A1A1A; }
.kpi-alert .badge { background: rgba(255, 255, 255, .6); color: #1A1A1A; }
.kpi-alert .kpi-icon { display: none; }

/* Badge ngữ nghĩa: chỉ dùng cho nhãn tăng/giảm, cảnh báo */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--ok-bg); color: var(--ok-text); font-variant-numeric: tabular-nums; }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }
.badge-bad { background: var(--bad-bg); color: var(--bad-text); }
.badge-flat { background: var(--vfc-primary-light); color: var(--vfc-primary); }

/* Biểu đồ SVG */
.chart { width: 100%; height: auto; display: block; font-family: var(--font); }
.chart text { font-size: 12px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .bar-actual { fill: var(--vfc-primary); }
.chart .bar-est { fill: var(--vfc-primary-40); }
.chart .bar-label { fill: var(--text); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; }
.donut { width: 100%; max-width: 200px; height: auto; }
.donut circle { fill: none; stroke-width: 6; }
.donut text { text-anchor: middle; fill: var(--text); }
.donut .center-num { font-size: 9px; font-weight: 700; fill: var(--vfc-primary); }
.donut .center-lab { font-size: 3.2px; fill: var(--muted); }
.seg-active { stroke: var(--vfc-primary); }
.seg-ceased { stroke: var(--vfc-primary-40); } .seg-never { stroke: var(--neutral); }
.dot-active { background: var(--vfc-primary); }
.dot-ceased { background: var(--vfc-primary-40); } .dot-never { background: var(--neutral); }

/* Thanh ngang (cơ cấu) */
.hbars { display: grid; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: 110px 1fr 56px; gap: 10px; align-items: center; font-size: 14px; }
.hbar-track { background: var(--vfc-primary-light); border-radius: 4px; height: 12px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--vfc-primary); border-radius: 4px; }
.hbar-fill.s2 { background: var(--vfc-primary-80); } .hbar-fill.s3 { background: var(--vfc-primary-60); } .hbar-fill.s4 { background: var(--vfc-primary-40); }
.hbar-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.progress-time { position: relative; height: 12px; background: var(--vfc-primary-light); border-radius: 6px; margin: 10px 0 4px; }
.progress-time .fill { height: 100%; background: var(--vfc-primary); border-radius: 6px; }
.progress-time .mark { position: absolute; top: -4px; width: 2px; height: 20px; background: var(--vfc-accent); }

/* Lưới Swiss lộ thiên: bảng tra cứu, full width */
.swiss-toolbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: end; padding: 14px 16px; background: var(--surface); border: 0; border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; }
.swiss-toolbar > div { display: flex; flex-direction: column; }
.swiss-toolbar label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.swiss-toolbar input[type=text], .swiss-toolbar select { min-width: 0; width: 100%; border-radius: 6px; }
.swiss-toolbar .grow { flex: 1 1 220px; }
.swiss-toolbar .shrink { flex: 0 1 150px; }
.swiss-toolbar button, .swiss-toolbar .btn { border-radius: 6px; }
.swiss-toolbar input:focus, .swiss-toolbar select:focus { outline: 2px solid var(--vfc-primary); outline-offset: 0; }
.swiss-wrap { overflow: auto; max-height: 72vh; border: 0; border-radius: 0 0 10px 10px; background: var(--surface); }
.swiss-wrap.standalone { border-radius: 10px; }
table.swiss { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 0; }
/* Lưới Swiss tối giản: chỉ kẻ ngang mảnh, không kẻ dọc */
table.swiss th, table.swiss td { border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 8px 10px; vertical-align: middle; }
table.swiss thead th { position: sticky; top: 0; z-index: 2; background: var(--vfc-primary-light); color: var(--vfc-primary); font-weight: 600; font-size: 12px; line-height: 1.25; vertical-align: bottom; }
table.swiss tbody tr:hover td { background: var(--hover); }
table.swiss td.num, table.swiss th.num { text-align: right; }
table.swiss tr:last-child td { border-bottom: 0; }
.swiss-foot { color: var(--muted); font-size: 13px; margin: 8px 2px 0; }

/* Ma trận phân khúc */
table.matrix td.cell { text-align: center; font-weight: 700; }
.heat-0 { background: var(--heat-0); color: var(--heat-t0); } .heat-1 { background: var(--heat-1); color: var(--heat-t1); } .heat-2 { background: var(--heat-2); color: var(--heat-t2); }
.heat-3 { background: var(--heat-3); color: var(--heat-t3); } .heat-4 { background: var(--heat-4); color: var(--heat-t4); }

/* Hình học phẳng: các bước nối tiếp (cách tính) */
.steps { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--vfc-primary-40); }
.steps li { position: relative; padding: 4px 0 10px 18px; }
.steps li::before { content: ""; position: absolute; left: -7px; top: 9px; width: 12px; height: 12px; background: var(--surface); border: 2px solid var(--vfc-primary); transform: rotate(45deg); }
.empty-state { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 8px; }

/* Tablet: lưới 2 cột; điện thoại: 1 cột */
@media (max-width: 1024px) {
  .col-span-3, .col-span-4, .col-span-5, .col-span-6, .col-span-7, .col-span-8 { grid-column: span 6; }
}
@media (max-width: 767px) {
  .bento { gap: 12px; }
  .col-span-3, .col-span-4, .col-span-5, .col-span-6, .col-span-7, .col-span-8, .col-span-12 { grid-column: span 12; }
  .hbar-row { grid-template-columns: 90px 1fr 48px; }
  table.swiss th:first-child, table.swiss td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
  table.swiss thead th:first-child { z-index: 3; background: var(--vfc-primary-light); }
  .swiss-toolbar .grow { flex: 1 1 100%; }
  .swiss-toolbar .shrink { flex: 1 1 calc(50% - 10px); }
}
.progress-time .fill { max-width: 100%; }

/* Form nhập: hai cột trên máy tính, một cột trên điện thoại; ô nhập bo 6px, viền đổi sang màu chủ đạo khi chọn */
.fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 24px; }
.fields-grid p { margin: 8px 0; }
.fields-grid input[type=text], .fields-grid select, .fields-grid textarea, .fields-grid input[type=date] { width: 100%; min-width: 0; max-width: none; }
input[type=text], input[type=password], input[type=date], select, textarea { border-radius: 6px; }
button, .btn { border-radius: 6px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--vfc-primary); outline-offset: 0; border-color: var(--vfc-primary); }
.login-box { border-radius: 10px; }
.login-box input[type=text], .login-box input[type=password] { width: 100%; }
@media (max-width: 767px) { .fields-grid { grid-template-columns: minmax(0, 1fr); } }

/* Bấm vào biểu đồ, thẻ, dòng bảng để đi vào danh sách NPP tương ứng */
a.tile-link { display: block; color: inherit; text-decoration: none; cursor: pointer; }
a.tile-link:hover { box-shadow: inset 0 0 0 2px var(--vfc-primary); }
a:focus-visible { outline: 2px solid var(--vfc-primary); outline-offset: 2px; border-radius: 4px; }
.drill-hint { color: var(--vfc-primary); font-weight: 600; margin-left: 6px; }
a.title-link { color: inherit; text-decoration: none; }
a.title-link:hover { text-decoration: underline; }
.svg-link { cursor: pointer; }
.svg-link:hover .bar-actual { fill: var(--vfc-primary-80); }
.svg-link:hover .bar-est { fill: var(--vfc-primary-60); }
.svg-link:hover .bar-label { text-decoration: underline; }
.donut .svg-link:hover circle { stroke-width: 7.2; }
a.legend-link { color: inherit; text-decoration: none; }
a.legend-link:hover { text-decoration: underline; }
a.row-link { color: inherit; text-decoration: none; padding: 4px 6px; margin: -4px -6px; border-radius: 6px; }
a.row-link:hover { background: var(--vfc-primary-light); }
table.matrix td.cell { padding: 0; }
a.cell-link { display: block; padding: 10px; color: inherit; text-decoration: none; text-align: center; }
a.cell-link:hover { text-decoration: underline; box-shadow: inset 0 0 0 2px var(--vfc-primary); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
a.chip { background: var(--vfc-primary-light); color: var(--vfc-primary); border: 1px solid var(--vfc-primary-40); border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; text-decoration: none; }
a.chip:hover { background: var(--vfc-primary-40); }
a.cell-plain { color: inherit; text-decoration: none; display: block; }
a.cell-plain:hover { background: var(--vfc-primary-light); }

/* Dấu "i" chú giải ở mỗi tiêu đề: rê chuột, bấm hoặc dùng bàn phím để xem là gì, cách tính, cách đọc */
.tile-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.tile-head h3, .tile-head .kpi-label { margin: 0; }
.tile-head.page-head { justify-content: flex-start; align-items: center; margin-bottom: 14px; gap: 10px; }
.tile-head.page-head h1 { margin: 0; }
.tile-link { position: relative; }
.tile-link:hover { box-shadow: inset 0 0 0 2px var(--vfc-primary); }
.kpi-alert.tile-link:hover { box-shadow: inset 0 0 0 2px #1A1A1A; }
.tile-hit { position: absolute; inset: 0; z-index: 1; border-radius: 10px; }
.kpi .kpi-icon { top: auto; bottom: 14px; right: 14px; }
.info-tip { position: relative; display: inline-flex; z-index: 3; flex: none; vertical-align: middle; text-transform: none; letter-spacing: 0; font-weight: 400; }
button.info-btn { background: none; border: 0; padding: 2px; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); border-radius: 50%; cursor: help; }
button.info-btn:hover, button.info-btn:focus-visible, .info-tip.open button.info-btn { color: var(--vfc-primary); filter: none; }
button.info-btn svg { width: 16px; height: 16px; display: block; }
.info-pop { display: none; position: absolute; top: 100%; right: 0; width: 280px; max-width: calc(100vw - 24px); background: var(--surface); color: var(--text); border: 2px solid var(--vfc-primary-40); border-radius: 10px; padding: 10px 12px; z-index: 1000; font-size: 13px; line-height: 1.4; text-align: left; text-transform: none; letter-spacing: 0; font-weight: 400; white-space: normal; }
.info-pop::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.info-title { display: block; font-weight: 700; color: var(--vfc-primary); font-size: 14px; margin-bottom: 4px; }
.info-text { display: block; }
th .info-tip { margin-left: 4px; }

/* ===== Chuyển động nhẹ (khoảng 0,2 đến 0,5 giây) =====
   Dùng fill-mode "backwards" để sau khi chạy xong phần tử trở về trạng thái bình thường: không giữ lớp xếp chồng,
   nên khung giải thích "i" không bị thẻ phía sau đè lên. */
@keyframes vfc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes vfc-grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes vfc-grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.tile, .card { animation: vfc-fade .3s ease-out backwards; }
.chart .bar-actual, .chart .bar-est { transform-box: fill-box; transform-origin: bottom; animation: vfc-grow-y .5s ease-out backwards; }
.hbar-fill, .progress-time .fill { transform-origin: left; animation: vfc-grow-x .5s ease-out backwards; }
.donut a circle { animation: vfc-fade .6s ease-out backwards; }
a, button, .btn, .tile-link, a.row-link, a.cell-link, .hbar-fill { transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s; }
@keyframes vfc-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===== Gọn hơn, vừa màn hình hơn (chủ hub yêu cầu 03/11/2026) ===== */
input[type=text], input[type=password], input[type=date], select, textarea { padding: 5px 8px; font-size: 13px; }
button, .btn { padding: 6px 12px; font-size: 13px; }
.swiss-toolbar { padding: 10px 12px; gap: 8px 10px; border-radius: 12px 12px 0 0; }
.swiss-wrap { border-radius: 0 0 12px 12px; }
.swiss-wrap.standalone { border-radius: 12px; }
.chips { margin: 8px 0; }

/* Vạch nhấn mảnh bên trái thẻ số liệu: điểm nhận diện nhẹ, vẫn phẳng */
.kpi { overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--vfc-primary-40); }
.kpi-alert::before { background: #1A1A1A; }
h1 { display: flex; align-items: center; gap: 10px; }
h1 .tag { text-transform: none; letter-spacing: 0; }

/* Dải số tổng của danh sách: các thẻ nhỏ nằm cùng một hàng */
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 12px; }
.summary-strip .tile { padding: 12px 16px; }
.summary-strip .kpi-value { font-size: 26px; margin: 4px 0 0; }
.short-list { max-height: 300px; }

/* Danh sách NPP: cột tên khách hàng rộng, tên là dòng chính, mã là dòng phụ; các cột còn lại gọn, không phải kéo ngang */
table.swiss-list th, table.swiss-list td { white-space: nowrap; }
table.swiss-list th { white-space: normal; }
table.swiss-list td.wrap { white-space: normal; min-width: 96px; max-width: 190px; }
table.swiss-list th, table.swiss-list td { padding-left: 8px; padding-right: 8px; }
table.swiss-list .col-name { white-space: normal; width: 32%; min-width: 230px; }
table.swiss-list th.num, table.swiss-list td.num { min-width: 78px; }
table.swiss-list .col-code { width: 1%; min-width: 96px; font-weight: 600; }
table.swiss-list th:first-child, table.swiss-list td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
table.swiss-list thead th:first-child { z-index: 3; background: var(--vfc-primary-light); }
table.swiss-list tbody tr:hover td:first-child { background: var(--hover); }
a.npp-name { display: block; color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.3; text-decoration: none; }
a.npp-name:hover { color: var(--accent); text-decoration: underline; }
.npp-code { color: var(--muted); font-size: 12px; margin-top: 2px; }
.status { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--ok-bg); color: var(--ok-text); }
.status-da_ngung { background: var(--warn-bg); color: var(--warn-text); }
.status-chua_phat_sinh { background: var(--tint); color: var(--muted); }

/* Tiêu đề cột bấm được để sắp xếp: mũi tên mờ khi chưa xếp, đậm khi đang xếp theo cột đó */
a.sort { color: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
a.sort::after { content: "\2195"; margin-left: 4px; font-size: 11px; opacity: .35; }
a.sort:hover { text-decoration: underline; }
a.sort:hover::after { opacity: .8; }
a.sort.sorted::after { opacity: 1; color: var(--accent); }
a.sort.sorted-tang::after { content: "\25B2"; }
a.sort.sorted-giam::after { content: "\25BC"; }
a.sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* Cửa sổ nổi chứa chi tiết NPP hoặc danh sách NPP */
dialog.popup { border: 0; padding: 0; width: min(1240px, 96vw); height: min(92vh, 980px); max-width: none; max-height: none; border-radius: 14px; background: var(--bg); color: var(--text); overflow: hidden; }
dialog.popup[open] { display: flex; flex-direction: column; animation: vfc-pop .2s ease-out backwards; }
dialog.popup::backdrop { background: rgba(8, 20, 16, .55); }
dialog.popup.loading .popup-content { opacity: .5; }
.popup-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.popup-grow { flex: 1; }
.popup-bar a { font-size: 13px; font-weight: 600; }
.popup-content { flex: 1; overflow: auto; padding: 16px 22px 28px; outline: none; }
.popup-content > h1:first-child { margin-top: 0; }
.popup-filters { margin: 0 0 8px; }
.popup-filters > summary { text-transform: none; letter-spacing: 0; font-size: 13px; padding: 2px 0 6px; }
.popup-filters .swiss-toolbar { border-radius: 12px; }
body:has(dialog.popup[open]) { overflow: hidden; }

@media (max-width: 1024px) {
  main { padding: 16px 16px 48px; }
  .brandbar { padding: 2px 16px; }
}
@media (max-width: 767px) {
  .kpi-value { font-size: 32px; }
  table.swiss-list .col-name { min-width: 200px; width: auto; }
  dialog.popup { width: 100vw; height: 100vh; border-radius: 0; }
  .popup-content { padding: 12px 14px 24px; }
}

/* Nhận định tổng quan ở đầu trang chi tiết NPP: một câu kết luận, bốn khối ngắn, việc nên làm, nhận định của ASM */
.summary { background: var(--surface); border-radius: 12px; border-left: 5px solid var(--accent); padding: 16px 20px; margin: 0 0 18px; }
.summary-tot { border-left-color: var(--green); }
.summary-luu-y { border-left-color: var(--highlight); }
.summary-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.summary-head h2 { margin: 0; }
.summary-headline { font-size: 17px; font-weight: 600; line-height: 1.45; margin: 6px 0 14px; }
.summary-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; }
.summary h3 { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.summary ul { margin: 0; padding-left: 18px; }
.summary li { margin: 3px 0; line-height: 1.45; }
@media (min-width: 900px) { .summary-cols .summary-block.has-table { grid-column: span 2; } }
.summary-table td, .summary-table th { white-space: nowrap; }
.summary-wrap { max-height: none; margin: 2px 0 8px; border: 1px solid var(--border); }
table.summary-table { width: 100%; }
.summary-table thead th { position: static; }
.summary ul.todo-sub { margin-top: 2px; list-style: disc; }
.summary-todo, .summary-asm { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.summary blockquote { margin: 0 0 4px; padding: 8px 12px; background: var(--tint); border-radius: 8px; }
.summary textarea { width: 100%; max-width: none; }

/* Cụm trang xã hội và hình ảnh khách hàng, nằm trên mục nhận định (chỉ quản trị và lãnh đạo thấy) */
.cluster { background: var(--surface); border-radius: 12px; border-left: 5px solid var(--blue); padding: 14px 20px; margin: 0 0 16px; }
.cluster-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 12px 28px; }
.cluster h3 { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.cluster dl { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 4px 12px; margin: 0; }
.cluster dt { color: var(--muted); font-size: 13px; line-height: 1.4; }
.cluster dd { margin: 0; line-height: 1.4; overflow-wrap: anywhere; }

/* Điện thoại (dưới 768px): thanh đầu gọn, menu một hàng vuốt ngang, bộ lọc thu gọn, danh sách NPP thành từng thẻ.
   Máy tính vẫn là bản chính; phần này chỉ đổi cách xếp khi màn hẹp. */
.sort-strip { display: none; }
.filters-page.is-wide > summary { display: none; }
@media (max-width: 767px) {
  .banner { font-size: 12px; padding: 4px 12px; }
  .brandbar { gap: 2px 12px; padding: 2px 12px; }
  .brand-name { font-size: 15px; }
  .who { margin-left: 0; flex: 1 1 100%; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; padding-bottom: 6px; }
  .who > span { flex: 1 1 100%; }
  .theme-toggle { padding: 4px 10px; }
  .theme-toggle .theme-label { display: none; }
  .navbar { flex-wrap: nowrap; overflow-x: auto; padding: 0 6px; scrollbar-width: none; }
  .navbar::-webkit-scrollbar { display: none; }
  .navbar a { flex: 0 0 auto; white-space: nowrap; padding: 10px; }
  main { padding: 12px 12px 40px; }
  h1 { font-size: 18px; }

  .filters > summary { display: block; padding: 10px 14px; background: var(--surface); border-radius: 10px; box-shadow: inset 0 0 0 1px var(--border); }
  .filters[open] > summary { border-radius: 10px 10px 0 0; }
  .filters .swiss-toolbar { border-radius: 0 0 10px 10px; }
  .swiss-toolbar button, .swiss-toolbar .btn { min-height: 40px; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .summary-strip .tile { padding: 10px 12px; }
  .summary-strip .kpi-value { font-size: 20px; }
  .summary-strip .kpi-label { font-size: 12px; }

  .sort-strip { display: flex; gap: 6px; align-items: center; overflow-x: auto; white-space: nowrap; padding: 2px 0 10px; font-size: 13px; scrollbar-width: none; }
  .sort-strip::-webkit-scrollbar { display: none; }
  .sort-strip a.sort { padding: 6px 12px; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
  .sort-strip a.sort.sorted { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); font-weight: 600; }

  .swiss-wrap:has(.swiss-list) { overflow: visible; max-height: none; background: none; border-radius: 0; }
  table.swiss-list, table.swiss-list tbody { display: block; }
  table.swiss-list thead { display: none; }
  table.swiss-list tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 0 0 10px; padding: 12px 14px; background: var(--surface); border-radius: 12px; box-shadow: inset 0 0 0 1px var(--border); }
  table.swiss-list tbody td { display: block; padding: 0; border: 0; position: static; background: none; min-width: 0; max-width: none; width: auto; white-space: normal; text-align: left; }
  table.swiss.swiss-list tbody td, table.swiss.swiss-list tbody td.num { text-align: left; }
  table.swiss-list tbody td:first-child { position: static; background: none; }
  table.swiss-list tbody tr:hover td:first-child { background: none; }
  table.swiss-list td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 1px; }
  table.swiss-list td.col-name { grid-column: 1 / -1; order: -2; min-width: 0; }
  table.swiss-list td.col-code { grid-column: 1 / -1; order: -1; font-weight: 600; width: auto; min-width: 0; }
  table.swiss-list td.col-code::before { display: inline; margin: 0 6px 0 0; }
  table.swiss-list td.empty-state { grid-column: 1 / -1; }

  table.stack, table.stack tbody { display: block; }
  table.stack thead { display: none; }
  table.stack tbody tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--border); }
  table.stack tbody tr:last-child { border-bottom: 0; }
  table.stack tbody td { display: flex; gap: 10px; padding: 2px 0; border: 0; position: static; background: none; white-space: normal; text-align: left; min-width: 0; }
  table.stack tbody td:first-child { position: static; background: none; }
  table.stack td[data-label]::before { content: attr(data-label); flex: 0 0 36%; font-size: 12px; font-weight: 600; color: var(--muted); }
  table.stack td > * { min-width: 0; }
  table.stack td[data-empty] { display: none; }
  input[type=text], input[type=password], input[type=date], input[type=search], select, textarea { min-height: 44px; font-size: 16px; }
  button:not(.info-btn):not(.linklike):not(.theme-toggle), .btn { min-height: 44px; }
  .popup-bar .btn-plain, .popup-bar a { min-height: 44px; display: inline-flex; align-items: center; }
  table.swiss.stack tbody td, table.swiss.stack tbody td.num { text-align: left; }
  .swiss-wrap:has(table.stack) { overflow: visible; max-height: none; }
}

/* ===== Nổi khối, hiện đại hơn (chủ hub duyệt 05/11/2026, bước 1 của giao diện mới) =====
   Chỉ dùng màu và sắc nhạt của bộ nhận diện VFC; không đổi font, không đụng logo. Bóng là sắc xanh đậm của màu chủ đạo, mờ dần
   (chế độ tối dùng bóng đen). Chiều sâu có ba bậc: 1 là thẻ, 2 là khi rê chuột hoặc đang chọn, 3 là cửa sổ nổi và khung giải thích.
   Mọi bóng đi qua các biến --shadow-1..3, không viết rời. Không dùng biến đổi 3D: độ nổi đến từ bóng, viền sáng và nhấc nhẹ. */
:root {
  --shadow-color: 15, 74, 64;
  --shadow-1: 0 1px 2px rgba(var(--shadow-color), .07), 0 3px 10px -3px rgba(var(--shadow-color), .12);
  --shadow-2: 0 2px 4px rgba(var(--shadow-color), .08), 0 12px 26px -8px rgba(var(--shadow-color), .22);
  --shadow-3: 0 6px 12px rgba(var(--shadow-color), .10), 0 28px 56px -14px rgba(var(--shadow-color), .36);
  --edge: inset 0 1px 0 rgba(255, 255, 255, .75);
  --well: inset 0 1px 2px rgba(var(--shadow-color), .20);
  --focus-ring: 0 0 0 3px rgba(25, 105, 91, .22);
  --drop: drop-shadow(0 3px 3px rgba(var(--shadow-color), .20));
  /* Ba mức cảnh báo dùng chung toàn hub: xanh, vàng, đỏ. Màu đỏ lấy từ màu lỗi đang dùng, chờ Brand chốt màu cảnh báo. */
  --lvl-ok: var(--green);
  --lvl-warn: var(--highlight);
  --lvl-bad: var(--error);
}
:root[data-theme="dark"] {
  --shadow-color: 0, 0, 0;
  --shadow-1: 0 1px 2px rgba(var(--shadow-color), .40), 0 3px 10px -3px rgba(var(--shadow-color), .45);
  --shadow-2: 0 2px 4px rgba(var(--shadow-color), .42), 0 12px 26px -8px rgba(var(--shadow-color), .55);
  --shadow-3: 0 6px 12px rgba(var(--shadow-color), .45), 0 28px 56px -14px rgba(var(--shadow-color), .70);
  --edge: inset 0 1px 0 rgba(255, 255, 255, .07);
  --well: inset 0 1px 2px rgba(var(--shadow-color), .55);
  --focus-ring: 0 0 0 3px rgba(79, 168, 151, .38);
  --drop: drop-shadow(0 3px 3px rgba(var(--shadow-color), .45));
}

/* Thẻ: nổi nhẹ khỏi nền, mặt thẻ hơi chuyển sắc để có cảm giác khối */
.tile, .card, .summary, .cluster {
  box-shadow: var(--shadow-1), var(--edge);
  background-image: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 93%, var(--vfc-primary-light)) 100%);
}
.kpi-alert, .card-warn { background-image: none; }
.swiss-wrap { box-shadow: var(--shadow-1); }
.navbar { box-shadow: var(--shadow-1); position: relative; z-index: 5; }
.login-box { box-shadow: var(--shadow-2), var(--edge); }

/* Cửa sổ nổi và khung giải thích: bậc cao nhất */
dialog.popup { box-shadow: var(--shadow-3); }
dialog.popup::backdrop { backdrop-filter: blur(3px); }
.info-pop { box-shadow: var(--shadow-3); }

/* Nút: nổi nhẹ, nhấc lên khi rê chuột, ấn xuống khi bấm */
button:not(.info-btn):not(.linklike):not(.theme-toggle), .btn { box-shadow: var(--shadow-1), var(--edge); transition: transform .12s ease, box-shadow .15s ease, filter .15s ease; }
button:not(.info-btn):not(.linklike):not(.theme-toggle):active, .btn:active { transform: translateY(1px); box-shadow: var(--well); }
.theme-toggle { box-shadow: var(--shadow-1); }
input:focus, select:focus, textarea:focus { box-shadow: var(--focus-ring); }

/* Thanh ngang, thanh tiến độ, biểu đồ: có khối nổi hoặc lõm nhẹ */
.hbar-track, .progress, .progress-time { box-shadow: var(--well); }
.hbar-fill, .progress-fill, .progress-time .fill { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), inset 0 -2px 0 rgba(0, 0, 0, .12); }
.chart .bar-actual, .chart .bar-est, .donut { filter: var(--drop); }
.badge, .status { box-shadow: inset 0 0 0 1px rgba(var(--shadow-color), .10); }
a.chip { box-shadow: var(--shadow-1); }

/* Dòng bảng: vạch nhấn bên trái khi rê chuột */
table.swiss tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--vfc-primary); }

/* Ba mức cảnh báo dùng chung: huy hiệu, chấm và thanh */
.badge-ok { background: var(--ok-bg); color: var(--ok-text); }
.dot-ok, .bar-ok { background: var(--lvl-ok); }
.dot-warn, .bar-warn { background: var(--lvl-warn); }
.dot-bad, .bar-bad { background: var(--lvl-bad); }
.lvl-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(var(--shadow-color), .25); }

/* Hiệu ứng nhấc lên chỉ cho thiết bị có chuột; màn cảm ứng không bị kẹt trạng thái rê chuột */
@media (hover: hover) {
  .tile-link, a.row-link, a.chip, a.cell-link { transition: transform .18s ease, box-shadow .18s ease, background-color .15s, color .15s; }
  .tile-link:hover { transform: translateY(-3px); box-shadow: var(--shadow-2), var(--edge), inset 0 0 0 2px var(--vfc-primary); }
  .kpi-alert.tile-link:hover { box-shadow: var(--shadow-2), inset 0 0 0 2px #1A1A1A; }
  a.chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
  button:not(.info-btn):not(.linklike):not(.theme-toggle):hover, .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-2), var(--edge); }
  .tile:not(.tile-link):hover, .summary:hover, .cluster:hover { box-shadow: var(--shadow-2), var(--edge); }
  .tile, .summary, .cluster { transition: box-shadow .2s ease; }
}
/* Thẻ đang nhấc lên không được che khung giải thích "i" nằm trong thẻ khác (biến đổi tạo lớp xếp chồng riêng) */
@media (hover: hover) { .tile-link:hover, .tile-link:focus-within { z-index: 20; } }

/* Dòng tầng ở màn Tổng quan: tên tầng và mốc quy mô nằm trên cả hàng, thanh và số nằm hàng dưới (nhãn dài không bị bóp hẹp) */
.hbar-row.tier-row { grid-template-columns: minmax(0, 1fr) 56px; row-gap: 4px; }
.hbar-row.tier-row > span:first-child { grid-column: 1 / -1; }
/* ===== Ngăn chi tiết trượt từ bên phải (bước 2 giao diện mới, 05/11/2026) =====
   Bấm vào một trường hoặc một số liệu ở trang NPP thì mở ngăn này. Chỉ đổi vị trí ngang khi trượt vào, không dùng biến đổi 3D. */
@keyframes vfc-slide { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
dialog.drawer { border: 0; padding: 0; margin: 0 0 0 auto; width: min(560px, 100vw); height: 100vh; max-width: none; max-height: none; background: var(--bg); color: var(--text); border-radius: 18px 0 0 18px; overflow: hidden; box-shadow: var(--shadow-3); }
dialog.drawer[open] { display: flex; flex-direction: column; animation: vfc-slide .22s ease-out backwards; }
dialog.drawer::backdrop { background: rgba(8, 20, 16, .45); backdrop-filter: blur(2px); }
dialog.drawer.loading .drawer-content { opacity: .5; }
.drawer-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.drawer-bar a { font-size: 13px; font-weight: 600; }
.drawer-content { flex: 1; overflow: auto; padding: 14px 18px 28px; outline: none; }
body:has(dialog.drawer[open]) { overflow: hidden; }
@media (max-width: 767px) { dialog.drawer { width: 100vw; border-radius: 0; } .drawer-bar .btn-plain, .drawer-bar a { min-height: 44px; display: inline-flex; align-items: center; } }

/* Nội dung ngăn */
.dr-head { margin: 0 0 12px; }
.dr-kicker { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.dr-kicker a { font-weight: 600; text-decoration: none; }
.dr-title { margin: 2px 0 8px; font-size: 17px; line-height: 1.3; text-transform: none; letter-spacing: 0; }
.dr-code { display: inline-block; background: var(--vfc-primary-light); color: var(--vfc-primary); border-radius: 6px; padding: 0 7px; margin-right: 4px; font-size: 14px; }
.dr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-s { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--tint); color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.chip-core { background: var(--vfc-primary-light); color: var(--vfc-primary); box-shadow: inset 0 0 0 1px var(--vfc-primary-40); }
.chip-high { background: var(--warn-bg); color: var(--warn-text); box-shadow: inset 0 0 0 1px var(--highlight); }
.dr-card { background: var(--surface); border-radius: 14px; padding: 14px 16px; margin: 0 0 12px; box-shadow: var(--shadow-1), var(--edge); }
.dr-card h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.dr-card h3 b { color: var(--text); font-size: 15px; letter-spacing: 0; }
.dr-big { font-size: 24px; font-weight: 700; line-height: 1.2; color: var(--vfc-primary); overflow-wrap: anywhere; }
.dr-big a { color: inherit; }
.dr-big .muted { font-size: 14px; font-weight: 400; }
.dr-empty { font-size: 16px; font-weight: 600; display: flex; align-items: center; margin-bottom: 6px; }
.dr-facts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.dr-facts li { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.dr-ic { flex: 0 0 104px; color: var(--muted); font-size: 12px; font-weight: 600; }
.dr-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.dr-badge { font-size: 14px; padding: 4px 14px; }
.dr-stars { font-size: 26px; color: var(--highlight); letter-spacing: 2px; white-space: nowrap; }

/* Thanh xếp chồng, chú giải màu, thanh từng năm */
.dr-stack { display: flex; height: 16px; border-radius: 8px; overflow: hidden; gap: 2px; box-shadow: var(--well); background: var(--tint); }
.dr-stack span { display: block; height: 100%; }
.dr-legend { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.dr-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.dr-bars { display: grid; gap: 8px; }
.dr-bar { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.dr-bar-l { font-weight: 600; }
.dr-bar-v { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 92px; text-align: right; }
.hbar-fill.bar-bad { background: var(--lvl-bad); }
.hbar-fill.bar-warn { background: var(--lvl-warn); }
.hbar-fill.bar-ok { background: var(--lvl-ok); }

/* Lịch sử */
.dr-timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--vfc-primary-40); display: grid; gap: 12px; }
.dr-timeline li { position: relative; }
.dr-dot { position: absolute; left: -23px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--vfc-primary); box-shadow: var(--shadow-1); }
.dr-dot.bad { border-color: var(--lvl-bad); }
.dr-when { font-size: 12px; font-weight: 600; color: var(--muted); }
.dr-what { font-size: 14px; overflow-wrap: anywhere; }
.dr-def { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 6px 12px; margin: 0 0 8px; font-size: 13px; }
.dr-def dt { color: var(--muted); font-weight: 600; font-size: 12px; }
.dr-def dd { margin: 0; overflow-wrap: anywhere; }
.dr-foot { text-align: center; margin: 14px 0 0; }

/* Tầng: các lớp xếp chồng, thanh vị trí */
.dr-layers { display: grid; gap: 3px; justify-items: center; width: 74px; flex: none; }
.dr-layers i { display: block; height: 14px; border-radius: 5px; background: var(--vfc-primary-40); box-shadow: var(--shadow-1); }
.dr-layers .l1 { width: 34px; } .dr-layers .l2 { width: 54px; } .dr-layers .l3 { width: 74px; }
.dr-layers i.on { background: var(--vfc-primary); box-shadow: var(--shadow-2), inset 0 2px 0 rgba(255, 255, 255, .3); }
.dr-rank, .dr-gauge { position: relative; display: flex; height: 18px; border-radius: 9px; overflow: visible; margin: 10px 0 4px; box-shadow: var(--well); background: var(--tint); }
.dr-rank span { display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--on-accent); min-width: 0; overflow: hidden; white-space: nowrap; }
.dr-rank span:first-child { border-radius: 9px 0 0 9px; } .dr-rank span:last-of-type { border-radius: 0 9px 9px 0; }
.dr-rank .t1 { background: var(--vfc-primary); } .dr-rank .t2 { background: var(--vfc-primary-80); } .dr-rank .t3 { background: var(--vfc-primary-60); }
.dr-gauge .g { display: block; height: 100%; }
.dr-gauge .g:first-child { border-radius: 9px 0 0 9px; } .dr-gauge .g:last-of-type { border-radius: 0 9px 9px 0; }
.dr-gauge .g.ok { background: var(--lvl-ok); } .dr-gauge .g.warn { background: var(--lvl-warn); } .dr-gauge .g.bad { background: var(--lvl-bad); }
.dr-marker { position: absolute; top: -5px; width: 4px; height: 28px; margin-left: -2px; border-radius: 2px; background: var(--text); outline: 2px solid var(--surface); }
.dr-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.dr-mini { width: 100%; border-collapse: collapse; font-size: 13px; background: none; }
.dr-mini td { border: 0; border-bottom: 1px solid var(--border); padding: 6px 4px; vertical-align: middle; }
.dr-mini tr:last-child td { border-bottom: 0; }
.dr-mini tr.mine td { background: var(--vfc-primary-light); font-weight: 600; }

/* Sao: thang điểm, từng phần */
.dr-scale { position: relative; height: 16px; border-radius: 8px; background: var(--tint); box-shadow: var(--well); margin: 22px 0 12px; }
.dr-scale-fill { height: 100%; border-radius: 8px; background: var(--vfc-primary); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3); }
.dr-scale i { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--vfc-primary-40); }
.dr-scale i b { position: absolute; top: -16px; left: -10px; font-size: 11px; font-style: normal; color: var(--muted); }
.dr-comp { margin: 0 0 12px; font-size: 13px; }
.dr-comp-h { display: flex; justify-content: space-between; margin-bottom: 3px; font-weight: 600; }
.dr-comp a { font-size: 12px; }
.dr-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; font-size: 13px; background: var(--tint); display: flex; align-items: center; }
.dr-note.bad { background: var(--bad-bg); color: var(--bad-text); }

/* Danh sách trường bộ lõi bấm được */
.dr-checks { list-style: none; margin: 0; padding: 0; }
.dr-checks li { border-bottom: 1px solid var(--border); }
.dr-checks li:last-child { border-bottom: 0; }
.dr-checks a { display: flex; align-items: center; gap: 4px; padding: 8px 4px; color: inherit; text-decoration: none; font-size: 13px; }
.dr-checks a:hover { background: var(--vfc-primary-light); }
.dr-checks em { margin-left: auto; font-style: normal; font-size: 12px; color: var(--muted); padding-left: 8px; text-align: right; }

/* Thẻ khóa cho giá trị nhạy cảm */
.dr-lock { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-text); }
.dr-lock-ic { flex: none; display: inline-flex; }
.dr-lock-t { flex: 1; min-width: 0; }
.dr-lock .muted { color: inherit; opacity: .85; }
.dr-lock form { margin: 0; }

/* Phần tử bấm được ở trang NPP: dòng bảng, thẻ số liệu */
[data-detail] { cursor: pointer; }
tr[data-detail]:hover td { background: var(--vfc-primary-light); }
tr[data-detail] td:first-child { position: relative; }
.rate-card { border-radius: 12px; padding: 8px 10px; margin: -8px -10px; position: relative; }
.rate-card[data-detail]:hover { background: var(--vfc-primary-light); }
.rate-card[data-detail]::after { content: "Chi tiết ›"; position: absolute; top: 8px; right: 10px; font-size: 11px; font-weight: 600; color: var(--vfc-primary); opacity: 0; transition: opacity .15s; }
.rate-card[data-detail]:hover::after, .rate-card[data-detail]:focus-visible::after { opacity: 1; }
.rate-card[data-detail]:focus-visible, tr[data-detail]:focus-visible, .tile[data-detail]:focus-visible { outline: 2px solid var(--vfc-primary); outline-offset: 2px; }
.tile[data-detail] { position: relative; }
.tile[data-detail]:hover { box-shadow: var(--shadow-2), var(--edge), inset 0 0 0 2px var(--vfc-primary); }
a.field-link { color: inherit; font-weight: 600; text-decoration: none; }
a.field-link:hover { text-decoration: underline; color: var(--accent); }
@media (max-width: 767px) { .rate-card[data-detail]::after { opacity: 1; } }

/* ===== Hình minh họa trong ô giải thích "i" (bước 3 giao diện mới, 05/11/2026): ít chữ, nhiều hình ===== */
.info-pop.has-vis { width: 320px; }
.info-vis { display: block; margin-top: 8px; }
.iv { display: block; }
.iv svg { display: block; width: 100%; height: auto; max-height: 96px; margin: 0 auto 6px; }
.iv-bar { display: flex; height: 18px; border-radius: 9px; overflow: hidden; gap: 2px; box-shadow: var(--well); background: var(--tint); }
.iv-bar.tall { height: 22px; }
.iv-bar i { display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 11px; font-weight: 600; min-width: 0; overflow: hidden; white-space: nowrap; color: var(--on-accent); }
.iv-bar .t1 { background: var(--vfc-primary); } .iv-bar .t2 { background: var(--vfc-primary-80); } .iv-bar .t3 { background: var(--vfc-primary-60); }
.iv-bar .p-scale { background: var(--vfc-primary); } .iv-bar .p-growth { background: var(--blue); color: #1A1A1A; }
.iv-bar .p-debt { background: var(--highlight); color: #1A1A1A; } .iv-bar .p-continuity { background: var(--green); color: #1A1A1A; }
.iv-bar .bar-ok, .iv-bar .bar-warn { color: #1A1A1A; } .iv-bar .bar-bad { color: #fff; }
.iv-leg { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: 12px; }
.iv-leg.col { flex-direction: column; gap: 3px; }
.iv-leg > span { display: inline-flex; align-items: center; gap: 5px; }
.iv-leg i:not(.lvl-dot) { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.iv-leg .t1 { background: var(--vfc-primary); } .iv-leg .t2 { background: var(--vfc-primary-80); } .iv-leg .t3 { background: var(--vfc-primary-60); }
.iv-leg .p-scale { background: var(--vfc-primary); } .iv-leg .p-growth { background: var(--blue); }
.iv-leg .p-debt { background: var(--highlight); } .iv-leg .p-continuity { background: var(--green); }
.iv-cuts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; }
.iv-cuts > span { background: var(--tint); border-radius: 8px; padding: 2px 8px; box-shadow: inset 0 0 0 1px var(--border); }
.iv-cuts b { color: var(--highlight); margin-right: 4px; font-weight: 700; }
.iv-note { display: flex; align-items: center; margin-top: 8px; padding: 4px 8px; border-radius: 8px; font-size: 12px; }
.iv-note.bad { background: var(--bad-bg); color: var(--bad-text); }
.iv-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 3px; }
.iv-dots { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 8px; font-size: 12px; }
.iv-dots > span { display: inline-flex; align-items: center; gap: 3px; }
.iv-dots .d { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--vfc-primary-40); box-shadow: inset 0 0 0 1px rgba(var(--shadow-color), .25); }
.iv-dots .d.on { background: var(--vfc-primary); }

/* Khối xếp lớp (nhìn nghiêng) cho tầng: ba lớp, tầng 1 trên cùng; sắc bên hông tối hơn mặt trên để có cảm giác khối */
.iso .top { stroke: var(--surface); stroke-width: .8; }
.iso .side { stroke: var(--surface); stroke-width: .8; filter: brightness(.82); }
.iso .side.r { filter: brightness(.68); }
.iso.l1 .top, .iso.l1 .side { fill: var(--vfc-primary); }
.iso.l2 .top, .iso.l2 .side { fill: var(--vfc-primary-60); }
.iso.l3 .top, .iso.l3 .side { fill: var(--vfc-primary-40); }
.iso { filter: drop-shadow(0 2px 2px rgba(var(--shadow-color), .20)); }

/* Đồng hồ nợ quá hạn: ba vùng màu theo cấu hình */
.iv-debt path { fill: none; stroke-width: 15; stroke-linecap: butt; }
.iv-debt .gz-ok { stroke: var(--lvl-ok); } .iv-debt .gz-warn { stroke: var(--lvl-warn); } .iv-debt .gz-bad { stroke: var(--lvl-bad); }
.iv-debt text { font-size: 10px; fill: var(--muted); }
.iv-debt .gt { font-size: 11px; font-weight: 600; fill: var(--text); text-anchor: middle; }
.iv-debt svg { max-height: 78px; }
/* Ngăn chi tiết, phần tầng: khối xếp lớp, lớp của NPP này nổi bật còn hai lớp kia mờ đi */
.dr-iso { width: 112px; flex: none; }
.dr-iso svg { width: 100%; height: auto; display: block; }
.dr-iso.mine-1 .iso:not(.l1), .dr-iso.mine-2 .iso:not(.l2), .dr-iso.mine-3 .iso:not(.l3) { opacity: .35; }
/* ===== Biểu đồ nổi khối hơn (bước 4 giao diện mới, 05/11/2026): cột chuyển sắc, thanh có vệt sáng phía trên ===== */
.chart .bar-actual { fill: url(#vfc-g-bar); }
.chart .bar-est { fill: url(#vfc-g-est); }
.hbar-fill, .progress-fill, .progress-time .fill { background-image: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(0, 0, 0, .10)); }
.hbar-fill.bar-ok, .hbar-fill.bar-warn, .hbar-fill.bar-bad { background-image: linear-gradient(180deg, rgba(255, 255, 255, .26), rgba(0, 0, 0, .10)); }
.donut circle { stroke-linecap: butt; }
.donut-wrap .donut { filter: var(--drop); }
a.cell-plain { padding: 2px 4px; margin: -2px -4px; border-radius: 6px; }
table.swiss-list td a.cell-plain:hover { background: var(--vfc-primary-light); text-decoration: underline; }
table.swiss-list td .badge { cursor: pointer; }