/* Trình thiết kế report — bố cục kiểu công cụ BI: rail trái, canvas giữa, 2 ô phải. Dùng token của lab.css. */
[hidden] { display: none !important; }
body.designer { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.small { font-size: .8rem; }

.d-top { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.d-back { color: var(--accent); text-decoration: none; font-weight: 600; }
.d-title { display: flex; gap: 10px; align-items: baseline; min-width: 0; flex: 1 1 auto; }
.d-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.d-engine-note { font-size: .78rem; color: var(--muted); padding: 3px 12px; background: var(--bg); border-bottom: 1px solid var(--line); }

.d-main { flex: 1; display: grid; grid-template-columns: 48px minmax(0, 1fr) var(--filter-pane, 210px) var(--viz-pane, 250px) var(--data-pane, 230px);
  grid-template-areas: "rail canvas filt viz data"; min-height: 0; }
.d-rail { grid-area: rail; } .d-canvas-wrap { grid-area: canvas; } #filter-pane { grid-area: filt; } #viz-pane { grid-area: viz; } #data-pane { grid-area: data; }
.d-main.no-report-panes { grid-template-columns: 48px minmax(0, 1fr) var(--data-pane, 230px); grid-template-areas: "rail canvas data"; }
.d-main.no-report-panes #filter-pane, .d-main.no-report-panes #viz-pane { display: none; }
@media (max-width: 1200px) {
  .d-main { grid-template-columns: 48px minmax(0, 1fr) var(--viz-pane, 240px) var(--data-pane, 220px); grid-template-rows: auto 1fr;
    grid-template-areas: "rail canvas viz data" "rail canvas filt data"; }
  #filter-pane { border-top: 1px solid var(--line); max-height: 40vh; }
}
@media (max-width: 760px) {
  body.designer { height: auto; overflow: auto; }
  .d-main, .d-main.no-report-panes { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "rail" "canvas" "filt" "viz" "data"; }
  .d-rail { flex-direction: row; } .d-canvas-wrap { max-height: 70vh; }
}

.d-rail { display: flex; flex-direction: column; gap: 4px; padding: 8px 6px; background: var(--surface); border-right: 1px solid var(--line); }
.rail-btn { width: 36px; height: 36px; border-radius: 8px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.rail-btn .ic { width: 20px; height: 20px; }
.rail-btn.is-active, .rail-btn:hover { background: var(--accent-soft); color: var(--accent); }

.d-canvas-wrap { overflow: hidden; background: color-mix(in srgb, var(--bg) 70%, var(--line)); min-width: 0; display: flex; flex-direction: column; }
.d-report { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.d-canvas { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.d-page { position: relative; width: 1280px; height: 720px; background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.12); transform-origin: 0 0; outline: none;
  background-image: radial-gradient(color-mix(in srgb, var(--line) 80%, transparent) 1px, transparent 1px); background-size: 16px 16px; }
.d-page.drop-ok { outline: 2px dashed var(--accent); outline-offset: -2px; }
.d-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 40px; pointer-events: none; }

.vis { position: absolute; background: var(--surface); border: 1px solid transparent; border-radius: 4px; display: flex; flex-direction: column; min-width: 40px; min-height: 40px; }
.vis:hover { border-color: var(--line); }
.vis.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vis.drop-ok { box-shadow: 0 0 0 2px var(--accent) inset; }
.vis-head { display: flex; align-items: center; gap: 4px; padding: 2px 6px; cursor: move; min-height: 22px; user-select: none; }
.vis-title { font-size: .82rem; font-weight: 600; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.vis-tools { display: none; gap: 2px; }
.vis:hover .vis-tools, .vis.is-selected .vis-tools { display: flex; }
.vis-tools button { border: 0; background: var(--bg); color: var(--ink); font-size: .72rem; padding: 1px 6px; border-radius: 4px; cursor: pointer; }
.vis-body { flex: 1; min-height: 0; position: relative; overflow: hidden; padding: 2px 6px 6px; }
.vis-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 8px; color: var(--muted); font-size: .8rem; }
.vis-msg.err { color: var(--bad); font-family: var(--mono); }
.vis-busy::after { content: ""; position: absolute; top: 4px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .2; } }
.vis-resize { position: absolute; right: -4px; bottom: -4px; width: 12px; height: 12px; cursor: nwse-resize; border-radius: 2px; background: var(--accent); display: none; }
.vis.is-selected .vis-resize { display: block; }

.card-v { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.card-v .big { font-size: 2.6rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.card-v .lbl { color: var(--muted); font-size: .85rem; }
.tbl-v { width: 100%; height: 100%; overflow: auto; }
.tbl-v table { border-collapse: collapse; width: 100%; font-size: .8rem; }
.tbl-v th, .tbl-v td { padding: 3px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl-v th { position: sticky; top: 0; background: var(--surface); }
.tbl-v td.num { text-align: right; font-variant-numeric: tabular-nums; }
.slicer-v { height: 100%; overflow: auto; display: grid; align-content: start; gap: 2px; font-size: .85rem; }
.slicer-v label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
svg.chart { width: 100%; height: 100%; display: block; overflow: visible; }
svg.chart text { fill: var(--muted); font: 11px var(--sans); }
svg.chart .axis { stroke: var(--line); }
svg.chart .mark { cursor: pointer; }
svg.chart .mark.dim { opacity: .3; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--surface); font-size: .75rem; padding: 3px 6px; border-radius: 4px; white-space: nowrap; z-index: 5; }

.d-pane { background: var(--surface); border-left: 1px solid var(--line); padding: 10px; overflow: auto; min-width: 0; }
.d-pane h2 { margin: 0 0 8px; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: .95rem; }
.viz-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 12px; }
.viz-btn { aspect-ratio: 1; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm); display: grid; place-items: center; cursor: pointer; padding: 3px; color: var(--muted); }
.viz-btn .ic { width: 22px; height: 22px; }
.viz-btn.is-active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.wells { display: grid; gap: 10px; }
.well h4 { margin: 0 0 4px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.well-drop { min-height: 32px; border: 1px dashed var(--line); border-radius: 6px; padding: 4px; display: grid; gap: 3px; font-size: .8rem; }
.well-drop.drop-ok { border-color: var(--accent); background: var(--accent-soft); }
.well-drop .ph { color: var(--muted); padding: 3px 4px; }
.chip { display: flex; align-items: center; gap: 4px; background: var(--bg); border-radius: 4px; padding: 2px 4px; }
.chip span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip select { font-size: .72rem; padding: 0 2px; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; }

.field-tree { display: grid; gap: 2px; margin-top: 8px; font-size: .84rem; }
.ft-table > summary { cursor: pointer; font-weight: 600; padding: 3px 2px; list-style: none; display: flex; gap: 6px; align-items: center; }
.ft-table > summary::before { content: "▸"; color: var(--muted); }
.ft-table[open] > summary::before { content: "▾"; }
.ft-field { display: flex; gap: 6px; align-items: center; padding: 2px 4px 2px 18px; border-radius: 4px; cursor: grab; user-select: none; }
.ft-field:hover { background: var(--accent-soft); }
.ft-ico { width: 16px; text-align: center; color: var(--muted); font: 600 .7rem var(--mono); flex: none; }
.ft-field.measure .ft-ico { color: var(--accent); }


.d-dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); max-width: min(720px, 92vw); width: 100%; }
.d-dialog pre { white-space: pre; overflow: auto; max-height: 50vh; }
.d-dialog::backdrop { background: rgba(0,0,0,.35); }
.d-toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 8px 14px; border-radius: 8px; font-size: .85rem; z-index: 20; max-width: 90vw; }
.d-toast.err { background: var(--bad); }

