/* be-vietnam-pro-vietnamese-400-normal */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/be-vietnam-pro-vietnamese-400-normal.woff2) format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}


/* be-vietnam-pro-latin-400-normal */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url(fonts/be-vietnam-pro-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
/* be-vietnam-pro-vietnamese-500-normal */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/be-vietnam-pro-vietnamese-500-normal.woff2) format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}


/* be-vietnam-pro-latin-500-normal */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 500;
  src: url(fonts/be-vietnam-pro-latin-500-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
/* be-vietnam-pro-vietnamese-600-normal */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/be-vietnam-pro-vietnamese-600-normal.woff2) format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}


/* be-vietnam-pro-latin-600-normal */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 600;
  src: url(fonts/be-vietnam-pro-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
/* be-vietnam-pro-vietnamese-700-normal */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(fonts/be-vietnam-pro-vietnamese-700-normal.woff2) format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}


/* be-vietnam-pro-latin-700-normal */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url(fonts/be-vietnam-pro-latin-700-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
/* be-vietnam-pro-vietnamese-800-normal */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 800;
  src: url(fonts/be-vietnam-pro-vietnamese-800-normal.woff2) format('woff2');
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}


/* be-vietnam-pro-latin-800-normal */
@font-face {
  font-family: 'Be Vietnam Pro';
  font-style: normal;
  font-display: swap;
  font-weight: 800;
  src: url(fonts/be-vietnam-pro-latin-800-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --line: #e3e1db;
  --line-strong: #cfccc4;
  --ink: #16161a;
  --ink-2: #4d4c48;
  --ink-3: #78766f;
  --accent: #2a78d6;
  --accent-soft: #e3eefb;
  --good: #16803c;
  --bad: #c43c3c;
  --warn: #a8660a;
  --good-soft: #e5f4ea;
  --bad-soft: #fbe9e7;
  --warn-soft: #fdf1dc;
  --info-soft: #e9f0fa;
  --row-hi: #fff4d6;
  --shadow: 0 1px 2px rgba(20, 20, 20, .05), 0 2px 8px rgba(20, 20, 20, .04);
  --radius: 12px;
  --h0-bg: #f6c4c1; --h0-fg: #8e1b1b; --h1-bg: #f9d6cf; --h1-fg: #9a3412; --h2-bg: #fde3c3; --h2-fg: #8a4b06; --h3-bg: #fdeeb0; --h3-fg: #6f5400;
  --h4-bg: #e8f0b8; --h4-fg: #4a5d0f; --h5-bg: #cdeac4; --h5-fg: #1f6a26; --h6-bg: #b2e0b4; --h6-fg: #155c22; --h7-bg: #93d3a0; --h7-fg: #0b4a1c;
  --edge-shadow: rgba(20, 20, 20, .14);
  --font: 'Be Vietnam Pro', 'Segoe UI', system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121212;
    --surface: #1c1c1b;
    --surface-2: #262624;
    --line: #333331;
    --line-strong: #4a4945;
    --ink: #f4f3ef;
    --ink-2: #c9c7bf;
    --ink-3: #9a988f;
    --accent: #5598e7;
    --accent-soft: #1d2f47;
    --good: #4cc06c;
    --bad: #ff7b72;
    --warn: #e7a73c;
    --good-soft: #17301f;
    --bad-soft: #3a1d1b;
    --warn-soft: #3a2c12;
    --info-soft: #1b2738;
    --row-hi: #3a3214;
    --h0-bg: #4a1f1f; --h0-fg: #ffb3ad; --h1-bg: #4a2a22; --h1-fg: #ffc2a8; --h2-bg: #47331c; --h2-fg: #fcd29a; --h3-bg: #433a17; --h3-fg: #f5e08a;
    --h4-bg: #363d18; --h4-fg: #d8e88f; --h5-bg: #233d23; --h5-fg: #a9e0a0; --h6-bg: #1d4226; --h6-fg: #90d99a; --h7-bg: #17482a; --h7-fg: #7fd99b;
    --edge-shadow: rgba(0, 0, 0, .55);
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --surface: #1c1c1b;
  --surface-2: #262624;
  --line: #333331;
  --line-strong: #4a4945;
  --ink: #f4f3ef;
  --ink-2: #c9c7bf;
  --ink-3: #9a988f;
  --accent: #5598e7;
  --accent-soft: #1d2f47;
  --good: #4cc06c;
  --bad: #ff7b72;
  --warn: #e7a73c;
  --good-soft: #17301f;
  --bad-soft: #3a1d1b;
  --warn-soft: #3a2c12;
  --info-soft: #1b2738;
  --row-hi: #3a3214;
  --h0-bg: #4a1f1f; --h0-fg: #ffb3ad; --h1-bg: #4a2a22; --h1-fg: #ffc2a8; --h2-bg: #47331c; --h2-fg: #fcd29a; --h3-bg: #433a17; --h3-fg: #f5e08a;
  --h4-bg: #363d18; --h4-fg: #d8e88f; --h5-bg: #233d23; --h5-fg: #a9e0a0; --h6-bg: #1d4226; --h6-fg: #90d99a; --h7-bg: #17482a; --h7-fg: #7fd99b;
  --edge-shadow: rgba(0, 0, 0, .55);
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
button, select, input { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 20px; }

/* ---------- đầu trang ---------- */
.top { padding-block: 22px 8px; }
.top h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.top .sub { color: var(--ink-2); margin-top: 4px; }
.top .sub b { color: var(--ink); font-weight: 600; }

.controls {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.controls .wrap { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding-top: 10px; padding-bottom: 10px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 600; }
.ctl-select { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; padding: 7px 10px; min-width: 0; max-width: 100%; }
.ctl-period { min-width: 220px; }
.btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 9px; padding: 7px 12px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn-icon { padding: 7px 10px; }
.spacer { flex: 1; }

.status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 0 4px; color: var(--ink-3); font-size: 13px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; margin-right: 6px; }

.tabs { display: flex; gap: 4px; margin: 10px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; color: var(--ink-3); font-weight: 600; border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.banner { margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.banner b { color: var(--warn); }

/* ---------- mục, thẻ ---------- */
main { padding-bottom: 60px; }
.sec { margin-top: 26px; }
.sec-label { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.sec-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.sec-label .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 11px; letter-spacing: 0; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.g-wide { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card .hint { color: var(--ink-3); font-size: 12.5px; margin-bottom: 12px; }
.card.flat { box-shadow: none; }
.empty { padding: 26px 18px; text-align: center; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty b { color: var(--ink); display: block; font-size: 16px; margin-bottom: 4px; }
.note { font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin-top: 12px; }

/* ---------- con số lớn ---------- */
.hero .lbl { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.hero .big { font-size: 48px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; margin: 6px 0 6px; }
.hero .summary { color: var(--ink-2); margin: 8px 0 12px; }
.hero .summary b { color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tiles.t5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.tiles.t4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 10px; min-width: 0; display: flex; flex-direction: column; }
.tile .lbl { font-size: 12.5px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tile .val { font-size: 22px; font-weight: 700; margin: 4px 0 2px; letter-spacing: -.01em; white-space: nowrap; }
.tile .spark { margin-top: auto; padding-top: 6px; }
.tile .sub { font-size: 12px; color: var(--ink-3); }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

.delta { font-size: 13px; font-weight: 700; white-space: nowrap; }
.delta.good { color: var(--good); }
.delta.bad { color: var(--bad); }
.delta.neutral, .delta.na { color: var(--ink-3); }
.delta .vs { font-weight: 400; color: var(--ink-3); }

/* ---------- nhận định ---------- */
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.ins { border-radius: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ins .lvl { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.ins .lvl i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.ins.warn .lvl i { background: var(--warn); }
.ins.bad .lvl i { background: var(--bad); }
.ins.good .lvl i { background: var(--good); }
.ins.info .lvl i { background: var(--accent); }
.ins h4 { font-size: 14px; }
.ins p { margin: 0; color: var(--ink-2); font-size: 13px; }

/* ---------- biểu đồ thời gian (HTML + SVG) ---------- */
.tchart { position: relative; padding-top: 18px; }
.tchart .plot { position: relative; height: var(--h, 180px); margin-left: var(--yw, 44px); border-bottom: 1px solid var(--line-strong); }
.tchart .gl { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.tchart .yl { position: absolute; right: calc(100% + 6px); transform: translateY(-50%); font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.tchart .refl { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--good); opacity: .9; pointer-events: none; }
.tchart .refl span { position: absolute; right: 0; bottom: 2px; font-size: 11px; font-weight: 600; color: var(--good); background: var(--surface); padding: 0 4px; border-radius: 4px; }
.tchart svg.line { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tchart .pt { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; border: 2px solid var(--surface); }
.tchart .pt.hi { width: 12px; height: 12px; margin: -6px 0 0 -6px; }
.tchart .vlab { position: absolute; transform: translate(-50%, -100%); margin-top: -8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--ink); }
.tchart .xl { display: flex; margin-left: var(--yw, 44px); }
.tchart .xl span { flex: 1; text-align: center; font-size: 11px; color: var(--ink-3); padding-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tchart .xl span.hi { color: var(--ink); font-weight: 700; }
.tchart .cols { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.tchart .col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column-reverse; align-items: center; height: 100%; padding: 0; position: relative; }
.tchart .col .cs { width: 62%; max-width: 46px; border-radius: 0; }
.tchart .col .cs + .cs { margin-bottom: 2px; }
.tchart .col .cs:last-child { border-radius: 4px 4px 0 0; }
.tchart .col .clab { position: absolute; font-size: 11px; font-weight: 600; white-space: nowrap; transform: translateY(-100%); margin-top: -3px; }
.tchart .hit { position: absolute; top: 0; bottom: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- phễu ---------- */
.funnel { display: grid; gap: 4px; }
.fn-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 118px; gap: 10px; align-items: center; }
.fn-row .name { font-size: 12.5px; color: var(--ink-2); line-height: 1.25; }
.fn-row .name b { display: block; font-size: 18px; color: var(--ink); }
.fn-shape { position: relative; height: 46px; }
.fn-shape svg { width: 100%; height: 100%; display: block; }
.fn-row .keep { font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.fn-row .keep b { font-size: 14px; color: var(--ink); }
.fn-row .keep .prev { color: var(--ink-3); font-size: 12px; }
.fn-row.worst .keep b { color: var(--bad); }
.fn-foot { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.fn-foot div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.fn-foot small { display: block; color: var(--ink-3); font-size: 12px; }
.fn-foot b { font-size: 16px; }

/* ---------- vòng tỉ trọng ---------- */
.donut-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut-wrap svg { width: 170px; height: 170px; flex: none; }
.donut-legend { flex: 1; min-width: 190px; display: grid; gap: 8px; }
.donut-legend .it { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
.donut-legend .it .v { font-weight: 600; text-align: right; }
.donut-legend .it .v small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11.5px; }

/* ---------- thanh ngang ---------- */
.hbars { display: grid; gap: 9px; }
.hb { display: grid; grid-template-columns: minmax(90px, 30%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.hb .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.hb .tr { height: 14px; background: var(--surface-2); border-radius: 0 4px 4px 0; position: relative; }
.hb .fill { height: 100%; border-radius: 0 4px 4px 0; }
.hb .v { white-space: nowrap; text-align: right; font-weight: 600; }
.hb .v small { font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.rank { display: grid; gap: 10px; }
.rk { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.rk .no { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.rk .nm { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk .bar { height: 6px; background: var(--surface-2); border-radius: 3px; margin-top: 4px; }
.rk .bar i { display: block; height: 100%; border-radius: 3px; }
.rk .v { text-align: right; font-weight: 600; font-size: 13px; white-space: nowrap; }
.rk .v small { display: block; color: var(--ink-3); font-weight: 400; font-size: 11.5px; }

/* thanh lồng thanh */
.nest { display: grid; gap: 10px; }
.ns { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 12px; align-items: center; }
.ns .nm { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 3px; }
.ns .outer { height: 18px; border-radius: 0 4px 4px 0; position: relative; }
.ns .inner { position: absolute; left: 0; top: 4px; bottom: 4px; border-radius: 0 3px 3px 0; }
.ns .num { font-size: 12.5px; text-align: right; line-height: 1.3; white-space: nowrap; }
.ns .num b { font-size: 13.5px; }
.ns .num small { color: var(--ink-3); display: block; font-size: 11.5px; }

/* thanh 100% */
.stack100 { display: flex; height: 26px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface); }
.stack100 div { height: 100%; min-width: 2px; }
.stack-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 14px; margin-top: 10px; font-size: 12.5px; }
.stack-legend span { display: flex; align-items: center; gap: 6px; min-width: 0; }
.stack-legend em { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.stack-legend b { margin-left: auto; white-space: nowrap; }

/* que kẹo */
.lolli { display: grid; gap: 10px; }
.lp { display: grid; grid-template-columns: minmax(90px, 46%) minmax(0, 1fr) 96px; gap: 10px; align-items: center; font-size: 13px; }
.lp .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.lp .tr { position: relative; height: 14px; }
.lp .stick { position: absolute; left: 0; top: 6px; height: 2px; }
.lp .head { position: absolute; top: 0; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; border: 2px solid var(--surface); }
.lp .v { font-weight: 700; text-align: right; }
.lp .one { position: absolute; top: -4px; bottom: -4px; border-left: 1px dashed var(--line-strong); }

/* ---------- bảng ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.tbl th { font-size: 12px; color: var(--ink-3); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td.l, .tbl th.l { text-align: left; }
.tbl td.wrap-cell { white-space: normal; min-width: 280px; }
.tbl tr.hi td { background: var(--row-hi); font-weight: 600; }
.tbl tr.total td { font-weight: 700; border-top: 2px solid var(--line-strong); }
.tbl td.muted { color: var(--ink-3); }
.tbl .badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; }
.badge.error { background: var(--bad-soft); color: var(--bad); }
.badge.check { background: var(--warn-soft); color: var(--warn); }
.badge.blank { background: var(--surface-2); color: var(--ink-2); }

/* bảng nhiệt: màu cố định, không đổi theo giao diện */
.heat td.h { padding: 1px; text-align: center; }
.heat .hc { display: block; border-radius: 6px; padding: 6px 4px; font-weight: 700; min-width: 46px; }
.heat td.h.nil { color: var(--ink-3); font-weight: 400; }
.heat th.r { text-align: center; white-space: normal; line-height: 1.2; min-width: 50px; }
.lv0 { background: var(--h0-bg); color: var(--h0-fg); }
.lv1 { background: var(--h1-bg); color: var(--h1-fg); }
.lv2 { background: var(--h2-bg); color: var(--h2-fg); }
.lv3 { background: var(--h3-bg); color: var(--h3-fg); }
.lv4 { background: var(--h4-bg); color: var(--h4-fg); }
.lv5 { background: var(--h5-bg); color: var(--h5-fg); }
.lv6 { background: var(--h6-bg); color: var(--h6-fg); }
.lv7 { background: var(--h7-bg); color: var(--h7-fg); }
.heat-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.heat-legend span { display: inline-flex; align-items: center; gap: 5px; }
.heat-legend .sw { width: 14px; height: 10px; }

/* người phụ trách */
.people { display: grid; gap: 4px; }
.pp { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pp:last-child { border-bottom: 0; }
.pp .av { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; }
.pp .nm { font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pp .nm .rv { font-weight: 700; white-space: nowrap; }
.pp .gauge { height: 8px; background: var(--surface-2); border-radius: 4px; margin: 6px 0 5px; overflow: hidden; }
.pp .gauge i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.pp .meta { font-size: 12px; color: var(--ink-2); }

/* thẻ nền tảng */
.plat { display: flex; flex-direction: column; gap: 10px; }
.plat-head { display: flex; align-items: center; gap: 8px; }
.plat-head h3 { margin: 0; }
.plat-head .big2 { margin-left: auto; font-weight: 700; font-size: 18px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; }
.kv div { background: var(--surface-2); border-radius: 8px; padding: 7px 9px; }
.kv small { display: block; color: var(--ink-3); font-size: 11.5px; }
.kv b { font-size: 14px; }

/* thẻ tháng */
.months { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.mc { background: var(--surface-2); border-radius: 10px; padding: 12px; border: 2px solid transparent; }
.mc.sel { border-color: var(--accent); }
.mc h4 { font-size: 13px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 6px; }
.mc .rv { font-size: 22px; font-weight: 700; margin: 4px 0; }
.mc .meta { font-size: 12px; color: var(--ink-2); display: grid; gap: 2px; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); white-space: nowrap; }

.smalls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.smalls .card h3 { font-size: 13.5px; }

/* chú thích nổi */
#tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12.5px; padding: 6px 9px; border-radius: 7px; max-width: 280px; opacity: 0; transition: opacity .08s; white-space: pre-line; }
#tip.on { opacity: 1; }
[data-tip] { cursor: default; }

.loading { padding: 80px 0; text-align: center; color: var(--ink-3); }
.err { margin: 20px 0; padding: 14px; border-radius: 10px; background: var(--bad-soft); color: var(--bad); }

/* ---------- điện thoại ---------- */
@media (max-width: 960px) {
  .g-hero, .g-wide, .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .tiles.t5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .smalls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .wrap { padding: 0 12px; }
  .top h1 { font-size: 18px; }
  .hero .big { font-size: 38px; }
  .tiles, .tiles.t5, .tiles.t4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile .val { font-size: 19px; }
  .smalls { grid-template-columns: minmax(0, 1fr); }
  .ctl-period { min-width: 0; flex: 1 1 160px; }
  .ctl-source { flex: 1 1 160px; }
  .fn-row { grid-template-columns: 92px minmax(0, 1fr) 84px; gap: 6px; }
  .fn-row .name b { font-size: 15px; }
  .ns { grid-template-columns: minmax(0, 1fr) 104px; }
  .card { padding: 14px 12px; }
  .fn-foot { grid-template-columns: minmax(0, 1fr); }
  .hb { grid-template-columns: minmax(70px, 34%) minmax(0, 1fr) auto; }
  .lp { grid-template-columns: minmax(80px, 36%) minmax(0, 1fr) 76px; }
}

.g-cause { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
@media (max-width: 960px) { .g-cause { grid-template-columns: minmax(0, 1fr); } }
.status .dot.stale { background: var(--warn); }
.notice { margin: 8px 0 0; padding: 9px 13px; border-radius: 9px; font-size: 13px; border: 1px solid var(--line); background: var(--info-soft); color: var(--ink); }
.notice.err { background: var(--bad-soft); }
.notice.warn { background: var(--warn-soft); }
.notice b { font-weight: 600; }
.notice .btn { margin-left: 8px; padding: 4px 10px; font-size: 12.5px; }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; font-weight: 600; }
.linkbtn:disabled { color: var(--ink-3); cursor: wait; }

/* ---------- vòng 2: hiện/ẩn theo màn hình, menu thao tác ---------- */
.show-sm { display: none !important; }
.more { position: relative; }
.more > summary { list-style: none; cursor: pointer; padding: 7px 12px; }
.more > summary::-webkit-details-marker { display: none; }
.more .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px; display: grid; gap: 2px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.more .menu button { text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 7px; cursor: pointer; }
.more .menu button:hover, .more .menu button:focus-visible { background: var(--surface-2); }
button:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- bảng: cột đầu cố định, bóng mờ báo còn cuộn ngang ---------- */
.tbl-box { position: relative; }
.tbl-box::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 26px; pointer-events: none; opacity: 0; transition: opacity .15s; border-radius: 0 8px 8px 0; background: linear-gradient(to right, transparent, var(--edge-shadow)); }
.tbl-box[data-more]::after { opacity: 1; }
.tbl th:first-child, .tbl td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.tbl th:first-child { z-index: 2; background: var(--surface-2); }
.tbl tr.hi td:first-child { background: var(--row-hi); }
.tbl-box[data-scrolled] .tbl td:first-child, .tbl-box[data-scrolled] .tbl th:first-child { box-shadow: 6px 0 8px -6px var(--edge-shadow); }
.tbl .c1 { display: block; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl.audit .c1 { max-width: none; }
.tbl-box::after { content: '›'; display: grid; place-items: center end; padding-right: 3px; color: var(--ink-2); font-weight: 700; font-size: 16px; }

/* bảng rà lỗi: đủ cột ở 1280px, chữ được xuống dòng */
.tbl.audit th, .tbl.audit td { white-space: normal; vertical-align: top; text-align: left; }
.tbl.audit td.wr { min-width: 150px; }
.tbl.audit td.prob { min-width: 220px; }
.tbl.audit td.no { font-weight: 700; }
.tbl.audit td.cells { white-space: nowrap; color: var(--ink-2); }

/* tháng chưa có số liệu sale: một dòng chữ nhỏ */
.months-note { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }

/* tab digital: ô nền tảng 5 cột, thẻ diễn biến 3 cột */
.hero-wide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 24px; align-items: center; }
.tiles.t5 { margin-top: 14px; }

@media (max-width: 960px) {
  .hero-wide { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 600px) {
  .hide-sm { display: none !important; }
  .show-sm { display: inline-flex !important; }
  .top { padding-block: 10px 4px; }
  .top h1 { font-size: 16px; }
  .top .sub { font-size: 12.5px; margin-top: 2px; }
  .controls .wrap { padding-top: 6px; padding-bottom: 6px; gap: 6px; }
  .seg button { padding: 5px 11px; }
  .ctl-select { padding: 5px 8px; font-size: 13px; }
  .ctl-period { flex: 1 1 150px; }
  .ctl-source { flex: 1 1 100%; }
  .status { padding: 6px 0 0; gap: 6px; flex-wrap: nowrap; font-size: 12.5px; }
  .status #fetched { min-width: 0; }
  .status .btn { padding: 6px 10px; }
  .tabs { margin-top: 6px; }
  .tabs button { padding: 9px 10px; }
  .sec { margin-top: 16px; }
  .sec-label { margin-bottom: 8px; }
  .banner { margin-top: 8px; padding: 7px 10px; font-size: 12.5px; }
  .notice { margin-top: 6px; }
  .tbl .c1 { max-width: 40vw; }
  .tbl th, .tbl td { padding: 6px 7px; }
  .heat .c1 { max-width: 26vw; }
  .heat th.r { min-width: 44px; font-size: 11px; padding: 5px 2px; }
  .heat td.h { padding: 1px; }
  .heat .hc { min-width: 42px; padding: 5px 2px; font-size: 12px; }
  .heat td, .heat th { padding-left: 4px; padding-right: 4px; }
  .tbl.audit td.wr, .tbl.audit td.prob { min-width: 140px; }
}
.tbl .badge { white-space: nowrap; }

/* chân trang: tuyên bố sở hữu + đường dẫn chính sách */
.site-foot { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; padding-block: 18px 26px; font-size: 11.5px; color: var(--ink-3); border-top: 1px solid var(--line); margin-top: 24px; }
.site-foot a { color: var(--ink-3); }
.site-foot a:hover { color: var(--ink-2); }

/* Phần riêng của bản web: dải chế độ (xem thử / tài khoản), khung kết nối trang tính, hướng dẫn khi chọn file. */
.brand { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.mode-bar { background: var(--warn-soft); border-bottom: 1px solid var(--line); font-size: 13px; }
.mode-bar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding-top: 7px; padding-bottom: 7px; }
.mode-bar .mb-text { flex: 1 1 260px; min-width: 0; }
.mode-bar .mb-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mode-bar .btn { padding: 5px 11px; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; }
.mode-bar a.btn { color: inherit; }
.mode-bar a.btn.primary { color: #fff; }
.mode-bar .mb-note { color: var(--ink-2); }
.gsi-btn { min-height: 32px; display: inline-flex; align-items: center; }
.mock { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mock label { font-size: 12px; color: var(--warn); font-weight: 700; }
.mock input { border: 1px solid var(--line-strong); border-radius: 8px; padding: 5px 8px; min-width: 0; width: 190px; max-width: 100%; background: var(--surface); }

.connect { max-width: 640px; margin: 28px auto; display: grid; gap: 10px; }
.connect h2 { font-size: 18px; }
.connect p { margin: 0; color: var(--ink-2); }
.connect .cp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.connect .err { margin: 0; }
.hint-share { font-size: 13px; background: var(--surface-2); border-radius: 8px; padding: 9px 12px; }

/* Hiện ngay trên màn hình khi hộp chọn file của Google đang mở (đè lên hộp chọn). */
.picker-hint { position: fixed; left: 12px; right: 12px; margin: 0 auto; width: fit-content; top: calc(10px + env(safe-area-inset-top, 0px)); /* ở trên để không che nút Chọn/Hủy của hộp chọn trên màn hình thấp */ z-index: 2147483000; max-width: min(560px, calc(100vw - 24px)); background: #16161a; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.4; box-shadow: 0 8px 28px rgba(0, 0, 0, .35); text-align: center; }
.picker-hint b { color: #ffd88a; word-break: break-all; }

@media (max-width: 600px) {
  .brand { font-size: 11px; margin-bottom: 2px; }
  .mode-bar { font-size: 12.5px; }
  .mode-bar .wrap { padding-top: 6px; padding-bottom: 6px; gap: 6px 10px; }
  .connect { margin: 16px auto; }
}

/* trang tĩnh (chính sách, điều khoản) */
.brand-link { color: inherit; text-decoration: none; }
.doc { display: grid; gap: 14px; padding-block: 8px 30px; }
.doc .placeholder { color: var(--ink-2); }
.doc .outline { color: var(--ink-3); margin: 10px 0 0; padding-left: 20px; }

[hidden] { display: none !important; }
/* Khách đã mua, chưa nạp trang tính: ẩn bộ chọn kỳ, nút PDF, menu và tab cho tới khi có số liệu */
body.no-data .controls > .wrap, body.no-data #btn-pdf, body.no-data #more, body.no-data #tabs, body.no-data #fetched { display: none !important; }

/* ---------- vòng 3b: form "Đăng ký mua" (hộp nổi) ---------- */
.lead-dlg { border: 0; border-radius: 14px; padding: 0; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--ink); box-shadow: 0 18px 50px rgba(0, 0, 0, .3); }
.lead-dlg::backdrop { background: rgba(10, 12, 14, .55); }
.lead-dlg form { display: grid; gap: 4px; padding: 18px 18px 16px; }
.lead-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.lead-head h2 { font-size: 17px; text-wrap: balance; }
.lead-head .x { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 0 2px; }
.lead-sub { margin: 0 0 6px; color: var(--ink-2); font-size: 13.5px; }
.lead-dlg label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 6px; }
.lead-dlg input { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px 12px; font: inherit; font-size: 16px; background: var(--surface); color: var(--ink); }
.lead-dlg input[aria-invalid="true"] { border-color: var(--bad); }
.lead-send { margin-top: 10px; padding: 11px 14px; font-size: 15px; justify-content: center; }
.field-err { margin: 2px 0 0; min-height: 0; color: var(--bad); font-size: 12.5px; }
.field-err:empty { display: none; }
.lead-note { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }
.lead-note a { color: var(--ink-2); }
.ok-msg { margin: 10px 0; padding: 12px 14px; border-radius: 10px; background: var(--good-soft); color: var(--ink); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- người đăng nhập mà chưa mua: ô đồng ý nhận tư vấn ---------- */
.optin { margin-top: 10px; display: grid; gap: 8px; }
.optin h2 { font-size: 15.5px; }
.optin p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.optin .check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.optin .check input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--accent); }
.optin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.optin-actions a { font-size: 12.5px; color: var(--ink-2); }

/* nội dung trang chính sách, điều khoản */
.prose { max-width: 820px; line-height: 1.65; font-size: 15px; }
.prose h2 { font-size: 18px; margin: 26px 0 8px; text-wrap: balance; }
.prose h3 { font-size: 15.5px; margin: 18px 0 6px; }
.prose h2:first-child, .prose p:first-child { margin-top: 0; }
.prose p { margin: 0 0 10px; color: var(--ink); }
.prose ul { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin: 3px 0; }
.prose code { font-size: 13.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.prose a { color: var(--accent); overflow-wrap: anywhere; }
.prose .doc-tbl td, .prose .doc-tbl th { white-space: normal; text-align: left; vertical-align: top; }
.prose .doc-tbl td:first-child { min-width: 160px; }
.prose mark.pending { background: var(--warn-soft); color: var(--warn); padding: 0 3px; border-radius: 3px; }

/* ---------- vòng 4a: bố cục bản web (thanh bên, đầu trang, Trang chủ, Cải thiện hiệu suất, Chẩn đoán kênh, Về ChiPan) ---------- */
:root { --track: #eeede8; --tip-bg: #2a78d6; --side-w: 64px; --side-open: 236px; --appbar-h: 60px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --track: #2c2c2a; --tip-bg: #1d5aa3; } }
:root[data-theme="dark"] { --track: #2c2c2a; --tip-bg: #1d5aa3; }

/* logo theo giao diện sáng / tối */
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-dark { display: inline-block; } :root:not([data-theme="light"]) .logo-light { display: none; } }
:root[data-theme="dark"] .logo-dark { display: inline-block; }
:root[data-theme="dark"] .logo-light { display: none; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }
body.shell { padding-left: var(--side-w); }
body.shell.side-pinned { padding-left: var(--side-open); }
.main-col { min-width: 0; }

/* thanh bên */
.side { position: fixed; z-index: 45; left: 0; top: 0; bottom: 0; width: var(--side-w); display: flex; flex-direction: column; gap: 2px; padding: 10px 0; background: var(--surface); border-right: 1px solid var(--line); overflow: hidden; transition: width .16s ease, box-shadow .16s ease; }
.side:hover, .side:focus-within, body.side-pinned .side { width: var(--side-open); }
body:not(.side-pinned) .side:hover, body:not(.side-pinned) .side:focus-within { box-shadow: 6px 0 24px rgba(0, 0, 0, .12); }
.side-nav { display: grid; gap: 2px; margin-top: 6px; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 8px; }
.nav-item, .side-toggle { display: flex; align-items: center; gap: 16px; height: 44px; padding: 0 0 0 21px; margin-right: 10px; border: 0; background: none; border-radius: 0 22px 22px 0; color: var(--ink-2); text-decoration: none; white-space: nowrap; cursor: pointer; font-weight: 500; width: calc(100% - 10px); text-align: left; }
.nav-item svg, .side-toggle svg { flex: none; }
.nav-item .lbl, .side-toggle .lbl { opacity: 0; transition: opacity .12s; }
.side:hover .lbl, .side:focus-within .lbl, body.side-pinned .side .lbl { opacity: 1; }
.nav-item:hover, .side-toggle:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.side-toggle { color: var(--ink-3); }

/* đầu trang */
.appbar { position: sticky; top: 0; z-index: 30; height: var(--appbar-h); display: flex; align-items: center; gap: 12px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
/* Cụm logo + tên sản phẩm + tên phòng khám: một đường dẫn về Trang chủ */
.brandline { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 0 1 auto; color: inherit; text-decoration: none; cursor: pointer; border-radius: 10px; padding: 4px 8px; margin-left: -8px; }
.brandline:hover .product { color: var(--accent); }
.brandline:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.brandline .logo { height: 30px; width: auto; flex: none; }
.brandline .logo-icon { display: none; flex: none; }
.brandtext { min-width: 0; line-height: 1.2; border-left: 1px solid var(--line); padding-left: 12px; }
.brandtext .product { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brandtext .clinic { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.refresh-box { display: flex; align-items: center; gap: 10px; flex: none; margin-left: auto; }
.last-upd { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.refresh-btn { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.refresh-btn svg { width: 18px; height: 18px; }
.refresh-btn.busy svg { animation: dgd-spin .9s linear infinite; }
.refresh-btn:disabled { opacity: .7; cursor: progress; }
@keyframes dgd-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .refresh-btn.busy svg { animation-duration: 2.4s; } .side { transition: none; } }
.acct-top { display: none; }
.shell .controls { top: var(--appbar-h); }
.shell .mode-bar { position: relative; z-index: 5; }

/* menu Trang tính và tài khoản */
.acct-menu { position: fixed; z-index: 60; min-width: 270px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 8px; display: grid; gap: 2px; box-shadow: 0 10px 34px rgba(0, 0, 0, .22); }
.acct-menu[data-from="side"] { left: calc(var(--side-open) + 8px); bottom: 14px; }
.acct-menu[data-from="top"] { right: 12px; top: calc(var(--appbar-h) - 4px); }
.am-who { padding: 6px 10px 8px; display: grid; gap: 1px; }
.am-who span { font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.am-sheet { padding: 2px 10px 8px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow-wrap: anywhere; }
.am-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 8px; cursor: pointer; color: var(--ink); text-decoration: none; }
.am-item:hover, .am-item:focus-visible { background: var(--surface-2); }
.am-theme { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; background: var(--surface-2); border-radius: 9px; padding: 3px; margin: 4px 0; }
.am-theme button { border: 0; background: none; padding: 7px 4px; border-radius: 7px; cursor: pointer; color: var(--ink-2); }
.am-theme button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* thanh điều hướng dưới (điện thoại) */
.bottom-nav { display: none; }

/* thông báo ngắn, lỗi cập nhật */
.toast { position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: 24px; max-width: min(560px, calc(100vw - 24px)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: 0 8px 28px rgba(0, 0, 0, .3); font-size: 13.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toast .btn { padding: 5px 12px; font-size: 13px; }
.refresh-err { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.refresh-err .re-acts { display: inline-flex; gap: 6px; margin-left: auto; }
.refresh-err .re-acts .btn { margin: 0; }

/* chung cho các mục mới */
.view { padding-bottom: 8px; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 24px 0 16px; }
.mini { font-size: 12.5px; color: var(--ink-3); }
.loading { padding: 48px 0; text-align: center; color: var(--ink-3); }
.block { margin-top: 28px; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 12px; }
.block-head h2 { font-size: 16px; }
.card.block { padding: 18px 20px; }
.more-link { color: var(--accent); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.more-link:hover { text-decoration: underline; }
.bar { height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; }
.bar i, .goal-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.bar i.good, .goal-bar i.good { background: var(--good); }
.bar i.warn, .goal-bar i.warn { background: var(--warn); }
.bar i.bad, .goal-bar i.bad { background: var(--bad); }
.lv { display: inline-block; width: fit-content; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.lv-cao { background: var(--bad-soft); color: var(--bad); }
.lv-vua { background: var(--warn-soft); color: var(--warn); }
.grade { font-size: 18px; font-weight: 700; }
.grade.good { color: var(--good); } .grade.warn { color: var(--warn); } .grade.bad { color: var(--bad); }
.ring { flex: none; display: block; }
.ring .ring-n { font-size: 27px; font-weight: 700; fill: var(--ink); }
.ring .ring-of { font-size: 11px; fill: var(--ink-3); }
.area-bars { display: grid; gap: 9px; margin-top: 14px; }
.ab-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 4px; }
.ab-top b { color: var(--ink); } .ab-top small { color: var(--ink-3); font-weight: 400; }

/* Trang chủ */
.home-cards { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.hc { padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.hc-lbl { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.hc .big { font-size: 30px; font-weight: 700; letter-spacing: -.015em; line-height: 1.15; }
.hc .big.muted { color: var(--ink-3); }
.spark-8 { margin-top: 8px; }
.spark-cap { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.hc .more-link { margin-top: auto; padding-top: 10px; }
.health-row { display: flex; align-items: center; gap: 16px; }
.need { font-weight: 600; margin: 6px 0 0; }
.hc-tip { background: var(--tip-bg); border-color: transparent; color: #fff; }
.hc-tip .hc-lbl { color: rgba(255, 255, 255, .85); }
.hc-tip h2 { font-size: 19px; line-height: 1.3; text-wrap: balance; }
.hc-tip p { margin: 0; color: rgba(255, 255, 255, .92); font-size: 13.5px; }
.btn.on-accent { margin-top: auto; align-self: flex-start; background: #fff; color: #1d5aa3; border-color: #fff; font-weight: 700; text-decoration: none; white-space: normal; text-align: left; }
.btn.on-accent:hover { background: #eef4fc; }
.goal { margin-top: 14px; }
.goal-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.goal-top b { color: var(--ink); }
.goal-bar { position: relative; height: 10px; background: var(--track); border-radius: 5px; }
.goal-bar .tmark { position: absolute; top: -5px; bottom: -5px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.tip-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tip-item { display: grid; align-content: start; gap: 7px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.tip-item:hover { border-color: var(--accent); }
.tip-item b { font-size: 14.5px; line-height: 1.35; }
.tip-item span:last-child { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 10px; }
.sc { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 500; }
.sc svg { width: 18px; height: 18px; color: var(--accent); }
.sc:hover { border-color: var(--accent); }
.cta { margin-top: 32px; display: flex; align-items: center; gap: 20px 28px; padding: 24px 26px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.cta-text { flex: 1 1 auto; }
.cta h2 { font-size: 17px; text-wrap: balance; }
.cta p { margin: 6px 0 0; color: var(--ink-2); max-width: 760px; }
.cta .btn { flex: none; padding: 10px 18px; font-weight: 600; }

/* Cải thiện hiệu suất */
.score-head { display: flex; align-items: center; gap: 28px; padding: 22px 24px; }
.sh-main { flex: 1 1 auto; min-width: 0; }
.sh-main .area-bars { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.bm-note { margin: 12px 0 0; font-size: 12px; color: var(--ink-3); }
.filters { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 20px 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; color: var(--ink-2); }
.chip small { color: var(--ink-3); margin-left: 2px; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.rule-group { margin-top: 22px; }
.grp-title { font-size: 15px; margin-bottom: 10px; }
.grp-title small { font-weight: 400; color: var(--ink-3); font-size: 12.5px; margin-left: 4px; }
details.rule { padding: 0; margin-bottom: 10px; scroll-margin-top: calc(var(--appbar-h) + 16px); }
details.rule > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 15px 18px; }
details.rule > summary::-webkit-details-marker { display: none; }
details.rule > summary::after { content: ''; flex: none; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform .15s; }
details.rule[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.rule[open] > summary { border-bottom: 1px solid var(--line); }
details.rule .rt { flex: 1 1 auto; font-weight: 600; font-size: 15px; line-height: 1.35; }
details.rule .pen { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.rule-body { padding: 6px 20px 18px; max-width: 900px; }
.rule-body h3 { font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin: 14px 0 4px; letter-spacing: .01em; }
.rule-body p { margin: 0; line-height: 1.6; }
.rule-body ol { margin: 0; padding-left: 20px; line-height: 1.6; }
.rule-body li { margin: 3px 0; }
.consult-btn { margin-top: 16px; display: inline-flex; align-items: center; gap: 7px; color: var(--accent); border-color: var(--accent); font-weight: 600; }
.congrats ul { margin: 6px 0 0; padding-left: 20px; }
.congrats p { margin: 8px 0 0; }
.empty-card p { margin: 6px 0 0; color: var(--ink-2); }

/* Chẩn đoán kênh */
.lead-line { color: var(--ink-2); max-width: 900px; margin: 0; }
.disclaim { display: inline-block; margin: 10px 0 0; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); padding: 7px 12px; border-radius: 8px; }
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 18px; }
.page-card { padding: 18px 20px; }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.pc-name { min-width: 0; }
.pc-name h2 { font-size: 15.5px; overflow-wrap: anywhere; }
.pc-score { font-size: 28px; font-weight: 700; line-height: 1; white-space: nowrap; }
.pc-score small { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.pc-score.good { color: var(--good); } .pc-score.warn { color: var(--warn); } .pc-score.bad { color: var(--bad); } .pc-score.na { color: var(--ink-3); }
.pm { margin-top: 12px; }
.pm-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); margin-bottom: 5px; }
.pm-top b { color: var(--ink); white-space: nowrap; }
.pm-ref { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.pm.off .pm-top span:first-child { color: var(--ink-3); }
.pm-note { font-size: 12px; color: var(--ink-3); margin: 10px 0 0; }
.pc-notes { margin: 12px 0 0; padding: 10px 0 0 18px; border-top: 1px solid var(--line); font-size: 13px; }
.pc-notes li { margin: 2px 0; }
.pc-notes a { color: var(--accent); text-decoration: none; }
.pc-notes a:hover { text-decoration: underline; }
.others { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.oth { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: grid; gap: 2px; }
.oth-v { font-size: 20px; font-weight: 700; }
.center-cta { text-align: center; margin: 32px 0 8px; }
.center-cta .btn { white-space: normal; padding: 11px 20px; font-weight: 600; }

/* Về ChiPan */
.about-hero { max-width: 860px; padding-top: 22px; }
.about-hero .logo-lg { height: 64px; width: auto; }
.about-hero .page-title { margin-top: 18px; }
.about-intro p { font-size: 15px; line-height: 1.7; color: var(--ink-2); margin: 0 0 10px; }
.svc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.svc { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px; }
.svc-head { display: grid; gap: 8px; }
.svc h2 { font-size: 16.5px; line-height: 1.35; }
.svc p { margin: 0; color: var(--ink-2); line-height: 1.6; }
.svc .btn { margin-top: auto; align-self: flex-start; white-space: normal; }
.badge-soft { width: fit-content; font-size: 11.5px; font-weight: 600; background: var(--warn-soft); color: var(--warn); padding: 2px 9px; border-radius: 999px; }
.contact { margin-top: 16px; }
.contact h2 { font-size: 16px; }
.contact ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; }
.contact p { margin: 6px 0 0; }
.contact a { color: var(--accent); }

/* hộp tư vấn */
.lead-dlg textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px 12px; font: inherit; font-size: 16px; background: var(--surface); color: var(--ink); resize: vertical; }
.lead-dlg input[readonly] { background: var(--surface-2); color: var(--ink-2); }

@media (max-width: 1080px) {
  .home-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .hc-tip { grid-column: 1 / -1; }
  .tip-list { grid-template-columns: minmax(0, 1fr); }
  .svc-grid { grid-template-columns: minmax(0, 1fr); }
}

/* điện thoại và máy tính bảng dọc: thanh dưới, nút tài khoản góc trên */
@media (max-width: 760px) {
  :root { --appbar-h: 54px; }
  body.shell, body.shell.side-pinned { padding-left: 0; padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
  .side { display: none; }
  .acct-top { display: inline-flex; padding: 7px; }
  .acct-top svg { width: 20px; height: 20px; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--surface); border-top: 1px solid var(--line); }
  .bn-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 60px; color: var(--ink-3); text-decoration: none; font-size: 11px; font-weight: 500; min-width: 0; }
  .bn-item .lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
  .bn-item svg { width: 22px; height: 22px; }
  .bn-item[aria-current="page"] { color: var(--accent); font-weight: 700; }
  .bn-item[aria-current="page"] svg { background: var(--accent-soft); border-radius: 12px; padding: 2px 12px; width: 46px; box-sizing: border-box; height: 26px; }
  .appbar { padding: 0 12px; gap: 8px; }
  .brandline { gap: 8px; padding: 4px 6px; margin-left: -6px; }
  .brandline .logo { display: none !important; }
  .brandline .logo-icon { display: block; }
  .brandtext { border-left: 0; padding-left: 0; }
  .brandtext .product { font-size: 13.5px; letter-spacing: -.01em; }
  .brandtext .clinic { font-size: 12px; }
  .refresh-box { gap: 6px; }
  .refresh-btn { padding: 7px; }
  .refresh-btn .lbl { display: none; }
  .last-upd { font-size: 10.5px; line-height: 1.25; white-space: normal; max-width: 38px; text-align: right; }
  .hide-xs { display: none; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .acct-menu[data-from="top"] { right: 8px; left: 8px; min-width: 0; }
  .home-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .hc { padding: 16px 18px; }
  .hc .big { font-size: 26px; }
  .page-title { font-size: 19px; margin: 16px 0 12px; }
  .score-head { flex-direction: column; align-items: flex-start; gap: 14px; padding: 18px; }
  .sh-main .area-bars { grid-template-columns: minmax(0, 1fr); }
  .cta { flex-direction: column; align-items: flex-start; padding: 18px; }
  .page-grid { grid-template-columns: minmax(0, 1fr); }
  details.rule > summary { padding: 13px 14px; gap: 8px; flex-wrap: wrap; }
  details.rule .rt { flex-basis: calc(100% - 30px); order: 2; font-size: 14.5px; }
  details.rule > summary::after { order: 3; }
  .rule-body { padding: 4px 14px 16px; }
  .refresh-err .re-acts { margin-left: 0; }
  .about-hero .logo-lg { height: 52px; }
}

/* trang Chính sách bảo mật, Điều khoản: logo về trang chủ webapp */
.page-brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; cursor: pointer; border-radius: 10px; padding: 4px 8px; margin: 0 0 10px -8px; }
.page-brand .logo { height: 30px; width: auto; }
.page-brand-name { font-weight: 700; font-size: 15px; border-left: 1px solid var(--line); padding-left: 12px; }
.page-brand:hover .page-brand-name { color: var(--accent); }
/* nút lên đầu trang */
.to-top { position: fixed; z-index: 40; right: 20px; bottom: 24px; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 6px 18px rgba(0, 0, 0, .16); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.to-top[hidden] { display: none; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }
.to-top:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 760px) { .to-top { right: 14px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); width: 42px; height: 42px; } }
@media print { .to-top { display: none !important; } }
.page-brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- dashboard Nha khoa 3C (src/web/c3view.js) ---------- */
.c3-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 6px; }
.c3-vs { font-size: 13px; color: var(--ink-3); }
/* thanh chọn kỳ + hàng tab: dính dưới thanh trên cùng khi cuộn */
.c3-sticky { position: sticky; top: var(--appbar-h); z-index: 20; background: var(--bg); margin: 0 -4px; padding: 6px 4px 0; }
.c3-sticky .c3-bar { margin: 0 0 2px; }
.c3-sticky .tabs { margin-top: 4px; }
.c3-sticky + .banner { margin-top: 10px; }
/* tab ngắn vẫn đủ chỗ để đưa đầu nội dung lên ngay dưới khối tab khi đổi tab lúc đang cuộn */
.c3-content { min-height: calc(100vh - var(--appbar-h) - 120px); }
.c3-vs b { color: var(--ink-2); font-weight: 600; }
.mode-3c .view .page-title { margin-bottom: 10px; }
.c3-content .sec:first-child { margin-top: 14px; }
.c3-link { text-decoration: none; color: var(--accent); font-weight: 700; margin-left: 4px; }
.tbl tr.dim td { color: var(--ink-3); }
.tbl .neg { color: var(--bad); }
.big-sm { font-size: 26px; font-weight: 700; }
.big-sm small { font-size: 13px; font-weight: 400; color: var(--ink-3); }
.card .bar { margin: 8px 0; }
.c3-todo-sum { list-style: none; margin: 6px 0 10px; padding: 0; display: grid; gap: 6px; }
.c3-todo-sum li { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; border-bottom: 1px dashed var(--line); padding-bottom: 5px; }
.c3-todo-card .more-link { display: inline-block; }
.c3-todo-tbl td, .c3-todo-tbl th { white-space: normal; vertical-align: top; text-align: left; }
.c3-todo-tbl td:first-child { min-width: 150px; }
.c3-todo-tbl .badge { white-space: normal; display: inline-block; }
.c3-slots { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 8px; }
.c3-slot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.c3-slot-l { font-size: 12.5px; color: var(--ink-3); grid-column: 1; }
.c3-slot-v { grid-column: 1; overflow-wrap: anywhere; }
.c3-slot .btn { grid-column: 2; grid-row: 1 / span 2; }
.prob { white-space: normal; }
@media (max-width: 760px) {
  .c3-bar .ctl-period { flex: 1 1 150px; }
  .c3-vs { flex-basis: 100%; }
  /* khối dính trên điện thoại: Tuần/Tháng + kỳ + PDF một dòng, "so với" dòng nhỏ bên dưới */
  .c3-sticky .c3-bar { gap: 6px 8px; }
  .c3-sticky .ctl-period { flex: 1 1 0; min-width: 0; }
  .c3-sticky .c3-vs { order: 3; font-size: 12px; margin-top: -2px; }
  .c3-sticky .c3-pdf { padding-left: 12px; padding-right: 12px; }
  /* danh sách việc: mỗi dòng thành một thẻ */
  .c3-todo .tbl-wrap { overflow: visible; }
  .c3-todo-tbl thead { display: none; }
  .c3-todo-tbl, .c3-todo-tbl tbody, .c3-todo-tbl tr, .c3-todo-tbl td { display: block; width: 100%; }
  .c3-todo-tbl tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .c3-todo-tbl td { padding: 2px 0 !important; border: 0 !important; position: static !important; background: none !important; }
  .c3-todo-tbl td:first-child { min-width: 0; }
  .c3-todo-tbl td:last-child::before { content: 'Dòng '; color: var(--ink-3); }
  .c3-todo-tbl td .c1 { max-width: none !important; white-space: normal; }
}
.c3-idle { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.7; }

/* tab Facebook của dashboard 3C */
.fb-intro { display: grid; gap: 8px; max-width: 820px; margin-top: 14px; }
.fb-intro p { margin: 0; color: var(--ink-2); line-height: 1.6; }
.fb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; }
.fb-head .mini { margin-right: auto; }
.fb-cmp { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); }
.fb-miss { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }
.fb-miss ul { margin: 6px 0 0; padding-left: 18px; }
.fb-pick { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; cursor: pointer; }
.fb-more { margin-top: 12px; }
.fb-more summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }

/* ---------- 3C: sức khoẻ vận hành, bảng chỉ số so với mốc, xu hướng trong đề xuất (src/web/c3view.js + src/core/c3rules.js) ---------- */
.c3-health { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
.c3-health .tip-list { grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 6px 0 10px; }
.c3-health .tip-item { box-shadow: none; padding: 10px 14px; }
.mtable th, .mtable td { text-align: center; }
.mtable td.l, .mtable th.l { text-align: left; min-width: 190px; }
.mtable td { padding: 3px 3px; }
.mtable td.l { padding: 6px 10px; }
.mtable th .hi { color: var(--ink); font-weight: 800; border-bottom: 2px solid var(--accent); }
.mt { display: block; border-radius: 6px; padding: 7px 4px; font-weight: 700; min-width: 50px; font-variant-numeric: tabular-nums; }
.mt-good { background: var(--h6-bg); color: var(--h6-fg); }
.mt-warn { background: var(--h3-bg); color: var(--h3-fg); }
.mt-bad { background: var(--h0-bg); color: var(--h0-fg); }
.mt-nil { color: var(--ink-3); font-weight: 400; }
.sw.mt-nil { background: var(--track); }
.mt.sel { box-shadow: inset 0 0 0 2px currentColor; }
.mt-nil.sel { box-shadow: none; }
.mt-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin: 2px 0 4px; }
.rule-body > .card { margin: 10px 0 16px; box-shadow: none; border: 1px solid var(--line); }
@media (max-width: 760px) {
  .c3-health { grid-template-columns: minmax(0, 1fr); }
  .mtable td.l, .mtable th.l { min-width: 140px; }
}

/* ---------- link xem không cần đăng nhập (web.js viewerFlow) ---------- */
.share-gate { max-width: 520px; margin: 24px auto; }
.share-gate .share-row { display: flex; gap: 8px; margin-top: 6px; }
.share-gate input { flex: 1 1 auto; min-width: 0; border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; font: inherit; background: var(--surface); color: var(--ink); }
body.viewer #acct-side, body.viewer #acct-top, body.viewer [data-consult], body.viewer .cta, body.viewer .bm-cta { display: none !important; }
body.viewer.no-data #refresh-box { display: none !important; }

/* ==========================================================================
   Bộ nền chung — quy chuẩn giao diện đồng bộ dental.chipan.vn (bản 1.0, 17/11/2026), Phần C.
   Chép nguyên khối từ quy chuẩn; mọi trang (webapp, quản trị, chính sách, điều khoản) đều nạp qua assets/app.css.
   Các trang chỉ gắn class bm-*, không viết lại style.
   ========================================================================== */
/* BO NEN CHUNG */
:root{
  --brand-red-deep:#7A0807; --brand-red:#A70B0A; --brand-orange:#E0452B;
  --brand-purple:#7B3FE4; --brand-magenta:#C13584;
  --ink:#1D1D1F; --ink-2:#424245; --ink-3:#6E6E73; --line:#ECECF0; --bg-soft:#F7F7FA;
}
body{font-family:'Be Vietnam Pro',system-ui,sans-serif;color:var(--ink);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
.bm-top{background:radial-gradient(900px 380px at 15% -10%,#FDE7E7 0,rgba(253,231,231,0) 70%),radial-gradient(800px 360px at 95% 0%,#ECE6FD 0,rgba(236,230,253,0) 65%),#FFFFFF;border-bottom:1px solid #EFEFF2}
.bm-soft{background:var(--bg-soft)}
.bm-w{width:100%;max-width:1160px;margin:0 auto;padding-left:32px;padding-right:32px;box-sizing:border-box}
.bm-sec{padding-top:44px;padding-bottom:44px;display:flex;flex-direction:column;gap:22px}
.bm-chip{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;padding:6px 12px;border-radius:999px;background:#FFFFFF;color:#A70B0A;box-shadow:0 0 0 1px #F3D3D3;text-decoration:none}
.bm-chip svg{width:16px;height:16px}
.bm-h1{margin:0;font-size:clamp(30px,4.4vw,48px);line-height:1.1;font-weight:800;letter-spacing:-1.6px;text-wrap:balance}
.bm-hl{background:linear-gradient(90deg,#A70B0A 0%,#E0452B 55%,#7B3FE4 100%);-webkit-background-clip:text;background-clip:text;color:transparent}
.bm-lead{margin:0;font-size:clamp(16px,1.7vw,18px);line-height:1.65;color:var(--ink-2);text-wrap:pretty}
.bm-lead b{color:var(--ink)}
.bm-kick{font-size:13px;font-weight:800;letter-spacing:1px;text-transform:uppercase;color:var(--c,#A70B0A)}
.bm-h2{margin:0;font-size:clamp(23px,2.6vw,32px);font-weight:800;letter-spacing:-.8px;line-height:1.2;text-wrap:balance}
.bm-sub{margin:0;font-size:16px;line-height:1.65;color:var(--ink-2);text-wrap:pretty}
.bm-head{display:flex;flex-direction:column;align-items:center;text-align:center;gap:8px}
.bm-card{background:#FFFFFF;border:1px solid var(--line);border-radius:18px;box-shadow:0 6px 18px rgba(17,17,26,.04);transition:transform .18s ease,box-shadow .18s ease,border-color .18s ease}
a.bm-card{text-decoration:none;color:inherit}
a.bm-card:hover{transform:translateY(-3px);box-shadow:0 18px 40px rgba(17,17,26,.08);border-color:#E2E2E8}
.bm-card.bm-on{border:2px solid var(--c,#A70B0A);box-shadow:0 18px 44px color-mix(in srgb,var(--c,#A70B0A) 22%,transparent)}
.bm-ic{width:40px;height:40px;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;background:color-mix(in srgb,var(--c,#A70B0A) 11%,#FFFFFF);color:var(--c,#A70B0A)}
.bm-ic.bm-solid{background:var(--c,#A70B0A);color:#FFFFFF}
.bm-ic svg,.bm-svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.bm-btn,.bm-btn2{font:inherit;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 24px;border-radius:999px;font-size:15.5px;font-weight:700;text-decoration:none;cursor:pointer;white-space:nowrap;box-sizing:border-box;transition:transform .15s ease,box-shadow .15s ease,background .15s ease}
.bm-btn{background:linear-gradient(90deg,#A70B0A,#E0452B);color:#FFFFFF;border:0;box-shadow:0 8px 20px rgba(167,11,10,.28)}
.bm-btn:hover{transform:translateY(-1px);box-shadow:0 12px 26px rgba(167,11,10,.34)}
.bm-btn2{background:#FFFFFF;color:var(--c,#1D1D1F);border:1.5px solid color-mix(in srgb,var(--c,#1D1D1F) 30%,#FFFFFF)}
.bm-btn2:hover{background:color-mix(in srgb,var(--c,#1D1D1F) 6%,#FFFFFF)}
.bm-cta{border-radius:22px;padding:clamp(24px,3.4vw,40px);display:flex;flex-wrap:wrap;gap:18px;align-items:center;justify-content:space-between;color:#FFFFFF;background:radial-gradient(600px 260px at 100% 0%,rgba(255,255,255,.18),rgba(255,255,255,0) 60%),linear-gradient(110deg,#7A0807 0%,#A70B0A 45%,#E0452B 100%)}
.bm-cta > *{min-width:0;max-width:100%}
.bm-cta span{overflow-wrap:anywhere}
.bm-cta .bm-btn2{--c:#A70B0A;border-color:#FFFFFF;white-space:normal;text-align:center}
.bm-cta .bm-ghost{background:transparent;color:#FFFFFF;border:1.5px solid rgba(255,255,255,.7)}
.bm-cta .bm-ghost:hover{background:rgba(255,255,255,.12)}
.bm-ribbon{position:absolute;top:-15px;left:50%;transform:translateX(-50%);display:inline-flex;align-items:center;gap:6px;white-space:nowrap;font-size:12.5px;font-weight:800;letter-spacing:.4px;text-transform:uppercase;color:#FFFFFF;padding:7px 14px;border-radius:999px;background:linear-gradient(90deg,#A70B0A,#E0452B);box-shadow:0 6px 16px rgba(167,11,10,.3)}
.bm-tag{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:800;letter-spacing:.3px;padding:4px 10px;border-radius:999px;background:color-mix(in srgb,var(--c,#A70B0A) 10%,#FFFFFF);color:var(--c,#A70B0A)}
.bm-trust{display:flex;flex-wrap:wrap;gap:8px 20px}
.bm-trust span{display:inline-flex;align-items:center;gap:8px;font-size:14.5px;font-weight:600}
.bm-trust em{width:28px;height:28px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--c) 11%,#FFFFFF);color:var(--c)}
.bm-trust em svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.bm-faq details{background:#FFFFFF;border:1px solid var(--line);border-radius:14px;padding:16px 18px;margin-bottom:10px}
.bm-faq summary{cursor:pointer;font-size:16px;font-weight:700;line-height:1.5;list-style:none;display:flex;justify-content:space-between;align-items:center;gap:16px}
.bm-faq summary::-webkit-details-marker{display:none}
.bm-faq summary::after{content:'+';font-size:20px;line-height:1;color:#A70B0A;flex-shrink:0;width:28px;height:28px;border-radius:999px;background:#FCF1F1;display:inline-flex;align-items:center;justify-content:center}
.bm-faq details[open] summary::after{content:'-'}
.bm-faq p{margin:10px 0 0;font-size:15.5px;line-height:1.75;color:#3A3A3C}
.bm-pill{font:inherit;font-size:14px;font-weight:700;min-height:38px;padding:0 16px;border-radius:999px;cursor:pointer;background:#FFFFFF;color:var(--ink);border:1px solid #E2E2E8}
.bm-pill.on,.bm-pill[aria-pressed="true"]{background:linear-gradient(90deg,#A70B0A,#E0452B);color:#FFFFFF;border-color:transparent;box-shadow:0 6px 16px rgba(167,11,10,.25)}
@keyframes bmUp{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:none}}
.bm-fade{animation:bmUp .6s cubic-bezier(.2,.7,.2,1) both}
.bm-fade.d1{animation-delay:.06s}.bm-fade.d2{animation-delay:.12s}.bm-fade.d3{animation-delay:.18s}
@supports (animation-timeline: view()){.bm-rv{animation:bmUp linear both;animation-timeline:view();animation-range:entry 0% entry 35%}}
@media (prefers-reduced-motion: reduce){.bm-fade,.bm-rv{animation:none !important}a.bm-card:hover,.bm-btn:hover{transform:none}}
@media (max-width:600px){.bm-w{padding-left:18px;padding-right:18px}.bm-sec{padding-top:32px;padding-bottom:32px}}

/* ==========================================================================
   Áp quy chuẩn cho webapp (không thuộc Bộ nền chung): đổi biến màu và kiểu nút/thẻ hiện có sang chuẩn,
   giữ giao diện tối và bảng màu biểu đồ (màu biểu đồ gắn với ý nghĩa nguồn khách / kênh, không đổi).
   ========================================================================== */
:root {
  --accent: #A70B0A; --accent-soft: #FCF1F1;
  --bg: #F7F7FA; --radius: 18px;
  --shadow: 0 6px 18px rgba(17, 17, 26, .04);
  --bm-grad: linear-gradient(90deg, #A70B0A, #E0452B);
  --bm-block: radial-gradient(600px 260px at 100% 0%, rgba(255,255,255,.18), rgba(255,255,255,0) 60%), linear-gradient(110deg, #7A0807 0%, #A70B0A 45%, #E0452B 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --accent: #FF8A73; --accent-soft: #3A1D1B; --shadow: none; }
}
:root[data-theme="dark"] { --accent: #FF8A73; --accent-soft: #3A1D1B; --shadow: none; }

/* nút: tròn hai đầu; nút chính tô gradient, nhấc 1px khi rê chuột */
.btn { border-radius: 999px; padding: 7px 14px; font-weight: 600; transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease; }
.btn.primary, a.btn.primary { background: var(--bm-grad); border-color: transparent; color: #fff; box-shadow: 0 8px 20px rgba(167, 11, 10, .28); }
.btn.primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(167, 11, 10, .34); border-color: transparent; }
.btn-icon { padding: 7px 10px; }
.seg { border-radius: 999px; }
.seg button { border-radius: 999px; }
.ctl-select { border-radius: 10px; }
/* thẻ */
.tile { border-radius: 14px; box-shadow: var(--shadow); }
.tip-item, .oth, .sc { border-radius: 16px; }
.lead-dlg { border-radius: 18px; }
.lead-dlg input, .lead-dlg textarea { border-radius: 10px; min-height: 44px; }

/* thẻ "Đề xuất ưu tiên số 1" và khối kêu gọi: gradient khối của quy chuẩn */
/* thẻ 'Đề xuất ưu tiên số 1' = thẻ nổi bật (D3): nền thẻ, viền 2px màu nhóm; khối gradient chỉ dành cho khối kêu gọi cuối trang */
.hc-tip { --c: #A70B0A; background: var(--surface); color: var(--ink); border: 2px solid var(--c); border-radius: 20px; box-shadow: 0 18px 44px color-mix(in srgb, var(--c) 22%, transparent); }
.hc-tip .hc-lbl { color: var(--c); font-size: 13px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.hc-tip h2 { color: var(--ink); font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
.hc-tip p { color: var(--ink-2); }
.btn.on-accent { background: var(--bm-grad); color: #fff; border: 0; border-radius: 999px; box-shadow: 0 8px 20px rgba(167, 11, 10, .28); padding: 10px 18px; }
.btn.on-accent:hover { background: var(--bm-grad); transform: translateY(-1px); box-shadow: 0 12px 26px rgba(167, 11, 10, .34); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .hc-tip { --c: #FF8A73; box-shadow: none; } }
:root[data-theme='dark'] .hc-tip { --c: #FF8A73; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .btn.primary:hover, .btn.on-accent:hover { transform: none; } }
.cta.bm-cta { margin-top: 32px; border: 0; }
.bm-cta .cta-title { margin: 0; font-size: clamp(21px, 2.2vw, 28px); font-weight: 800; letter-spacing: -.5px; line-height: 1.25; text-wrap: balance; color: #fff; }
.bm-cta .cta-text p { margin: 8px 0 0; color: rgba(255, 255, 255, .9); max-width: 760px; text-wrap: pretty; }
.bm-cta .bm-btn2 { color: #A70B0A; }

/* phần đầu trang chủ (D1 gọn): nền gradient nhạt tràn hết khung nội dung */
.home-top { margin: 0 -20px 4px; padding: 32px 20px 26px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.home-top .bm-h1 { font-size: clamp(30px, 3.6vw, 44px); }
.home-top .bm-lead { max-width: 760px; }
.home-top .acts { display: flex; flex-wrap: wrap; gap: 10px; }
.mode-3c .home-top { margin-bottom: 8px; }

/* lối tắt: thẻ trắng có ô icon màu riêng của từng nhóm */
.bm-shortcuts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.bm-sc { display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-weight: 700; font-size: 15px; }
.bm-sc .bm-ic svg { width: 20px; height: 20px; }
.bm-sc .go { margin-left: auto; color: var(--ink-3); font-weight: 600; }
.block-head h2, .sec-label { letter-spacing: -.2px; }
.block-head h2 { font-size: 20px; font-weight: 800; }
@media (max-width: 980px) { .bm-shortcuts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .bm-shortcuts { grid-template-columns: minmax(0, 1fr); }
  .home-top { margin: 0 -12px 4px; padding: 22px 12px 20px; }
  .home-top .acts .bm-btn, .home-top .acts .bm-btn2 { flex: 1 1 auto; }
}

/* giao diện tối: các thành phần bm-* dùng nền tối tương ứng (quy chuẩn chỉ có bản sáng) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .bm-top { background: radial-gradient(900px 380px at 15% -10%, rgba(167, 11, 10, .30) 0, rgba(167, 11, 10, 0) 70%), radial-gradient(800px 360px at 95% 0%, rgba(123, 63, 228, .22) 0, rgba(123, 63, 228, 0) 65%), var(--bg); border-bottom-color: var(--line); }
  :root:not([data-theme="light"]) .bm-chip { background: var(--surface); color: #FF8A73; box-shadow: 0 0 0 1px rgba(255, 138, 115, .35); }
  :root:not([data-theme="light"]) .bm-hl { background-image: linear-gradient(90deg, #FF6B5E 0%, #FF9A5B 55%, #B69CFF 100%); }
  :root:not([data-theme="light"]) .bm-card { background: var(--surface); border-color: var(--line); box-shadow: none; }
  :root:not([data-theme="light"]) .bm-btn2 { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
  :root:not([data-theme="light"]) .bm-ic { background: color-mix(in srgb, var(--c, #A70B0A) 22%, var(--surface)); color: color-mix(in srgb, var(--c, #A70B0A) 55%, #fff); }
  :root:not([data-theme="light"]) .bm-cta .bm-btn2 { background: #fff; color: #A70B0A; border-color: #fff; }
}
:root[data-theme="dark"] .bm-top { background: radial-gradient(900px 380px at 15% -10%, rgba(167, 11, 10, .30) 0, rgba(167, 11, 10, 0) 70%), radial-gradient(800px 360px at 95% 0%, rgba(123, 63, 228, .22) 0, rgba(123, 63, 228, 0) 65%), var(--bg); border-bottom-color: var(--line); }
:root[data-theme="dark"] .bm-chip { background: var(--surface); color: #FF8A73; box-shadow: 0 0 0 1px rgba(255, 138, 115, .35); }
:root[data-theme="dark"] .bm-hl { background-image: linear-gradient(90deg, #FF6B5E 0%, #FF9A5B 55%, #B69CFF 100%); }
:root[data-theme="dark"] .bm-card { background: var(--surface); border-color: var(--line); box-shadow: none; }
:root[data-theme="dark"] .bm-btn2 { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
:root[data-theme="dark"] .bm-ic { background: color-mix(in srgb, var(--c, #A70B0A) 22%, var(--surface)); color: color-mix(in srgb, var(--c, #A70B0A) 55%, #fff); }
:root[data-theme="dark"] .bm-cta .bm-btn2 { background: #fff; color: #A70B0A; border-color: #fff; }

/* nhóm 1 — các mục của webapp: phần đầu D1 dùng chung .home-top; trang Về ChiPan giữ logo trong phần đầu */
.about-top .logo-lg { height: 64px; width: auto; }
.about-top .about-intro p { font-size: inherit; line-height: inherit; color: inherit; margin: 0 0 8px; }
#report-top .home-top { margin-bottom: 0; }
#view-report .status { padding-top: 14px; }
.svc .bm-btn, .svc .bm-btn2 { margin-top: auto; align-self: flex-start; white-space: normal; text-align: left; }
@media (max-width: 600px) { .about-top .logo-lg { height: 52px; } }
/* chip lọc (Cải thiện hiệu suất, Việc cần xử lý) theo .bm-pill: đang chọn tô gradient */
.chip { border-radius: 999px; font-weight: 700; min-height: 34px; }
.chip[aria-pressed="true"] { background: var(--bm-grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(167, 11, 10, .25); }
.chip[aria-pressed="true"] small { color: rgba(255, 255, 255, .85); }

/* nhóm 2 — Chính sách, Điều khoản: phần đầu D1 nền sáng (đường dẫn, chip, H1), nội dung pháp lý giữ nguyên */
.legal-top { padding-top: 20px; padding-bottom: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.legal-top .page-brand { margin: 0 0 6px -8px; }
.bm-crumb { font-size: 14px; color: var(--ink-3); }
.bm-crumb a { color: var(--accent); text-decoration: none; }
.bm-crumb a:hover { text-decoration: underline; }
body.legal .doc { padding-top: 32px; padding-bottom: 44px; }
body.legal .prose { border-radius: 18px; padding: clamp(20px, 3vw, 36px); }
body.legal .prose p, body.legal .prose li { text-wrap: pretty; }
body.legal .site-foot { margin-top: 0; }
@media (max-width: 600px) { .legal-top { padding-top: 14px; padding-bottom: 22px; } body.legal .doc { padding-top: 24px; padding-bottom: 32px; } }

/* độ tương phản (Phần G): chữ trắng trên phần cam #E0452B của gradient chỉ dùng khi chữ từ 16px và đậm.
   Nút và chip cỡ nhỏ của dashboard (13–14px) dùng nền đỏ đặc #A70B0A; gradient giữ cho .bm-btn và khối kêu gọi. */
.btn.primary, a.btn.primary, .btn.on-accent, .chip[aria-pressed="true"], .chip.on { background: #A70B0A; }
.btn.primary:hover:not(:disabled), .btn.on-accent:hover { background: #8E0908; }
