/*!
 * HDB UI · hdb-ui.css · v1.3.0 (12/11/2026)
 * Bộ giao diện dùng chung cho các trang trên https://hdb-digital.cloud
 * Theo HDBank Digital Playbook (mục 2.a–2.j) và các trang đang chạy:
 * Digital Hub, Đánh giá Google Maps, Xếp hạng app, Theo dõi follower, Tạo mã QR, Tạo bảng tên.
 *
 * CÁCH DÙNG (đặt trong <head>, sau link Google Fonts):
 *   <link rel="stylesheet" href="https://hdb-digital.cloud/assets/hdb-ui.css?v=1.3">
 * Chuyển động (hero, khối nội dung hiện lần lượt, phản hồi khi bấm): thêm class "motion" vào <body> (mục 10)
 * Menu công cụ trong header: <nav class="nav" data-hdb-nav aria-label="Công cụ"></nav> + assets/hdb-nav.js
 * Hướng dẫn đầy đủ (khung HTML mẫu, bảng tra class, quy tắc): DESIGN.md
 *
 * QUY TẮC SỬA FILE NÀY: file dùng chung cho mọi trang, sửa ở đây là mọi trang đổi theo.
 *   - Chỉ THÊM class/biến mới hoặc sửa lỗi hiển thị → tăng số phụ (1.0 → 1.1) và đổi ?v= ở trang mới.
 *   - Đổi tên / xóa / đổi hẳn kiểu một class đang dùng → KHÔNG sửa file này, tạo hdb-ui-v2.css.
 *
 * MỤC LỤC
 *   0. Tokens: màu, chữ, dải màu, bóng, bo góc, bố cục
 *   1. Nền tảng: reset, chữ, focus, tiện ích
 *   2. Khung trang: header, hero, footer
 *   3. Nút & điều khiển: btn, ô nhập, field, select, check, switch, seg, chip, khoảng ngày, combobox, popover
 *   4. Khối nội dung: card, panel, lưới, thông báo, nhãn trạng thái, thu gọn, ghi chú nguồn
 *   5. Dashboard: bộ lọc, ô KPI, mức thay đổi, sao, chú giải, biểu đồ, tooltip, bảng, mật khẩu, đánh giá
 *   6. Công cụ tạo ấn phẩm: khu làm việc, các bước, chọn mẫu, tải file, xem trước, hộp thoại, cảnh báo Zalo
 *   7. Trang giới thiệu: hero lớn, section, thẻ tính năng, quy trình, form
 *   8. Responsive
 *   9. Trợ năng: giảm chuyển động, chế độ tương phản cao
 *  10. Chuyển động (1.3): vào trang, phản hồi khi bấm, ảnh xem trước vừa vẽ lại, nút vừa bấm được, hiệu ứng khi cuộn tới
 */

/* =========================================================================
   0. TOKENS
   Chỉ dùng 5 màu thương hiệu + các bước sắc độ (pha với trắng) liệt kê dưới đây.
   Không tự đặt mã màu mới trong trang; cần màu nào thì dùng biến.
   ========================================================================= */
:root {
  color-scheme: light;

  /* 5 màu thương hiệu (2.b) */
  --red: #DA2128;      /* Đỏ HDBank: màu chủ đạo, nút chính, HDBank trong biểu đồ */
  --grey: #58595B;     /* Xám HDBank: chữ, đối thủ thứ nhất trong biểu đồ */
  --orange: #FAA61A;   /* Cam HDBank: điểm nhấn, sao, dải màu */
  --amber: #FFC20E;    /* Cam vàng HDBank: chân dải màu, cảnh báo */
  --yellow: #FFDD00;   /* Vàng HDBank: điểm nhấn nhỏ (dấu đầu dòng trên nền đỏ) */
  --white: #FFFFFF;

  /* Sắc độ (tint = pha với trắng) */
  --red-5: #FDF6F6;    /* nền dòng bảng khi rê chuột */
  --red-10: #FBE9EA; --red-20: #F8D3D4;
  --grey-5: #F7F7F7;   /* nền tiêu đề bảng */
  --grey-10: #EEEEEF; --grey-20: #DEDEDE; --grey-30: #CDCDCE; --grey-40: #BCBCBD;
  --grey-50: #ACACAD; --grey-60: #9B9B9D; --grey-70: #8A8B8C; --grey-80: #77787A;
  --orange-10: #FEF6E9; --orange-20: #FEEDD1;
  --yellow-20: #FFF8CC;

  /* Vai trò */
  --text: var(--grey);        /* chữ chính */
  --muted: var(--grey);       /* chữ phụ: vẫn dùng xám HDBank (7:1), phân cấp bằng cỡ/độ đậm */
  --subtle: var(--grey-80);   /* chú thích nhỏ, CHỈ đặt trên nền trắng (4.5:1) */
  --page: var(--grey-10);     /* nền trang công cụ / dashboard */
  --surface: var(--white);    /* nền thẻ */
  --line: var(--grey-20);     /* viền ô nhập, viền thẻ phụ */
  --line-soft: var(--grey-10);/* đường kẻ trong thẻ, giữa các dòng bảng */

  /* Ngữ nghĩa: tăng/giảm & trạng thái (luôn đi kèm ▲▼ hoặc chữ, không dùng màu đơn độc) */
  --up: #1F7A45;              /* tăng = tốt: số màu xanh lá + ▲ */
  --down: var(--red);         /* giảm = cần chú ý: số màu đỏ + ▼ */
  --flat: var(--grey-70);     /* không đổi */
  --ok: #1F6B3E;  --ok-bg: #E8F5EE;           /* đang hoạt động, thành công */
  --warn: #8A5200; --warn-bg: var(--orange-10);/* nội bộ, lưu ý */
  --err: #A3161C; --err-bg: var(--red-10);     /* lỗi, đang phát triển */

  /* Màu biểu đồ: gán theo đối tượng, KHÔNG theo thứ hạng; tối đa 5 chuỗi */
  --c-hd: var(--red);         /* HDBank: luôn đỏ */
  --c1: var(--grey);          /* đối thủ 1 */
  --c2: var(--orange);        /* đối thủ 2: kèm nét đứt */
  --c3: var(--grey-70);       /* đối thủ 3: kèm nét chấm */
  --c4: var(--amber);         /* đối thủ 4 */
  --c-rest: var(--grey-30);   /* "Khác" / các đối tượng còn lại khi chỉ làm nổi HDBank */
  /* Thang số sao (đã kiểm định): 5★ đỏ, 4★ cam, 3★/2★/1★ xám 30/70/100% */
  --s5: var(--red); --s4: var(--orange); --s3: var(--grey-30); --s2: var(--grey-70); --s1: var(--grey);
  --grid: var(--grey-20); --axis: var(--grey-50); --hover: var(--red-10);

  /* Chữ (2.c): máy có font gốc dùng font gốc; không có thì dùng font web gần nhất hỗ trợ tiếng Việt */
  --font-head: "BauhausVO", "Quicksand", "Segoe UI", system-ui, sans-serif;
  --font-body: "Myriad Pro", "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  /* Dải màu (2.d) */
  --kv-band: linear-gradient(0deg, var(--amber) 0%, var(--orange) 7%, var(--red) 26%, var(--red) 100%);      /* hero thấp */
  --kv-band-tall: linear-gradient(0deg, var(--amber) 0%, var(--orange) 4%, var(--red) 15%, var(--red) 100%); /* hero / khối cao */
  --band-lr: linear-gradient(90deg, var(--orange) 0%, var(--red) 100%);  /* dải mảnh chân thẻ, footer */
  --icon-bg: linear-gradient(0deg, var(--amber) 0%, var(--orange) 24%, var(--red) 68%); /* nền icon cấp 1 */

  /* Bóng đổ nhẹ tạo chiều sâu (2.e) */
  --lift: 0 1px 2px rgba(88,89,91,.10), 0 10px 24px -12px rgba(88,89,91,.30), 0 36px 72px -32px rgba(110,10,16,.35);
  --lift-sm: 0 1px 2px rgba(88,89,91,.08), 0 8px 22px -14px rgba(88,89,91,.35);

  /* Bo góc */
  --r-xl: 28px;   /* thẻ lớn trang giới thiệu */
  --r-lg: 24px;   /* card, panel, khung bộ lọc */
  --r-md: 20px;   /* ô KPI */
  --r-sm: 16px;   /* ô con trong thẻ, khung bảng, danh sách thả xuống */
  --r-xs: 12px;   /* thông báo nhỏ */
  --r-field: 14px;/* ô nhập trong form */
  --pill: 999px;

  /* Bố cục */
  --wrap: 1240px;                     /* bề rộng nội dung tối đa */
  --gutter: clamp(16px, 3vw, 32px);   /* lề hai bên */
  --pad: 24px;                        /* lề trong thẻ (16px trên điện thoại) — mọi khối dùng chung để thẳng lề */
  --gap: 16px;                        /* khoảng cách giữa các thẻ */
  --overlap: 64px;                    /* phần khung bộ lọc / panel nổi đè lên chân hero */
}

