/* ===== U888 Control Finance (giao diện kế thừa bản tiện ích 11) =====
   Màu theo logo U888 (cam – đỏ) & ABCVIP (đỏ hồng, đen, bạc). A = ngày đang xem (cam), B = ngày so sánh (xám xanh). */
:root {
  --brand: #f26a1b; --brand-2: #e0283f; --brand-soft: #fff1e8;
  --grad: linear-gradient(90deg, #ff9a00 0%, #f26a1b 40%, #e0283f 100%);
  --bg: #f6f4f1; --surface: #ffffff; --surface-2: #fbf8f5; --line: #ece5dd; --line-2: #f3eee8;
  --text: #1e2228; --muted: #6b7280; --faint: #9aa1ad;
  --ok: #16915a; --ok-bg: #e6f5ed; --watch: #b97c00; --watch-bg: #fff3d4;
  --bad: #d4233a; --bad-bg: #fde8eb; --few: #7d8594; --few-bg: #eef0f3;
  --circuit: rgba(226, 92, 30, .10); --node: rgba(242, 106, 27, .55);
  --shadow: 0 1px 2px rgba(30, 34, 40, .05), 0 6px 18px rgba(30, 34, 40, .05);
  --line-rate: #1e2228;
  --st-a: #d98a00; --st-i: #2f7fd8; --st-r: #e0283f; --st-j: #7a5af0;
  --cmp-a: #f26a1b; --cmp-b: #6b7a90; --tip-bg: rgba(24, 27, 33, .96); --tip-text: #f3f4f6;
  color-scheme: light;
}
html[data-theme="dark"] {
  --brand: #ff8a3d; --brand-2: #ff5468; --brand-soft: rgba(255, 138, 61, .12);
  --bg: #191b21; --surface: #22252d; --surface-2: #272b34; --line: #343946; --line-2: #2c303a;
  --text: #eef0f4; --muted: #a6adba; --faint: #7b8392;
  --ok: #3dcc84; --ok-bg: rgba(61, 204, 132, .14); --watch: #f2b84b; --watch-bg: rgba(242, 184, 75, .15);
  --bad: #ff5d70; --bad-bg: rgba(255, 93, 112, .15); --few: #a6adba; --few-bg: rgba(166, 173, 186, .12);
  --circuit: rgba(255, 138, 61, .10); --node: rgba(255, 138, 61, .7);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px rgba(0, 0, 0, .18);
  --line-rate: #eef0f4;
  --st-a: #f2b84b; --st-i: #5ea8ff; --st-r: #ff5d70; --st-j: #a48bff;
  --cmp-a: #ff8a3d; --cmp-b: #9aa8bf; --tip-bg: rgba(10, 11, 14, .96); --tip-text: #f3f4f6;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.45 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; transition: background-color .25s, color .25s; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
kbd { font: 600 10.5px/1 inherit; padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line); background: var(--surface-2); }

/* ===== Khung trang: cột danh mục bên trái + nội dung ===== */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; position: relative; z-index: 1; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 0 14px 14px; background: var(--surface); border-right: 1px solid var(--line); }
.brandline { height: 3px; background: var(--grad); margin: 0 -14px; }
.logo-plate { background: #fff; border-radius: 10px; padding: 5px 10px; display: flex; justify-content: center; box-shadow: var(--shadow); margin-top: 4px; }
.logo-plate img { max-width: 100%; height: auto; max-height: 52px; display: block; }
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.side-nav button { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 8px; text-align: left; border: 1px solid transparent; background: transparent; padding: 10px; border-radius: 12px; cursor: pointer; color: var(--text); font-weight: 700; font-size: 15px; transition: background .15s, border-color .15s; }
.side-nav button i { font-style: normal; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--brand); font-size: 16px; }
.side-nav button small { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.side-nav button:hover { background: var(--surface-2); }
.side-nav button.on { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand); }
.side-nav button.on i { background: var(--grad); color: #fff; }
.nb { font-size: 11.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--bad); color: #fff; }
.nb:empty { display: none; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side-foot .status { justify-content: center; }
.clock-box { text-align: center; }
.clock { display: block; font-size: 22px; font-weight: 700; }
.clock-box small { color: var(--muted); font-size: 11.5px; }
.side-note { margin: 0; font-size: 11.5px; color: var(--watch); line-height: 1.4; } .side-note:empty { display: none; }
.side-btns { display: flex; gap: 8px; } .side-btns .btn:first-child { flex: 1; }
.side-ro { margin: 0; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.7; }
.main { padding: 14px 24px 24px; min-width: 0; overflow-x: clip; }
.sec { max-width: 1720px; }

/* ===== Đầu mục ===== */
.shead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.stitle { margin-right: auto; min-width: 260px; }
.stitle h1 { margin: 0; font-size: 21px; } .stitle h1 small { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.stitle p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.datebar { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.datebar .chip { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; }
.datebar .chip.on { background: var(--grad); color: #fff; font-weight: 700; }
.datebar .chip.pick.on { background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); }
.datebar .caret { font-size: 10px; opacity: .7; }
.dnav { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 17px; line-height: 1; color: var(--text); display: inline-grid; place-items: center; }
.dnav:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.dnav:disabled { opacity: .35; cursor: default; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; background: var(--few-bg); color: var(--few); white-space: nowrap; }
.status i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: none; }
.status.live { background: var(--ok-bg); color: var(--ok); }
.status.live i { animation: dotPulse 1.6s ease-in-out infinite; will-change: opacity; }
.status.load { background: var(--watch-bg); color: var(--watch); }
.status.err { background: var(--bad-bg); color: var(--bad); }
/* Nhấp nháy chỉ đổi độ trong suốt → card đồ hoạ tự làm, không bắt trình duyệt vẽ lại mỗi khung hình (nhẹ cho laptop yếu) */
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 7px 13px; border-radius: 9px; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn.icon { width: 36px; padding: 7px 0; text-align: center; }
.btn.primary { background: var(--grad); border: 0; color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.link { border: 0; background: none; color: var(--brand); font-weight: 600; font-size: inherit; cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.active-filters:not(:empty) { margin-bottom: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px dashed var(--brand); border-radius: 999px; padding: 3px 4px 3px 11px; font-size: 12.5px; }
.tag button { border: 0; background: var(--brand-soft); color: var(--brand); border-radius: 50%; width: 20px; height: 20px; cursor: pointer; line-height: 1; }

/* Mục con + thanh lọc nhanh (dính trên cùng khi cuộn) */
.stick { position: sticky; top: 0; z-index: 15; background: var(--bg); margin: 0 -24px 12px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.subtabs { display: flex; gap: 2px; overflow-x: auto; margin-top: 4px; scrollbar-width: thin; }
.subtabs button { border: 0; background: transparent; padding: 11px 16px 10px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; display: inline-flex; align-items: center; gap: 7px; }
.subtabs button:hover { color: var(--text); }
.subtabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.subtabs [data-sub="cmp"]::before { content: "⇄"; font-weight: 800; }
.sb-n { font-size: 11px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--bad); color: #fff; }
.sb-n:empty { display: none; }
.qbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0 10px; }
.qbar[hidden], .qbar [hidden] { display: none !important; }
.qf { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.qf select, .ctl select { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 6px 8px; max-width: 240px; }
.search { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; min-width: 220px; }
.search:focus { outline: 0; border-color: var(--brand); }
.search.tm { min-width: 0; width: 72px; text-align: center; }
.search.invalid { border-color: var(--bad); background: var(--bad-bg); }
.state-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.state-tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 12.5px; color: var(--muted); }
.state-tabs button b { color: var(--text); margin-left: 3px; }
.state-tabs button.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.state-tabs button:disabled { opacity: .5; cursor: default; }
.notice { display: none; margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; background: var(--watch-bg); color: var(--watch); border: 1px solid color-mix(in srgb, var(--watch) 30%, transparent); }
.notice.show { display: block; }
.notice.err { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }

/* ===== Cảnh báo ===== */
.alerts:not(:empty) { margin-bottom: 14px; }
.alert-ok { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); box-shadow: var(--shadow); }
.alert-ok b { color: var(--ok); }
.alert-box { border-radius: 12px; background: var(--bad-bg); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); padding: 12px 16px; box-shadow: var(--shadow); animation: alertIn .3s ease; }
@keyframes alertIn { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }
.alert-title { display: flex; align-items: center; gap: 10px; color: var(--bad); font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.alert-title .siren { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: dotPulse 1.2s ease-in-out infinite; will-change: opacity; }
.alert-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid color-mix(in srgb, var(--bad) 18%, transparent); }
.alert-row:first-of-type { border-top: 0; }
.alert-row .who { font-weight: 700; min-width: 160px; }
.alert-row .what { flex: 1; }
.alert-row .num { font-size: 18px; font-weight: 800; color: var(--bad); }

/* ===== Ô chỉ số ===== */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-bottom: 6px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 13px 15px; box-shadow: var(--shadow); position: relative; overflow: hidden; min-width: 0; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--k, var(--brand)); }
.kpi.click { cursor: pointer; transition: box-shadow .15s; }
.kpi.click:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--k) 40%, transparent), var(--shadow); }
.kpi .lbl { color: var(--muted); font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.kpi .lbl span { font-weight: 700; color: var(--ok); }
.kpi .val { font-size: 28px; font-weight: 800; line-height: 1.15; margin: 4px 0 2px; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .val .money, .okpi .val .money { font-size: .78em; }
.kpi .sub { color: var(--muted); font-size: 12.5px; }
.kpi .sub b { color: var(--text); }
.kpi .meter { height: 6px; border-radius: 4px; background: var(--line-2); margin-top: 8px; overflow: hidden; display: flex; }
.kpi .meter i { display: block; height: 100%; transition: width .6s ease; }
.kdl { margin-top: 5px; font-size: 12px; }
.kpi-note { margin: 4px 2px 14px; font-size: 12.5px; color: var(--muted); min-height: 1px; }
.kpi-note:empty { margin: 0 0 8px; }
.flash { animation: flash .8s ease; }
@keyframes flash { 0% { color: var(--brand); } 100% { } }
/* Chênh lệch ▲▼ */
.dl { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 12px; white-space: nowrap; padding: 1px 6px; border-radius: 6px; }
.dl.good { color: var(--ok); background: var(--ok-bg); }
.dl.worse { color: var(--bad); background: var(--bad-bg); }
.dl.neu { color: var(--brand); background: var(--brand-soft); }
.dl.eq, .dl.na { color: var(--faint); font-weight: 500; }

/* ===== Thẻ / bảng ===== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 14px 18px 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-head .sub { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 16px; }
.table-wrap { overflow: auto; border-top: 1px solid var(--line); }
.list-wrap { max-height: 600px; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12.5px; text-align: center; vertical-align: middle; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid th button { all: unset; cursor: pointer; }
.grid th button:hover, .grid th.on { color: var(--brand); }
.grid td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); text-align: center; vertical-align: middle; white-space: nowrap; }
.grid th:first-child, .grid td:first-child { text-align: left; }
.grid.compact td, .grid.compact th { padding: 7px 12px; }
.grid.list th:first-child, .grid.list td:first-child { text-align: center; }
.grid tbody tr { transition: background .2s; }
.grid tbody tr.gw:hover td { background: var(--surface-2); }
.grid tbody tr.row-stuck td { background: color-mix(in srgb, var(--bad-bg) 70%, transparent); }
.grid tfoot td, .grid tr.total td { background: var(--surface-2); font-weight: 700; border-top: 2px solid var(--line); }
.grid tfoot td { position: sticky; bottom: 0; }
.grid.list td.memo { max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.name { font-weight: 700; color: var(--text); }
.rate-cell { min-width: 160px; }
.rate-cell b { font-size: 15px; }
.mini { height: 6px; border-radius: 4px; background: var(--line-2); margin: 5px auto 0; display: flex; overflow: hidden; max-width: 190px; }
.mini i { display: block; height: 100%; transition: width .6s ease; }
.cellbar { display: block; height: 4px; border-radius: 3px; background: var(--line-2); margin-top: 4px; overflow: hidden; min-width: 60px; }
.cellbar i { display: block; height: 100%; border-radius: 3px; }
.ok-t { color: var(--ok); } .watch-t { color: var(--watch); } .bad-t { color: var(--bad); } .few-t { color: var(--faint); }
.warn-t { color: var(--watch); } .load-t { color: var(--watch); }
.stuck-n { font-weight: 800; color: var(--bad); }
td.warn-n { color: var(--st-a); font-weight: 700; }
.zero { color: var(--faint); }
.muted { color: var(--muted); font-size: 12.5px; }
.empty { text-align: center !important; color: var(--muted); padding: 34px !important; }
.click-row { cursor: pointer; } .click-row:hover td { background: var(--brand-soft); }
tr.picked td { background: var(--brand-soft); } tr.picked td:first-child { box-shadow: inset 4px 0 0 var(--brand); }
tr.kidrow td { background: var(--surface-2); font-size: 12.5px; } td.kid { padding-left: 40px !important; color: var(--muted); }
.exp { all: unset; cursor: pointer; width: 18px; display: inline-block; text-align: center; color: var(--brand); }
.hb { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
button.hb.pick { cursor: pointer; font-family: inherit; }
button.hb.pick b { margin-left: 4px; font-weight: 800; }
button.hb.pick:hover:not(:disabled) { box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 30%, transparent); }
button.hb.pick.on { box-shadow: 0 0 0 2px currentColor; }
button.hb.pick:disabled { opacity: .35; cursor: default; }
.hb.ok { background: var(--ok-bg); color: var(--ok); } .hb.watch { background: var(--watch-bg); color: var(--watch); } .hb.bad { background: var(--bad-bg); color: var(--bad); }
.hb.stuck { background: var(--bad); color: #fff; } .hb.few { background: var(--few-bg); color: var(--few); } .hb.clear { background: transparent; border-color: var(--line); color: var(--muted); }
.legend-health { display: flex; gap: 6px; flex-wrap: wrap; }
.sb { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.sb.st-a { background: color-mix(in srgb, var(--st-a) 16%, transparent); color: var(--st-a); }
.sb.st-i { background: color-mix(in srgb, var(--st-i) 16%, transparent); color: var(--st-i); }
.sb.st-s { background: var(--ok-bg); color: var(--ok); }
.sb.st-r { background: color-mix(in srgb, var(--st-r) 14%, transparent); color: var(--st-r); }
.sb.st-j { background: color-mix(in srgb, var(--st-j) 16%, transparent); color: var(--st-j); }
.sb.st-u { background: var(--few-bg); color: var(--few); }
.pill { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 11px; background: var(--brand-soft); color: var(--brand); margin-left: 4px; }
.pill.lock { background: var(--few-bg); color: var(--muted); }
a.id-link { color: var(--brand); font-weight: 600; text-decoration: none; }
a.id-link:hover { text-decoration: underline; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line-2); }
.tm-range { display: inline-flex; align-items: center; gap: 6px; }
.clip { display: inline-block; max-width: 230px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.seg.small span, .card-head .seg span { padding: 6px 14px; }
.tog { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
.tog input { accent-color: var(--brand); width: 15px; height: 15px; }

/* ===== Biểu đồ ===== */
.chart { padding: 2px 12px 12px; min-height: 120px; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart text.y2t { fill: var(--faint); }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .zero-l { stroke: var(--faint); stroke-width: 1.2; }
.chart .mark-l { stroke: var(--brand); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: .8; }
.chart .hl { fill: var(--brand-soft); opacity: 0; transition: opacity .1s; }
.c-wrap { position: relative; touch-action: pan-y; cursor: crosshair; }
.c-empty { padding: 40px 10px; text-align: center; color: var(--muted); }
.ctip { position: absolute; z-index: 5; pointer-events: none; min-width: 200px; max-width: 320px; background: var(--tip-bg); color: var(--tip-text); border-radius: 10px; padding: 8px 11px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
.ctip .tt-h { font-weight: 700; margin-bottom: 4px; padding-bottom: 4px; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.ctip .tt-h small { font-weight: 400; opacity: .7; }
.ctip .tt-r { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.ctip .tt-r span { flex: 1; opacity: .82; }
.ctip .tt-r b { font-weight: 700; }
.ctip .tt-r.sep { margin-top: 3px; padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, .12); }
.ctip .dl.good { background: rgba(61, 204, 132, .18); color: #5be19c; } .ctip .dl.worse { background: rgba(255, 93, 112, .2); color: #ff8b99; } .ctip .dl.neu { background: rgba(255, 138, 61, .18); color: #ffad70; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0 4px 8px 52px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; background: var(--c); }
.legend i.l { height: 3px; border-radius: 2px; }
.legend i.d { height: 0; border-top: 3px dashed var(--c); background: none; border-radius: 0; }
.sub-h { padding: 4px 18px 0 70px; font-size: 12px; color: var(--muted); font-weight: 600; }
.spark { display: block; margin-top: 6px; width: 100%; height: 34px; }

/* ===== So sánh ngày ===== */
.tagd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 6px; font-size: 11.5px; font-weight: 800; color: #fff; vertical-align: middle; }
.tagd.a { background: var(--cmp-a); } .tagd.b { background: var(--cmp-b); }
.cmp-head { padding: 14px 18px 12px; }
.cmp-pick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cmp-day { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); min-width: 230px; }
.cmp-day.a { border-color: color-mix(in srgb, var(--cmp-a) 45%, transparent); }
.cmp-day.b { border-color: color-mix(in srgb, var(--cmp-b) 45%, transparent); }
.cmp-day .tagd { width: 30px; height: 30px; font-size: 15px; border-radius: 9px; }
.cmp-day small { display: block; color: var(--muted); font-size: 11.5px; }
.cmp-day b { font-size: 15px; }
.cmp-day .mini-nav { margin-left: auto; display: inline-flex; gap: 4px; }
.cmp-day .mini-nav .dnav { width: 26px; height: 26px; font-size: 15px; }
.vs { color: var(--muted); font-weight: 700; font-size: 13px; }
.cmp-opts { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.cmp-opts select { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: 6px 8px; }
.cmp-status { margin-top: 10px; font-size: 12.5px; color: var(--muted); display: grid; gap: 3px; }
.cmp-status b { color: var(--text); }
.cmp-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ckpi { all: unset; box-sizing: border-box; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px 8px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; transition: box-shadow .15s, border-color .15s; }
.ckpi:hover { border-color: color-mix(in srgb, var(--brand) 50%, transparent); }
.ckpi.on { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent), var(--shadow); }
.ckpi:focus-visible { outline: 2px solid var(--brand); }
.ckpi .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ckpi .vals { display: flex; flex-direction: column; gap: 2px; margin: 5px 0 3px; }
.ckpi .va, .ckpi .vb { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ckpi .va b { font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ckpi .vb span:last-child { font-size: 13.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ckpi .tagd { min-width: 17px; height: 17px; font-size: 10.5px; }
.ckpi .kdl { margin-top: 2px; }
[data-panel$="-cmp"].is-loading .cmp-kpis, [data-panel$="-cmp"].is-loading .card:not(.cmp-head) { opacity: .45; transition: opacity .2s; }
.grid.cmpg td:nth-child(3n+2), .grid.cmpg th:nth-child(3n+2) { border-left: 1px solid var(--line); }
.grid.cmpg td .dl { font-size: 11.5px; }
.grid.cmpg td, .grid.cmpg th { padding: 7px 9px; }
details > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 12px; padding: 14px 18px; flex-wrap: wrap; }
details > summary::-webkit-details-marker { display: none; }
details > summary h2 { margin: 0; font-size: 16px; }
details > summary h2::before { content: "▸ "; color: var(--brand); }
details[open] > summary h2::before { content: "▾ "; }
details > summary .sub { color: var(--muted); font-size: 12.5px; }

/* ===== Tổng quan chung ===== */
.o-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; padding: 4px 16px 16px; }
.okpi { border: 1px solid var(--line); border-left: 4px solid var(--k); border-radius: 10px; padding: 10px 12px; background: var(--surface); min-width: 0; }
.okpi .lbl { font-size: 12.5px; color: var(--muted); } .okpi .val { font-size: 23px; font-weight: 800; margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .okpi .sub { font-size: 12px; color: var(--muted); }
.flow { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 6px 18px 18px; flex-wrap: wrap; }
.flow > div { text-align: center; min-width: 180px; } .flow span { display: block; color: var(--muted); font-size: 12.5px; }
.flow b { font-size: 24px; display: block; } .flow small { color: var(--muted); font-size: 12px; } .flow i { font-style: normal; font-size: 26px; color: var(--muted); }

/* ===== Chân mục ===== */
.foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; }
.check-line { all: unset; cursor: pointer; display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.check-line:hover { border-color: var(--brand); }
.check-line.ok .ci { color: var(--ok); } .check-line.warn .ci { color: var(--watch); } .check-line.bad .ci { color: var(--bad); }

/* ===== Hộp thoại ===== */
.dlg { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--text); width: min(720px, 94vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dlg::backdrop { background: rgba(20, 22, 28, .55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: relative; }
.dlg-head::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--grad); border-radius: 16px 16px 0 0; }
.dlg-head h3 { margin: 0; font-size: 16px; }
.x { border: 0; background: transparent; font-size: 22px; cursor: pointer; color: var(--muted); }
.dlg-body { padding: 16px 20px; max-height: 70vh; overflow: auto; }
.dlg-foot { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.grow { flex: 1; }
.form-error { color: var(--bad); margin: 0; min-height: 18px; font-size: 13px; }
.dlg h4 { margin: 4px 0 10px; font-size: 14px; color: var(--brand); }
.hint { color: var(--muted); font-size: 12.5px; }
.ref { background: var(--brand-soft); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; margin: 8px 0 14px; }
.ref:empty { display: none; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.check-list { list-style: none; margin: 0 0 10px; padding: 0; }
.check-list li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.check-list .ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.check-list .ic.ok { background: var(--ok-bg); color: var(--ok); } .check-list .ic.warn { background: var(--watch-bg); color: var(--watch); } .check-list .ic.bad { background: var(--bad-bg); color: var(--bad); }
.check-list b { display: block; }
.check-list span { color: var(--muted); font-size: 12.5px; }

/* ===== Màn hình hẹp ===== */
@media (max-width: 1500px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1250px) { .grid2 { grid-template-columns: 1fr; } .app { grid-template-columns: 200px minmax(0, 1fr); } .cmp-opts { margin-left: 0; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 0 12px 10px; }
  .side .logo-plate { display: none; } .side-nav { flex-direction: row; flex: 1; } .side-foot { margin: 0; flex-direction: row; flex-wrap: wrap; }
  .main { padding: 12px 16px 20px; } .stick { margin: 0 -16px 12px; padding: 0 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmp-day { min-width: 0; flex: 1; }
}

/* ===== Nền bo mạch vi lượng tử ===== */
.bg-circuit { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; contain: strict; transform: translateZ(0); }
.bg-circuit::before {
  content: ""; position: absolute; inset: 0; background: var(--circuit);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260' fill='none' stroke='white' stroke-width='1.4'><path d='M0 42h58l22 22h64l18-18h98'/><path d='M144 64v58l20 20h96'/><path d='M22 260v-62l22-22h58l16-16v-44'/><path d='M190 0v34l20 20v52'/><path d='M60 122h44l14 14'/><path d='M0 214h40'/><path d='M210 260v-46l-18-18h-40'/><rect x='118' y='182' width='44' height='28' rx='3'/><path d='M126 182v-8M140 182v-8M154 182v-8M126 210v8M140 210v8M154 210v8'/><g fill='white' stroke='none'><circle cx='58' cy='42' r='3.2'/><circle cx='162' cy='46' r='3.2'/><circle cx='144' cy='122' r='3.2'/><circle cx='22' cy='198' r='3.2'/><circle cx='118' cy='160' r='3.2'/><circle cx='210' cy='106' r='3.2'/><circle cx='104' cy='122' r='3.2'/><circle cx='152' cy='196' r='2.4'/><circle cx='40' cy='214' r='3.2'/></g></svg>") 0 0 / 260px 260px repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='260' height='260' fill='none' stroke='white' stroke-width='1.4'><path d='M0 42h58l22 22h64l18-18h98'/><path d='M144 64v58l20 20h96'/><path d='M22 260v-62l22-22h58l16-16v-44'/><path d='M190 0v34l20 20v52'/><path d='M60 122h44l14 14'/><path d='M0 214h40'/><path d='M210 260v-46l-18-18h-40'/><rect x='118' y='182' width='44' height='28' rx='3'/><path d='M126 182v-8M140 182v-8M154 182v-8M126 210v8M140 210v8M154 210v8'/><g fill='white' stroke='none'><circle cx='58' cy='42' r='3.2'/><circle cx='162' cy='46' r='3.2'/><circle cx='144' cy='122' r='3.2'/><circle cx='22' cy='198' r='3.2'/><circle cx='118' cy='160' r='3.2'/><circle cx='210' cy='106' r='3.2'/><circle cx='104' cy='122' r='3.2'/><circle cx='152' cy='196' r='2.4'/><circle cx='40' cy='214' r='3.2'/></g></svg>") 0 0 / 260px 260px repeat;
}
/* các "nút lượng tử" phát sáng nhẹ */
.bg-circuit::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 12% 30%, var(--node) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 18%, var(--node) 0 2px, transparent 3px),
    radial-gradient(circle at 64% 72%, var(--node) 0 2px, transparent 3px),
    radial-gradient(circle at 30% 86%, var(--node) 0 2px, transparent 3px),
    radial-gradient(circle at 92% 58%, var(--node) 0 2px, transparent 3px),
    radial-gradient(600px 400px at 100% 0%, var(--brand-soft), transparent 70%);
  opacity: .8;
}
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .bg-circuit::after { animation: none; } }

/* ===== Ô ngày giờ & bộ chọn lịch 24 giờ ===== */
.dt { position: relative; display: flex; }
.dt .dt-in { flex: 1; padding-right: 38px !important; font-variant-numeric: tabular-nums; letter-spacing: .2px; cursor: pointer; }
.dt .dt-in.invalid { border-color: var(--bad) !important; background: var(--bad-bg) !important; }
.dt-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; font-size: 15px; padding: 4px 6px; border-radius: 6px; }
.dt-btn:hover { background: var(--brand-soft); }
.dtp { position: fixed; z-index: 1000; width: 304px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .22); padding: 12px; animation: dtpIn .14s ease; font-size: 13.5px; }
.dtp::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 14px 14px 0 0; background: var(--grad); }
@keyframes dtpIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.dtp-head { display: flex; align-items: center; gap: 6px; margin: 2px 0 8px; }
.dtp-head .nav { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 18px; line-height: 1; color: var(--text); }
.dtp-head .nav:hover { border-color: var(--brand); color: var(--brand); }
.dtp-title { flex: 1; display: flex; gap: 6px; justify-content: center; }
.dtp-title select { border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; padding: 5px 6px; font-weight: 600; color: var(--text); cursor: pointer; }
.dtp-week, .dtp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dtp-week span { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 4px 0; }
.dtp-week .wk, .dtp-grid .wk:not(.sel):not(.out) { color: var(--brand-2); }
.dtp-grid .d { height: 34px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.dtp-grid .d:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand); }
.dtp-grid .d.out { color: var(--faint); font-weight: 400; }
.dtp-grid .d.today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.dtp-grid .d.sel { background: var(--grad); color: #fff; box-shadow: none; }
.dtp-grid .d:disabled { color: var(--faint); opacity: .35; cursor: default; }
.dtp-time { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.dtp-time .lbl { font-size: 12px; color: var(--muted); width: 100%; }
.dtp-time b { font-size: 18px; color: var(--muted); }
.spin { display: flex; flex-direction: column; align-items: center; }
.spin button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; line-height: 1; padding: 3px 10px; border-radius: 6px; }
.spin button:hover { color: var(--brand); background: var(--brand-soft); }
.spin input { width: 46px; text-align: center; font-size: 18px; font-weight: 700; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.spin input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }
.dtp-time .quick { display: flex; gap: 4px; margin-left: auto; flex-direction: column; }
.dtp-time .quick button, .dtp-foot button { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 7px; padding: 4px 8px; font-size: 12px; cursor: pointer; }
.dtp-time .quick button:hover, .dtp-foot button:hover { border-color: var(--brand); color: var(--brand); }
.dtp-preview { margin-top: 8px; text-align: center; font-weight: 700; font-size: 14px; padding: 6px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-variant-numeric: tabular-nums; }
.dtp-foot { display: flex; gap: 6px; margin-top: 10px; align-items: center; }
.dtp-foot .ok { background: var(--grad); color: #fff; border: 0; font-weight: 700; padding: 5px 16px; }
.dtp-foot .ok:hover { color: #fff; filter: brightness(1.06); }

/* ===== Bố cục hộp Bộ lọc & Cài đặt: nhãn một cột, điều khiển một cột, thẳng hàng ===== */
.dlg.wide-dlg { width: min(860px, 95vw); }
.frow { display: grid; grid-template-columns: 210px 1fr; gap: 16px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line-2); }
.frow.top { align-items: start; }
.frow.top .flabel { padding-top: 7px; }
.frow:last-of-type { border-bottom: 0; }
.flabel { font-weight: 600; font-size: 13.5px; color: var(--text); line-height: 1.35; }
.flabel small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); margin-top: 2px; }
.flabel .hb { margin-right: 4px; }
.fctl { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fctl.two { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.inline-l { white-space: nowrap; }
.fctl.spins { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
.frow input:not([type=checkbox]):not([type=radio]) { width: 100%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 9px; padding: 8px 11px; height: 38px; font-variant-numeric: tabular-nums; transition: border-color .15s, box-shadow .15s; }
.frow input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.frow .range { display: grid; grid-template-columns: 1fr 22px 1fr; align-items: center; gap: 6px; }
.tilde { text-align: center; color: var(--muted); font-weight: 700; }
.mini-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.link { border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 12.5px; cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; }

/* Thẻ chọn (trạng thái, cấp độ) */
.chipset { display: flex; flex-wrap: wrap; gap: 8px; max-height: 150px; overflow: auto; padding: 1px; }
.tchip { position: relative; cursor: pointer; user-select: none; }
.tchip input { position: absolute; opacity: 0; pointer-events: none; }
.tchip span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-size: 13px; transition: all .15s; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tchip span::before { content: ""; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--faint); flex: none; transition: all .15s; }
.tchip input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--text); font-weight: 600; }
.tchip input:checked + span::before { border-color: var(--brand); background: var(--brand) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center / 12px no-repeat; }
.tchip input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }

/* Ô số − / + */
.spinbox { display: inline-flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); height: 38px; }
.spinbox:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.spinbox button { width: 34px; border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; transition: background .15s, color .15s; }
.spinbox button:hover { background: var(--brand-soft); color: var(--brand); }
.frow .spinbox input { width: 58px !important; height: auto !important; border: 0 !important; border-left: 1px solid var(--line) !important; border-right: 1px solid var(--line) !important; border-radius: 0 !important; text-align: center; font-weight: 700; font-size: 15px; padding: 0 !important; box-shadow: none !important; }
.frow .spinbox.wide input { width: 86px !important; }
.unit { color: var(--muted); font-size: 13px; }
.unit.pre { min-width: 22px; text-align: right; font-weight: 700; color: var(--text); }

/* Nút chọn một trong nhiều */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); width: max-content; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 8px 18px; font-size: 13px; color: var(--muted); transition: all .15s; }
.seg label + label span { border-left: 1px solid var(--line); }
.seg input:checked + span { background: var(--grad); color: #fff; font-weight: 700; }

/* Công tắc bật / tắt */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; cursor: pointer; flex: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + span { background: var(--grad); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 25%, transparent); }
@media (max-width: 760px) { .frow { grid-template-columns: 1fr; gap: 6px; } .fctl.two { grid-template-columns: 1fr; } }
.dt.d-only { width: 170px; }

