/* =====================================================================
   KENDY HUYỀN HỌC – HỆ THỐNG BIẾN MÀU (DESIGN TOKENS)
   Mọi màu trong ứng dụng đều lấy từ các biến gốc dưới đây.
   Muốn đổi màu: chỉ sửa ở khối này, toàn bộ ứng dụng tự cập nhật.
   ===================================================================== */
/* Tông tối: nền xanh ngọc lục bảo pha xanh cổ vịt, khung xanh ngọc đậm, viền và tiêu đề vàng champagne, chữ trắng ngà. */
:root {
  /* I. Màu thương hiệu (tông tối: xanh ngọc lục bảo pha xanh cổ vịt) */
  --brand-primary: #075B55; /* Xanh ngọc lục bảo đậm – Deep Teal (thương hiệu) */
  --brand-deep: #04302D;    /* Xanh cổ vịt rất đậm – nền trang */
  --brand-cream: #F2E9D8;   /* Trắng ngà – chữ nội dung */
  --brand-gold: #C6A15B;    /* Vàng champagne – viền, tiêu đề, điểm nhấn */
  --brand-ink: #063F3B;     /* Mực xanh ngọc – chữ trên nền vàng/ngà (ô nhập, nút vàng) */

  /* II. Màu Ngũ Hành (gốc, giữ nguyên – dùng cho biểu đồ, thanh hành) */
  --element-wood: #269B57;  /* Mộc – xanh lá */
  --element-fire: #D94A45;  /* Hỏa – đỏ */
  --element-earth: #D5A43B; /* Thổ – vàng đất */
  --element-metal: #D5DCE5; /* Kim – trắng bạc */
  --element-water: #3989D6; /* Thủy – xanh dương */
  /* Chữ Ngũ Hành trên nền xanh đậm: pha sáng từ chính màu hành để đủ tương phản (≥ 4,5:1) */
  --el-wood-ink: color-mix(in srgb, var(--element-wood) 64%, #fff);
  --el-fire-ink: color-mix(in srgb, var(--element-fire) 60%, #fff);
  --el-earth-ink: var(--element-earth);
  --el-metal-ink: var(--element-metal);
  --el-water-ink: color-mix(in srgb, var(--element-water) 68%, #fff);

  /* --- Sắc độ dẫn xuất (pha từ biến gốc) --- */
  --bg: var(--brand-deep);                                                 /* nền trang */
  --surface: color-mix(in srgb, var(--brand-primary) 48%, var(--brand-deep)); /* nền khung nội dung */
  --surface-ink: color-mix(in srgb, var(--brand-primary) 22%, #021c1a);      /* nền bảng dữ liệu Can Chi */
  --head-bg: color-mix(in srgb, var(--brand-primary) 82%, #000);           /* thanh trên/dưới, tiêu đề khung, đầu bảng */
  --text: var(--brand-cream);
  --text-muted: color-mix(in srgb, var(--brand-cream) 74%, var(--brand-primary));
  --text-on-cream: var(--brand-ink);
  --gold-ink: color-mix(in srgb, var(--brand-gold) 88%, #fff);               /* chữ vàng champagne trên nền đậm */
  --line: color-mix(in srgb, var(--brand-gold) 72%, transparent);
  --line-soft: color-mix(in srgb, var(--brand-gold) 30%, transparent);
  --gold-soft: color-mix(in srgb, var(--brand-gold) 16%, transparent);
  --on-gold: color-mix(in srgb, var(--brand-ink) 70%, #000);
  --cream-soft: color-mix(in srgb, var(--brand-cream) 12%, transparent);
  --input-bg: color-mix(in srgb, var(--brand-cream) 92%, #fff);
  --shadow: 0 1px 3px rgba(0, 0, 0, .28);

  /* Màu trạng thái chức năng (đạt / không đạt) – pha với ngà để không lẫn với màu Ngũ Hành */
  --state-ok: color-mix(in srgb, var(--brand-cream) 50%, #2fbf71);
  --state-bad: color-mix(in srgb, var(--brand-cream) 42%, #e0524d);

  --nav-h: 56px;
  --serif: "Cormorant SC", "Times New Roman", serif;
}

/* ---------- Ngũ Hành: màu chữ và màu nền biểu đồ ---------- */
/* !important: màu Ngũ Hành luôn thắng màu thương hiệu của tiêu đề/bảng (không để champagne thay màu hành) */
.e-moc { color: var(--el-wood-ink) !important; } .e-hoa { color: var(--el-fire-ink) !important; } .e-tho { color: var(--el-earth-ink) !important; } .e-kim { color: var(--el-metal-ink) !important; } .e-thuy { color: var(--el-water-ink) !important; }
.bg-moc { background: var(--element-wood); } .bg-hoa { background: var(--element-fire); } .bg-tho { background: var(--element-earth); } .bg-kim { background: var(--element-metal); } .bg-thuy { background: var(--element-water); }
/* Thanh hành màu nhạt (Kim) cần viền mảnh để thấy trên nền sáng */
.bg-kim { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--el-metal-ink) 35%, transparent); }

/* ---------- Nền tảng ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
}
body.no-scroll { overflow: hidden; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold-ink); }
[hidden] { display: none !important; }
.accent { color: var(--gold-ink); }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
small { font-size: 11.5px; }
.pos { color: var(--state-ok); } .neg { color: var(--state-bad); }
.left { text-align: left !important; }
.req { color: var(--gold-ink); font-weight: 600; }
code { background: var(--surface-ink); border-radius: 3px; padding: 0 3px; font-size: 11.5px; }

/* ---------- Thanh trên ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px;
  padding: calc(6px + env(safe-area-inset-top)) 8px 6px; background: var(--head-bg); border-bottom: 1px solid var(--line);
}
.icon-btn { background: none; border: 0; color: var(--gold-ink); padding: 8px; border-radius: 10px; display: inline-flex; }
.icon-btn:active { background: var(--gold-soft); }
.brand { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--gold-ink); font-family: var(--serif); font-size: 20px; letter-spacing: 1px; white-space: nowrap; }
.brand > div { display: flex; flex-direction: column; align-items: center; line-height: 1.1; min-width: 0; }
.brand small { font-family: "Be Vietnam Pro", sans-serif; font-size: 10.5px; color: var(--text); letter-spacing: 0; max-width: 52vw; overflow: hidden; text-overflow: ellipsis; }
.lotus { width: 40px; height: 26px; color: var(--gold-ink); flex: none; }
.lotus.big { width: 72px; height: 46px; }

main { max-width: 1180px; margin: 0 auto; padding: 12px 12px 0; }

/* ---------- Khung (panel) ---------- */
.panel { position: relative; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin-bottom: 12px; }
.panel::before, .panel::after { content: ""; position: absolute; width: 12px; height: 12px; border: 2px solid var(--brand-gold); pointer-events: none; }
.panel::before { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }
.ptitle {
  margin: -12px -12px 10px; padding: 9px 8px; text-align: center; border-radius: 5px 5px 0 0;
  font-family: var(--serif); font-weight: 700; font-size: 16px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--gold-ink); background: var(--head-bg); border-bottom: 1px solid var(--line);
}
.ptitle span { color: var(--text); }
.sub-title { font-family: var(--serif); color: var(--gold-ink); font-size: 15px; margin: 14px 0 6px; letter-spacing: .4px; border-bottom: 1px solid var(--line-soft); padding-bottom: 3px; }
h4 { margin: 10px 0 4px; color: var(--gold-ink); font-size: 13px; }
.hint, .note { color: var(--text-muted); font-size: 12px; margin: 8px 2px 2px; }
/* Hộp thông tin: nền kem */
.info-box, .warn-box { border-radius: 6px; padding: 8px 10px; font-size: 12.5px; margin: 0 0 12px; background: var(--brand-cream); color: var(--text-on-cream); border-left: 4px solid var(--brand-gold); }
.warn-box { border-left-color: var(--state-bad); }
.info-box a, .warn-box a { color: var(--gold-ink); font-weight: 600; }
.info-box .mini, .warn-box .mini { color: var(--gold-ink); border-color: var(--line); }

/* ---------- Thông tin chủ nhân ---------- */
.hero { display: grid; grid-template-columns: 150px minmax(0, 1fr); padding: 0; overflow: hidden; }
.hero-logo { text-align: center; padding: 14px 8px; border-right: 1px solid var(--line); color: var(--gold-ink); background: var(--head-bg); }
.hero-name { font-family: var(--serif); font-size: 26px; letter-spacing: 2px; line-height: 1; margin-top: 4px; }
.hero-sub { font-family: var(--serif); font-size: 16px; letter-spacing: 2px; }
.hero-tags { color: var(--text); font-size: 10.5px; margin-top: 8px; text-transform: uppercase; letter-spacing: .3px; }
.hero-info { margin: 0; padding: 12px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; align-content: center; background: var(--surface-ink); }
.hero-info div { display: flex; flex-direction: column; min-width: 0; }
.hero-info dt { color: var(--gold-ink); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.hero-info dd { margin: 0; font-size: 16px; font-weight: 500; }

/* ---------- Bố cục ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
.grid > div { min-width: 0; }
@media (min-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
  .hero { grid-template-columns: 210px minmax(0, 1fr); }
  .hero-info { padding: 18px 24px; }
  .hero-info div { flex-direction: row; gap: 8px; align-items: baseline; }
  .hero-info dt { width: 110px; flex: none; }
}

/* ---------- Bảng: khung vàng champagne mảnh, nền mực để Can Chi rõ màu ---------- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; text-align: center; background: var(--surface-ink); }
.tbl th, .tbl td { border: 1px solid var(--line-soft); padding: 6px 5px; vertical-align: middle; }
.tbl thead th { color: var(--text); font-weight: 600; font-size: 12px; text-transform: uppercase; background: var(--head-bg); border-color: var(--line); }
.tbl tbody th { color: var(--gold-ink); font-weight: 500; font-size: 11px; text-transform: uppercase; text-align: left; }
.tutru td { min-width: 70px; cursor: pointer; }
.tutru .dm-col { background: var(--gold-soft); }
.big-num td { font-size: 17px; }
.glyph { font-family: var(--serif); font-size: 28px; font-weight: 700; letter-spacing: 1px; }
.glyph.xl { font-size: 34px; }
.stack { display: block; line-height: 1.6; }
.kv th { width: 30%; }
.kv td { text-align: left; }
.clickable { cursor: pointer; }
.clickable:hover, tr.clickable:hover td { background: var(--gold-soft); }
tr.absent th, tr.absent td { opacity: .55; }
.el-tbl td { font-size: 12.5px; }
.stars { letter-spacing: 1px; }
.el-bar { height: 6px; border-radius: 3px; margin: 4px auto 0; max-width: 80px; background: var(--cream-soft); overflow: hidden; }
.el-bar > i { display: block; height: 100%; }
.hx td { font-size: 12.5px; }

/* ---------- Cặp khóa/giá trị ---------- */
.lbl { display: block; color: var(--gold-ink); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; }
.kv2 { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line-soft); }
.kv2 > div { padding: 6px 8px 10px; min-width: 0; }
.kv2 > div + div { border-left: 1px solid var(--line-soft); }
.kv1 { padding: 8px; }
.kv1 p { margin: 3px 0; }
.kv2 b, .kv1 > b { font-size: 17px; font-weight: 600; display: block; }
.kv2 small { color: var(--text-muted); }
b.xl { font-size: 20px; display: block; }
.method-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.method-label b { color: var(--gold-ink); }
.dt-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 560px) { .dt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.dt-box { border: 1px solid var(--line-soft); border-radius: 6px; padding: 8px; min-width: 0; background: var(--surface-ink); }
.dt-box p { margin: 4px 0; }
.vs-box { margin-top: 10px; border: 1px dashed var(--line); border-radius: 6px; padding: 8px; }
.tag-ref { background: var(--gold-soft); color: var(--gold-ink); border-radius: 4px; padding: 1px 6px; font-size: 10px; margin-left: 4px; }
.tc3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); text-align: center; border-bottom: 1px solid var(--line-soft); padding-bottom: 8px; }
.tc3 > div + div { border-left: 1px solid var(--line-soft); }
.forces { text-align: left; }
.forces > div { padding: 0 8px; }
.forces ul { margin: 4px 0 0; padding-left: 16px; font-size: 12.5px; }
ul.plain { margin: 4px 0; padding-left: 18px; }
ul.plain li { margin: 3px 0; }
ul.plain li::marker { color: var(--gold-ink); }
.flow { text-align: center; font-family: var(--serif); color: var(--gold-ink); font-size: 15px; margin: 0 0 8px; letter-spacing: .5px; }

/* ---------- Kết luận có truy xuất ---------- */
.stmts { list-style: none; margin: 4px 0; padding: 0; }
.stmt { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.stmt:last-child { border-bottom: 0; }
.stmt-main { flex: 1; min-width: 0; }
/* Bảng dữ kiện cho người luận (Kendy 11/11/2026) */
.dk-bang { margin: 6px 0; }
.dk-muc { margin: 8px 0; }
.dk-ten { margin: 0 0 3px; font-size: 1em; color: var(--gold-ink); border-bottom: 1px solid var(--line-soft); padding-bottom: 2px; }
.dk-ds { margin: 0; padding-left: 18px; }
.dk-ds > li { margin: 2px 0; }
.dk-con { margin: 1px 0 3px; padding-left: 16px; font-size: 0.92em; color: var(--text-muted); }
/* Xem nhanh (Kendy 11/11/2026): Ý nghĩa · Căn cứ · Mức độ; chi tiết kỹ thuật nằm trong «Xem chi tiết» */
.stmt-y b, .stmt-cc b, .stmt-md b { color: var(--gold-ink); font-weight: 600; }
.stmt-cc, .stmt-md { font-size: 0.9em; color: var(--text-muted); margin-top: 2px; }
.stmt-meta { margin-top: 3px; font-size: 11.5px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.tone { font-style: normal; font-size: 11px; margin-top: 3px; flex: none; }
.tone.pos { color: var(--state-ok); } .tone.neg { color: var(--state-bad); } .tone.mid { color: var(--gold-ink); }
.cert { border-radius: 10px; padding: 0 7px; font-size: 10.5px; border: 1px solid; white-space: nowrap; }
.cert-cao { color: var(--text); border-color: var(--text); }
.cert-kha { color: var(--gold-ink); border-color: var(--line); }
.cert-tk { color: var(--text-muted); border-color: var(--line-soft); }
.rule-chip { background: var(--gold-soft); border: 1px solid var(--line-soft); color: var(--gold-ink); border-radius: 4px; padding: 0 5px; font-size: 10.5px; }
.vbadge { border-radius: 4px; padding: 0 6px; font-size: 10.5px; white-space: nowrap; border: 1px solid; }
.v-off { color: var(--on-gold); background: var(--brand-gold); border-color: var(--brand-gold); font-weight: 600; }
.v-ref { color: var(--gold-ink); border-color: var(--line); }
.v-hyp { color: var(--text-muted); border-color: var(--line-soft); border-style: dashed; font-style: italic; }
.v-data { color: var(--text-muted); border-color: var(--line-soft); }
.sbadge { border-radius: 10px; padding: 0 8px; font-size: 10.5px; border: 1px solid var(--line-soft); }
.s-confirmed { color: var(--state-ok); border-color: var(--state-ok); }
.s-draft { color: var(--gold-ink); }
.s-disabled { color: var(--text-muted); text-decoration: line-through; }
details.why { margin-top: 3px; font-size: 12px; }
details.why summary { cursor: pointer; color: var(--gold-ink); font-size: 11.5px; display: inline; }
details.why > div { margin: 4px 0 0 2px; }
ul.checks { list-style: none; padding-left: 4px; margin: 3px 0; font-size: 12px; }
ul.checks li { margin: 2px 0; }

/* ---------- Trạng thái dữ liệu / hiệu lực ---------- */
.confirm-bar { border-radius: 6px; padding: 8px 10px; font-size: 12.5px; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--surface); border: 1px solid var(--line-soft); }
.confirm-bar.ok { border-left: 4px solid var(--state-ok); }
.confirm-bar.warn { border-left: 4px solid var(--brand-gold); }
.confirm-bar.bad { border-left: 4px solid var(--state-bad); }
.valid-sum { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; line-height: 1.9; }

/* ---------- Tố công ---------- */
details.cong { border: 1px solid var(--line-soft); border-radius: 6px; margin: 6px 0; background: var(--surface-ink); }
details.cong summary { padding: 8px 10px; cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; list-style: none; }
details.cong summary::-webkit-details-marker { display: none; }
details.cong[open] summary { border-bottom: 1px solid var(--line-soft); }
.cong-n { background: var(--brand-gold); color: var(--on-gold); border-radius: 50%; width: 20px; height: 20px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; }
.cong-t { flex: 1 1 60%; min-width: 0; }
.cong-m { color: var(--text-muted); font-size: 11.5px; }
.cong-body { padding: 8px 10px; font-size: 13px; }
.cong-body p { margin: 5px 0; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.loss { margin-top: 10px; border-left: 3px solid var(--state-bad); padding-left: 8px; }
details.sub { margin-top: 8px; }
details.sub summary { cursor: pointer; color: var(--gold-ink); font-size: 12.5px; }

/* ---------- Đại vận ---------- */
.dv { font-size: 12px; }
.dv th, .dv td { min-width: 84px; }
.dv .gz { font-size: 15px; font-weight: 700; white-space: nowrap; }
.dv .cur, .years .cur { background: var(--gold-soft); box-shadow: inset 0 -2px 0 var(--brand-gold); }
.dv .sel { outline: 1px solid var(--brand-gold); outline-offset: -1px; }
.years td { font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { background: var(--surface-ink); border: 1px solid var(--line-soft); border-radius: 16px; padding: 4px 10px; font-size: 12px; color: var(--text); }
.chip.on { background: var(--brand-gold); color: var(--on-gold); border-color: var(--brand-gold); }
.chip:disabled { opacity: .5; }
.pd-head { display: flex; gap: 12px; align-items: center; margin: 6px 0 10px; }

/* ---------- Lưu niên ---------- */
.ln-grid { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); overflow-x: auto; border: 1px solid var(--line-soft); background: var(--surface-ink); }
.ln { padding: 10px 8px; text-align: center; border-right: 1px solid var(--line-soft); }
.ln:last-child { border-right: 0; }
.ln.cur { background: var(--gold-soft); outline: 1px solid var(--brand-gold); outline-offset: -1px; }
.ln.cur .ln-year { color: var(--gold-ink); font-weight: 700; }
.ln-year { font-size: 17px; }
.ln-gz { font-size: 18px; font-weight: 700; }
.ln-tt { margin-bottom: 6px; }
.ln-row { font-size: 12px; border-top: 1px solid var(--line-soft); padding: 5px 0; }
.ln-note { font-size: 11.5px; color: var(--text-muted); border-top: 1px solid var(--line-soft); padding-top: 6px; text-align: left; }
.year-pick { display: flex; gap: 8px; justify-content: center; align-items: center; }
.year-pick input { width: 110px; text-align: center; font-size: 18px; }
.year-nav { display: flex; justify-content: space-between; align-items: center; gap: 6px; }

/* ---------- Chân trang ---------- */
.footer-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
@media (min-width: 700px) { .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); } }
.legend h3 { margin: 0 0 8px; font-weight: 500; font-size: 13px; text-transform: uppercase; color: var(--gold-ink); }
.contact { display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; justify-content: space-around; }
.contact a { color: var(--text); text-decoration: none; font-size: 15px; }

/* ---------- Biểu mẫu và nút ---------- */
.gold, .ghost, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; border-radius: 8px; padding: 10px 16px; font-weight: 600; cursor: pointer; }
.gold { background: var(--brand-gold); color: var(--on-gold); border: 0; }
.ghost { background: none; border: 1px solid var(--line); color: var(--text); }
.gold.big { padding: 12px 26px; font-size: 16px; letter-spacing: 1px; }
.mini { background: none; border: 1px solid var(--line-soft); color: var(--gold-ink); border-radius: 6px; padding: 3px 8px; font-size: 12px; }
.mini-gold { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.danger { color: var(--state-bad) !important; border-color: var(--state-bad) !important; }
.link { background: none; border: 0; padding: 0; color: var(--gold-ink); text-align: left; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea { color: var(--text-on-cream); background: var(--input-bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; min-width: 0; }
select option { color: var(--text-on-cream); background: var(--input-bg); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--gold-ink); }
textarea { resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-gold); outline-offset: 1px; }
form label { display: grid; gap: 4px; font-size: 12px; color: var(--gold-ink); margin: 6px 0; }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; }
.row2, .row3 { display: grid; gap: 10px; }
.row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-inline { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.row-inline > select, .row-inline > input { flex: 1 1 120px; width: auto; min-width: 0; max-width: 100%; }
.seg { border: 0; padding: 0; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
.seg legend { font-size: 12px; color: var(--gold-ink); padding: 0; margin-bottom: 4px; float: left; width: 100%; }
.seg label { display: flex !important; align-items: center; gap: 6px; color: var(--text) !important; font-size: 14px !important; margin: 0; }
.tabs { display: flex; gap: 4px; margin: 10px 0; overflow-x: auto; }
.tabs button { flex: 1; white-space: nowrap; background: var(--surface-ink); border: 1px solid var(--line-soft); color: var(--text); border-radius: 8px; padding: 9px 10px; font-size: 12.5px; }
.tabs button.on { color: var(--on-gold); background: var(--brand-gold); border-color: var(--brand-gold); font-weight: 600; }
.pillar-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pillar-in { display: grid; gap: 6px; text-align: center; }
.pillar-in select { padding: 8px 4px; text-align: center; }
.file-drop { border: 1px dashed var(--line); border-radius: 8px; padding: 10px; }
#ocrPreview img { max-width: 100%; max-height: 260px; border-radius: 6px; margin: 6px 0; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 10px; }
.actions.wrap { justify-content: flex-start; }
.sticky-actions { position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--surface); padding: 8px 0; z-index: 2; }
.sheet .sticky-actions { bottom: -18px; border-top: 1px solid var(--line-soft); }
.search-row, .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.search-row input { flex: 1 1 220px; }
.filters > * { flex: 1 1 150px; }
.filters > label.check { flex: 0 0 auto; }

/* ---------- Hồ sơ ---------- */
.profiles { list-style: none; margin: 0; padding: 0; }
.prof { display: flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--line-soft); padding: 4px 0; }
.prof.cur { background: var(--gold-soft); }
.prof-main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 8px 4px; display: grid; gap: 2px; }
.prof-pillars { font-family: var(--serif); color: var(--gold-ink); font-size: 15px; }
.prof-acts { display: flex; flex-direction: column; gap: 4px; }
.readings, .insights { list-style: none; padding: 0; margin: 0; }
.readings li, .insights li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- Thư viện, quy tắc, kiểm thử ---------- */
.kcard, .rcard, .trace-step { border: 1px solid var(--line-soft); border-radius: 6px; padding: 8px 10px; margin: 8px 0; background: var(--surface-ink); }
.kcard p, .rcard p { margin: 4px 0 0; }
.rhead { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.compare { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 10px; overflow-x: auto; }
.cmp-col h3 { font-size: 13px; color: var(--gold-ink); margin: 0 0 6px; }
.md h3, .md h4 { color: var(--gold-ink); }
.md ul { padding-left: 18px; }
.ex-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 6px; margin: 4px 0; align-items: center; }
.ex-row input, .ex-row select { padding: 7px 8px; font-size: 12.5px; }
.try { border-left: 2px solid var(--brand-gold); padding-left: 8px; margin: 6px 0; }
details.tcase { border: 1px solid var(--line-soft); border-radius: 6px; margin: 6px 0; padding: 6px 10px; background: var(--surface-ink); }
details.tcase.fail { border-color: var(--state-bad); }
details.tcase summary { cursor: pointer; }
.prop { align-items: flex-start !important; border-bottom: 1px solid var(--line-soft); padding: 6px 0; }

/* ---------- Trợ lý AI ---------- */
.ai-status { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip-st { font-size: 11.5px; border: 1px solid var(--line-soft); border-radius: 12px; padding: 2px 9px; color: var(--text-muted); }
.chip-st.ok { color: var(--state-ok); border-color: var(--state-ok); }
.chip-st.bad { color: var(--state-bad); border-color: var(--state-bad); }
.ai-pickers { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 10px; }
@media (min-width: 700px) { .ai-pickers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ai-pickers label { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 4px; font-size: 12px; color: var(--gold-ink); margin: 4px 0; }
.chat { display: grid; gap: 10px; max-height: 62vh; overflow-y: auto; margin: 10px 0; padding: 2px; }
.msg { border-radius: 10px; padding: 8px 12px; font-size: 13.5px; }
.msg-meta { font-size: 10.5px; opacity: .8; margin-bottom: 4px; }
.msg.user { background: var(--brand-cream); color: var(--text-on-cream); justify-self: end; max-width: 90%; }
.msg.ai { background: var(--surface-ink); border: 1px solid var(--line-soft); }
.msg.ai.err { border-color: var(--state-bad); }
.msg.ai .md p { margin: 4px 0; }
.ai-block { border-left: 2px solid var(--line); padding-left: 8px; margin: 8px 0; }
.msg-acts { justify-content: flex-start; margin-top: 6px; }
.ask-row { display: flex; gap: 8px; align-items: flex-end; }
.ask-row textarea, .ask-row input { flex: 1; }
.ask-btns { display: flex; flex-direction: column; gap: 6px; }
.ai-fab {
  position: fixed; right: 14px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); z-index: 25;
  width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--brand-gold); background: var(--head-bg); color: var(--gold-ink);
  display: grid; place-items: center; padding: 0;
}
.ai-fab svg { width: 24px; height: 24px; }
.ai-fab span { position: absolute; bottom: 5px; font-size: 9px; font-weight: 700; color: var(--text); }
.net-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 60; background: var(--brand-cream); color: var(--text-on-cream); border-bottom: 2px solid var(--state-bad); padding: calc(6px + env(safe-area-inset-top)) 12px 6px; font-size: 12.5px; text-align: center; }

/* ---------- Trang chi tiết (sheet) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; background: color-mix(in srgb, #000 60%, transparent); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: min(760px, 100%); max-height: 92vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line); background: var(--head-bg); border-radius: 14px 14px 0 0; }
.sheet-head h2 { flex: 1; margin: 0; font-family: var(--serif); color: var(--gold-ink); font-size: 18px; }
.sheet-body { overflow-y: auto; padding: 10px 14px calc(18px + env(safe-area-inset-bottom)); }

/* ---------- Ngăn kéo menu ---------- */
.drawer { position: fixed; inset: 0; z-index: 40; background: color-mix(in srgb, #000 55%, transparent); }
.drawer-panel { width: min(300px, 82vw); height: 100%; background: var(--head-bg); border-right: 1px solid var(--line); padding: calc(14px + env(safe-area-inset-top)) 12px 12px; display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.drawer-brand { font-family: var(--serif); color: var(--gold-ink); font-size: 18px; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.drawer-item { display: block; text-align: left; padding: 12px; border-radius: 8px; border: 1px solid var(--line-soft); background: var(--surface); color: var(--text); text-decoration: none; font-size: 14px; }
.drawer-item.gold { background: var(--brand-gold); color: var(--on-gold); }

/* ---------- Khóa ---------- */
.lock { position: fixed; inset: 0; z-index: 100; background: var(--head-bg); display: grid; place-items: center; padding: 16px; }
.lock-box { width: min(340px, 100%); text-align: center; color: var(--gold-ink); }
.lock-box h2 { font-family: var(--serif); }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translate(-50%, 20px); background: var(--brand-cream); color: var(--text-on-cream); border: 1px solid var(--brand-gold); padding: 8px 16px; border-radius: 12px; opacity: 0; transition: .25s; pointer-events: none; z-index: 200; font-weight: 600; max-width: calc(100vw - 32px); font-size: 13px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Thanh điều hướng dưới ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(8, 1fr);
  background: var(--head-bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a { color: var(--text); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 10.5px; white-space: nowrap; text-decoration: none; border-top: 2px solid transparent; }
.bottomnav svg { color: var(--gold-ink); width: 23px; height: 23px; }
.bottomnav a.active { color: var(--gold-ink); font-weight: 700; border-top-color: var(--gold-ink); background: var(--gold-soft); }
.bottomnav a.nav-ai svg { color: var(--text); }

/* ---------- Điện thoại ---------- */
@media (max-width: 520px) {
  body { font-size: 13.5px; }
  main { padding: 10px 10px 0; }
  .brand { font-size: 16px; }
  .lotus { width: 30px; height: 20px; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-logo { border-right: 0; border-bottom: 1px solid var(--line); display: flex; justify-content: center; align-items: center; gap: 10px; padding: 10px; }
  .hero-logo .lotus { width: 56px; height: 36px; }
  .hero-logo .hero-name { font-size: 22px; text-align: left; }
  .hero-tags { display: none; }
  .hero-info dd { font-size: 14px; }
  .glyph { font-size: 24px; }
  .tutru td { min-width: 62px; }
  .row2 { grid-template-columns: minmax(0, 1fr); }
  .pillar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tc3 { grid-template-columns: minmax(0, 1fr); }
  .tc3 > div + div { border-left: 0; border-top: 1px solid var(--line-soft); padding-top: 6px; margin-top: 6px; }
  .ex-row { grid-template-columns: 1fr 1fr; }
  .bottomnav a { font-size: 8.5px; }
  .bottomnav svg { width: 20px; height: 20px; }
}

/* =====================================================================
   GIAO DIỆN DI ĐỘNG: Thư viện · Sổ quy tắc · Kiểm thử · Trợ lý AI · Cấu hình AI
   (chỉ dùng biến token ở đầu tệp)
   ===================================================================== */
.big-tap { min-height: 44px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.toolbar input[type=search] { flex: 1 1 180px; min-height: 44px; }
.toolbar > button { flex: 0 0 auto; }
.seg-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; margin: 4px 0; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg-tabs::-webkit-scrollbar { display: none; }
.seg-tabs .seg { display: inline-flex; flex: 0 0 auto; margin: 0; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 20px; white-space: nowrap; background: var(--surface-ink); border: 1px solid var(--line-soft); color: var(--text); font-size: 13px; }
.seg-tabs .seg small { color: var(--text-muted); font-size: 11px; }
.seg-tabs .seg.on { background: var(--brand-gold); color: var(--on-gold); border-color: var(--brand-gold); font-weight: 600; }
.seg-tabs .seg.on small { color: var(--on-gold); }
.filter-box, .info-fold, .form-sec, .manifest { border: 1px solid var(--line-soft); border-radius: 10px; background: var(--surface-ink); margin: 8px 0; }
.filter-box > summary, .info-fold > summary, .form-sec > summary, .manifest > summary { cursor: pointer; padding: 11px 12px; min-height: 44px; box-sizing: border-box; color: var(--gold-ink); font-weight: 600; font-size: 13.5px; list-style-position: inside; }
.filter-box > :not(summary), .info-fold > :not(summary), .form-sec > :not(summary), .manifest > :not(summary) { margin-left: 12px; margin-right: 12px; }
.filter-box[open], .info-fold[open], .form-sec[open], .manifest[open] { padding-bottom: 10px; }
.form-sec label { display: block; margin-top: 8px; margin-bottom: 8px; }
.card-list { display: grid; gap: 10px; margin-top: 6px; }
.item-card { border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface-ink); padding: 12px; min-width: 0; }
.item-card[role=button] { cursor: pointer; }
.item-card[role=button]:active, .item-card[role=button]:focus-visible { border-color: var(--brand-gold); outline: none; }
.ic-head { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.ic-title { flex: 1; min-width: 0; color: var(--text); font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
button.ic-title { color: var(--text); font: inherit; }
button.ic-title b { color: var(--gold-ink); }
.ic-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; flex: 0 0 auto; max-width: 45%; }
.ic-meta { color: var(--text-muted); font-size: 12px; margin-top: 4px; overflow-wrap: anywhere; }
.ic-text { margin: 8px 0 0; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ic-more { margin-top: 8px; }
.ic-more > summary { cursor: pointer; color: var(--gold-ink); font-size: 13px; padding: 8px 0; }
.ic-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ic-actions > button { flex: 1 1 120px; }
.rule-card.s-confirmed { border-color: var(--line); }
.rule-card.s-disabled { opacity: .65; }
.empty-state { text-align: center; padding: 22px 12px; border: 1px dashed var(--line-soft); border-radius: 12px; color: var(--text-muted); }
.danger { color: var(--state-bad) !important; border-color: var(--state-bad) !important; }

/* Kiểm thử */
.test-sum { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 6px 0 8px; }
.ts-box { border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px; display: grid; text-align: center; background: var(--surface-ink); }
.ts-box b { font-size: 24px; font-family: var(--serif); }
.ts-box span { font-weight: 600; }
.ts-box small { color: var(--text-muted); font-size: 11.5px; }
.ts-box.ok { border-color: var(--state-ok); } .ts-box.ok b { color: var(--state-ok); }
.ts-box.bad { border-color: var(--state-bad); } .ts-box.bad b { color: var(--state-bad); }
.ts-box.none b { color: var(--text-muted); }
.test-card.fail { border-color: var(--state-bad); }
.check-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.check-list li { border-left: 3px solid var(--line-soft); padding: 4px 0 4px 8px; font-size: 13px; }
.check-list li.ok { border-left-color: var(--state-ok); }
.check-list li.bad { border-left-color: var(--state-bad); background: var(--cream-soft); }
.cl-v { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.cl-v b { color: var(--text); }

/* Trợ lý AI: kiểm tra dữ liệu đầu vào, luận nhiều bước */
.mf { list-style: none; padding: 0; display: grid; gap: 4px; font-size: 12.5px; }
.mf li { border-left: 3px solid var(--line-soft); padding: 3px 0 3px 8px; }
.mf-st { display: inline-block; min-width: 64px; font-weight: 700; }
.mf-du { border-left-color: var(--state-ok) !important; } .mf-du .mf-st { color: var(--state-ok); }
.mf-thieu { border-left-color: var(--state-bad) !important; } .mf-thieu .mf-st { color: var(--state-bad); }
.mf-canh-bao { border-left-color: var(--gold-ink) !important; } .mf-canh-bao .mf-st { color: var(--gold-ink); }
.mf-khong-ap-dung { opacity: .7; }
.step-card { border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px; margin: 8px 0; background: var(--surface-ink); }
.step-card.pending { opacity: .6; border-style: dashed; }
.step-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--gold-ink); }

/* Cấu hình AI */
.honest { list-style: none; padding: 0; display: grid; gap: 6px; }
.honest li { border: 1px solid var(--line-soft); border-left-width: 4px; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.honest .st-ok, .st-ok { border-color: var(--state-ok); }
.honest .st-warn, .st-warn { border-color: var(--brand-gold); }
.honest .st-bad, .st-bad { border-color: var(--state-bad); }
.pcard { border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px; margin: 10px 0; background: var(--surface-ink); }
.pcard > p.st-ok, .pcard > p.st-warn, .pcard > p.st-bad { border-left: 4px solid; padding-left: 8px; }
.models-box { margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.model-list { display: grid; gap: 4px; max-height: 260px; overflow-y: auto; padding: 4px; border: 1px solid var(--line-soft); border-radius: 8px; }
.model-list label.check { display: flex; align-items: center; gap: 8px; min-height: 36px; font-size: 13px; overflow-wrap: anywhere; }
.model-list input[type=checkbox] { width: 20px; height: 20px; flex: 0 0 auto; }

/* Sheet toàn màn hình trên điện thoại */
@media (max-width: 520px) {
  .sheet { height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; }
  .sheet-head { border-radius: 0; padding-top: calc(8px + env(safe-area-inset-top)); }
  .sheet-head button { min-width: 44px; min-height: 44px; }
  .ex-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ex-row input[name=rv], .ex-row input[name=rn] { grid-column: span 2; }
  .ex-row [data-rdel] { grid-column: span 2; }
  .toolbar > button { flex: 1 1 auto; }
  .ic-badges { max-width: 50%; }
  input, select, textarea { font-size: 16px; } /* tránh trình duyệt tự phóng to khi chạm ô nhập */
}

/* Vùng chạm tối thiểu ~44px và cỡ chữ dễ đọc trên điện thoại (đo ở 360px và 412px) */
@media (max-width: 520px) {
  label.check { min-height: 44px; display: flex; align-items: center; gap: 10px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--gold-ink); }
  .mini { min-height: 40px; padding: 6px 12px; font-size: 13px; }
  #app summary, .sheet summary { padding-top: 11px; padding-bottom: 11px; }
  .vbadge, .sbadge, .chip-st { font-size: 11.5px; }
  .seg-tabs .seg small { font-size: 12px; }
  .tbl th, .tbl td { font-size: 12px; }
}
@media (max-width: 520px) { .info-fold .tbl tbody th, .ic-more .tbl tbody th, details.sub .tbl tbody th, .sheet .tbl tbody th { font-size: 12px; } }
.more-btn { width: 100%; margin-top: 10px; }
/* Bảng giá mô hình (Cấu hình AI) */
.price-row { border: 1px solid var(--line-soft); border-radius: 10px; padding: 6px 10px 2px; margin: 8px 0; min-width: 0; }
.price-row legend { color: var(--gold-ink); font-size: 13px; padding: 0 4px; overflow-wrap: anywhere; }
.price-row .row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-items: end; }
.price-row label { font-size: 12px; margin: 4px 0; }
.env-val { font-family: ui-monospace, monospace; font-size: 12px; }


/* =====================================================================
   MOBILE-FIRST: giao diện gọn cho điện thoại (360–430px), nới dần cho máy tính bảng/máy tính.
   Lớp này đặt cuối tệp để thắng các kích thước cũ; chỉ dùng biến token ở đầu tệp.
   ===================================================================== */
body { font-size: 13.5px; line-height: 1.5; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); }
main { max-width: 1080px; padding: 8px 8px 0; }

/* Thanh trên: mỏng, thanh lịch */
.topbar { padding: calc(4px + env(safe-area-inset-top)) 4px 4px; background: var(--head-bg); border-bottom: 1px solid var(--line-soft); box-shadow: var(--shadow); }
.icon-btn { padding: 8px; color: var(--gold-ink); }
.icon-btn svg { width: 21px; height: 21px; }
.brand { font-size: 15px; letter-spacing: 1.2px; gap: 6px; color: var(--gold-ink); }
.brand small { font-size: 10.5px; color: var(--text-muted); max-width: 54vw; }
.lotus { width: 26px; height: 17px; }
.lotus.big { width: 56px; height: 36px; }

/* Khung: bo mềm, viền champagne mảnh, đổ bóng nhẹ */
.panel { padding: 10px; margin-bottom: 10px; border-radius: 12px; border-color: var(--line-soft); box-shadow: var(--shadow); }
.panel::before, .panel::after { width: 8px; height: 8px; border-width: 1.5px; border-color: var(--line); }
.ptitle { margin: -10px -10px 8px; padding: 7px 10px; font-size: 13px; letter-spacing: .8px; border-radius: 11px 11px 0 0; border-bottom-color: var(--line-soft); }
.sub-title { font-size: 14px; margin: 12px 0 6px; }
.info-box, .warn-box { background: var(--surface-ink); color: var(--text); border: 1px solid var(--line-soft); border-left-width: 3px; border-radius: 10px; padding: 7px 10px; font-size: 12.5px; margin-bottom: 10px; }
.info-box { border-left-color: var(--brand-gold); } .warn-box { border-left-color: var(--state-bad); }

/* Thông tin chủ nhân: gọn một cột */
.hero { grid-template-columns: minmax(0, 1fr); }
.hero-logo { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
.hero-logo .lotus { width: 36px; height: 24px; }
.hero-logo .hero-name, .hero-name { font-size: 18px; letter-spacing: 1.5px; margin: 0; text-align: left; }
.hero-sub { font-size: 12px; letter-spacing: 1.5px; }
.hero-tags { display: none; }
.hero-info { padding: 10px 12px; gap: 8px 12px; }
.hero-info dt { font-size: 10px; }
.hero-info dd { font-size: 13.5px; }

/* Bảng: gọn; bảng rộng vuốt ngang riêng trong khung, không làm tràn trang */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; margin: 0 -2px; padding: 0 2px; scrollbar-width: thin; }
.tbl th, .tbl td { padding: 4px 4px; }
.tbl thead th { font-size: 10.5px; letter-spacing: .2px; }
.tbl tbody th { font-size: 10px; }
.tutru td { min-width: 58px; }
.tutru th:first-child, .tutru td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface-ink); }
.glyph { font-size: 22px; letter-spacing: .5px; }
.glyph.xl { font-size: 26px; }
.big-num td { font-size: 14px; }
.el-tbl td, .hx td, .years td { font-size: 12px; }
.dv { font-size: 11.5px; }
.dv th, .dv td { min-width: 70px; }
.dv .gz { font-size: 13.5px; }
.ln-grid { grid-template-columns: repeat(7, minmax(118px, 1fr)); }
.ln { padding: 8px 6px; }
.ln-year { font-size: 14px; } .ln-gz { font-size: 15px; }
.kv2 b, .kv1 > b { font-size: 15px; }
b.xl { font-size: 17px; }
.stmt { font-size: 12.5px; padding: 5px 0; }
.cong-body { font-size: 12.5px; }

/* Nút: vừa ngón tay (~40px), không chiếm nhiều diện tích */
.gold, .ghost, .btn { padding: 8px 14px; font-size: 13px; border-radius: 10px; min-height: 40px; }
.gold.big { padding: 10px 20px; font-size: 14px; }
.big-tap { min-height: 40px; }
.mini { padding: 4px 10px; font-size: 12px; min-height: 34px; }
input, select, textarea { padding: 8px 10px; font-size: 14px; border-radius: 10px; border-color: var(--line-soft); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand-primary) 70%, transparent); outline-offset: 0; border-color: var(--brand-primary); }
form label { font-size: 11.5px; margin: 5px 0; }
.seg-tabs .seg { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.tabs button { padding: 7px 8px; font-size: 12px; }
.chip { padding: 3px 9px; font-size: 11.5px; }
.item-card { padding: 10px; border-radius: 12px; }
.ic-title { font-size: 13.5px; }
.ic-text { font-size: 12.5px; }
.filter-box > summary, .info-fold > summary, .form-sec > summary, .manifest > summary { min-height: 40px; padding: 9px 10px; font-size: 12.5px; }
.ts-box b { font-size: 20px; }

/* Thanh dưới: 6 mục, cố định, dễ bấm bằng một tay */
.bottomnav { grid-template-columns: repeat(6, minmax(0, 1fr)); height: calc(var(--nav-h) + env(safe-area-inset-bottom)); background: var(--head-bg); border-top: 1px solid var(--line-soft); box-shadow: 0 -2px 10px rgba(0, 0, 0, .3); }
.bottomnav a, .bottomnav .nav-more { color: var(--text-muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 0 4px; font-size: 10.5px; font-weight: 500; white-space: nowrap; text-decoration: none; border: 0; border-top: 2px solid transparent; background: none; min-width: 0; }
.bottomnav svg { width: 21px; height: 21px; color: currentColor; }
.bottomnav a.active, .bottomnav .nav-more.active { color: var(--gold-ink); font-weight: 700; border-top-color: var(--brand-gold); background: var(--gold-soft); }

/* Nút AI nổi: nhỏ gọn hơn */
.ai-fab { width: 46px; height: 46px; right: 12px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); background: var(--surface); box-shadow: var(--shadow); }
.ai-fab svg { width: 20px; height: 20px; } .ai-fab span { font-size: 8px; bottom: 3px; }
#toast { bottom: calc(var(--nav-h) + 16px); font-size: 12.5px; }

/* Menu, trang chi tiết */
.drawer-panel { background: var(--surface); }
.drawer-item { padding: 10px 12px; font-size: 13.5px; border-radius: 10px; }
.sheet-head { padding: 6px 6px 6px 12px; }
.sheet-head h2 { font-size: 16px; }
.sheet-body { padding: 10px 12px calc(16px + env(safe-area-inset-bottom)); }

/* Máy tính bảng / máy tính: nới rộng, chữ lớn hơn một chút, thanh dưới thu vào giữa */
@media (min-width: 768px) {
  body { font-size: 14px; }
  main { padding: 14px 16px 0; }
  .brand { font-size: 18px; }
  .lotus { width: 32px; height: 21px; }
  .panel { padding: 14px; margin-bottom: 14px; }
  .ptitle { margin: -14px -14px 12px; padding: 9px 12px; font-size: 14px; }
  .hero { grid-template-columns: 190px minmax(0, 1fr); }
  .hero-logo { flex-direction: column; border-right: 1px solid var(--line-soft); border-bottom: 0; padding: 14px 8px; }
  .hero-logo .lotus { width: 56px; height: 36px; }
  .hero-logo .hero-name { font-size: 22px; text-align: center; }
  .hero-info dd { font-size: 15px; }
  .glyph { font-size: 28px; } .glyph.xl { font-size: 32px; }
  .tbl th, .tbl td { padding: 6px 6px; }
  .tutru td { min-width: 76px; }
  .bottomnav { left: 50%; right: auto; transform: translateX(-50%); width: min(560px, 100%); border: 1px solid var(--line-soft); border-bottom: 0; border-radius: 16px 16px 0 0; }
}
/* Khung bo tròn: bỏ góc trang trí cũ (lệch khỏi góc bo) cho gọn, tinh tế */
.panel::before, .panel::after { display: none; }

/* =====================================================================
   DASHBOARD THEO ẢNH MẪU: lưới nhiều cột, nhiều ô ngang ở MỌI kích thước màn hình.
   Không xếp thành một cột dài; chữ nhỏ, thanh mảnh; chỉ bảng quá rộng mới cuộn ngang trong khung của nó.
   (Thay thế các quy tắc "một cột" của lớp Mobile-first phía trên.)
   ===================================================================== */
body { font-size: 11px; line-height: 1.4; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px); }
main { max-width: 1180px; padding: 4px 4px 0; }

/* Thanh trên gọn */
.topbar { padding: calc(2px + env(safe-area-inset-top)) 2px 2px; }
.icon-btn { padding: 6px; } .icon-btn svg { width: 19px; height: 19px; }
.brand { font-size: 14px; letter-spacing: 1px; }
.brand small { font-size: 9px; }
.lotus { width: 24px; height: 16px; }

/* Khung nhỏ, viền mảnh, sát nhau */
.panel { padding: 5px; margin-bottom: 5px; border-radius: 6px; border-color: var(--line); box-shadow: none; }
.ptitle { margin: -5px -5px 5px; padding: 4px 4px; font-size: 9.5px; letter-spacing: .4px; border-radius: 5px 5px 0 0; border-bottom: 1px solid var(--line); }
.sub-title { font-size: 10px; margin: 6px 0 3px; }
.info-box, .warn-box { font-size: 10px; padding: 4px 6px; margin-bottom: 5px; border-radius: 6px; }
.confirm-bar { font-size: 10px; padding: 4px 6px; margin-bottom: 5px; gap: 4px; }
.valid-sum { font-size: 9.5px; margin-bottom: 5px; line-height: 1.6; }
.note, .hint { font-size: 9.5px; margin: 4px 1px 1px; }
.small { font-size: 10px; } small { font-size: 9px; }
.vbadge, .sbadge, .chip-st, .cert, .rule-chip { font-size: 8.5px; padding: 0 4px; }

/* Đầu trang: logo trái + thông tin hai cột bên phải (như ảnh mẫu) */
.hero { display: grid; grid-template-columns: minmax(0, 25%) minmax(0, 1fr); padding: 0; overflow: hidden; }
.hero-logo { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; padding: 6px 3px; border-right: 1px solid var(--line); border-bottom: 0; }
.hero-logo .lotus { width: 34px; height: 22px; }
.hero-logo .hero-name, .hero-name { font-size: 13px; letter-spacing: 1px; text-align: center; margin: 0; line-height: 1.05; }
.hero-sub { font-size: 8.5px; letter-spacing: 1px; }
.hero-tags { display: block; font-size: 6.5px; line-height: 1.35; margin-top: 3px; letter-spacing: 0; color: var(--text-muted); }
.hero-info { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 6px; padding: 6px 6px; align-content: center; }
.hero-info div { flex-direction: row; align-items: baseline; gap: 4px; }
.hero-info dt { font-size: 7.5px; width: 42%; flex: none; letter-spacing: .1px; }
.hero-info dd { font-size: 10.5px; overflow-wrap: anywhere; }

/* Nội dung chính: hai khu vực trái – phải ở mọi kích thước */
.grid { grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); gap: 0 5px; align-items: start; }
.footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 0 5px; }

/* Bảng: chữ nhỏ, giữ hàng – cột; bảng quá rộng cuộn ngang riêng */
.scroll { overflow-x: auto; margin: 0; padding: 0; }
.tbl th, .tbl td { padding: 2px 2px; line-height: 1.3; }
.tbl thead th { font-size: 8.5px; letter-spacing: 0; }
.tbl tbody th { font-size: 7.5px; letter-spacing: 0; }
.tbl td { font-size: 9px; }
.tutru td { min-width: 0; }
.tutru th:first-child, .tutru td:first-child { position: static; }
.glyph { font-size: 14px; letter-spacing: .3px; }
.glyph.xl { font-size: 18px; }
.big-num td { font-size: 10.5px; }
.stack { line-height: 1.35; }
.el-tbl td, .hx td, .years td, .tc-tbl td { font-size: 8.5px; }
.dv { font-size: 8.5px; }
.dv th, .dv td { min-width: 46px; }
.dv .gz { font-size: 10px; }
.el-bar { height: 4px; max-width: 46px; }

/* Cặp khóa – giá trị, ô thông tin nhỏ */
.lbl { font-size: 7.5px; }
.kv2 > div { padding: 3px 4px 5px; }
.kv2 b, .kv1 > b { font-size: 11px; }
.kv1 { padding: 4px; } .kv1 p { margin: 2px 0; }
b.xl { font-size: 12px; }
.kv2 small { font-size: 8.5px; }
.method-label { font-size: 8.5px; margin-bottom: 4px; }
.dt-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
.dt-box { padding: 3px; }
.tc3 { grid-template-columns: repeat(3, minmax(0, 1fr)); padding-bottom: 4px; }
.tc3 > div + div { border-left: 1px solid var(--line-soft); border-top: 0; padding-top: 0; margin-top: 0; }
.flow { font-size: 10px; margin-bottom: 4px; }
.forces ul, ul.plain { font-size: 9.5px; padding-left: 12px; }
.stmt { font-size: 9.5px; padding: 3px 0; gap: 4px; }
.stmt-meta { font-size: 8.5px; gap: 2px 4px; }
details.why { font-size: 9px; } details.why summary { font-size: 8.5px; }
details.cong summary { padding: 4px 5px; gap: 3px; font-size: 9.5px; }
.cong-n { width: 14px; height: 14px; font-size: 8px; }
.cong-m { font-size: 8.5px; }
.cong-body { font-size: 9.5px; padding: 4px 5px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
details.sub summary { font-size: 9.5px; }
.chips { gap: 3px; margin: 4px 0; }
.chip { font-size: 9px; padding: 1px 6px; }

/* Lưu niên: 7 cột ngang để so sánh trực tiếp */
.ln-grid { grid-template-columns: repeat(7, minmax(52px, 1fr)); }
.ln { padding: 4px 2px; }
.ln-year { font-size: 10.5px; } .ln-gz { font-size: 10.5px; }
.ln-tt { margin-bottom: 3px; font-size: 9px; }
.ln-row { font-size: 8.5px; padding: 3px 0; }
.ln-note { font-size: 8px; padding-top: 3px; }

/* Chân trang */
.legend h3 { font-size: 9px; margin-bottom: 4px; }
.legend { font-size: 9.5px; }
.contact { gap: 4px 10px; }
.contact a { font-size: 10px; }

/* Nút gọn */
.gold, .ghost, .btn { padding: 5px 10px; font-size: 11px; min-height: 30px; border-radius: 7px; }
.mini, .mini-gold { padding: 2px 7px; font-size: 10px; min-height: 24px; }

/* Thanh dưới: 7 mục như ảnh mẫu */
.bottomnav { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.bottomnav a { font-size: 9.5px; gap: 2px; padding: 5px 0 3px; }
.bottomnav svg { width: 20px; height: 20px; }

/* Màn hình rộng: tăng nhẹ cỡ chữ, vẫn giữ nguyên bố cục */
@media (min-width: 768px) {
  body { font-size: 12.5px; }
  main { padding: 10px 12px 0; }
  .panel { padding: 8px; margin-bottom: 8px; }
  .ptitle { margin: -8px -8px 8px; padding: 6px; font-size: 12px; }
  .grid, .footer-grid { gap: 0 8px; }
  .tbl th, .tbl td { padding: 4px 4px; }
  .tbl td { font-size: 11.5px; } .tbl thead th { font-size: 10.5px; } .tbl tbody th { font-size: 9.5px; }
  .glyph { font-size: 22px; } .glyph.xl { font-size: 26px; }
  .hero-info dt { font-size: 9.5px; } .hero-info dd { font-size: 13.5px; }
  .hero-logo .hero-name { font-size: 20px; } .hero-tags { font-size: 9px; }
  .stmt, .cong-body, .forces ul, ul.plain { font-size: 11.5px; }
  .dv { font-size: 10.5px; } .dv .gz { font-size: 12.5px; } .dv th, .dv td { min-width: 60px; }
  .ln-year, .ln-gz { font-size: 13px; } .ln-row { font-size: 10.5px; }
  .bottomnav { width: min(640px, 100%); }
  .bottomnav a { font-size: 10.5px; }
}
/* Ô tóm tắt trên Trang chủ (dashboard) */
.el-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; margin: 4px 0; }
.el-card { border: 1px solid var(--line-soft); border-radius: 4px; padding: 2px 1px 3px; text-align: center; background: var(--surface-ink); display: grid; gap: 1px; justify-items: center; }
.el-card b { font-size: 9px; font-weight: 600; } .el-card .stars { font-size: 7.5px; letter-spacing: 0; }
.el-card .el-bar { width: 80%; margin: 1px auto 0; }
.dt-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dt-compact .dt-box:nth-child(3) { grid-column: 1 / -1; }
.dt-compact .dt-box small { display: block; font-size: 8px; color: var(--text-muted); }
.tt-brief th { width: 38%; font-size: 8px !important; } .tt-brief td { font-size: 8.5px; }
.hx-brief td, .hx-brief th { font-size: 8px; }
.tc3 .lbl { margin-bottom: 1px; } .tc3 > div { font-size: 9px; padding: 0 2px; } .tc3 small { display: block; font-size: 7.5px; }
details.more { margin-top: 3px; }
details.more > summary { cursor: pointer; font-size: 8.5px; color: var(--gold-ink); padding: 2px 0; list-style-position: inside; }
details.more[open] > summary { border-bottom: 1px dashed var(--line-soft); margin-bottom: 3px; }
details.more .dt-grid, details.more .two { grid-template-columns: minmax(0, 1fr); }
details.more .lbl { display: flex; flex-wrap: wrap; gap: 2px 4px; align-items: center; }

/* ---------- Dashboard gọn: giảm chiều cao tổng thể ---------- */
:root { --nav-h: 46px; }
body { line-height: 1.3; }
main { padding: 3px 3px 0; }
.topbar { padding: calc(1px + env(safe-area-inset-top)) 2px 1px; }
.icon-btn { padding: 5px; } .icon-btn svg { width: 18px; height: 18px; }
.brand { font-size: 13px; } .brand small { font-size: 8.5px; }
.panel { padding: 3px; margin-bottom: 3px; border-radius: 5px; }
.ptitle { margin: -3px -3px 3px; padding: 2px 3px; font-size: 8.5px; letter-spacing: .2px; line-height: 1.25; border-radius: 4px 4px 0 0; }
.grid, .footer-grid { gap: 0 3px; }

/* Đầu trang */
.hero-logo { padding: 3px 2px; gap: 0; }
.hero-logo .lotus { width: 26px; height: 17px; }
.hero-logo .hero-name { font-size: 11px; } .hero-sub { font-size: 7.5px; }
.hero-tags { font-size: 6px; margin-top: 1px; line-height: 1.25; }
.hero-info { gap: 1px 4px; padding: 3px 4px; }
.hero-info dt { font-size: 7px; } .hero-info dd { font-size: 9.5px; line-height: 1.25; }
.confirm-bar { font-size: 9px; padding: 2px 5px; margin-bottom: 3px; border-radius: 5px; flex-wrap: nowrap; justify-content: space-between; }
.confirm-bar .mini, .confirm-bar .mini-gold { min-height: 20px; padding: 1px 6px; font-size: 8.5px; flex: none; }
.valid-sum { font-size: 8px; margin-bottom: 3px; line-height: 1.5; }
.valid-sum .vbadge { font-size: 7.5px; }

/* Bảng: hàng thấp */
.tbl th, .tbl td { padding: 1px 2px; line-height: 1.2; }
.tbl thead th { font-size: 8px; } .tbl tbody th { font-size: 7px; } .tbl td { font-size: 8.5px; }
.glyph { font-size: 13px; line-height: 1.1; }
.big-num td { font-size: 9.5px; }
.tutru small, .tutru .stack { font-size: 8px; line-height: 1.2; }

/* Đại vận, Lưu niên: nhiều cột sát nhau */
.dv-brief th, .dv-brief td { min-width: 34px; font-size: 8px; }
.dv-brief thead th { font-size: 7.5px; line-height: 1.1; } .dv-brief thead small { font-size: 7px; }
.dv-brief .gz { font-size: 9px; }
.ln-brief { width: 100%; }
.ln-brief th, .ln-brief td { font-size: 8px; min-width: 40px; }
.ln-brief thead th { font-size: 8.5px; }
.ln-brief .gz { font-size: 9px; font-weight: 700; }
.dv-brief .cur, .ln-brief .cur { background: var(--gold-soft); }

/* Cột phải */
.kv2 > div { padding: 1px 3px 2px; } .kv2 b, .kv1 > b { font-size: 10px; } .kv2 small { font-size: 7.5px; }
.lbl { font-size: 7px; }
.el-cards { margin: 2px 0; gap: 1px; } .el-card { padding: 1px 0 2px; } .el-card b { font-size: 8.5px; } .el-card .stars { font-size: 7px; }
.dt-grid { gap: 2px; } .dt-box { padding: 2px 3px; } b.xl { font-size: 10.5px; } .dt-compact .dt-box small { font-size: 7.5px; }
.tc3 > div { font-size: 8.5px; } .tc3 small { font-size: 7px; }
.tt-brief th { font-size: 7px !important; } .tt-brief td { font-size: 8px; }
.hx-brief td, .hx-brief th { font-size: 7.5px; }
details.more { margin-top: 1px; } details.more > summary { font-size: 8px; padding: 1px 0; }
.vbadge, .sbadge, .cert, .rule-chip { font-size: 7.5px; padding: 0 3px; }
p.small { margin: 2px 0; font-size: 8.5px; }

/* Chú thích một dòng */
.legend-compact { font-size: 8.5px; }
.legend-compact .vbadge { font-size: 7px; }

/* Thanh dưới gọn */
.bottomnav a { font-size: 8.5px; gap: 1px; padding: 3px 0 2px; }
.bottomnav svg { width: 18px; height: 18px; }
.ai-fab { width: 40px; height: 40px; }

@media (min-width: 768px) {
  :root { --nav-h: 54px; }
  .panel { padding: 6px; margin-bottom: 6px; } .ptitle { margin: -6px -6px 6px; padding: 4px; font-size: 11px; }
  .tbl td { font-size: 11px; } .tbl thead th { font-size: 10px; } .tbl tbody th { font-size: 9px; }
  .glyph { font-size: 20px; } .hero-info dd { font-size: 13px; } .hero-info dt { font-size: 9px; }
  .dv-brief th, .dv-brief td, .ln-brief th, .ln-brief td { font-size: 10.5px; }
  .bottomnav a { font-size: 10px; } .bottomnav svg { width: 20px; height: 20px; }
}
/* Trang chủ: cân hai cột (Lưu niên nằm dưới Đại vận để lấp khoảng trống) */
.grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); }
@media (min-width: 768px) { .grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); } }
details.more { min-width: 0; max-width: 100%; overflow: hidden; }
details.more .ln-grid { max-width: 100%; }
.tc3 > div, .tt-brief td, .hx-brief td, .dt-box, .kv2 > div { overflow-wrap: anywhere; min-width: 0; }