/* -- Thanh công thức + lỗi kiểu công cụ BI -- */
.fbar { display: flex; align-items: flex-start; gap: 4px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.fb-btn { width: 30px; height: 30px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 6px; cursor: pointer; display: grid; place-items: center; flex: none; }
.fb-btn svg { width: 14px; height: 14px; }
.fb-btn:hover { color: var(--accent); border-color: var(--accent); }
.fb-editor { flex: 1; min-width: 0; }
.fb-editor .dax-ed .dax-hl, .fb-editor .dax-ed textarea.dax-input { padding: 5px 8px; font-size: .88rem; }
.fb-editor textarea.dax-input { min-height: 30px; resize: vertical; }
.fb-table { font-size: .78rem; align-self: center; white-space: nowrap; }
.fb-errwrap { padding: 0 12px; background: var(--surface); }
.fb-errwrap .err-bar { margin: 0 0 6px; }
.ft-field .ft-warn { color: #c27c00; margin-left: auto; display: inline-flex; }
.ft-field .ft-warn svg { width: 14px; height: 14px; }
.ft-field.is-open { background: var(--accent-soft); }
.vis-error { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; text-align: center;
  padding: 8px; background: color-mix(in srgb, var(--muted) 10%, var(--surface)); color: var(--ink); font-size: .82rem; }
.vis-error svg { width: 22px; height: 22px; color: var(--muted); }
.vis-error a { color: var(--accent); cursor: pointer; text-decoration: underline; }
.err-detail { display: grid; gap: 8px; font-size: .85rem; }
.err-detail pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30vh; overflow: auto; font: .8rem var(--mono); background: var(--bg); padding: 8px; border-radius: 6px; margin: 0; }
.err-detail .err-main { color: var(--bad); font-family: var(--mono); white-space: pre-wrap; }
.d-dax { padding: 16px; display: grid; gap: 8px; align-content: start; overflow: auto; flex: 1; }
.dq-out .grid-wrap { max-height: 50vh; }

/* -- icon kiểu aivbank -- */
.d-back { display: inline-flex; align-items: center; gap: 4px; }
.d-back .ic { width: 16px; height: 16px; }
.viz-btn:hover { color: var(--brand-700); background: var(--surface-hover); border-color: var(--line-strong); }
.ft-ico { display: inline-grid; place-items: center; width: 18px; color: var(--muted); }
.ft-ico .ic { width: 15px; height: 15px; }
.ft-field.measure .ft-ico { color: var(--accent); }
.ft-table > summary .ic { width: 15px; height: 15px; color: var(--muted); }
.ft-field .ft-warn { color: var(--warning); }
.ft-field .ft-warn .ic { width: 15px; height: 15px; }
.vis-tools button { display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; color: var(--muted); }
.vis-tools button:hover { color: var(--brand-700); background: var(--surface-hover); }
.vis-tools .ic { width: 14px; height: 14px; }
.chip button { display: inline-grid; place-items: center; padding: 0 2px; }
.chip button .ic { width: 13px; height: 13px; }
.vis-error .ic { width: 22px; height: 22px; color: var(--muted); }
.dlg-title { display: flex; align-items: center; gap: 8px; }
.dlg-title .ic { width: 20px; height: 20px; color: var(--muted); }
#err-dialog .dlg-title .ic { color: var(--danger, #B91C1C); }
.search-in { position: relative; display: block; }
.search-in .ic { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.search-in .text-in { width: 100%; padding-left: 28px; }
.fbar .icon-btn { width: 30px; height: 30px; }
.fb-check { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); align-self: center; white-space: nowrap; }
.fb-check .ic { width: 14px; height: 14px; }
.fb-check.ok { color: var(--accent); } .fb-check.bad { color: var(--bad); }

/* ===================== đợt parity: thanh công cụ, ô, trang, định dạng, lọc ===================== */
.tb-group { display: inline-flex; gap: 4px; align-items: center; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--line); }
.tb-group:last-of-type { border-right: 0; }
.icon-btn:disabled, .btn:disabled { opacity: .4; cursor: not-allowed; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 40; min-width: 230px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.15); padding: 4px; display: grid; }
.menu button { text-align: left; border: 0; background: none; color: var(--ink); padding: 6px 10px; border-radius: 6px; cursor: pointer; font: inherit; font-size: .85rem; }
.menu button:hover { background: var(--surface-hover); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 3px 0; width: 100%; }