/* =========================================================================
   1. NỀN TẢNG
   ========================================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 16px/1.5 var(--font-body); -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; margin: 0; color: var(--text); }
p { margin: 0; }
a { color: var(--red); }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; border-radius: 6px; }
/* Trên nền đỏ dùng viền focus trắng; khối trắng nằm trong nền đỏ quay lại viền đỏ */
.hero :focus-visible, .on-red :focus-visible { outline-color: var(--white); }
.hero :is(.card, .panel, .form-card) :focus-visible, .section.is-red .form-card :focus-visible { outline-color: var(--red); }
.section.is-red :focus-visible { outline-color: var(--white); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)); }
.stack > * + * { margin-top: var(--gap); }          /* xếp khối theo chiều dọc, cách đều 16px */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link {
  position: absolute; left: 16px; top: -80px; z-index: 100; background: var(--red); color: var(--white);
  padding: 12px 20px; border-radius: var(--pill); font-weight: 700; text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 12px; outline-color: var(--amber); }
.tnum { font-variant-numeric: tabular-nums; }       /* số trong bảng, cột số */
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; } /* ô màu nhận diện chuỗi */
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* Icon cấp 1 (2.g): glyph trắng trong khối vuông bo góc kiểu icon app iPhone, nền dải màu.
   Đổi cỡ bằng style="--s:64px". Glyph vẽ trong viewBox 48×48. */
.icon1 {
  --s: 56px; width: var(--s); height: var(--s); border-radius: calc(var(--s) * .2237); flex: none;
  display: grid; place-items: center; background: var(--icon-bg);
  box-shadow: 0 8px 16px -10px rgba(218,33,40,.6), inset 0 1px 0 rgba(255,255,255,.25);
}
.icon1 svg { width: 56%; height: 56%; fill: var(--white); }

/* =========================================================================
   2. KHUNG TRANG
   ========================================================================= */

/* ---- Header: nền trắng, logo gốc dương bản góc trên trái (2.a) ---- */
.site-header { background: var(--white); }
.site-header.is-sticky {
  position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.96);
  backdrop-filter: saturate(1.4) blur(8px); -webkit-backdrop-filter: saturate(1.4) blur(8px);
  box-shadow: 0 1px 0 var(--grey-10);
}
.header-inner { display: flex; align-items: center; gap: 20px; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; flex: none; padding-block: 14px; } /* vùng an toàn ≈ chiều cao chữ H */
.brand-logo { display: block; height: 34px; width: auto; min-width: 55px; }  /* logo rộng tối thiểu 55px */
.brand-name {
  font: 700 16px/1.1 var(--font-head); color: var(--grey); white-space: nowrap;
  padding-left: 16px; border-left: 1px solid var(--grey-20);
}
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
:is(.nav, .nav-links) > a:not(.btn) {
  white-space: nowrap; text-decoration: none; color: var(--grey); font-weight: 600; font-size: 15px;
  padding: 9px 14px; border-radius: var(--pill); transition: color .2s, background-color .2s;
}
:is(.nav, .nav-links) > a:not(.btn):hover, :is(.nav, .nav-links) > a[aria-current="page"] { color: var(--red); background: var(--red-10); }
.nav .short { display: none; }   /* nhãn ngắn hiện trên điện thoại thay cho .long */

/* ---- Menu công cụ dùng chung: <nav class="nav" data-hdb-nav> + hdb-nav.js
   Đủ chỗ: hàng link. Chật (điện thoại, máy tính bảng, nhiều công cụ): JS thêm .is-collapsed → nút "Công cụ" mở danh sách theo nhóm ---- */
.nav[data-hdb-nav] { flex: 1 1 auto; min-width: 0; justify-content: flex-end; overflow: visible; }
.nav-links { display: flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
.nav-menu { position: relative; display: none; }
.nav.is-collapsed .nav-links { display: none; }
.nav.is-collapsed .nav-menu { display: block; }
.nav-toggle {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px 0 14px; cursor: pointer;
  font: 600 15px/1 var(--font-body); color: var(--grey); background: var(--white);
  border: 1.5px solid var(--line); border-radius: var(--pill); transition: border-color .2s, color .2s, background-color .2s;
}
.nav-toggle svg { width: 18px; height: 18px; flex: none; fill: currentColor; }
.nav-toggle .nav-chev { width: 16px; height: 16px; transition: transform .2s; }
.nav-toggle:hover { border-color: var(--grey-50); }
.nav.is-open .nav-toggle { border-color: var(--red); color: var(--red); background: var(--red-10); }
.nav.is-open .nav-chev { transform: rotate(180deg); }
.nav-panel {
  position: absolute; z-index: 60; right: 0; top: calc(100% + 10px); width: min(340px, calc(100vw - 32px));
  max-height: min(72vh, 560px); overflow-y: auto; padding: 6px 8px 8px;
  background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--lift);
}
.nav-group { margin: 0; padding: 12px 10px 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px;
  font-size: 15px; font-weight: 600; color: var(--grey); text-decoration: none; transition: background-color .15s, color .15s;
}
.nav-item .icon1 { --s: 34px; box-shadow: none; }
.nav-item:hover { background: var(--grey-10); }
.nav-item[aria-current="page"] { background: var(--red-10); color: var(--red); }
.nav-home {
  display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 12px 10px 6px; border-top: 1px solid var(--line-soft);
  font-size: 14px; font-weight: 600; color: var(--grey); text-decoration: none;
}
.nav-home svg { width: 18px; height: 18px; flex: none; fill: var(--red); }
.nav-home:hover { color: var(--red); }

/* ---- Hero trang công cụ: nền đỏ + chân dải màu, cánh diều đôi gốc (kite.jpg) cắt mép phải ---- */
.hero { position: relative; overflow: hidden; isolation: isolate; color: var(--white); background: var(--kv-band); }
.hero::after {
  content: ""; position: absolute; z-index: -1; top: 0; right: 0; bottom: 0; width: min(56%, 760px);
  background: url("kite.jpg") left top / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 50%); mask-image: linear-gradient(90deg, transparent 0%, #000 50%);
  pointer-events: none;
}
.hero-inner {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px 24px; align-items: start;
  padding-block: 40px calc(40px + var(--overlap));   /* chừa chỗ cho khung bộ lọc / panel nổi đè lên */
}
.hero.no-overlap .hero-inner { padding-bottom: 48px; }    /* trang không có khối nổi đè */
.hero-icon { --s: 68px; box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 14px 28px -12px rgba(0,0,0,.45); }
.hero h1 { color: var(--white); font-size: clamp(30px, 4vw, 46px); letter-spacing: -.01em; line-height: 1.08; }
.hero-lead { margin-top: 10px; font-size: 18px; max-width: 46em; text-wrap: pretty; color: rgba(255,255,255,.95); } /* 1.3: 44em → 46em để câu mô tả dài vừa 1 dòng trên máy tính */
.hero-meta { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.hero-meta li {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: var(--pill);
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); color: var(--white);
}
.hero-meta svg { width: 14px; height: 14px; fill: currentColor; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---- Footer: logo, mô tả ngắn, hotline + website, dải màu chân trang ---- */
.site-footer { background: var(--white); margin-top: 48px; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 32px; padding-block: 26px; font-size: 14px; }
.footer-inner .brand-logo { height: 30px; }
.footer-inner > p { flex: 1 1 320px; color: var(--muted); }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
.footer-links a { color: var(--grey); font-weight: 600; text-decoration: none; }
.footer-links a:hover { color: var(--red); text-decoration: underline; }
.footer-band { height: 8px; background: var(--band-lr); }

/* =========================================================================
   3. NÚT & ĐIỀU KHIỂN
   ========================================================================= */

/* ---- Nút: dạng viên thuốc. Mỗi khu vực chỉ 1 nút đỏ (hành động chính) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px;
  border-radius: var(--pill); border: 2px solid transparent; font: 600 15px/1 var(--font-body);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s, transform .2s;
}
.btn svg { width: 18px; height: 18px; flex: none; fill: currentColor; }
.btn-red { background: var(--red); color: var(--white); }
.btn-red:hover:not(:disabled) { box-shadow: 0 10px 20px -10px rgba(218,33,40,.75); transform: translateY(-1px); }
.btn-outline { border-color: var(--red); color: var(--red); background: var(--white); }
.btn-outline:hover:not(:disabled) { background: var(--red-10); }
.btn-white { background: var(--white); color: var(--red); }                 /* trên nền đỏ */
.btn-white:hover { box-shadow: 0 12px 26px -12px rgba(0,0,0,.45); transform: translateY(-1px); }
.btn-ghost { border-color: rgba(255,255,255,.7); color: var(--white); background: none; } /* nút phụ trên nền đỏ */
.btn-ghost:hover { background: rgba(255,255,255,.12); border-color: var(--white); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-width: 1.5px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 17px; font-weight: 700; gap: 10px; }  /* nút tải file, CTA lớn */
.btn-lg svg { width: 20px; height: 20px; }
.btn-block { display: flex; width: 100%; }
.btn-red:disabled { background: var(--red-20); color: var(--white); cursor: not-allowed; box-shadow: none; transform: none; }
.btn-outline:disabled { border-color: var(--red-20); color: var(--red-20); cursor: not-allowed; }
.btn.is-busy { cursor: progress; opacity: .7; }
.link-btn { font: 600 14px/1 var(--font-body); color: var(--red); background: none; border: 0; padding: 12px 6px; cursor: pointer; border-radius: 8px; }
.link-btn:hover { text-decoration: underline; }
/* Nút tròn chỉ có icon (xóa, đóng, mở lịch…): luôn có aria-label */
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; padding: 0; border: 0;
  border-radius: 50%; background: none; color: var(--grey); cursor: pointer; transition: background-color .15s, color .15s;
}
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.icon-btn:hover { background: var(--red-10); color: var(--red); }
.icon-btn.is-filled { width: 40px; height: 40px; background: var(--grey-10); }