/* Vùng nền ngà (tin nhắn của bạn, thông báo nhanh, băng báo mạng): chữ Ngũ Hành đặt trên nền đậm để giữ tương phản */
:is(.msg.user, #toast, .net-banner) :is(.e-moc, .e-hoa, .e-tho, .e-kim, .e-thuy) { background: var(--surface-ink); padding: 0 .25em; border-radius: 3px; }

/* Thu gọn nhẹ chiều cao (đợt 2) */
.tbl th, .tbl td { line-height: 1.15; }
.dv-brief td, .ln-brief td { white-space: nowrap; }
.ln-brief tr:last-child td { white-space: normal; min-width: 58px; }
.hx-brief td { line-height: 1.15; } .hx-brief b { font-weight: 600; }
.ptitle { line-height: 1.15; }
.hero-info dd { line-height: 1.15; }
.kv2 small, .dt-compact .dt-box small, .tc3 small { line-height: 1.15; }
.el-cards { margin: 1px 0; }
.valid-sum { line-height: 1.35; }
@media (min-width: 380px) and (max-width: 767px) { .grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
/* Đại vận / Lưu niên: cột hẹp để thấy nhiều cột cùng lúc; chỉ Can chi giữ một dòng */
.dv-brief td, .ln-brief td { white-space: normal; }
.dv-brief .gz, .ln-brief .gz { white-space: nowrap; }
.dv-brief th, .dv-brief td { min-width: 40px; } .ln-brief th, .ln-brief td { min-width: 42px; }
.dv-brief, .ln-brief { table-layout: fixed; }
.dv-brief { width: calc(34px + 8 * 46px); } .ln-brief { width: calc(34px + 7 * 46px); }
.dv-brief th:first-child, .ln-brief th:first-child { width: 34px; }
.dv-brief th, .dv-brief td, .ln-brief th, .ln-brief td, .ln-brief tr:last-child td { min-width: 0; overflow-wrap: anywhere; }
@media (min-width: 768px) { .dv-brief { width: calc(60px + 8 * 76px); } .ln-brief { width: 100%; } .dv-brief th:first-child, .ln-brief th:first-child { width: 60px; } }

/* ===== Luận giải tự động 10 bước: nhãn nguồn ===== */
.obadge { display: inline-block; border-radius: 4px; padding: 0 5px; font-size: 10.5px; line-height: 16px; border: 1px solid; white-space: nowrap; vertical-align: 1px; }
.o-kendy.obadge { color: var(--gold-ink); border-color: var(--brand-gold); background: var(--gold-soft); }
.o-data.obadge { color: var(--text-muted); border-color: var(--line-soft); }
.o-ai.obadge { color: var(--el-water-ink); border-color: color-mix(in srgb, var(--element-water) 60%, transparent); }
.o-cho.obadge { color: var(--state-bad); border-color: color-mix(in srgb, var(--state-bad) 70%, transparent); }
.oline { margin: 4px 0; line-height: 1.45; }
.lg-step { border: 1px solid var(--line-soft); border-radius: 8px; padding: 6px 10px; margin: 8px 0; background: var(--surface-ink); }
.lg-step > summary { cursor: pointer; color: var(--gold-ink); font-weight: 600; min-height: 32px; display: flex; align-items: center; gap: 6px; }
.lg-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.lg-year input { width: 6.5em; margin-left: 6px; }
.lg-legend .chip { display: inline-flex; gap: 4px; align-items: center; }
.lg-sum { border-top: 1px solid var(--line-soft); margin-top: 10px; padding-top: 6px; }

/* ===== "Vì sao?" 5 phần: Can Chi tham gia · Quy tắc · Điều kiện · Quan hệ · Kết quả ===== */
.why5 { margin: 6px 0 2px; padding: 8px 10px; border-left: 3px solid var(--line-soft); background: var(--surface-ink); border-radius: 0 6px 6px 0; overflow-wrap: anywhere; }
.why5 h4 { margin: 8px 0 2px; font-size: 12px; color: var(--gold-ink); }
.why5 .why-src, .why5 .why-cho { margin-bottom: 4px; line-height: 1.5; }
.why-list { margin: 2px 0; padding-left: 16px; font-size: 12px; line-height: 1.45; }
.why-list li { margin: 2px 0; }
.why-list li.neg { color: var(--state-bad); }
.why-notes li { color: var(--text-muted); }
.nbadge { display: inline-block; border-radius: 4px; padding: 0 5px; font-size: 10.5px; line-height: 16px; border: 1px solid; white-space: nowrap; }
.n-kendy { color: var(--gold-ink); border-color: var(--brand-gold); background: var(--gold-soft); }
.n-data { color: var(--text-muted); border-color: var(--line-soft); }
.n-ai { color: var(--el-water-ink); border-color: color-mix(in srgb, var(--element-water) 60%, transparent); }
.n-cho { color: var(--state-bad); border-color: color-mix(in srgb, var(--state-bad) 70%, transparent); }
.oline > details.why { margin-left: 2px; }

/* ---------- BẢNG TỔNG HỢP LÁ SỐ (6 phần) – nền giấy sáng, chỉ áp trong .bth ---------- */
.bth{--b-teal:#0F5E57;--b-teal-d:#0A4440;--b-teal-s:#EAF2EE;--b-gold-s:#EFE3C4;--b-paper:#FBF7EE;--b-card:#FFFDF8;--b-ink:#2A3332;--b-mu:#857F70;
  --b-moc:#2F8A4E;--b-hoa:#C8453C;--b-tho:#A97C26;--b-kim:#71808F;--b-thuy:#2C67B0;--b-hop:#2F8A4E;--b-xung:#C8453C;--b-hinh:#7D52AE;--b-hai:#2C67B0;--b-pha:#B9822A;
  background:var(--b-paper);color:var(--b-ink);border-radius:12px;padding:0 10px 14px;margin-bottom:12px;font-size:13.5px;line-height:1.45;overflow:hidden}
.bth .warn-box{margin:8px 0}
.bth-top{background:linear-gradient(180deg,var(--b-teal),var(--b-teal-d));color:#F4E7C6;text-align:center;padding:12px 8px 10px;margin:0 -10px 10px;border-bottom:2px solid #C9A961}
.bth-top h1{margin:0;font:700 22px/1.1 var(--serif);letter-spacing:1px}.bth-top p{margin:3px 0 0;font:600 11.5px var(--serif);letter-spacing:.5px;color:#E9D7A8}
.bth-info{display:grid;grid-template-columns:1fr;gap:8px;margin-top:8px}
.bth-ibox{border:1px solid var(--b-gold-s);border-radius:8px;background:var(--b-card);padding:6px 10px}
.bth-ibox h3{margin:0 0 3px;font:700 13px var(--serif);color:var(--b-teal);letter-spacing:.5px}
.bth-kv{display:grid;grid-template-columns:86px 1fr;font-size:13px;gap:1px 6px}.bth-kv span{color:var(--b-mu)}
.bth-tt8{text-align:center;font:700 16px var(--serif);color:var(--b-teal);letter-spacing:.5px;padding:4px 0}
.bth-sec{margin-top:14px;border:1px solid var(--b-gold-s);border-radius:10px;background:var(--b-card);padding:0 0 8px}
.bth-sec h2{margin:0;padding:6px 10px;font:700 15px var(--serif);color:var(--b-teal);letter-spacing:.5px;display:flex;align-items:center;gap:8px;border-bottom:1px solid var(--b-gold-s)}
.bth-num{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;background:var(--b-teal);color:#F4E7C6;font:700 13px var(--serif)}
.bth-sec>*:not(h2){margin-left:8px;margin-right:8px}
.bth table{width:calc(100% - 16px);border-collapse:collapse;margin-top:8px;color:var(--b-ink)}
.bth-tru{table-layout:fixed}
.bth-tru th{background:var(--b-teal);color:#F4E7C6;font:600 12px var(--sans, inherit);padding:5px 2px;text-transform:uppercase;letter-spacing:.3px;border-left:1px solid #ffffff33;text-align:center}
.bth-tru th small{display:block;font-size:10px;text-transform:none;opacity:.85}.bth-tru th.dm{background:#14736A}
.bth-tru td{text-align:center;border-left:1px solid var(--b-gold-s);padding:4px 2px;vertical-align:top;background:transparent;cursor:pointer}.bth-tru td:first-child,.bth-tru th:first-child{border-left:0}
.bth-tru td.dm{background:var(--b-teal-s)}
.bth-tru .tt td{font-size:12px;font-weight:600;color:var(--b-teal);text-transform:uppercase;border-bottom:1px solid var(--b-gold-s)}
.bth-tru .g{font:700 clamp(28px,8.6vw,40px)/1.05 var(--serif);white-space:nowrap}
.bth .pills{display:flex;flex-direction:column;align-items:center;gap:3px;margin-top:5px}
.bth .pill{font-size:11px;color:#fff;padding:1px 8px;border-radius:9px;white-space:nowrap}
.bth .bb-moc{background:var(--b-moc)}.bth .bb-hoa{background:var(--b-hoa)}.bth .bb-tho{background:var(--b-tho)}.bth .bb-kim{background:var(--b-kim)}.bth .bb-thuy{background:var(--b-thuy)}
.bth-tru .sub td{background:#F6EEDB;color:var(--b-teal);font-size:11.5px;font-weight:600;text-transform:uppercase;letter-spacing:.3px;padding:3px;cursor:default}
.bth-tru .tang td{text-align:left;font-size:12.5px;padding:5px 2px 6px 5px}.bth-tru .tang div{line-height:1.35;margin-bottom:2px}
.bth .mu{color:var(--b-mu);font-weight:400}.bth-tru .tang .mu{font-size:12px}
.bth .be-moc{color:var(--b-moc)}.bth .be-hoa{color:var(--b-hoa)}.bth .be-tho{color:var(--b-tho)}.bth .be-kim{color:var(--b-kim)}.bth .be-thuy{color:var(--b-thuy)}
.bth-tb{font-size:13px}.bth-tb th,.bth-tb td{border:1px solid var(--b-gold-s);padding:4px 6px;text-align:left;background:transparent}
.bth-tb thead th{background:var(--b-teal);color:#F4E7C6;font-weight:600;font-size:12px}.bth-tb tbody th{color:var(--b-teal);font-weight:600;width:52px}
.bth .thuc{color:var(--b-moc);font-weight:700}.bth .hu{color:var(--b-hoa);font-weight:700}.bth .banhu{color:var(--b-pha);font-weight:700}
.bth-note{font-size:11.5px;color:var(--b-mu);margin-top:6px;margin-bottom:0}
.bth-box{border:1px solid var(--b-gold-s);border-radius:8px;margin-top:8px;overflow:hidden}
.bth-box h3{margin:0;background:var(--b-teal);color:#F4E7C6;font-size:12.5px;font-weight:600;padding:4px 8px;text-transform:uppercase;letter-spacing:.3px}
.bth-box h3.h-sinh{background:#3E7A5B}.bth-box h3.h-khac{background:#B04A43}
.bth-box h4{margin:6px 8px 0;font-size:12px;color:var(--b-mu)}
.bth-box ul{list-style:none;margin:0;padding:5px 8px}.bth-box li{padding:2px 0}
.bth .ar{font-weight:600;white-space:nowrap}.bth .ar.sinh{color:var(--b-moc)}.bth .ar.khac{color:var(--b-hoa)}.bth .ar.dong{color:var(--b-mu)}
.bth .hop{color:var(--b-hop)}.bth .xung{color:var(--b-xung)}.bth .hinh{color:var(--b-hinh)}.bth .hai{color:var(--b-hai)}.bth .pha{color:var(--b-pha)}
.bth-pairs{list-style:none;padding:0;margin-top:8px}.bth-pairs li{display:grid;grid-template-columns:118px 1fr;gap:6px;padding:4px 0;border-bottom:1px dotted var(--b-gold-s)}.bth-pairs .mu{font-size:12px}
.bth-dia{display:block;width:100%;max-width:360px;margin:8px auto 0}
.bth-dia .none{stroke:#CFC6B0;stroke-width:1.2;stroke-dasharray:4 4}.bth-dia .ed{stroke-width:2}
.bth-dia .ed.hop{stroke:var(--b-hop)}.bth-dia .ed.xung{stroke:var(--b-xung)}.bth-dia .ed.hinh{stroke:var(--b-hinh)}.bth-dia .ed.hai{stroke:var(--b-hai)}.bth-dia .ed.pha{stroke:var(--b-pha)}
.bth-dia .lb{font-size:12px;font-weight:600;text-anchor:middle;dominant-baseline:middle;paint-order:stroke;stroke:var(--b-card);stroke-width:4px}
.bth-dia .lb.hop{fill:var(--b-hop)}.bth-dia .lb.xung{fill:var(--b-xung)}.bth-dia .lb.hinh{fill:var(--b-hinh)}.bth-dia .lb.hai{fill:var(--b-hai)}.bth-dia .lb.pha{fill:var(--b-pha)}
.bth-dia .nd{fill:var(--b-card);stroke-width:2}.bth-dia .s-moc{stroke:var(--b-moc)}.bth-dia .s-hoa{stroke:var(--b-hoa)}.bth-dia .s-tho{stroke:var(--b-tho)}.bth-dia .s-kim{stroke:var(--b-kim)}.bth-dia .s-thuy{stroke:var(--b-thuy)}
.bth-dia .nt{font:700 19px var(--serif);text-anchor:middle;dominant-baseline:middle}
.bth-dia .nt.be-moc{fill:var(--b-moc)}.bth-dia .nt.be-hoa{fill:var(--b-hoa)}.bth-dia .nt.be-tho{fill:var(--b-tho)}.bth-dia .nt.be-kim{fill:var(--b-kim)}.bth-dia .nt.be-thuy{fill:var(--b-thuy)}
.bth-dia .ns{font-size:10.5px;fill:var(--b-mu);text-anchor:middle}
.bth-lks{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:8px}
.bth-lks .lk{border:1px solid var(--b-gold-s);border-radius:8px;overflow:hidden;font-size:12.5px;display:flex;flex-direction:column;background:#fff}
.bth-lks .lh{color:#fff;text-align:center;font-weight:600;padding:3px;text-transform:uppercase;font-size:12px;letter-spacing:.3px}
.bth-lks .lh.hop{background:var(--b-hop);color:#fff}.bth-lks .lh.xung{background:var(--b-xung);color:#fff}.bth-lks .lh.hai{background:var(--b-hai);color:#fff}.bth-lks .lh.hinh{background:var(--b-hinh);color:#fff}.bth-lks .lh.pha{background:var(--b-pha);color:#fff}
.bth-lks ul{list-style:none;margin:0;padding:4px 8px;flex:1;text-align:center}.bth-lks li{padding:1px 0}.bth-lks li small{color:var(--b-mu)}
.bth-lks li.on{background:#FFF1C9;font-weight:600;border-radius:4px}
.bth-lks .lf{border-top:1px solid var(--b-gold-s);background:#FAF4E4;padding:3px 6px;font-size:11.5px;text-align:center;color:var(--b-teal)}
.bth-facts{margin:8px 8px 0 8px!important;padding:0 0 0 30px}.bth-facts li{padding:3px 0 3px 2px;border-bottom:1px dotted var(--b-gold-s)}.bth-facts li::marker{color:var(--b-teal);font-weight:700}
@media (min-width:600px){.bth-info{grid-template-columns:1fr 1fr}.bth-lks{grid-template-columns:repeat(3,1fr)}}
/* Mục 5 bản 6c: chỉ quan hệ thực có (nguyên cục, Đại vận, năm) */
.bth-lks.bth-lks5{grid-template-columns:1fr}
.bth-lks5 ul.q5{text-align:left;padding:4px 8px}.bth-lks5 .q5 li{padding:4px 0;border-bottom:1px dotted var(--b-gold-s)}.bth-lks5 .q5 li:last-child{border-bottom:0}
.bth .src{display:inline-block;font-size:11px;color:var(--b-teal);background:var(--b-teal-s);border-radius:8px;padding:0 6px;margin-right:2px}
.bth-note5{font-size:12.5px;margin-top:8px}

/* ===== Màn hình chính – hai nút lớn (Phương án 1, Kendy 11/11/2026) ===== */
.bd-wrap { display: grid; gap: 16px; padding: 16px; min-height: calc(100vh - 170px); align-content: center; }
.bd-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 30vh; width: 100%;
  padding: 20px 16px; border: 2px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow); cursor: pointer; text-align: center; }
.bd-btn:active { background: var(--gold-soft); }
.bd-btn:focus-visible { outline: 3px solid var(--brand-gold); outline-offset: 2px; }
.bd-icon { font-size: 44px; line-height: 1; }
.bd-ten { font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: 1px; color: var(--gold-ink); }
.bd-ghi { font-size: 14px; color: var(--text-muted); max-width: 30ch; }
@media (max-width: 360px) { .bd-ten { font-size: 20px; } .bd-btn { min-height: 26vh; } }

/* ---------- TRANG CHỦ DẠNG DASHBOARD (mẫu Kendy duyệt 12/11/2026) – chỉ áp trong .dash ---------- */
.dash { --d-khung: color-mix(in srgb, var(--brand-primary) 30%, #031614); --d-o: color-mix(in srgb, var(--brand-primary) 18%, #021412);
  border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin-bottom: 12px;
  background: radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--brand-primary) 40%, #021c1a), #021412); box-shadow: inset 0 0 0 3px #021412, inset 0 0 0 4px var(--line-soft); }
.dash-dau { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 10px; border-bottom: 1px solid var(--line-soft); margin-bottom: 10px; }
.dash-thuonghieu { display: flex; align-items: center; gap: 8px; }
.dash-ten { font-family: var(--serif); color: var(--gold-ink); font-size: 20px; letter-spacing: 1.5px; font-weight: 600; }
.dash-phu { color: var(--text-muted); font-size: 11px; letter-spacing: .6px; text-transform: uppercase; }
.dash-cong-cu { display: flex; flex-wrap: wrap; gap: 6px; }
.dash-cong-cu .mini { border: 1px solid var(--line); color: var(--gold-ink); }
.dash-luoi { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.dash-khung { border: 1px solid var(--line); border-radius: 10px; background: var(--d-khung); padding: 8px 10px 10px; min-width: 0; }
.dash-tieude { margin: -8px -10px 8px; padding: 7px 10px; text-align: center; font-family: var(--serif); color: var(--gold-ink); font-size: 15px; letter-spacing: 1px; text-transform: uppercase;
  border-bottom: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--brand-gold) 14%, transparent), transparent); border-radius: 10px 10px 0 0; }
.dash-tieude small { text-transform: none; letter-spacing: 0; font-family: inherit; }
.dash-kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 6px; align-items: baseline; padding: 4px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13px; }
.dash-kv span { color: var(--gold-ink); font-size: 12px; }
.dash-kv b { font-weight: 500; overflow-wrap: anywhere; }
.dash-chugiai { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; padding-top: 6px; font-size: 12px; }
.dash-chugiai .dash-nho { width: 100%; }
.dash-nho { font-size: 11.5px; color: var(--text-muted); }
.dash-bang { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: center; }
.dash-bang th, .dash-bang td { border: 1px solid var(--line-soft); padding: 4px 2px; font-size: 12px; overflow-wrap: anywhere; }
.dash-bang thead th { color: var(--gold-ink); font-family: var(--serif); font-size: 14px; letter-spacing: .8px; text-transform: uppercase; background: color-mix(in srgb, var(--brand-gold) 10%, transparent); cursor: pointer; }
.dash-bang tbody th { width: 21%; color: var(--gold-ink); font-weight: 500; font-size: 11px; text-align: left; padding-left: 4px; }
.dash-bang td { background: var(--d-o); cursor: pointer; }
.dash-bang .dash-nc { background: color-mix(in srgb, var(--brand-gold) 16%, var(--d-o)); }
.dash-bang .dash-chu { font-family: var(--serif); font-size: 26px; font-weight: 700; line-height: 1.1; padding: 6px 2px; }
.dash-bang .dash-tt-o { font-weight: 600; color: var(--text); }
.dash-goiy { margin: 6px 0 0; font-size: 11.5px; color: var(--text-muted); }
/* Thần Sát: mỗi tên một dòng, không gãy giữa tên; hàng tự cao theo số lượng, không cắt bớt */
.dash-bang .dash-ts-o { vertical-align: top; }
.dash-ts { display: block; white-space: nowrap; line-height: 1.35; padding: 1px 0; }
.dash-ts + .dash-ts { border-top: 1px dotted var(--line-soft); }
.dash-the { border: 1px solid var(--line-soft); border-radius: 8px; padding: 0 8px 8px; margin-bottom: 8px; background: var(--d-o); }
.dash-the h3 { margin: 0 -8px 6px; padding: 5px 8px; font-size: 13.5px; color: var(--on-gold); text-align: center; border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--brand-gold) 92%, #fff), var(--brand-gold)); }
.dash-the p { margin: 4px 0; font-size: 13px; }
.dash-trong { color: var(--text-muted); font-style: italic; font-size: 12.5px; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.dash-chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 12px; background: color-mix(in srgb, var(--brand-gold) 8%, transparent); }
.dash-ds { margin: 0; padding-left: 18px; font-size: 13px; }
.dash-pt .ket-luan-bar { margin: 4px 0 0; text-align: center; }
.dash-duoi { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); margin-top: 10px; }
.dash-vans { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.dash-van { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; background: var(--d-o);
  box-shadow: inset 0 3px 0 var(--vien-tren), inset 0 -3px 0 var(--vien-duoi); }
.dash-van.cur { border-color: var(--brand-gold); }
.dash-van.sel { background: color-mix(in srgb, var(--brand-gold) 20%, var(--d-o)); outline: 2px solid var(--brand-gold); }
.dash-van-chon { background: none; border: 0; color: var(--text); padding: 7px 4px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.dash-tuoi { font-family: var(--serif); font-size: 20px; color: var(--gold-ink); font-weight: 700; }
.dash-gz { font-weight: 600; font-size: 14px; }
.dash-van-chon small { color: var(--text-muted); font-size: 10.5px; }
.dash-van-truoc .dash-van-chon { flex: 1; justify-content: center; }
.dash-van-truoc .dash-gz { font-size: 12px; color: var(--text-muted); }
.dash-van-ct { background: none; border: 0; border-top: 1px solid var(--line-soft); color: var(--gold-ink); font-size: 11px; padding: 4px; margin-bottom: 3px; cursor: pointer; }
.dash-nam { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.dash-nam-o { background: var(--d-o); border: 1px solid var(--line-soft); border-radius: 8px; color: var(--text); padding: 6px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; cursor: pointer; }
.dash-nam-o b { font-family: var(--serif); font-size: 18px; color: var(--gold-ink); }
.dash-nam-o.cur { border-color: var(--brand-gold); background: color-mix(in srgb, var(--brand-gold) 20%, var(--d-o)); }
.dash-chitiet { margin-bottom: 12px; }
@media (min-width: 1000px) {
  .dash { padding: 14px; }
  .dash-luoi { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.9fr) minmax(0, 1.15fr); }
  .dash-duoi { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
  .dash-bang .dash-chu { font-size: 34px; }
  .dash-bang th, .dash-bang td { font-size: 13px; }
}
@media (max-width: 560px) {
  .dash-bang .dash-chu { font-size: 19px; letter-spacing: 0; white-space: nowrap; }
  .dash-tuoi { font-size: 17px; }
}
@media (max-width: 400px) {
  .dash { padding: 6px; }
  .dash-bang .dash-chu { font-size: 17px; }
  .dash-bang th, .dash-bang td { font-size: 11px; padding: 3px 1px; }
  .dash-bang thead th { font-size: 12px; }
  .dash-ts { font-size: 10.5px; letter-spacing: -.1px; white-space: normal; overflow-wrap: break-word; }
  .dash-bang tbody th { width: 18%; font-size: 10px; }
}
/* Xuất báo cáo PDF: in riêng nội dung trang, bỏ thanh trên / dưới và nút bấm */
@media print {
  .topbar, .bottomnav, #bottomnav, .dash-cong-cu, .ket-luan-bar, .dash-van-ct, .dash-goiy, #toast { display: none !important; }
  body { background: #021412 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  main { max-width: none; padding: 0; }
  .dash { break-inside: avoid; }
}

/* Màn hình cảm ứng (điện thoại Samsung…): vùng chạm tối thiểu ~40px. Đặt cuối tệp vì các khối phía trên
   ghi đè lại cỡ nhỏ (đo thực tế: chọn Đại vận cao 16px, mã quy tắc 12px, Sửa / Xóa hồ sơ 24px). Máy tính dùng chuột giữ nguyên. */
@media (pointer: coarse) {
  #app .gold, #app .ghost, #app .btn, #app .big-tap, .sheet .gold, .sheet .ghost, .sheet .btn { min-height: 42px; }
  #app .mini, #app .mini-gold, .sheet .mini { min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
  #app .chip, .sheet .chip { min-height: 38px; display: inline-flex; align-items: center; padding: 4px 12px; }
  #app .rule-chip, .sheet .rule-chip { min-height: 30px; display: inline-flex; align-items: center; padding: 2px 8px; font-size: 11.5px; }
  #app summary, .sheet summary { min-height: 40px; }
  #app .seg-tabs .seg, #app .tabs button { min-height: 40px; }
  #app .readings .link { display: inline-block; min-height: 36px; padding: 8px 0; }
  .year-pick .ghost { min-width: 44px; }
}

/* Trang chủ – mạch phân tích (giai đoạn 1, 18/11/2026): đánh số bước, số thứ tự quan hệ để lĩnh vực trỏ ngược */
.dash-pt { counter-reset: buoc; }
.dash-pt .dash-the h3::before { counter-increment: buoc; content: counter(buoc) " · "; }
.dash-mach { text-align: center; }
.dash-qh-ds { list-style: none; margin: 4px 0; padding: 0; }
.dash-qh-dong { padding: 6px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.dash-qh-dong:first-child { border-top: 0; }
.dash-so { display: inline-block; min-width: 1.5em; padding: 0 4px; border-radius: 9px; border: 1px solid var(--line-soft); text-align: center; font-size: 12px; font-weight: 600; }
.dash-lv li { margin-bottom: 6px; }
/* Giai đoạn A (18/11/2026): một ý chính mỗi bước, chi tiết thu gọn */
.dash-ct { margin-top: 4px; font-size: 12.5px; }
.dash-ct > summary { color: var(--text-muted); font-size: 12px; cursor: pointer; }
.dash-cho { margin-top: 6px; }