.mtools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 4px 12px 6px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: .8rem; }
.mtools label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.mtools select, .mtools .text-in { font-size: .8rem; padding: 3px 6px; width: auto; }
.mtools .mt-desc { flex: 1 1 220px; } .mtools .mt-desc .text-in { flex: 1; width: 100%; }
.mt-title { display: inline-flex; gap: 4px; align-items: center; font-weight: 600; color: var(--accent); }
.mt-title .ic { width: 15px; height: 15px; }
.mt-custom { width: 9rem !important; }

.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.pane-head h2 { margin: 0 !important; }
.pane-toggle { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 4px; display: inline-grid; }
.pane-toggle .ic { width: 16px; height: 16px; }
.pane-toggle:hover { color: var(--brand-700); background: var(--surface-hover); }
.d-pane.collapsed { padding: 8px 4px; overflow: hidden; }
.d-pane.collapsed .pane-body { display: none; }
.d-pane.collapsed .pane-head { flex-direction: column-reverse; }
.d-pane.collapsed .pane-head h2 { writing-mode: vertical-rl; font-size: .85rem; }
.pane-tabs { display: flex; gap: 4px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.pane-tab { flex: 1; display: inline-flex; gap: 6px; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted);
  padding: 6px 4px; cursor: pointer; border-bottom: 2px solid transparent; font: inherit; font-size: .82rem; }
.pane-tab .ic { width: 16px; height: 16px; }
.pane-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.chip { cursor: grab; }
.chip .chip-ico { display: inline-grid; color: var(--muted); flex: none; }
.chip .chip-ico .ic { width: 13px; height: 13px; }
.ft-field.hierarchy .ft-ico { color: var(--accent); }
.ft-hier .level { padding-left: 34px; font-size: .8rem; color: var(--muted); }
.ft-folder { margin-left: 14px; }
.ft-folder > summary { cursor: pointer; list-style: none; display: flex; gap: 6px; align-items: center; color: var(--muted); padding: 2px; font-size: .82rem; }
.ft-table > summary .ft-name { flex: 1; }
.ft-act { border: 0; background: none; color: var(--muted); cursor: pointer; display: inline-grid; padding: 1px; border-radius: 4px; }
.ft-act .ic { width: 14px; height: 14px; }
.ft-act:hover { color: var(--brand-700); background: var(--surface-hover); }

/* trang */
.d-pages { display: flex; align-items: stretch; gap: 2px; padding: 0 8px; background: var(--surface); border-top: 1px solid var(--line); min-height: 34px; overflow-x: auto; flex: none; }
.pg-tab { display: inline-flex; align-items: center; gap: 4px; padding: 0 10px; font-size: .82rem; cursor: pointer; border-top: 3px solid transparent; white-space: nowrap; color: var(--muted); }
.pg-tab.is-active { border-top-color: var(--accent); color: var(--ink); font-weight: 600; background: var(--bg); }
.pg-act, .pg-add { border: 0; background: none; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; padding: 2px; border-radius: 4px; }
.pg-act .ic { width: 13px; height: 13px; } .pg-add .ic { width: 16px; height: 16px; }
.pg-act:hover, .pg-add:hover { color: var(--brand-700); background: var(--surface-hover); }
.pg-add { padding: 0 8px; }
.pg-rename { font: inherit; font-size: .82rem; width: 9rem; padding: 2px 4px; border: 1px solid var(--accent); border-radius: 4px; background: var(--surface); color: var(--ink); }
.d-marquee { position: absolute; border: 1px dashed var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); pointer-events: none; z-index: 900; }