/* ---- Ô nhập & select: mặc định dạng form (bo 14px). Trong .filters tự đổi sang dạng viên thuốc ----
   :where() giữ độ ưu tiên = 0 để mọi quy tắc riêng (select, .combo input, .date input…) luôn thắng.
   text-indent 2px (padding trái bớt 2px): máy có cài Myriad Pro bị cắt mất nét trái chữ đầu dòng (vd chữ "T") trong ô nhập. */
:where(input[type=text], input[type=search], input[type=password], input[type=email], input[type=tel],
    input[type=number], input[type=url], textarea, select) {
  font: 400 16px/1.3 var(--font-body); color: var(--text); background-color: var(--white);
  border: 1.5px solid var(--line); border-radius: var(--r-field); padding: 11px 14px 11px 12px; text-indent: 2px; min-height: 46px;
  max-width: 100%; transition: border-color .2s, box-shadow .2s;
}
:is(input, textarea)::placeholder { color: var(--grey-70); opacity: 1; }
:where(input[type=text], input[type=search], input[type=password], input[type=email], input[type=tel],
    input[type=number], input[type=url], textarea, select):focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 4px var(--red-10);
}
:is(input, textarea, select)[aria-invalid="true"], :is(input, textarea, select).is-invalid { border-color: var(--red); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; padding-left: 14px; text-indent: 0; } /* nhiều dòng: không thụt dòng đầu */
select {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;   /* chừa chỗ cho mũi tên ▾ */
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 8l4.5 4.5L14.5 8' fill='none' stroke='%2358595B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 14px center / 16px no-repeat;
}

/* ---- Field: nhãn + ô nhập + gợi ý + lỗi, rộng hết khung ---- */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 16px; }
.field > label, .field-label { font-size: 14px; font-weight: 600; color: var(--muted); }
.field .hint { font-weight: 400; }
.field :is(input, select, textarea) { width: 100%; }
.field-help { font-size: 13.5px; color: var(--muted); }
.field-error { display: none; font-size: 14px; font-weight: 600; color: var(--red); }
.field.has-error .field-error { display: block; }
.field.has-error :is(input, select, textarea) { border-color: var(--red); }

/* ---- Ô chọn (checkbox) ---- */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--grey); cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--red); cursor: pointer; }

/* ---- Công tắc bật/tắt: <label class="switch"><input type="checkbox" role="switch"> Nhãn</label> ---- */
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--grey); cursor: pointer; white-space: nowrap; }
.switch input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer; position: relative;
  width: 44px; height: 26px; border-radius: var(--pill); background: var(--grey-30); transition: background-color .2s;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s;
}
.switch input:checked { background: var(--red); }
.switch input:checked::after { transform: translateX(18px); }

/* ---- Nhóm nút chọn 1 trong nhiều (Ngày/Tuần/Tháng, Facebook/TikTok): nút đang chọn có aria-pressed="true" ---- */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--grey-10); border-radius: var(--pill); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; font: 600 14px/1 var(--font-body); color: var(--grey);
  background: none; border: 0; border-radius: var(--pill); min-height: 36px; padding: 0 14px; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.seg button svg { width: 16px; height: 16px; fill: currentColor; flex: none; }
.seg button:hover { background: var(--grey-20); }
.seg button[aria-pressed="true"] { background: var(--red); color: var(--white); box-shadow: 0 6px 14px -8px rgba(218,33,40,.8); }
.seg.sm button { min-height: 30px; padding: 0 12px; font-size: 13px; }

/* ---- Chip: lọc nhanh (bật/tắt nhiều cái) hoặc thẻ đối tượng đang chọn có nút xóa ---- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; font: 600 14px/1 var(--font-body); white-space: nowrap;
  border: 1.5px solid var(--line); background: var(--white); color: var(--grey); border-radius: var(--pill); padding: 8px 14px;
}
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--grey-50); }
.chip[aria-pressed="true"], .chip.is-on { color: var(--red); border-color: var(--red); background: var(--red-10); }
.chip .icon-btn { width: 22px; height: 22px; margin: -4px -8px -4px -2px; }
.chip .icon-btn svg { width: 14px; height: 14px; }
.chip-sep { width: 1px; height: 24px; background: var(--line); margin-inline: 4px; }

/* ---- Khoảng ngày: nút "Toàn bộ" + ô Từ ngày / đến ngày (gõ dd/mm/yyyy hoặc bấm icon lịch) ---- */
.range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.range-all {
  font: 600 14px/1 var(--font-body); color: var(--grey); background: var(--grey-10); border: 0; border-radius: var(--pill);
  min-height: 42px; padding: 0 16px; cursor: pointer; white-space: nowrap; transition: background-color .15s, color .15s;
}
.range-all:hover { background: var(--grey-20); }
.range-all[aria-pressed="true"] { background: var(--red); color: var(--white); }
.date {
  position: relative; display: flex; align-items: center; gap: 5px; min-height: 42px; padding: 0 5px 0 12px;
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--pill); transition: border-color .2s, box-shadow .2s;
}
.date:focus-within { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-10); }
.date.is-invalid { border-color: var(--red); }
.date label { font-size: 14px; font-weight: 400; color: var(--grey); white-space: nowrap; cursor: text; }
.date input[type=text] {
  font: 400 15px/1.2 var(--font-body); font-variant-numeric: tabular-nums; color: var(--grey);
  flex: 1 1 84px; width: 84px; min-width: 0; min-height: 0; border: 0; border-radius: 0; background: none; padding: 0;
}
.date input[type=text]:focus { box-shadow: none; }
.date .icon-btn { width: 28px; height: 28px; }
.date .icon-btn svg { width: 17px; height: 17px; }
.date-native { position: absolute; left: 0; bottom: 0; width: 100%; height: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
/* Kỳ so sánh đang áp dụng, vd "01/09 – 30/09/2026" */
.range-pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: var(--pill);
  background: var(--grey-10); color: var(--grey); font-size: 13.5px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.range-pill i { width: 12px; height: 12px; border-radius: 3px; border: 2px solid var(--grey); flex: none; } /* ô viền = kỳ so sánh */

/* ---- Combobox: ô gõ tìm + danh sách thả xuống (chọn địa điểm, chi nhánh…) ---- */
.combo { position: relative; }
.combo-lead { position: absolute; left: 14px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); fill: var(--grey-60); pointer-events: none; }
.combo input[type=text], .combo input[type=search] { width: 100%; padding-left: 38px; padding-right: 72px; text-overflow: ellipsis; }
.combo.has-value input { font-weight: 700; color: var(--red); }
.combo > .icon-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; }
.combo-clear { right: 38px; }
.combo-toggle { right: 6px; }
.combo-toggle svg { transition: transform .2s; }
.combo.is-open .combo-toggle svg { transform: rotate(180deg); }
.combo-list {
  position: absolute; z-index: 45; left: 0; right: 0; top: calc(100% + 6px);   /* rộng bằng ô tìm, không tràn mép màn hình */
  max-height: min(380px, 60vh); overflow: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-sm); box-shadow: var(--lift);
}
.combo-group { position: sticky; top: -6px; z-index: 1; padding: 10px 10px 4px; background: var(--white); font-size: 12px; font-weight: 700; color: var(--muted); }
.combo-opt { display: flex; align-items: baseline; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--grey); }
.combo-opt .nm { flex: 1; min-width: 0; }
.combo-opt .meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.combo-opt.is-active { background: var(--red-10); }
.combo-opt[aria-selected="true"] .nm { color: var(--red); font-weight: 700; }
.combo-opt.is-all { font-weight: 600; margin-bottom: 4px; border: 1px dashed var(--grey-30); }
.combo-empty { padding: 12px 10px; font-size: 14px; color: var(--muted); }