/* Ô thời gian xử lý: nhanh nhất · trung bình · chậm nhất */
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.trio > div { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding-left: 8px; border-left: 2px solid var(--line); }
.trio > div:first-child { padding-left: 0; border-left: 0; }
.trio small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.trio b { font-size: 20px; font-weight: 800; line-height: 1.2; white-space: nowrap; }
.trio .min b { color: var(--ok); } .trio .avg b { color: var(--st-i); } .trio .max b { color: var(--bad); }
.trio .kdl .dl { font-size: 11px; padding: 0 4px; }
.okpi.wide { grid-column: span 2; }
.kpi .lbl .muted { font-size: 11.5px; }

/* Hiệu suất đối tác: danh sách thanh ngang (tên đối tác dài vẫn đọc được) */
.blist { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px 14px; max-height: 440px; overflow: auto; }
.brow { all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(120px, 34%) 1fr auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.brow:hover { background: var(--surface-2); }
.brow.on { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.brow .bn { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow .bt { display: flex; height: 12px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.brow .bt i { display: block; height: 100%; }
.brow .bv { font-size: 12.5px; color: var(--muted); white-space: nowrap; text-align: right; min-width: 150px; }
.brow .bv b { color: var(--text); } .brow .bv b.ok-t { color: var(--ok); } .brow .bv b.watch-t { color: var(--watch); } .brow .bv b.bad-t { color: var(--bad); }

/* Chú thích biểu đồ bấm được: ẩn / hiện từng loại dữ liệu */
.legend { align-items: center; gap: 4px 6px; }
.legend .lg { all: unset; box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; color: var(--text); font-size: 12px; transition: background .15s, opacity .15s, border-color .15s; user-select: none; }
.legend .lg:hover { background: var(--surface-2); border-color: var(--line); }
.legend .lg:focus-visible { outline: 2px solid var(--brand); }
.legend .lg.off { opacity: .45; text-decoration: line-through; }
.legend .lg.off i { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--c); }
.legend .lg.off i.d { box-shadow: none; }
.legend .lg.all { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); font-weight: 600; }
.legend .lg-hint { color: var(--faint); font-size: 11px; margin-left: 4px; }
/* Ô chọn cổng nạp: gõ để tìm */
.cbx { position: relative; display: inline-block; }
.cb-in { min-width: 230px; padding-right: 26px; }
.cb-in.picked { border-color: var(--brand); color: var(--text); font-weight: 600; }
.cb-x { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 17px; line-height: 1; padding: 2px 6px; }
.cb-x:hover { color: var(--bad); }
.cb-pop { position: absolute; left: 0; top: calc(100% + 4px); z-index: 40; min-width: 100%; width: max-content; max-width: min(440px, 90vw); max-height: 340px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0, 0, 0, .28); }
.cb-pop li { display: flex; justify-content: space-between; align-items: baseline; gap: 18px; padding: 7px 10px; border-radius: 7px; cursor: pointer; color: var(--text); font-size: 13px; white-space: nowrap; }
.cb-pop li small { color: var(--muted); font-size: 11.5px; }
.cb-pop li.act { background: var(--surface-2); }
.cb-pop li.sel { color: var(--brand); font-weight: 700; }
.cb-pop li.none { cursor: default; color: var(--muted); white-space: normal; }
.cb-pop mark { background: transparent; color: var(--brand); font-weight: 700; }

/* Cài đặt: 4 thẻ chia 2 cột, vừa một màn hình (không phải cuộn trên laptop) */
.dlg.set-dlg { width: min(1120px, 96vw); }
.set-dlg .dlg-head h3 small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 8px; }
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-height: calc(100vh - 170px); padding: 14px 16px; background: var(--bg); }
.set-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.scard { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 10px 14px 8px; }
.scard > header { display: flex; gap: 10px; align-items: center; padding-bottom: 8px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
.scard > header i { font-style: normal; flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 15px; }
.scard h4 { margin: 0; font-size: 14px; color: var(--text); }
.scard > header p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.scard .frow { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 7px 0; }
.scard .frow:last-of-type { border-bottom: 0; }
.scard .flabel { font-size: 13px; }
.scard .flabel small { font-size: 11.5px; }
.scard .fctl.spins { justify-content: flex-end; flex-wrap: nowrap; gap: 6px; }
.scard .spinbox { height: 34px; }
.scard .spinbox button { width: 28px; font-size: 16px; }
.scard .frow .spinbox input { width: 46px !important; }
.scard .frow .spinbox.wide input { width: 70px !important; }
.scard .unit { font-size: 12px; color: var(--muted); }
.scard .ref { margin: 6px 0 4px; font-size: 12px; padding: 6px 10px; }
.set-err { margin: 0; padding: 0 20px; }
.set-err:empty { display: none; }
.set-err:not(:empty) { padding: 8px 20px; }
@media (max-width: 900px) { .set-grid { grid-template-columns: 1fr; } }
/* Biểu đồ bấm được → khung chi tiết */
.c-wrap.pickable { cursor: pointer; }
.tt-pick { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--brand); font-weight: 700; font-size: 11.5px; }
/* Khung chi tiết bên phải (không che toàn trang, bấm cột khác là đổi ngay) */
.drill { position: fixed; top: 0; right: 0; bottom: 0; width: min(1000px, 96vw); z-index: 60; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); box-shadow: -20px 0 50px rgba(0, 0, 0, .35); animation: drillIn .18s ease-out; }
.drill[hidden] { display: none; }
@keyframes drillIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
.drill-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px 10px; border-bottom: 1px solid var(--line); position: relative; }
.drill-head::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--grad); }
.drill-head .dh-t { flex: 1; min-width: 0; }
.drill-head h3 { margin: 0; font-size: 16.5px; }
.drill-head p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }
.drill-head .x { border: 0; background: var(--surface-2); color: var(--text); width: 34px; height: 34px; border-radius: 10px; font-size: 20px; cursor: pointer; flex: none; }
.drill-head .x:hover { background: var(--bad-bg); color: var(--bad); }
.drill-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 18px; border-bottom: 1px solid var(--line); }
.drill-bar:empty { display: none; }
.drill-bar .state-tabs { flex-wrap: wrap; }
.drill-body { flex: 1; overflow: auto; padding: 14px 18px 28px; display: flex; flex-direction: column; gap: 16px; }
.dr-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.dr-tile.wide { grid-column: span 2; }
@media (max-width: 760px) { .dr-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dr-tile { border: 1px solid var(--line); border-radius: 11px; padding: 9px 11px; background: var(--surface-2); min-width: 0; }
.dr-tile.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.dr-tile.warn { border-color: color-mix(in srgb, var(--watch) 45%, var(--line)); }
.dr-tile .lbl { font-size: 11.5px; color: var(--muted); }
.dr-tile .v { font-size: 19px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-tile .v b { color: var(--brand); }
.dr-tile .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.dr-tile .kdl { margin-top: 4px; }
.dr-sec h4 { margin: 0 0 8px; font-size: 13.5px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.dr-sec h4 small { font-weight: 400; font-size: 11.5px; }
.dr-sec h4 .btn { margin-left: auto; }
.dr-note { margin: -2px 0 8px; font-size: 12px; }
.dr-why { margin: 0; padding: 10px 14px 10px 30px; border-radius: 11px; background: var(--watch-bg); font-size: 13px; line-height: 1.6; }
.dr-why.ok { background: var(--ok-bg); }
.drill td.badc { color: var(--bad); font-weight: 700; }
.drill tr.kid td:first-child .name { padding-left: 22px; color: var(--muted); }
.drill .tw { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 0 6px 0 0; font-size: 12px; }
.drill .list-wrap { max-height: none; }

/* Các phần của mục So sánh ngày: thanh mục ngang (xem từng phần, không dồn chung một trang) */
.segbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.segbar button { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; padding: 12px 10px; border: 1px solid transparent; border-radius: 10px; background: var(--surface-2); color: var(--text); font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s; }
.segbar button span { overflow: hidden; text-overflow: ellipsis; }
.segbar button:hover { border-color: var(--line); }
.segbar button.on { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface-2)); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 16%, transparent); }
.segbar .cnt { flex: none; font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; background: var(--line); color: var(--text); }
.segbar button.on .cnt { background: var(--brand); color: #fff; }
.segbar .cnt.bad { background: var(--bad); color: #fff; }
.csec[hidden] { display: none !important; }

/* Kết quả đối chiếu từng đơn (hộp Kiểm tra số liệu) */
.recon:empty { display: none; }
.recon { margin: 6px 0 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 12.5px; line-height: 1.55; }
.recon h4 { margin: 4px 0 8px; font-size: 13px; color: var(--text); }
.recon table { margin-bottom: 8px; }
.recon p { margin: 6px 0; }