/* visual */
.vis.has-border { border-color: var(--line-strong, var(--line)); }
.vis.drill-on { box-shadow: 0 0 0 1px var(--info) inset; }
.vis-tools button.is-on { color: var(--accent); background: var(--accent-soft); }
.vis-tools button:disabled { opacity: .35; cursor: default; }
.vis-flag { display: inline-grid; place-items: center; width: 22px; color: var(--accent); }
.vis-flag .ic { width: 13px; height: 13px; }
svg.chart .grid { stroke: color-mix(in srgb, var(--line) 70%, transparent); }
svg.chart .axis-title { font-weight: 600; fill: var(--muted); }
svg.chart .data-label { fill: var(--ink); font-size: 10px; }
svg.chart .note { font-size: 10px; fill: var(--muted); }
svg.chart .tm-label { fill: #fff; font-size: 11px; pointer-events: none; }
svg.chart .gauge-val { font-size: 20px; font-weight: 600; fill: var(--ink); }
svg.chart .mark.ghost { opacity: .32; }
.chart-tip { white-space: pre; line-height: 1.35; }
.mcard-v { height: 100%; overflow: auto; display: grid; gap: 6px; align-content: start; }
.mcard-item { border-left: 3px solid var(--accent); padding: 2px 8px; }
.mcard-item .big { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.mcard-item .lbl { color: var(--muted); font-size: .78rem; }
.kpi-v { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.kpi-v .big { font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-v .big.good { color: var(--good); } .kpi-v .big.bad { color: var(--bad); }
.kpi-v .lbl { font-size: .8rem; }
.kpi-v .spark { margin-top: 6px; display: block; }
.tbl-v tr.dim td { opacity: .45; }
.tbl-v tbody tr { cursor: pointer; }
.tbl-v th { cursor: pointer; }
.tbl-v th.num { text-align: right; }
.matrix th.rh { text-align: left; font-weight: 400; position: static; background: none; white-space: nowrap; }
.matrix tr.sub th.rh, .matrix tr.sub td { font-weight: 600; }
.matrix tr.tot th, .matrix tr.tot td { font-weight: 700; border-top: 2px solid var(--line); }
.matrix td.tot, .matrix th.tot { font-weight: 600; background: color-mix(in srgb, var(--bg) 60%, transparent); }
.mx-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 15px; height: 15px; line-height: 11px; font-size: 11px; padding: 0; margin-right: 4px; border-radius: 3px; cursor: pointer; }
.slicer-v { display: flex; flex-direction: column; gap: 4px; }
.slicer-search { font: inherit; font-size: .8rem; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.slicer-list { overflow: auto; display: grid; gap: 2px; align-content: start; }
.slicer-list label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

/* ô Định dạng */
.fmt { display: grid; gap: 6px; }
.fmt-h { margin: 6px 0 2px; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fmt-card { border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; }
.fmt-card > summary { cursor: pointer; padding: 6px 0; font-weight: 600; font-size: .85rem; }
.fmt-card[open] { padding-bottom: 8px; }
.fmt-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .82rem; padding: 3px 0; }
.fmt-row.col { flex-direction: column; align-items: stretch; }
.fmt-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmt-row select { font-size: .8rem; max-width: 60%; }
.fmt-row input[type=color] { width: 34px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; flex: none; }
.fmt-row .text-in { width: 100%; font-size: .8rem; }
.fmt-num { width: 4.5rem !important; }

/* ô Filters */
.flt-sec { margin-bottom: 12px; }
.flt-sec h3 { font-size: .78rem; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.flt-drop { border: 1px dashed var(--line); border-radius: 6px; padding: 6px; font-size: .78rem; color: var(--muted); }
.flt-drop.drop-ok { border-color: var(--accent); background: var(--accent-soft); }
.flt-card { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; background: var(--surface); }
.flt-card.is-active { border-left: 3px solid var(--accent); }
.flt-head { display: flex; align-items: center; gap: 4px; padding: 5px 6px; cursor: pointer; }
.flt-caret { display: inline-grid; color: var(--muted); } .flt-caret .ic { width: 14px; height: 14px; }
.flt-name { flex: 1; min-width: 0; display: grid; font-size: .8rem; }
.flt-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flt-x { border: 0; background: none; color: var(--muted); cursor: pointer; display: inline-grid; padding: 1px; }
.flt-x .ic { width: 13px; height: 13px; }
.flt-body { padding: 0 8px 8px; display: grid; gap: 6px; font-size: .8rem; }
.flt-body select, .flt-body .text-in { font-size: .8rem; width: 100%; }
.flt-values { max-height: 180px; overflow: auto; display: grid; gap: 2px; }
.flt-values label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.flt-adv { display: grid; gap: 5px; }

/* DAX query view */
.dq-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.dq-tab { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; font-size: .82rem; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); white-space: nowrap; }
.dq-tab.is-active { border-bottom-color: var(--accent); color: var(--ink); font-weight: 600; }
.dax-ed .t-match { background: color-mix(in srgb, var(--accent) 28%, transparent); outline: 1px solid var(--accent); border-radius: 2px; }
.dax-sig { position: absolute; z-index: 31; max-width: min(520px, 95%); background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,.14); padding: 5px 8px; font-size: .78rem; color: var(--muted); pointer-events: none; }
.dax-sig code { font-family: var(--mono); color: var(--ink); display: block; }
.dax-sig b { color: var(--accent); }

/* Model view */
.d-model, .d-table { flex: 1; min-height: 0; }
.mv { display: flex; flex-direction: column; }
.mv-bar { display: flex; gap: 10px; align-items: center; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mv-body { flex: 1; min-height: 0; display: flex; }
.mv-scroll { flex: 1; overflow: auto; }
.mv-canvas { position: relative; min-width: 100%; min-height: 100%;
  background-image: radial-gradient(color-mix(in srgb, var(--line) 80%, transparent) 1px, transparent 1px); background-size: 16px 16px; }
.mv-lines { position: absolute; inset: 0; overflow: visible; pointer-events: none; z-index: 2; }
.mv-rel { pointer-events: all; }
.mv-card { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); font-size: .8rem; overflow: hidden; z-index: 1; }
.mv-head { display: flex; gap: 6px; align-items: center; height: 30px; padding: 0 8px; font-weight: 600; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-bottom: 1px solid var(--line); cursor: move; user-select: none; }
.mv-col { display: flex; gap: 6px; align-items: center; height: 22px; padding: 0 8px; user-select: none; }
.mv-col.can-link { cursor: crosshair; }
.mv-col.can-link:hover { background: var(--accent-soft); }
.mv-col.more { color: var(--muted); font-style: italic; }
.mv-ico { display: inline-grid; color: var(--muted); } .mv-ico .ic { width: 14px; height: 14px; }
.mv-rel .line { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.mv-rel .hit { fill: none; stroke: transparent; stroke-width: 12; cursor: pointer; pointer-events: stroke; }
.mv-rel.inactive .line { stroke-dasharray: 5 4; }
.mv-rel.is-sel .line { stroke: var(--accent); stroke-width: 2.5; }
.mv-rel .dir { stroke: var(--muted); stroke-width: 1.5; }
.mv-rel .card { fill: var(--ink); font: 600 12px var(--sans); }
.mv-arrow { fill: var(--muted); }
.mv-ghost { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; }
.mv-props { width: 280px; flex: none; border-left: 1px solid var(--line); background: var(--surface); padding: 12px; display: grid; gap: 10px; align-content: start; font-size: .84rem; overflow: auto; }
.mv-props-head { display: flex; justify-content: space-between; align-items: center; }
.mv-props-head h3 { margin: 0; font-size: .95rem; }
.mv-kv { display: grid; gap: 3px; }
label.mv-kv:has(input[type=checkbox]) { display: flex; gap: 6px; align-items: center; }
.mv-props code { font-family: var(--mono); font-size: .8rem; overflow-wrap: anywhere; }

/* Table view */
.tv { display: flex; }
.tv-list { width: 180px; flex: none; border-right: 1px solid var(--line); background: var(--surface); padding: 8px; display: grid; gap: 2px; align-content: start; overflow: auto; }
.tv-tab { display: flex; gap: 6px; align-items: center; border: 0; background: none; color: var(--ink); padding: 5px 8px; border-radius: 6px; cursor: pointer; text-align: left; font: inherit; font-size: .84rem; }
.tv-tab:hover { background: var(--surface-hover); }
.tv-tab.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px; overflow: hidden; }
.tv-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tv-tools { margin-left: auto; display: inline-flex; gap: 6px; }
.tv-grid { flex: 1; max-height: none; }
.tv-grid th { cursor: pointer; white-space: nowrap; }
.tv-grid th > * { vertical-align: middle; }
.tv-grid th.err { color: var(--bad); }

.d-pane { overflow-x: hidden; }
.chip select { max-width: 92px; }
.chip span { min-width: 0; }

/* ===================== đợt 2: chart mới, trang trí, dashboard ===================== */
.dash-wrap { display: inline-flex; align-items: center; gap: 4px; position: relative; }
.dash-select { font: inherit; font-size: .85rem; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); max-width: 220px; }
.dash-wrap .icon-btn { width: 28px; height: 28px; }
.small-dlg { max-width: 420px; }
.small-dlg .text-in { width: 100%; margin: 6px 0 10px; }

.vis.is-decor:not(.is-selected):not(:hover) { border-color: transparent; }
.vis.is-decor .vis-body { padding: 0; }
.tb-v { width: 100%; height: 100%; overflow: auto; padding: 4px 6px; white-space: pre-wrap; outline: none; color: var(--ink); line-height: 1.3; }
.tb-v.ph { color: var(--muted); font-style: italic; }
.tb-v[contenteditable="plaintext-only"] { box-shadow: inset 0 0 0 1px var(--accent); cursor: text; }
.shape-v { display: block; }
.img-v { width: 100%; height: 100%; display: block; }
.btn-v { width: 100%; height: 100%; border: 1px solid var(--line-strong, var(--line)); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn-v:hover { border-color: var(--accent); color: var(--accent); }
.fmt-area { width: 100%; resize: vertical; font-family: var(--sans); }

.ncard-v { height: 100%; display: flex; gap: 8px; align-items: stretch; overflow: auto; }
.ncard-item { flex: 1 1 0; min-width: 90px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; }
.ncard-item .lbl { color: var(--muted); font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ncard-item .big { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.dt-v { height: 100%; display: flex; gap: 14px; overflow: auto; align-items: flex-start; padding-top: 2px; }
.dt-col { min-width: 150px; max-width: 200px; display: grid; gap: 4px; }
.dt-head { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.dt-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; }
.dt-node { position: relative; display: flex; justify-content: space-between; gap: 6px; font-size: .78rem; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; overflow: hidden; }
.dt-node.is-sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dt-bar { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, #118dff 22%, transparent); pointer-events: none; }
.dt-lbl, .dt-val { position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dt-val { font-variant-numeric: tabular-nums; font-weight: 600; }
.dt-add { font: inherit; font-size: .78rem; padding: 2px 4px; border: 1px dashed var(--accent); border-radius: 6px; background: var(--surface); color: var(--accent); cursor: pointer; }

.slicer-tiles { display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; overflow: auto; }
.slicer-tile { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 3px 9px; font: inherit; font-size: .8rem; cursor: pointer; }
.slicer-tile.is-on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.slicer-dd { width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 6px; padding: 4px 8px; font: inherit; font-size: .82rem; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slicer-pop { border: 1px solid var(--line); border-radius: 6px; padding: 4px; display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow: auto; }
.slicer-between { display: flex; align-items: center; gap: 4px; }
.slicer-range { width: 0; flex: 1; font-size: .8rem; padding: 3px 5px; }
.vis.is-decor .vis-head { position: absolute; left: 0; right: 0; top: -24px; z-index: 3; min-height: 22px; background: transparent; pointer-events: none; }
.vis.is-decor .vis-head .vis-tools { pointer-events: auto; margin-left: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.vis.is-decor { cursor: move; }
.tb-v { overflow: hidden; }
.tb-v[contenteditable="plaintext-only"] { overflow: auto; }

/* ---------- Ribbon kiểu công cụ BI desktop (tab + nhóm lệnh), Quick Access Toolbar ---------- */
.d-top { padding: 4px 10px; gap: 10px; }
.qat { display: inline-flex; gap: 2px; padding-right: 8px; border-right: 1px solid var(--line); }
.qat .icon-btn { width: 28px; height: 28px; }
.ribbon { position: relative; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; z-index: 30; }
.rb-tabs { display: flex; align-items: stretch; gap: 2px; padding: 0 8px; min-height: 30px; }
.rb-tab { border: 0; background: none; color: var(--ink); font: inherit; font-size: .84rem; padding: 6px 12px 5px; cursor: pointer; border-bottom: 3px solid transparent; border-radius: 4px 4px 0 0; }
.rb-tab:hover { background: var(--surface-hover); }
.rb-tab.is-active { border-bottom-color: var(--accent); font-weight: 600; }
.rb-tab.file { color: var(--accent); font-weight: 600; }
.rb-tab.ctx { color: var(--brand-700); background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.rb-tab.ctx.is-active { background: var(--accent-soft); }
.rb-tab:focus-visible, .rb-btn:focus-visible, .rb-arrow:focus-visible, .rb-pin:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rb-spacer { flex: 1; }
.rb-pin { border: 0; background: none; color: var(--muted); cursor: pointer; width: 30px; display: grid; place-items: center; border-radius: 4px; }
.rb-pin:hover { background: var(--surface-hover); color: var(--ink); }
.rb-pin .ic { width: 16px; height: 16px; }
.rb-body { display: flex; align-items: stretch; gap: 0; padding: 4px 6px 0; min-height: 86px; overflow-x: auto; border-top: 1px solid var(--line); }
.ribbon.is-min .rb-body { display: none; }
.ribbon.is-min.peek .rb-body { display: flex; position: absolute; left: 0; right: 0; top: 100%; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 6px 16px rgba(0,0,0,.14); }
.rb-group { display: flex; flex-direction: column; padding: 0 8px; border-right: 1px solid var(--line); flex: none; }
.rb-group:last-child { border-right: 0; }
.rb-items { display: flex; align-items: flex-start; gap: 2px; flex: 1; }
.rb-glabel { font-size: .7rem; color: var(--muted); text-align: center; padding: 2px 0 3px; white-space: nowrap; }
.rb-stack { display: flex; flex-direction: column; gap: 1px; }
.rb-btn { border: 1px solid transparent; background: none; color: var(--ink); font: inherit; cursor: pointer; border-radius: 4px; display: inline-flex; align-items: center; }
.rb-btn:hover:not(:disabled), .rb-arrow:hover:not(:disabled) { background: var(--surface-hover); }
.rb-btn:disabled, .rb-arrow:disabled { opacity: .4; cursor: default; }
.rb-btn.is-on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.rb-btn.large { flex-direction: column; justify-content: flex-start; gap: 3px; min-width: 64px; max-width: 104px; min-height: 64px; padding: 4px 2px; font-size: .74rem; line-height: 1.15; text-align: center; }
.rb-btn.large .ic { width: 26px; height: 26px; color: var(--accent); }
.rb-btn.small { gap: 6px; padding: 2px 8px 2px 4px; font-size: .78rem; height: 22px; white-space: nowrap; }
.rb-btn.small .ic { width: 15px; height: 15px; color: var(--accent); }
.rb-btn .rb-label { display: block; }
.rb-caret { display: inline-grid; place-items: center; color: var(--muted); }
.rb-caret .ic { width: 11px !important; height: 11px !important; color: var(--muted) !important; }
.rb-split { display: inline-flex; flex-direction: column; border-radius: 4px; }
.rb-split.large .rb-btn.large { min-height: 46px; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.rb-arrow { border: 1px solid transparent; background: none; cursor: pointer; border-radius: 0 0 4px 4px; height: 18px; display: grid; place-items: center; color: var(--muted); }
.rb-split:hover { box-shadow: inset 0 0 0 1px var(--line); }
.rb-custom .rb-items { align-items: center; gap: 12px; }
.rb-custom .mtools { border: 0; padding: 0; background: none; max-width: 760px; }
.rb-props { display: grid; grid-template-columns: auto auto; gap: 2px 10px; font-size: .78rem; align-content: center; }
.rb-prop { display: contents; }
.rb-check { display: inline-flex; gap: 6px; align-items: center; font-size: .78rem; }
.rb-note { max-width: 260px; align-self: center; }
@media (max-width: 760px) { .rb-body { min-height: 0; } .rb-btn.large { width: 56px; } }

/* ---------- menu nổi (chuột phải, "…", thả xuống) ---------- */
.ctx-menu { position: fixed; z-index: 1000; min-width: 210px; max-width: 340px; max-height: calc(100vh - 12px); overflow-y: auto; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong, var(--line)); border-radius: 8px; box-shadow: 0 10px 28px rgba(0,0,0,.18); padding: 4px; outline: none; }
.ctx-item { display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; width: 100%; border: 0; background: none; color: inherit; font: inherit; font-size: .84rem;
  text-align: left; padding: 5px 8px; border-radius: 5px; cursor: pointer; }
.ctx-item.is-focus, .ctx-item:hover:not(:disabled) { background: var(--surface-hover); outline: none; }
.ctx-item:disabled { color: var(--muted); opacity: .55; cursor: default; }
.ctx-item.danger:not(:disabled) { color: var(--bad); }
.ctx-ic { display: inline-grid; place-items: center; color: var(--accent); }
.ctx-ic .ic, .ctx-key .ic { width: 15px; height: 15px; }
.ctx-key { color: var(--muted); font-size: .74rem; display: inline-grid; place-items: center; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 6px; }

/* ---------- File (backstage) ---------- */
.backstage { position: fixed; inset: 0; z-index: 900; display: grid; grid-template-columns: 240px 1fr; background: var(--bg); }
.bs-nav { background: var(--accent); color: #fff; display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; }
.bs-nav hr { border: 0; border-top: 1px solid rgba(255,255,255,.3); width: 100%; margin: 6px 0; }
.bs-back, .bs-item { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; text-align: left; }
.bs-back { width: 40px; height: 40px; justify-content: center; margin-bottom: 8px; }
.bs-back .ic, .bs-item .ic { width: 18px; height: 18px; }
.bs-item:hover:not(:disabled), .bs-back:hover, .bs-item:focus-visible, .bs-back:focus-visible { background: rgba(255,255,255,.18); outline: none; }
.bs-item:disabled { opacity: .5; cursor: default; }
.bs-main { padding: 28px 36px; overflow: auto; }
.bs-main h2 { margin: 0 0 4px; font-size: 1.3rem; }
.bs-list { display: grid; gap: 6px; max-width: 720px; margin-top: 14px; }
.bs-dash { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: 10px; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 10px 12px; cursor: pointer; font: inherit; }
.bs-dash .ic { grid-row: span 2; width: 20px; height: 20px; color: var(--accent); align-self: center; }
.bs-dash.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.bs-dash:hover { background: var(--surface-hover); }
.bs-dname { font-weight: 600; }
@media (max-width: 760px) { .backstage { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } .bs-nav { flex-direction: row; flex-wrap: wrap; } }

/* ---------- Selection pane, Focus mode, Spotlight, ẩn, khóa, lưới ---------- */
.d-canvas-wrap { position: relative; }
.sel-pane { position: absolute; top: 0; right: 0; bottom: 0; width: 250px; background: var(--surface); border-left: 1px solid var(--line); padding: 10px; overflow: auto; z-index: 20; box-shadow: -4px 0 12px rgba(0,0,0,.08); }
.sel-pane .pane-head { display: flex; align-items: center; justify-content: space-between; }
.sel-pane h2 { margin: 0; font-size: .95rem; }
.sel-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.sel-row { display: grid; grid-template-columns: 18px 1fr 24px; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 5px; cursor: pointer; font-size: .82rem; border: 1px solid transparent; }
.sel-row:hover { background: var(--surface-hover); }
.sel-row.is-sel { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.sel-row.is-hidden { color: var(--muted); }
.sel-row.is-hidden .sel-name { text-decoration: line-through; }
.sel-row.drop-ok { border-top: 2px solid var(--accent); }
.sel-ico .ic { width: 16px; height: 16px; color: var(--accent); }
.sel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sel-eye { border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 4px; }
.sel-eye:hover { color: var(--ink); background: var(--bg); }
.sel-eye .ic { width: 15px; height: 15px; }
.vis.is-hidden { display: none !important; }
.d-page.focus-mode .vis:not(.is-focus) { display: none; }
.d-page.focus-mode .vis.is-focus { z-index: 50 !important; box-shadow: none; }
.d-page.spotlight .vis:not(.is-spot) { opacity: .22; transition: opacity .15s; }
.focus-bar { display: flex; align-items: center; gap: 10px; padding: 4px 10px; background: var(--surface); border-top: 1px solid var(--line); }
.focus-grid { position: absolute; left: 0; right: 0; top: 408px; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 8px; display: flex; flex-direction: column; gap: 4px; z-index: 51; }
.focus-grid .grid-wrap { flex: 1; overflow: auto; }
.d-page.no-grid { background-image: none; }
.d-page.locked .vis-head { cursor: default; }
.d-page.locked .vis-resize { display: none !important; }

/* ---------- ô Data: mục ẩn; tab trang ẩn; chip field-well ---------- */
.ft-field.is-hidden > span:not(.ft-ico):not(.ft-hid), .ft-table > summary.is-hidden .ft-name { opacity: .55; font-style: italic; }
.ft-hid { display: inline-grid; color: var(--muted); margin-left: auto; }
.ft-hid .ic { width: 13px; height: 13px; }
.pg-tab.is-hidden span { opacity: .6; font-style: italic; }
.pg-hid .ic { width: 13px; height: 13px; color: var(--muted); }
.chip .chip-dd .ic { width: 12px; height: 12px; }
.chip-rename { flex: 1; min-width: 0; font: inherit; font-size: .8rem; padding: 1px 4px; border: 1px solid var(--accent); border-radius: 3px; background: var(--surface); color: var(--ink); }
.info-body { max-height: 60vh; overflow: auto; }
.kbd-table td { vertical-align: top; }
.kbd-table kbd { font: .78rem var(--mono); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }

.bs-main h2, .sel-pane h2 { text-transform: none; letter-spacing: 0; color: var(--ink); }

.flt-tuple { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: .8rem; padding: 2px 0; }

/* Edit interactions, drill through, bookmarks */
.d-page.edit-inter .vis .vis-tools { display: flex; }
.d-page.edit-inter .vis-tools .inter-btn { width: 24px; height: 22px; }
.d-page.edit-inter .vis-tools .inter-btn.is-on { color: #fff; background: var(--accent); }
.dthru-bar { border-top: 0; border-bottom: 1px solid var(--line); }
.bm-pane { z-index: 21; }
.bm-pane .row { margin: 6px 0; }
#qm-dialog .fmt-row select, #qm-dialog .fmt-row .text-in { max-width: 360px; width: 100%; }
#qm-dialog pre { max-height: 220px; }
.dthru-bar { flex: none; height: auto; }
.dthru-bar .btn { display: inline-flex; align-items: center; gap: 4px; }
.dthru-bar .ic, .focus-bar .ic { width: 14px; height: 14px; }

/* ---------- Power Query Editor (bản lab) ---------- */
.pq { position: fixed; inset: 0; z-index: 950; background: var(--bg); display: flex; flex-direction: column; color: var(--ink); }
.pq-head { padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.pq-ribbon { display: flex; background: var(--surface); border-bottom: 1px solid var(--line); padding: 4px 6px 0; overflow-x: auto; }
.pq-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr) 260px; }
.pq-queries { border-right: 1px solid var(--line); background: var(--surface); padding: 8px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.pq-queries h3, .pq-settings h3 { margin: 0 0 6px; font-size: .9rem; text-transform: none; letter-spacing: 0; color: var(--ink); }
.pq-q { display: flex; gap: 6px; align-items: center; border: 0; background: none; color: var(--ink); font: inherit; font-size: .84rem; padding: 5px 6px; border-radius: 4px; text-align: left; cursor: pointer; }
.pq-q .ic { width: 15px; height: 15px; color: var(--accent); flex: none; }
.pq-q:hover:not(:disabled) { background: var(--surface-hover); }
.pq-q.is-active { background: var(--accent-soft); font-weight: 600; }
.pq-q.is-ro { color: var(--muted); cursor: default; }
.pq-center { display: flex; flex-direction: column; min-width: 0; }
.pq-gridwrap { flex: 1; overflow: auto; background: var(--surface); }
.pq-grid { border-collapse: collapse; font-size: .8rem; }
.pq-grid th { position: sticky; top: 0; background: var(--surface); border-bottom: 2px solid var(--line-strong, var(--line)); white-space: nowrap; padding: 4px 6px; text-align: left; z-index: 1; }
.pq-grid td { border-bottom: 1px solid var(--line); padding: 3px 8px; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.pq-grid .pq-rn { color: var(--muted); background: var(--bg); text-align: right; width: 36px; }
.pq-null { color: var(--muted); font-style: italic; }
.pq-type { display: inline-block; font: 600 .66rem var(--mono); color: var(--accent); border: 1px solid var(--line); border-radius: 3px; padding: 0 3px; margin-right: 6px; }
.pq-dd { border: 0; background: none; color: var(--muted); cursor: pointer; margin-left: 4px; display: inline-grid; place-items: center; }
.pq-dd .ic { width: 12px; height: 12px; }
.pq-status { padding: 4px 8px; border-top: 1px solid var(--line); background: var(--surface); }
.pq-empty { padding: 32px; }
.pq-settings { border-left: 1px solid var(--line); background: var(--surface); padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.pq-settings h4 { margin: 10px 0 2px; font-size: .82rem; }
.pq-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 1px; }
.pq-steps li { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px; border-radius: 4px; font-size: .82rem; cursor: pointer; }
.pq-steps li:hover { background: var(--surface-hover); }
.pq-steps li.is-active { background: var(--accent-soft); font-weight: 600; }
@media (max-width: 900px) { .pq-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; } }
.ed-grid td, .ed-grid th { min-width: 90px; outline: none; }
.ed-grid td:focus, .ed-grid th:focus { box-shadow: inset 0 0 0 2px var(--accent); }

/* thanh trạng thái, Optimize, TMDL view, tìm bộ lọc */
.d-statusbar { display: flex; align-items: center; gap: 6px; padding: 2px 10px; min-height: 24px; font-size: .74rem; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); flex: none; }
.sb-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: .9rem; width: 22px; height: 20px; display: inline-grid; place-items: center; border-radius: 3px; }
.sb-btn:hover { background: var(--surface-hover); color: var(--ink); }
.sb-btn .ic { width: 14px; height: 14px; }
.sb-zoom { width: 110px; accent-color: var(--accent); }
.sb-pct { min-width: 36px; text-align: right; }
.sb-paused { color: var(--warn-ink, var(--bad)); font-weight: 600; margin-right: 10px; }
.d-page.paused .vis-body { opacity: .55; }
.perf-pane { z-index: 22; }
.perf-list { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.perf-row summary { display: flex; justify-content: space-between; gap: 8px; cursor: pointer; font-size: .8rem; padding: 3px 4px; border-radius: 4px; }
.perf-row summary:hover { background: var(--surface-hover); }
.perf-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perf-ms { font: .75rem var(--mono); color: var(--accent); flex: none; }
.perf-detail { font-size: .76rem; padding: 2px 8px 6px; display: grid; gap: 2px; }
.d-tmdl { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr); background: var(--surface); }
.tmdl-files { border-right: 1px solid var(--line); padding: 8px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.tmdl-main { display: flex; flex-direction: column; min-width: 0; padding: 8px 12px; gap: 6px; }
.tmdl-code { flex: 1; overflow: auto; margin: 0; font-size: .78rem; white-space: pre; tab-size: 4; }
.flt-search { margin-bottom: 8px; width: 100%; }

.d-main.no-report-panes .sel-pane { display: none !important; }

/* View > Themes, Sync slicers */
.theme-gallery { display: flex; gap: 4px; align-items: center; }
.theme-tile { width: 54px; height: 52px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 3px; }
.theme-tile:hover { border-color: var(--accent); }
.theme-tile.is-on { box-shadow: 0 0 0 2px var(--accent); }
.theme-aa { font-size: .72rem; color: var(--ink); }
.theme-bars { display: flex; gap: 1px; align-items: flex-end; height: 18px; }
.theme-bars i { display: block; width: 6px; }
.theme-bars i:nth-child(1) { height: 18px; } .theme-bars i:nth-child(2) { height: 12px; } .theme-bars i:nth-child(3) { height: 15px; }
.theme-bars i:nth-child(4) { height: 9px; } .theme-bars i:nth-child(5) { height: 14px; } .theme-bars i:nth-child(6) { height: 7px; }
.sync-pane { z-index: 23; }
.sync-row { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: center; font-size: .82rem; padding: 4px 2px; }