/* ---- Popover chọn nhiều (vd chọn tối đa 5 đối thủ): nút mở + hộp nổi có ô tìm + danh sách tích chọn ---- */
.pop-wrap { position: relative; }
.popover {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; width: min(400px, calc(100vw - 32px));
  background: var(--white); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--lift); padding: 14px;
}
.popover input[type=search] { width: 100%; border-radius: var(--pill); }
.pop-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 8px; }
.pop-quick button { font: 600 13px/1 var(--font-body); color: var(--grey); background: var(--grey-10); border: 0; border-radius: var(--pill); padding: 8px 12px; cursor: pointer; }
.pop-quick button:hover { background: var(--red-10); color: var(--red); }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.pick-list label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.pick-list label:hover { background: var(--red-5); }
.pick-list label.is-disabled { opacity: .45; cursor: not-allowed; }
.pick-list input { width: 18px; height: 18px; flex: none; accent-color: var(--red); }
.pick-list img { width: 24px; height: 24px; border-radius: 6px; flex: none; box-shadow: 0 0 0 1px var(--line); }
.pick-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list .meta { color: var(--grey-70); font-size: 13px; font-variant-numeric: tabular-nums; }
.pop-foot { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* =========================================================================
   4. KHỐI NỘI DUNG
   ========================================================================= */

/* ---- Card: khối trắng chứa biểu đồ, bảng, danh sách. Lề trong = var(--pad) ---- */
.card { background: var(--surface); color: var(--text); border-radius: var(--r-lg); padding: 22px var(--pad) 20px; box-shadow: var(--lift-sm); min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 14px; }
.card-head h2 { font-size: 20px; }
.card-sub { flex-basis: 100%; color: var(--muted); font-size: 14px; }   /* 1 dòng nói rõ phạm vi số liệu, không viết lời dẫn */
.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* Panel: khối trắng nổi (bóng đậm hơn), dùng cho khối đè lên hero: bộ lọc, form, xem trước */
.panel { background: var(--surface); color: var(--text); border-radius: var(--r-lg); box-shadow: var(--lift); min-width: 0; }
.panel-body { padding: 24px var(--pad) 22px; }

/* ---- Lưới ---- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: var(--gap); }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: var(--gap); }
/* Tiêu đề phân đoạn trong dashboard (giữa các nhóm thẻ) */
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 36px; }
.sec-head h2 { font-size: 24px; }
.sec-head p { font-size: 14px; color: var(--muted); }
.stack > .sec-head { margin-top: 36px; }

/* ---- Thông báo: is-info (cam), is-warn (vàng), is-err (đỏ), is-ok (xanh). Luôn có chữ, không chỉ có màu ---- */
.notice {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--r-sm);
  font-size: 14px; color: var(--grey); background: var(--grey-10); border-left: 4px solid var(--grey-50);
}
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 1px; fill: currentColor; }
.notice > :not(svg) { flex: 1; min-width: 0; }
.notice.is-info { background: var(--orange-10); border-left-color: var(--orange); }
.notice.is-info svg { fill: var(--orange); }
.notice.is-warn { background: var(--yellow-20); border-left-color: var(--amber); }
.notice.is-err { background: var(--red-10); border-left-color: var(--red); }
.notice.is-err svg { fill: var(--red); }
.notice.is-ok { background: var(--ok-bg); border-left-color: var(--up); }
.notice.sm { padding: 9px 12px; font-size: 13.5px; border-radius: var(--r-xs); }
.notice { overflow-wrap: anywhere; }   /* link, đường dẫn dài không tràn khung */
.notice + .notice { margin-top: 8px; }
/* 1.3: khung chứa thông báo ngay dưới ô nhập/ô chọn (JS điền vào); trống thì không chiếm chỗ */
.notices:not(:empty) { margin-top: 8px; }

/* ---- Nhãn trạng thái: chấm tròn + chữ ---- */
.badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; line-height: 1.2;
  padding: 6px 12px 6px 10px; border-radius: var(--pill); background: var(--grey-10); color: var(--grey); white-space: nowrap;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.no-dot::before { display: none; }
.badge.is-live { background: var(--ok-bg); color: var(--ok); }
.badge.is-internal { background: var(--warn-bg); color: var(--warn); }
.badge.is-building, .badge.is-red { background: var(--red-10); color: var(--err); }
/* Danh sách nhãn xám nhỏ (thông số file, phạm vi dữ liệu) */
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font-size: 13px; font-weight: 600; padding: 5px 12px; border-radius: var(--pill); background: var(--grey-10); color: var(--grey); }

/* ---- Thu gọn trong thẻ: <details class="disclosure"><summary>Xem dạng bảng</summary>…</details> ---- */
details.disclosure { margin-top: 12px; font-size: 14px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
details.disclosure summary {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--red); font-weight: 600;
  list-style: none; padding: 4px 2px; border-radius: 6px;
}
details.disclosure summary::-webkit-details-marker { display: none; }
details.disclosure summary::before {
  content: ""; width: 14px; height: 14px; transition: transform .2s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M8 5.5l4.5 4.5L8 14.5' fill='none' stroke='%23DA2128' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
details.disclosure[open] summary::before { transform: rotate(90deg); }

/* ---- Thẻ thu gọn được: <details class="card collapse"><summary class="collapse-head">…</summary><div class="collapse-body">…</div></details>
   Lề trong nằm ở head/body (không cộng thêm padding của .card) để thẳng lề với các thẻ khác ---- */
.card.collapse { padding: 0; }
.collapse-head { display: flex; align-items: center; gap: 12px; padding: 18px var(--pad); cursor: pointer; list-style: none; border-radius: var(--r-lg); }
.collapse-head::-webkit-details-marker { display: none; }
.collapse-head h2 { font-size: 20px; transition: color .15s; }
.collapse-head:hover h2 { color: var(--red); }
.collapse-head::after {
  content: ""; width: 20px; height: 20px; margin-left: auto; flex: none; transition: transform .2s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.4 8.6L12 14.2l5.6-5.6L19 10l-7 7-7-7z' fill='%2358595B'/%3E%3C/svg%3E") center / contain no-repeat;
}
details[open] > .collapse-head::after { transform: rotate(180deg); }
.collapse-body { padding: 0 var(--pad) 22px; }

/* ---- Ghi chú nguồn dữ liệu: đặt cuối trang dashboard ---- */
.source-note {
  display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 18px 22px; border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--white); font-size: 14px; color: var(--grey);
}
.source-note > svg { width: 22px; height: 22px; fill: var(--red); }
.source-note h2 { font-size: 16px; margin-bottom: 4px; }
.source-note p + p { margin-top: 4px; }
.source-note ul { margin: 4px 0 0; padding-left: 18px; }

/* =========================================================================
   5. DASHBOARD
   ========================================================================= */

/* ---- Bộ lọc: thẻ trắng nổi đè lên chân hero, KHÔNG dính khi cuộn ---- */
.filter-dock { position: relative; z-index: 30; margin-top: calc(-1 * var(--overlap)); padding-bottom: calc(var(--gap) + 4px); } /* z-index: danh sách thả xuống nổi trên nội dung */
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px;
  background: var(--white); border-radius: var(--r-lg); padding: 16px 20px; box-shadow: var(--lift);
}
.filters :where(input[type=text], input[type=search], select) { border-radius: var(--pill); min-height: 42px; font-size: 15px; line-height: 1.2; padding: 10px 14px 10px 12px; }
.filters select { padding-right: 36px; min-width: 132px; background-position: right 12px center; }
.f-group { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; border: 0; margin: 0; padding: 0; }
.f-group > legend { padding: 0; margin-bottom: 6px; float: left; width: 100%; }
.f-group > legend + * { clear: both; }
.f-group.has-sep { padding-right: 16px; border-right: 1px solid var(--line); }   /* vạch ngăn giữa 2 nhóm lọc */
.f-group.grow { flex: 1 1 260px; }                                                 /* ô tìm địa điểm chiếm phần còn lại */
.f-cap { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.f-err { color: var(--red); }
.f-hint { font-size: 13px; font-weight: 400; color: var(--muted); }
.f-break { flex-basis: 100%; height: 0; }                                          /* xuống hàng trong khung lọc */
.f-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }   /* Xóa lọc + Tải Excel ở cuối hàng */

