/* =============================================================================
   TỔNG QUAN KINH DOANH — port từ mockup smart-erp-demo.html (CSS dòng 7–631).
   Ba luật để sống chung với app (giống kpi.css):
     1. Biến --x của mockup → var(--st-x) khai trong smart-theme.css. File này KHÔNG khai :root.
     2. Mọi selector bọc trong .tq-page; không có selector trần (*, body, button, a).
     3. Đã bỏ shell của mockup (sidebar, topbar, tabbar) và khối màn chứng từ — app có sẵn.
   Khối "TINH CHỈNH THEO NHẬN DIỆN SMART SOFTWARE" của mockup đã gộp thẳng vào rule gốc.
   style="..." inline tĩnh của template mockup đã chuyển thành lớp có tên (nhóm cuối file).
   ============================================================================= */

/* ---------- Trang: gánh vai body + .tt-page của mockup; đệm 6 / 8 / 8, các khối cách nhau 8 như màn Người dùng ---------- */
.tq-page{background:var(--st-page);color:var(--st-text-1);font-family:var(--app-font-family);
  font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;
  padding:6px 8px 8px;display:flex;flex-direction:column;gap:8px;min-height:100%}
/* ---------- Bảng màu của app (xanh dương chủ đạo) áp riêng cho trang tổng quan ---------- */
.tq-page{
  --st-s1:#2563eb;--st-s2:#dc2626;--st-s3:#16a34a;
  --st-seq-1:#dbe7ff;--st-seq-2:#93b4f5;--st-seq-3:#4f86ef;--st-seq-4:#2563eb;
  --st-text-1:#1f2937;--st-text-2:#5b6577;--st-text-muted:#8a94a6;
  --st-border:#e6eaf1;--st-border-2:#eef1f6;--st-grid:#eef1f6;--st-axis:#d5dbe5;
  --st-surface-2:#f8fafc;--st-surface-3:#f1f4f9;
  --st-good:#16a34a;--st-good-text:#15803d;--st-good-bg:#eaf7ef;
  --st-warning:#f59e0b;--st-warn-text:#92400e;--st-warn-bg:#fff7e6;
  --st-critical:#dc2626;--st-critical-text:#b91c1c;--st-crit-bg:#fdecec;
  --st-r-md:10px}
/* Thanh lọc theo khuôn báo cáo (.sm-page.ob .ob-toolbar): bỏ nền / chiều cao của gốc .sm-page.ob */
.tq-page .tq-filters.sm-page.ob{min-height:0;background:transparent;font-size:13px}
/* Ba ô lọc luôn trên một dòng: không xuống dòng, ô chọn co lại khi thiếu chỗ */
.tq-page .tq-filters .slt-filters{flex-wrap:nowrap}
.tq-page .tq-filters .rf-fld{flex:0 1 auto;min-width:0}
.tq-page .tq-filters .flt-lbl{white-space:nowrap}
.tq-page .tq-filters.sm-page.ob .ob-filter{width:220px;min-width:120px;flex:0 1 220px}
.tq-page .tt-empty{padding:24px 0;text-align:center;color:var(--st-text-muted)}
.tq-page *{box-sizing:border-box}
:where(.tq-page) button{font-family:inherit;font-size:inherit;cursor:pointer}
.tq-page a{color:inherit;text-decoration:none}
.tq-page .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
/* Đang nạp số liệu: làm mờ thẻ */
.tq-page .tt-card,.tq-page .tt-kpi{transition:opacity .2s ease}
.tq-page.is-dim .tt-card,.tq-page.is-dim .tt-kpi{opacity:.55}

/* ---------- Page header ---------- */
.tq-page .tt-pagehead{display:flex;align-items:flex-end;gap:16px;flex-wrap:wrap}
.tq-page .tt-crumb{font-size: 14px;color:var(--st-text-muted);margin-bottom:2px}
.tq-page .tt-pagehead h1{margin:0;font-size:20px;font-weight:700;letter-spacing:-.2px}
.tq-page .tt-pagehead__meta{font-size: 13px;color:var(--st-text-2);margin-top:3px}
.tq-page .tt-pagehead__actions{margin-left:auto;display:flex;gap:8px}


/* ---------- Grid 12 cột ---------- */
.tq-page .tt-grid{display:grid;grid-template-columns:repeat(12,1fr);gap:8px}
.tq-page .c3{grid-column:span 3}.tq-page .c4{grid-column:span 4}.tq-page .c5{grid-column:span 5}
.tq-page .c6{grid-column:span 6}.tq-page .c7{grid-column:span 7}.tq-page .c8{grid-column:span 8}.tq-page .c12{grid-column:span 12}