/* ---- Ô KPI ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: var(--gap); }
.kpis.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tile { position: relative; overflow: hidden; background: var(--white); border-radius: var(--r-md); padding: 18px 20px; box-shadow: var(--lift-sm); min-width: 0; }
.tile .lab { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--muted); }
.tile .lab i, .tile .lab .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.tile .row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.tile .val { font-size: 32px; font-weight: 700; line-height: 1.1; color: var(--grey); letter-spacing: -.01em; }
.tile .unit { font-size: 16px; font-weight: 600; color: var(--grey-70); }
.tile .foot { margin-top: 6px; font-size: 14px; color: var(--muted); }
.tile .foot b { color: var(--grey); }
/* Ô chính: số lớn + dải màu chân ô (dùng cho 1–2 chỉ số quan trọng nhất) */
.tile.is-main { padding-bottom: 22px; }
.tile.is-main .val { font-size: 48px; }
.tile.is-main::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--band-lr); }
.tile .meter { margin-left: auto; align-self: center; }
/* Ô viền (không bóng): số liệu tham chiếu cố định, đặt trong thẻ, vd "Số liệu trước 10/10/2026" */
.tile.is-outline { box-shadow: none; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; }
.tile.is-outline .val { font-size: 24px; line-height: 1.2; margin-top: 4px; }

/* ---- Mức thay đổi khi so sánh: chỉ hiện %, tăng xanh ▲, giảm đỏ ▼, không đổi xám ----
   Với chỉ số "xấu" (vd số lượt 1★) thì đảo: tăng dùng .down, giảm dùng .up */
.delta { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--flat); }
.delta.up { color: var(--up); }
.delta.down { color: var(--down); }
.tile.is-main .delta { font-size: 20px; }
:is(td, th) .delta { font-size: inherit; }   /* trong bảng: theo cỡ chữ của bảng */
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--flat); }

/* ---- Thang sao (điểm trung bình): 5 sao xám + lớp sao cam cắt theo % ---- */
.meter { position: relative; display: inline-block; line-height: 0; }
.meter-bg, .meter-fg { display: flex; gap: 4px; }
.meter-fg { position: absolute; inset: 0 auto 0 0; overflow: hidden; }
.meter svg { width: 24px; height: 24px; flex: none; fill: var(--grey-20); }
.meter-fg svg { fill: var(--orange); }

/* ---- Chú giải biểu đồ (bắt buộc khi có từ 2 chuỗi) ---- */
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--grey); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }          /* cột, ô */
.legend i.line { width: 16px; height: 3px; border-radius: 2px; }                                         /* đường liền */
.legend i.dash { width: 16px; height: 0; border-radius: 0; border-top: 3px dashed currentColor; background: none !important; } /* đường nét đứt: đặt color cho thẻ i */
.legend i.outline { background: none !important; border: 2px solid var(--grey); width: 12px; height: 12px; } /* kỳ so sánh */

/* ---- Biểu đồ SVG tự vẽ: chữ dùng màu chữ, không dùng màu chuỗi ---- */
.chart { width: 100%; position: relative; }
.chart svg { display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 12px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.chart text.lab { fill: var(--grey); font-size: 13px; font-variant-numeric: normal; }
.chart text.lab.is-hd { fill: var(--red); font-weight: 700; }     /* nhãn HDBank */
.chart text.val { fill: var(--grey); font-size: 12.5px; font-weight: 600; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .mark-row { outline: none; }
.chart .mark-row:hover .hit, .chart .mark-row:focus .hit { fill: var(--hover); }   /* vùng rê chuột lớn hơn thanh */
.chart .mark-row:focus-visible .hit { stroke: var(--red); stroke-width: 1.5; }
/* Khung cho thư viện canvas (Chart.js): chiều cao cố định */
.chart-box { position: relative; height: 300px; }
.chart-box.tall { height: 340px; }
.nodata { color: var(--muted); }

/* ---- Tooltip: <div class="tip" id="tip" role="tooltip" hidden> — 1 cái cho cả trang, định vị bằng JS ---- */
.tip {
  position: fixed; pointer-events: none; z-index: 60; background: var(--white); color: var(--grey);
  border: 1px solid var(--line); border-radius: var(--r-xs); padding: 10px 12px; font-size: 13px;
  box-shadow: var(--lift); min-width: 150px; max-width: 300px;
}
.tip .t { color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.tip .r { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.tip .r .k { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.tip .r .k i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.tip .r b { font-weight: 700; color: var(--grey); }
.tip .r.is-hd b, .tip .r.is-hd .k { font-weight: 700; }

/* ---- Bảng: đặt trong .tbl-wrap để cuộn ngang trên điện thoại; tiêu đề dính khi cuộn dọc ---- */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.tbl-wrap.is-tall { max-height: 640px; }
.tbl-wrap :is(th, td) { white-space: nowrap; }                 /* bảng rộng thì cuộn ngang, không bóp chữ */
.tbl-wrap td.can-wrap { white-space: normal; min-width: 220px; } /* cột chữ dài (nội dung đánh giá…) được xuống dòng */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { color: var(--grey); font-weight: 700; font-size: 13px; background: var(--grey-5); position: sticky; top: 0; z-index: 2; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
tbody tr:hover td { background: var(--red-5); }
tr.is-hd td, tbody tr.is-hd:hover td { background: var(--red-10); font-weight: 700; }   /* dòng HDBank */
th.sort { cursor: pointer; user-select: none; }
th.sort::after { content: " ↕"; color: var(--grey-50); }
th.sort[aria-sort="ascending"]::after { content: " ↑"; color: var(--red); }
th.sort[aria-sort="descending"]::after { content: " ↓"; color: var(--red); }
th.sort:hover { color: var(--red); }
.sticky-col td:first-child, .sticky-col th:first-child { position: sticky; left: 0; z-index: 1; background: var(--white); }
.sticky-col th:first-child { z-index: 3; background: var(--grey-5); }
.sticky-col tr.is-hd td:first-child { background: var(--red-10); color: var(--red); }
/* Thứ hạng dạng viên tròn; dòng HDBank đổi sang đỏ */
.rank { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: var(--pill); background: var(--grey-10); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
tr.is-hd .rank { background: var(--red); color: var(--white); }
/* Thanh nhỏ trong ô bảng (tỷ trọng); dòng HDBank dùng dải màu */
.cell-bar { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.cell-bar .b { height: 8px; border-radius: 0 4px 4px 0; background: var(--grey-20); display: inline-block; }
tr.is-hd .cell-bar .b { background: var(--band-lr); }
/* Tên đối tượng có icon/ô màu + link ngoài */
.entity { display: inline-flex; align-items: center; gap: 8px; color: var(--grey); font-weight: 600; text-decoration: none; }
.entity img { width: 28px; height: 28px; border-radius: 7px; flex: none; box-shadow: 0 0 0 1px var(--line); }
.entity svg { width: 12px; height: 12px; fill: var(--red); opacity: .7; flex: none; }
a.entity:hover { color: var(--red); text-decoration: underline; }
.tag-new { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: var(--pill); background: var(--orange-10); color: var(--warn); }

/* ---- Màn hình mật khẩu: <body class="locked"> ẩn bộ lọc + nội dung cho tới khi giải mã xong ---- */
body.locked .filter-dock, body.locked main { display: none; }
.gate { position: relative; z-index: 30; margin-top: calc(-1 * var(--overlap)); padding-bottom: 48px; }
.gate-card { max-width: 440px; display: grid; gap: 12px; box-shadow: var(--lift); }
.gate-card h2 { font-size: 20px; }
.gate-card label { font-weight: 600; font-size: 14px; }
.gate-card input[type=password] { width: 100%; border-radius: var(--pill); }
.gate-card .check { font-weight: 400; color: var(--muted); }
.gate-err { margin: 0; color: var(--red); font-size: 14px; font-weight: 600; }
.gate-card .btn { justify-self: start; }

/* ---- Thẻ đánh giá / bình luận ---- */
.reviews { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 14px; align-items: start; }
.review { border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; background: var(--white); min-width: 0; }
.review-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.review-stars { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; padding: 4px 10px; border-radius: var(--pill); background: var(--grey-10); }
.review-stars i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.review .who { font-weight: 700; color: var(--grey); }
.review time { margin-left: auto; font-size: 13px; color: var(--muted); }
.review-meta { display: flex; gap: 6px; align-items: baseline; margin-top: 8px; font-size: 13px; color: var(--muted); }
.review-meta svg { width: 12px; height: 12px; fill: var(--red); flex: none; transform: translateY(1px); }
.review-text { margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-reply {
  margin-top: 12px; padding: 10px 14px; border-radius: var(--r-xs); background: var(--orange-10);
  border-left: 4px solid var(--orange); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.review-reply b { display: block; color: var(--grey); margin-bottom: 2px; }
.review-noreply { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--muted); font-size: 13px; }
.review-noreply::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--grey-30); }
.more-row { display: flex; justify-content: center; margin-top: 18px; }

/* =========================================================================
   6. CÔNG CỤ TẠO ẤN PHẨM
   Bố cục: trái = các bước (form) + nút tải; phải = xem trước dính khi cuộn.
   Điện thoại: bước → xem trước → nút tải.
   ========================================================================= */
.workspace {
  position: relative; z-index: 2; margin-top: calc(-1 * var(--overlap));
  display: grid; grid-template-columns: minmax(320px, 410px) minmax(0, 1fr); gap: 20px; align-items: start;
  grid-template-areas: "form preview" "actions preview"; grid-template-rows: auto 1fr;
}
.ws-form { grid-area: form; }
.ws-actions { grid-area: actions; }
.ws-preview { grid-area: preview; position: sticky; top: 16px; padding: 22px var(--pad) 20px; }

/* ---- Các bước có số thứ tự và đường nối ---- */
.step-list { list-style: none; margin: 0; padding: 0; }
.step { position: relative; padding-left: 46px; padding-bottom: 24px; }
.step:last-child { padding-bottom: 0; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 36px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.step-num { position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--red); color: var(--white); font: 700 15px/1 var(--font-head); }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; min-height: 32px; margin-bottom: 12px; } /* bên phải có thể đặt công tắc, link */
.step-head h2 { font-size: 18px; }

/* ---- Chọn mẫu: thẻ có ảnh thu nhỏ, mẫu đang chọn có dấu tích ---- */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: 14px 10px 12px; cursor: pointer; text-align: center;
  font: 600 15px/1.25 var(--font-body); color: var(--grey); background: var(--grey-10);
  border: 2px solid transparent; border-radius: 18px; transition: border-color .2s, background-color .2s;
}
.choice:hover { border-color: var(--grey-30); }
.choice img { display: block; height: 118px; width: auto; margin-bottom: 8px; border-radius: 4px; box-shadow: 0 2px 8px rgba(88,89,91,.35); }
.choice small { font-size: 12.5px; font-weight: 400; color: var(--muted); }
.choice[aria-pressed="true"] { border-color: var(--red); background: var(--red-10); color: var(--red); }
.choice[aria-pressed="true"]::after {
  content: ""; position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--red) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3.2L15 6.9' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

/* ---- Tải ảnh lên: vùng kéo thả + dòng file đã chọn ---- */
.drop {
  position: relative; display: grid; justify-items: center; text-align: center; gap: 6px; padding: 20px 14px; cursor: pointer;
  border: 2px dashed var(--grey-30); border-radius: var(--r-sm); background: var(--grey-10); color: var(--muted); font-size: 14px;
  transition: border-color .2s, background-color .2s;
}
.drop:hover, .drop.is-over { border-color: var(--red); background: var(--red-10); color: var(--grey); }
.drop:focus-within { outline: 3px solid var(--red); outline-offset: 2px; }
.drop svg { width: 30px; height: 30px; fill: var(--red); }
.drop b { color: var(--red); font-size: 16px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-row { display: flex; gap: 12px; align-items: center; margin-top: 10px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-field); }
.file-row :is(img, canvas) { width: 56px; height: 56px; flex: none; border: 1px solid var(--line); border-radius: 8px; background: var(--white); object-fit: contain; }
.file-row .name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 1.3: ô chọn (vd "Tự cắt viền trắng") ngay dưới vùng tải ảnh: cả dòng bấm được, cách 12px */
:is(.drop, .file-row) + .check { display: flex; margin-top: 12px; }

/* ---- Nút tải file xếp dọc + ghi chú dưới nút ---- */
.btn-stack { display: grid; gap: 10px; }
.btn-note { margin-top: 12px; font-size: 14px; color: var(--muted); text-align: center; }

/* ---- Xem trước ---- */
.preview-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.preview-head h2 { font-size: 18px; }
.stage {
  position: relative; overflow: hidden; border-radius: 18px; background: var(--grey-10);
  padding: 28px; display: grid; place-items: center; min-height: 420px;
}
.stage::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--band-lr); }
/* Ấn phẩm khổ ngang (bảng tên, banner): <div class="workspace is-landscape"> — khung xem trước thấp, ảnh rộng hết khung;
   trên điện thoại khung xem trước lên đầu và dính khi cuộn để vừa gõ vừa thấy kết quả */
.workspace.is-landscape .stage { min-height: 0; padding: 20px; }
.workspace.is-landscape .paper { width: 100%; }
.paper { background: var(--white); line-height: 0; box-shadow: 0 1px 2px rgba(88,89,91,.15), 0 14px 36px -10px rgba(88,89,91,.45); }
.paper :is(canvas, img) { display: block; width: 100%; height: auto; }
.preview .tags, .ws-preview .tags { margin-top: 14px; }
/* Lưu ý in ấn: dấu đầu dòng hình thoi cam */
.tips { list-style: none; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px solid var(--line-soft); display: grid; gap: 6px; font-size: 14px; }
.tips li { display: flex; gap: 10px; align-items: baseline; }
.tips li::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--orange); flex: none; transform: translateY(-2px) rotate(45deg); }

/* ---- Hộp thoại: <div class="sheet" role="dialog" aria-modal="true"><div class="sheet-box">…</div></div> ---- */
.sheet { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; overflow-y: auto; background: rgba(30,30,32,.72); }
.sheet-box { width: min(100%, 460px); display: grid; gap: 12px; padding: 18px 18px 20px; border-radius: var(--r-lg); background: var(--white); box-shadow: var(--lift); }
.sheet-box:focus { outline: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { font-size: 19px; }
.sheet-btns { display: grid; gap: 10px; margin-top: 4px; }
body.has-sheet { overflow: hidden; }

/* ---- Cảnh báo mở trong Zalo/Facebook (trình duyệt trong app không tải được file) ---- */
.inapp { background: var(--yellow-20); border-bottom: 1px solid var(--amber); font-size: 14.5px; }
.inapp-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding-block: 12px; }
.inapp p { flex: 1 1 280px; }

/* =========================================================================
   7. TRANG GIỚI THIỆU (kiểu trang chủ Digital Hub)
   <body class="landing">: nền trắng, chữ 18px, header dính (.site-header.is-sticky)
   ========================================================================= */
body.landing { background: var(--white); font-size: 18px; line-height: 1.6; }
body.landing .site-footer { margin-top: 0; }
/* 1.3: header dính cao 72px → chừa chỗ khi nhảy tới mục; cuộn mượt khi bấm link neo */
body.landing section[id] { scroll-margin-top: 88px; }
@media (prefers-reduced-motion: no-preference) { html:has(> body.landing) { scroll-behavior: smooth; } }

/* ---- Hero lớn: tiêu đề to + nút; cột phải tùy chọn (thẻ minh họa, ô mở nhanh) ---- */
.hero.hero-xl { background: var(--kv-band-tall); }
.hero.hero-xl::after { width: min(62%, 860px); }
.hero-xl .hero-inner {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: clamp(32px, 5vw, 72px); align-items: center;
  padding-block: clamp(56px, 8vw, 104px) clamp(64px, 9vw, 120px);
}
.hero-xl .hero-inner.is-single { grid-template-columns: minmax(0, 1fr); }
.hero-xl h1 { font-size: clamp(40px, 5.4vw, 70px); line-height: 1.04; letter-spacing: -.015em; }
.hero-xl .hero-lead { margin-top: 24px; font-size: clamp(18px, 1.5vw, 20px); line-height: 1.6; max-width: 34em; }
.hero-xl .hero-actions { margin-top: 36px; gap: 14px; }
.hero-xl .hero-actions .btn { min-height: 48px; padding: 0 24px; font-size: 17px; }
.hero-aside { justify-self: end; width: 100%; max-width: 400px; }

/* ---- Section ---- */
.section { padding-block: clamp(72px, 9vw, 128px); }
.section.is-grey { background: var(--grey-10); }
.section.is-red { background: var(--kv-band-tall); color: var(--white); }
.section.is-red :is(h2, h3) { color: var(--white); }
.section-head { max-width: 720px; margin-bottom: clamp(40px, 5vw, 64px); }
.section-head h2 { font-size: clamp(32px, 3.6vw, 46px); letter-spacing: -.01em; text-wrap: balance; }
.section-head p { margin-top: 18px; font-size: 19px; max-width: 38em; }
.section.is-red .section-head p { color: rgba(255,255,255,.94); }
.split .section-head { margin-bottom: 0; }
/* Tiêu đề nhóm dạng thanh ngăn: tên nhóm + số lượng + đường kẻ */
.group-head { display: flex; align-items: center; gap: 14px; margin-bottom: clamp(28px, 3.4vw, 40px); }
.group-head h3 { font-size: clamp(21px, 2vw, 25px); white-space: nowrap; }
.group-head::after { content: ""; flex: 1 1 0; min-width: 24px; height: 1px; background: var(--line); }
.group-count { font-size: 15px; font-weight: 600; line-height: 1; padding: 7px 12px; border-radius: var(--pill); background: var(--red-10); color: var(--err); white-space: nowrap; }
.feature-group + .feature-group { margin-top: clamp(80px, 10vw, 128px); }

/* ---- Thẻ tính năng / công cụ: 2 cột bằng nhau; số thẻ lẻ thì thẻ cuối trải hết hàng ---- */
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(20px, 3vw, 32px); }
.feature-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden; min-width: 0;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: clamp(24px, 3.4vw, 40px) clamp(24px, 3.4vw, 40px) calc(clamp(24px, 3.4vw, 40px) + 8px);
}
.feature-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--band-lr); }
.feature-grid > .feature-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
.feature-grid > .feature-card:last-child:nth-child(odd) .points { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; max-width: none; }
.feature-top { display: flex; align-items: center; gap: 16px; margin-bottom: 22px; }
.feature-top .icon1 { --s: 64px; }
.feature-card h3, .feature-card h4 { font-size: clamp(26px, 2.6vw, 34px); line-height: 1.15; letter-spacing: -.01em; }
.feature-lead { margin-top: 14px; font-size: 18px; max-width: 34em; }
.feature-meta { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line-soft); display: grid; gap: 8px; font-size: 16px; }
.feature-meta b { color: var(--grey); }
.feature-note { color: var(--subtle); font-style: italic; }
.feature-actions { margin-top: auto; padding-top: 28px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
/* 1.3: hình minh họa đầu thẻ — tràn hết mép thẻ, nền xám, nội dung (phác giao diện) nhô lên từ cạnh dưới.
   <article class="feature-card"><div class="feature-visual" aria-hidden="true">…</div><div class="feature-top">… */
.feature-visual {
  --fc-pad: clamp(24px, 3.4vw, 40px);   /* = lề trong .feature-card */
  position: relative; height: 210px; margin: calc(-1 * var(--fc-pad)) calc(-1 * var(--fc-pad)) 28px;
  padding: 28px var(--fc-pad) 0; background: var(--grey-10); border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-end; justify-content: center; gap: 18px; overflow: hidden;
}

/* ---- Danh sách điểm: <ul class="points"> dấu tích đỏ; <ol class="points"> số thứ tự ---- */
.points { margin: 24px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; max-width: 36em; }
.points li { position: relative; padding-left: 34px; }
ul.points li::before {
  content: ""; position: absolute; left: 0; top: .3em; width: 20px; height: 20px; border-radius: 6px;
  background: var(--red-10) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3.2L15 6.9' fill='none' stroke='%23DA2128' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
}
ol.points { counter-reset: pt; }
ol.points li { counter-increment: pt; }
ol.points li::before {
  content: counter(pt); position: absolute; left: 0; top: .1em; width: 24px; height: 24px; border-radius: 50%;
  background: var(--red); color: var(--white); font: 700 14px/24px var(--font-body); text-align: center;
}
/* Dấu đầu dòng hình thoi vàng, dùng trên nền đỏ */
.diamonds { margin: 24px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: 17px; }
.diamonds li { display: flex; gap: 12px; align-items: baseline; }
.diamonds li::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--yellow); flex: none; transform: translateY(-2px) rotate(45deg); }