/* ---------- KPI ---------- */
.tq-page .tt-kpi{background:var(--st-surface-1);border:1px solid var(--st-border);border-radius:var(--st-r-md);
  padding:13px 14px 10px;display:flex;flex-direction:column;gap:6px;min-height:104px}
.tq-page .tt-kpi__top{display:flex;align-items:flex-start;gap:8px}
.tq-page .tt-kpi__lb{font-size: 14px;color:var(--st-text-2);font-weight:600;letter-spacing:.1px}
.tq-page .tt-kpi__info{margin-left:auto;color:#aab2bd;cursor:help;flex:0 0 auto}
.tq-page .tt-kpi__val{font-size:25px;font-weight:700;letter-spacing:-.6px;line-height:1.1}
.tq-page .tt-kpi__val--good{font-size:20px;color:var(--st-good-text);padding-top:4px}
.tq-page .tt-kpi__unit{font-size:14px;font-weight:600;color:var(--st-text-2);margin-left:3px}
.tq-page .tt-kpi__foot{display:flex;align-items:center;gap:8px;margin-top:auto}
.tq-page .tt-delta{display:inline-flex;align-items:center;gap:3px;font-size: 14px;font-weight:700;font-variant-numeric:tabular-nums}
.tq-page .tt-delta--up{color:var(--st-good-text)}
.tq-page .tt-delta--down{color:var(--st-critical-text)}
.tq-page .tt-delta--flat{color:var(--st-text-muted)}
.tq-page .tt-kpi__vs{font-size: 14px;color:var(--st-text-muted)}
.tq-page .tt-kpi__spark{margin-left:auto}
.tq-page .tt-kpi--hero{border-color:var(--st-red-100);background:linear-gradient(180deg,#F6F9FF,#fff)}
.tq-page .tt-kpi--hero .tt-kpi__val{font-size:42px;letter-spacing:-1.4px;color:var(--st-red-700)}
.tq-page .tt-kpi--hero .tt-kpi__unit{font-size:17px}
.tq-page .tt-kpi--hero .tt-kpi__lb{color:var(--st-red-700)}
.tq-page .tt-kpi--alert{border-color:#f3d6d6;background:var(--st-crit-bg)}
.tq-page .tt-kpi--warn{border-color:#f0e0b6;background:var(--st-warn-bg)}
.tq-page .tt-statusdot{display:inline-flex;align-items:center;gap:5px;font-size: 14px;font-weight:700}
.tq-page .tt-statusdot svg{flex:0 0 13px}
.tq-page .tt-statusdot--warn{color:var(--st-warn-text)}
.tq-page .tt-statusdot--crit{color:var(--st-critical-text)}

/* ---------- Card ---------- */
.tq-page .tt-card{background:var(--st-surface-1);border:1px solid var(--st-border);border-radius:var(--st-r-md);
  display:flex;flex-direction:column;overflow:hidden}
.tq-page .tt-card__head{display:flex;align-items:center;gap:10px;padding:12px 14px 8px}
.tq-page .tt-card__title{font-size:14px;font-weight:700;letter-spacing:-.1px}
.tq-page .tt-card__sub{font-size: 14px;color:var(--st-text-muted);margin-top:1px}
.tq-page .tt-card__tools{margin-left:auto;display:flex;align-items:center;gap:4px;flex:0 0 auto}
.tq-page .tt-toggle{display:flex;border:1px solid var(--st-border);border-radius:var(--st-r-sm);overflow:hidden}
.tq-page .tt-toggle button{border:0;background:#fff;padding:4px 8px;font-size: 14px;font-weight:600;color:var(--st-text-2);white-space:nowrap}
.tq-page .tt-toggle button.is-active{background:var(--st-red-050);color:var(--st-red-700)}
.tq-page .tt-card__body{padding:4px 14px 14px;flex:1 1 auto}
.tq-page .tt-card__body--scroll{max-height:280px;overflow-y:auto}
.tq-page .tt-legend{display:flex;flex-wrap:wrap;gap:14px;padding:2px 0 8px}
.tq-page .tt-legend__i{display:inline-flex;align-items:center;gap:6px;font-size: 13px;color:var(--st-text-2);font-weight:600}
.tq-page .tt-legend__sw{width:11px;height:11px;border-radius:3px;flex:0 0 11px}
.tq-page .tt-legend__sw--line{height:3px;border-radius:2px;width:14px;flex-basis:14px}
.tq-page .tt-legend__sw--dot{border-radius:50%}
.tq-page .tt-legend__sw--ref{width:3px;flex-basis:3px;border-radius:2px}

/* ---------- Ranked bars ---------- */
.tq-page .tt-rank{display:flex;flex-direction:column;gap:2px}
.tq-page .tt-rank__row{display:grid;grid-template-columns:142px 1fr 108px 50px;align-items:center;gap:10px;
  padding:5px 6px;border-radius:var(--st-r-sm)}
.tq-page .tt-rank__row:hover{background:var(--st-surface-2)}
.tq-page .tt-rank__name{font-size: 14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tq-page .tt-rank__track{position:relative;height:18px}
.tq-page .tt-rank__bar{position:absolute;top:1px;height:16px;border-radius:0 4px 4px 0;background:var(--st-s1)}
.tq-page .tt-rank__bar--neg{border-radius:4px 0 0 4px;background:var(--st-critical)}
.tq-page .tt-rank__zero{position:absolute;top:-1px;bottom:-1px;width:1px;background:var(--st-axis)}
.tq-page .tt-rank__val{text-align:right;font-size: 14px;font-weight:600;font-variant-numeric:tabular-nums}
.tq-page .tt-rank__pct{text-align:right;font-size: 14px;color:var(--st-text-muted);font-variant-numeric:tabular-nums}
.tq-page .tt-rank__val.is-neg{color:var(--st-critical-text)}

/* ---------- Funnel ---------- */
.tq-page .tt-funnel{display:flex;flex-direction:column;gap:2px;padding-top:2px}
.tq-page .tt-funnel__stage{padding:7px 6px;border-radius:var(--st-r-sm)}
.tq-page .tt-funnel__stage:hover{background:var(--st-surface-2)}
.tq-page .tt-funnel__lbrow{display:flex;align-items:baseline;gap:8px;margin-bottom:5px}
.tq-page .tt-funnel__name{font-size: 14px;font-weight:600}
.tq-page .tt-funnel__cnt{margin-left:auto;font-size:13px;font-weight:700;font-variant-numeric:tabular-nums}
.tq-page .tt-funnel__bar{height:14px;border-radius:0 4px 4px 0;min-width:4px}
.tq-page .tt-funnel__drop{display:flex;align-items:center;gap:6px;font-size: 14px;color:var(--st-text-muted);
  padding:1px 6px 1px 14px;font-variant-numeric:tabular-nums}
.tq-page .tt-funnel__drop b{color:var(--st-text-2);font-weight:700}
.tq-page .tt-funnel__drop.is-bad b{color:var(--st-critical-text)}

/* ---------- Insight strip ---------- */
.tq-page .tt-insight{display:flex;gap:10px;align-items:flex-start;padding:11px 13px;border-radius:var(--st-r-md);
  border:1px solid #f0e0b6;background:var(--st-warn-bg)}
.tq-page .tt-insight--crit{border-color:#f3d6d6;background:var(--st-crit-bg)}
.tq-page .tt-insight--inner{margin-top:12px;padding:9px 11px}
.tq-page .tt-insight__ico{flex:0 0 18px;margin-top:1px}
.tq-page .tt-insight__tt{font-size: 14px;font-weight:700}
.tq-page .tt-insight__tx{font-size: 14px;color:var(--st-text-2);margin-top:2px}
.tq-page .tt-insight__tx b{color:var(--st-text-1)}
.tq-page .tt-insight__tx b.neg{color:var(--st-critical-text)}
.tq-page .tt-insight__act{margin-left:auto;flex:0 0 auto}

/* ---------- Tabs + Table ---------- */
.tq-page .tt-tabs{display:flex;gap:2px;border-bottom:1px solid var(--st-border);padding:0 14px}
.tq-page .tt-tabs button{border:0;background:transparent;padding:9px 12px;font-size: 14px;font-weight:600;
  color:var(--st-text-2);border-bottom:2px solid transparent;margin-bottom:-1px}
.tq-page .tt-tabs button:hover{color:var(--st-text-1)}
.tq-page .tt-tabs button.is-active{color:var(--st-red-700);border-bottom-color:var(--st-red)}
.tq-page .tt-tablewrap{overflow-x:auto}
.tq-page .tt-tablewrap--detail{max-height:420px;overflow-y:auto}
.tq-page table.tt-table{width:100%;border-collapse:collapse;font-size: var(--tbl-fs, 14px);margin:0}
.tq-page .tt-table th{text-align:left;font-size: var(--tbl-fs-head, 14px);letter-spacing:.6px;text-transform:uppercase;
  color:var(--st-text-muted);font-weight:700;padding:8px 12px;background:var(--st-surface-2);
  border-bottom:1px solid var(--st-border);white-space:nowrap;position:sticky;top:0}
.tq-page .tt-table th.num,.tq-page .tt-table td.num{text-align:right;font-variant-numeric:tabular-nums}
.tq-page .tt-table th.tt-table__share{width:150px}
.tq-page .tt-table td{padding:6px 12px;border-bottom:1px solid var(--st-grid)}
.tq-page .tt-table tbody tr:hover{background:var(--st-surface-2)}
.tq-page .tt-table td.name{font-weight:600}
.tq-page .tt-table tfoot td{padding:6px 12px;font-weight:700;background:var(--st-surface-2);
  border-top:2px solid var(--st-axis);border-bottom:0}
.tq-page .tt-table .neg{color:var(--st-critical-text)}
.tq-page .tt-minibar{display:inline-block;height:6px;border-radius:3px;background:var(--st-s1);vertical-align:middle}
.tq-page .tt-minibar.is-neg{background:var(--st-critical)}
.tq-page .tt-badge{display:inline-flex;align-items:center;gap:5px;font-size: 13px;font-weight:700;padding:2px 8px;border-radius:20px}
.tq-page .tt-badge--good{background:var(--st-good-bg);color:var(--st-good-text)}
.tq-page .tt-badge--warn{background:var(--st-warn-bg);color:#7A5600}
.tq-page .tt-badge--crit{background:var(--st-crit-bg);color:var(--st-critical-text)}

/* ---------- Chart svg ---------- */
.tq-page .tt-svg{display:block;width:100%;height:auto;overflow:visible}
.tq-page .tt-svg .grid{stroke:var(--st-grid);stroke-width:1}
.tq-page .tt-svg .axis{stroke:var(--st-axis);stroke-width:1}
.tq-page .tt-svg .tick{fill:var(--st-text-muted);font-size:10.5px;font-variant-numeric:tabular-nums}
.tq-page .tt-svg .lbl{fill:var(--st-text-2);font-size:11px;font-weight:600}
.tq-page .tt-svg .ln{fill:none;stroke-width:2;stroke-linejoin:round;stroke-linecap:round}
.tq-page .tt-svg .hit{fill:transparent}

/* ---------- Tooltip (position:fixed, z-index trên chrome của app) ---------- */
.tq-page .tt-tooltip{position:fixed;z-index:2100;pointer-events:none;background:#0f172a;color:#fff;
  border-radius:8px;padding:8px 10px;font-size: 14px;box-shadow:var(--st-sh-pop);opacity:0;
  transition:opacity .1s;min-width:150px;max-width:256px;transform:translateY(-100%)}
.tq-page .tt-tooltip--below{transform:none}
.tq-page .tt-tooltip.is-on{opacity:1}
.tq-page .tt-tooltip__h{font-weight:700;margin-bottom:5px;font-size: 14px}
.tq-page .tt-tooltip__r{display:flex;align-items:center;gap:7px;margin-top:3px}
.tq-page .tt-tooltip__sep{border-top:1px solid #334155;padding-top:5px;margin-top:5px}
.tq-page .tt-tooltip__sw{width:8px;height:8px;border-radius:2px;flex:0 0 8px}
.tq-page .tt-tooltip__sw--dot{border-radius:50%}
.tq-page .tt-tooltip__v{margin-left:auto;font-weight:700;font-variant-numeric:tabular-nums}
.tq-page .tt-tooltip__v--up{color:#7ee787}
.tq-page .tt-tooltip__v--down{color:#ffa8a8}
.tq-page .tt-tooltip__k{color:#cbd5e1}

/* ---------- Foot ---------- */
.tq-page .tt-foot{font-size: 14px;color:var(--st-text-muted);display:flex;gap:10px;align-items:center;padding-top:4px}
.tq-page .tt-foot .dot{width:3px;height:3px;border-radius:50%;background:#c3c9d2}
.tq-page .tt-foot b{color:var(--st-text-1)}
.tq-page .tt-foot .crit{color:var(--st-critical-text)}
.tq-page .tt-foot .warn{color:var(--st-warn-text)}
.tq-page .tt-foot--gap{margin-top:8px}
.tq-page .tt-foot--gap6{margin-top:6px}
.tq-page .tt-foot--note{padding-top:4px;font-size: 13px}
.tq-page .tt-foot code{font-size:inherit;color:inherit}

/* ---------- Responsive ---------- */
@media (max-width:1400px){ .tq-page .c3{grid-column:span 4} }
@media (max-width:1180px){
  .tq-page .c3,.tq-page .c4,.tq-page .c5{grid-column:span 6}
  .tq-page .c7,.tq-page .c8{grid-column:span 12}
}
@media (max-width:860px){
  .tq-page{padding:6px 8px 8px}
  .tq-page .c3,.tq-page .c4,.tq-page .c5,.tq-page .c6,.tq-page .c7,.tq-page .c8{grid-column:span 12}
  .tq-page .tt-pagehead__actions{margin-left:0;width:100%;flex-wrap:wrap;justify-content:flex-end}
  .tq-page .tt-rank__row{grid-template-columns:96px 1fr 92px}
  .tq-page .tt-rank__pct{display:none}
}
@media print{
  .tq-page .tq-filters,.tq-page .tt-card__tools{display:none}
  .tq-page .tt-card{break-inside:avoid}
  .tq-page{background:#fff}
}