/* ---- Quy trình 4 bước ngang, có đường nối ---- */
.process { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); }
.process-item { position: relative; }
.process-item:not(:last-child)::after {
  content: ""; position: absolute; top: 27px; left: 68px; right: calc(12px - clamp(20px, 3vw, 40px)); height: 2px;
  background: repeating-linear-gradient(90deg, var(--grey-40) 0 8px, transparent 8px 14px);
}
.process-num {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--white); border: 2px solid var(--red); color: var(--red); font: 700 22px/1 var(--font-head);
}
.process-item:last-child .process-num { background: var(--red); color: var(--white); }
.process-item h3 { margin-top: 22px; font-size: 21px; line-height: 1.25; }
.process-item p { margin-top: 10px; font-size: 17px; line-height: 1.55; }

/* ---- Thẻ form (đề xuất, đăng ký) ---- */
.form-card { background: var(--white); color: var(--grey); border-radius: 26px; padding: clamp(24px, 3.4vw, 40px); box-shadow: var(--lift); }
.form-card h3 { font-size: 24px; margin-bottom: 4px; }
.form-card :is(h2, h3, h4), .section.is-red .form-card :is(h2, h3, h4) { color: var(--text); }   /* thẻ trắng nằm trong section đỏ */
.form-card .field { margin-top: 20px; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 24px; }
.form-status { font-size: 15px; font-weight: 600; color: var(--ok); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 88px); align-items: center; }

/* ---- Footer nhiều cột ---- */
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding-block: 56px 44px; }
.footer-grid .brand-logo { height: 40px; }
.footer-grid h4 { margin: 0 0 12px; font-size: 17px; }
.footer-grid .footer-links { display: grid; gap: 8px; font-size: 16px; }
.footer-grid .footer-links a { font-weight: 400; }
.footer-about { margin-top: 18px; font-size: 16px; max-width: 30em; }
.footer-bottom {
  border-top: 1px solid var(--line-soft); padding-block: 18px 22px; font-size: 14px; color: var(--subtle);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
}

/* =========================================================================
   8. RESPONSIVE
   1100: bộ lọc xuống hàng · 1024: trang giới thiệu 1 cột · 900: khu làm việc 1 cột
   860: thẻ tính năng 1 cột · 760: điện thoại · 640: trang giới thiệu trên điện thoại
   ========================================================================= */
@media (max-width: 1100px) {
  .f-group.has-sep { border-right: 0; padding-right: 0; }
  .kpis.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .hero-xl .hero-inner { grid-template-columns: 1fr; }
  .hero-aside { justify-self: start; }
  .split { grid-template-columns: 1fr; }
  .process { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 44px; }
  .process-item::after { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; grid-template-areas: "form" "preview" "actions"; grid-template-rows: auto; }
  .ws-preview { position: static; padding: 16px; }
  .stage { padding: 16px; min-height: 0; }
  .ws-preview .tips { display: none; }
  .workspace.is-landscape { grid-template-areas: "preview" "form" "actions"; }
  .workspace.is-landscape .ws-preview { position: sticky; top: 8px; z-index: 5; padding: 12px; }
  .workspace.is-landscape .stage { padding: 10px; }
  .workspace.is-landscape .ws-preview :is(.preview-head, .tags) { display: none; }
}
@media (max-width: 860px) {
  .feature-grid { grid-template-columns: 1fr; }
  .feature-grid > .feature-card:last-child:nth-child(odd) .points { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --pad: 16px; --gap: 12px; --overlap: 60px; }
  .header-inner { min-height: 60px; gap: 10px; }
  .brand { gap: 10px; padding-block: 12px; }
  .brand-logo { height: 26px; }
  .brand-name { display: none; }
  .nav { gap: 2px; }
  .nav > a:not(.btn) { padding: 7px 8px; font-size: 14px; }
  .nav .long { display: none; }
  .nav .short { display: inline; }
  .hero::after { width: 72%; opacity: .9; background-image: url("kite-sm.jpg"); }
  .hero-inner { grid-template-columns: 1fr; padding-block: 28px calc(28px + var(--overlap)); gap: 14px; }
  .hero-icon { --s: 52px; }
  .hero-lead { font-size: 16px; }
  .filters { padding: 16px; gap: 12px; border-radius: var(--r-md); }
  .f-group { flex: 1 1 140px; }
  .f-group.grow, .f-group.full, .f-group:has(> .seg) { flex-basis: 100%; }
  .f-group select { width: 100%; min-width: 0; }
  .range-all { flex: 1 1 auto; }
  .date { flex: 1 1 190px; }
  .seg { width: 100%; }
  .seg button { flex: 1 1 auto; justify-content: center; padding: 0 10px; }
  .f-actions { width: 100%; margin-left: 0; justify-content: space-between; }
  .f-actions .btn { flex: 1; }
  .kpis, .kpis.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.cols-2 { grid-template-columns: 1fr; }
  .kpis.cols-3, .kpis.cols-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile { padding: 14px 16px; }
  .tile .lab { font-size: 13px; }
  .tile .val { font-size: 26px; }
  .tile.is-main .val { font-size: 40px; }
  .tile.is-outline .val { font-size: 22px; }
  .tile .meter { margin-left: 0; }
  .meter svg { width: 18px; height: 18px; }
  .meter-bg, .meter-fg { gap: 2px; }
  .delta { font-size: 15px; }
  .tile.is-main .delta { font-size: 18px; }
  .card { padding: 18px var(--pad) 16px; border-radius: var(--r-md); }
  .card-actions { width: 100%; }
  .collapse-head { padding: 14px var(--pad); border-radius: var(--r-md); }
  .collapse-head h2 { font-size: 18px; }
  .collapse-body { padding-bottom: 16px; }
  .chart-box, .chart-box.tall { height: 280px; }
  .sec-head { flex-direction: column; gap: 2px; margin-top: 28px; }
  .sec-head h2 { font-size: 20px; }
  .review time { margin-left: 0; }
  .choice img { height: 96px; }
  .hide-sm { display: none !important; }
}
@media (max-width: 640px) {
  body.landing { font-size: 17px; }
  .hero-xl .hero-actions .btn { flex: 1 1 auto; }
  .section-head p, .feature-lead { font-size: 18px; }
  .process { grid-template-columns: 1fr; row-gap: 32px; }
  .process-item { display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto 1fr; column-gap: 18px; }
  .process-num { grid-row: 1 / span 2; }
  .process-item h3 { margin-top: 14px; }
  .process-item p { grid-column: 2; margin-top: 6px; }
  .footer-grid { grid-template-columns: 1fr; }
  /* 1.3: tiêu đề nhóm cho xuống dòng, bỏ đường kẻ để không tràn ngang; hình minh họa đầu thẻ thấp hơn */
  .group-head h3 { white-space: normal; }
  .group-head::after { display: none; }
  .feature-visual { height: 190px; padding: 22px 16px 0; }
}
@media (max-width: 380px) {
  .kpis.cols-3, .kpis.cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =========================================================================
   9. TRỢ NĂNG
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  .legend i, .chip i, .swatch, .tile .lab i, .review-stars i, .tip .r .k i { forced-color-adjust: none; }
}

/* =========================================================================
   10. CHUYỂN ĐỘNG (1.3) — bật cho cả trang: <body class="motion"> (trang có mật khẩu: class="locked motion")
   - Vào trang (chạy 1 lần): hero, khung lọc / màn hình mật khẩu, các khối trong <main class="stack">,
     khu làm việc hiện lần lượt; khung biểu đồ hiện dần trái → phải. Trang có mật khẩu: nội dung bị ẩn tới khi
     giải mã nên chuyển động chạy đúng lúc mở khóa.
   - Gắn vào khung bọc (không gắn vào ô KPI / SVG biểu đồ được vẽ lại) để không nháy khi đổi bộ lọc hay gõ tìm.
   - Hiệu ứng vào trang dùng fill-mode "backwards": chạy xong không để lại transform/opacity, nên không tạo lớp
     xếp chồng làm danh sách thả xuống của khung lọc bị khối bên dưới che.
   - Trạng thái do JS của trang gắn (gỡ khi animationend):
       .paper.is-fresh   ảnh xem trước vừa vẽ lại vì đổi địa điểm / mẫu / ảnh mã QR (không gắn khi người dùng gõ chữ)
       .btn.is-ready     nút tải vừa chuyển từ khóa sang bấm được
       [data-reveal]     khối chạy hiệu ứng khi cuộn tới: JS gắn .is-armed rồi .is-in (mẫu initReveal() ở trang chủ)
   - Tắt JS: mọi thứ hiện đủ. Máy bật "giảm chuyển động": mục 9 tắt toàn bộ, JS không gắn .is-armed.
   ========================================================================= */
.motion { --ease-out: cubic-bezier(.2, .7, .2, 1); }
@keyframes m-rise  { from { opacity: 0; transform: translateY(14px); } }
@keyframes m-pop   { from { opacity: 0; transform: scale(.8); } 60% { opacity: 1; transform: scale(1.05); } }
@keyframes m-bg    { from { opacity: 0; transform: scale(1.06); } }
@keyframes m-wipe  { from { clip-path: inset(0 100% 0 0); } }
@keyframes m-fresh { from { opacity: .35; transform: scale(.985); } }
@keyframes m-sheen { from { transform: translateX(-130%) skewX(-18deg); } to { transform: translateX(330%) skewX(-18deg); } }
@keyframes m-ready { from { box-shadow: 0 0 0 0 var(--red-20); } to { box-shadow: 0 0 0 14px transparent; } }

/* ---- Vào trang ---- */
.motion .hero::after { animation: m-bg 1.1s var(--ease-out) backwards; }
.motion .hero-icon { animation: m-pop .6s var(--ease-out) .05s backwards; }
.motion .hero h1 { animation: m-rise .5s var(--ease-out) .1s backwards; }
.motion .hero-lead { animation: m-rise .5s var(--ease-out) .16s backwards; }
.motion :is(.hero-meta li, .hero-actions) { animation: m-rise .45s var(--ease-out) backwards; animation-delay: calc(.22s + var(--i, 0) * 50ms); }
.motion .hero-meta li:nth-child(2) { --i: 1; }
.motion .hero-meta li:nth-child(3) { --i: 2; }
.motion .hero-meta li:nth-child(n+4) { --i: 3; }
.motion :is(.filter-dock .filters, .gate-card) { animation: m-rise .5s var(--ease-out) .2s backwards; }
.motion main.stack > * { animation: m-rise .5s var(--ease-out) .44s backwards; }
.motion main.stack > :nth-child(1) { animation-delay: .24s; }
.motion main.stack > :nth-child(2) { animation-delay: .29s; }
.motion main.stack > :nth-child(3) { animation-delay: .34s; }
.motion main.stack > :nth-child(4) { animation-delay: .39s; }
.motion :is(.chart, .chart-box) { animation: m-wipe .9s var(--ease-out) .5s backwards; }
.motion .workspace > .panel { animation: m-rise .5s var(--ease-out) .18s backwards; }
.motion .workspace > .ws-preview { animation-delay: .26s; }
.motion .workspace > .ws-actions { animation-delay: .32s; }

/* ---- Phản hồi khi rê chuột / bấm ---- */
.motion .btn:active:not(:disabled) { transform: scale(.98); }
.motion .choice { transition: border-color .2s, background-color .2s, transform .2s var(--ease-out), box-shadow .2s; }
.motion :is(.choice img, .feature-actions .btn svg) { transition: transform .25s var(--ease-out); }
@media (hover: hover) {
  .motion .choice:hover { transform: translateY(-2px); box-shadow: var(--lift-sm); }
  .motion .choice:hover img { transform: scale(1.03); }
  .motion .feature-actions .btn:hover svg { transform: translate(2px, -2px); }
}
.motion .choice:active { transform: scale(.98); box-shadow: none; }
.motion .choice[aria-pressed="true"]::after { animation: m-pop .35s var(--ease-out) backwards; }

/* ---- Trạng thái do JS gắn ---- */
.motion .paper { position: relative; overflow: hidden; }
.motion .paper.is-fresh > :is(canvas, img) { animation: m-fresh .45s var(--ease-out); }
.motion .paper.is-fresh::after {
  content: ""; position: absolute; top: -10%; bottom: -10%; left: 0; width: 34%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: m-sheen .8s var(--ease-out) .05s both;
}
.motion .btn.is-ready { animation: m-ready .9s ease-out 2; }
/* Quy trình 4 bước: số hiện lần lượt, đường nối vẽ dần (<ol class="process" data-reveal>) */
.motion .process-item:nth-child(2) { --i: 1; }
.motion .process-item:nth-child(3) { --i: 2; }
.motion .process-item:nth-child(4) { --i: 3; }
.motion .process.is-armed .process-num { opacity: 0; transform: scale(.6); }
.motion .process.is-armed .process-item::after { clip-path: inset(0 100% 0 0); }
.motion .process.is-armed.is-in .process-num { opacity: 1; transform: none; transition: transform .45s var(--ease-out), opacity .3s; transition-delay: calc(var(--i, 0) * .3s); }
.motion .process.is-armed.is-in .process-item::after { clip-path: inset(0); transition: clip-path .4s ease-in-out; transition-delay: calc(var(--i, 0) * .3s + .2s); }
