/* hoaithanh.css: Báo Giá CK96 (tenant hoaithanh), on kit v1.5.
   Holds only what the kit lacks (each block names its gap in KIT_GAPS.md, G1..G10; G11 is icons, no CSS) and layout glue for these screens.
   Colour, spacing, radius, type size and shadow are var(--*) tokens only; the diagram hues are tenant tokens in tokens.json
   (--hoaithanh-k1-* .. --hoaithanh-k5-*, --hoaithanh-gate-*), each checked for contrast (KIT_GAPS.md, "Tokens").
   No kit class is restyled. Delete a block when the kit gains the part it names. */

/* Hue of each step of the CK96-KEKT-03A diagram, read by G1, G2, G3. */
[class*="hoaithanh-"][data-khoi="k1"] { --hoaithanh-k-bg: var(--hoaithanh-k1-bg); --hoaithanh-k-head: var(--hoaithanh-k1-head); --hoaithanh-k-line: var(--hoaithanh-k1-line); }
[class*="hoaithanh-"][data-khoi="k2"] { --hoaithanh-k-bg: var(--hoaithanh-k2-bg); --hoaithanh-k-head: var(--hoaithanh-k2-head); --hoaithanh-k-line: var(--hoaithanh-k2-line); }
[class*="hoaithanh-"][data-khoi="cong-a"],
[class*="hoaithanh-"][data-khoi="cong-b"] { --hoaithanh-k-bg: var(--hoaithanh-gate-bg); --hoaithanh-k-head: var(--hoaithanh-gate-head); --hoaithanh-k-line: var(--hoaithanh-gate-line); }
[class*="hoaithanh-"][data-khoi="k3"] { --hoaithanh-k-bg: var(--hoaithanh-k3-bg); --hoaithanh-k-head: var(--hoaithanh-k3-head); --hoaithanh-k-line: var(--hoaithanh-k3-line); }
[class*="hoaithanh-"][data-khoi="k4"] { --hoaithanh-k-bg: var(--hoaithanh-k4-bg); --hoaithanh-k-head: var(--hoaithanh-k4-head); --hoaithanh-k-line: var(--hoaithanh-k4-line); }
[class*="hoaithanh-"][data-khoi="k5"] { --hoaithanh-k-bg: var(--hoaithanh-k5-bg); --hoaithanh-k-head: var(--hoaithanh-k5-head); --hoaithanh-k-line: var(--hoaithanh-k5-line); }

/* ------------------------------------------------------------------------------------------------
   G1 hoaithanh-khoi: "which step" badge in the step's own hue (Khối 1 light blue, Khối 2 purple, gates yellow,
   Khối 3 green, Khối 4 and 5 blue). Kit .tag has only the status tones. Statuses stay kit .tag. */
.hoaithanh-khoi {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-xs); font-weight: 600; line-height: var(--lh-tight);
  color: var(--primary); white-space: nowrap;
  background: var(--hoaithanh-k-bg); border: 1px solid var(--hoaithanh-k-line); border-radius: var(--radius-sm);
}
.hoaithanh-khoi .icon { flex: none; width: var(--icon-sm); height: var(--icon-sm); }
.tbl .hoaithanh-khoi { font-size: var(--fs-sm); }

/* ------------------------------------------------------------------------------------------------
   G2 hoaithanh-buoc: the quote's stepper drawn as the diagram (ASM-007): the same 7 shapes in order, khối as boxes,
   gates as yellow hexagons with the shield, blue arrows between, the two red return arrows under the row with their
   counts. Nearest kit part: ol.stepper (one look for every step, no gate shape, no return arrow). */
.hoaithanh-buoc { --hoaithanh-gap: var(--sp-5); container-type: inline-size; }
.hoaithanh-buoc-list {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: var(--hoaithanh-gap);
  margin: 0; padding: calc(var(--sp-6) + var(--sp-2)) 0 0; list-style: none;
}
.hoaithanh-buoc-item { position: relative; display: flex; min-width: 0; }
.hoaithanh-buoc-item + .hoaithanh-buoc-item::before {
  content: ""; position: absolute; top: 50%; inset-inline-start: calc(-1 * var(--hoaithanh-gap));
  width: var(--hoaithanh-gap); height: var(--hoaithanh-line); background: var(--primary); transform: translateY(-50%);
}
.hoaithanh-buoc-item + .hoaithanh-buoc-item::after {
  content: ""; position: absolute; top: 50%; inset-inline-start: calc(-1 * var(--hoaithanh-arrow));
  width: var(--hoaithanh-arrow); height: calc(var(--hoaithanh-arrow) * 1.4); background: var(--primary);
  clip-path: polygon(0 0, 100% 50%, 0 100%); transform: translateY(-50%);
}
.hoaithanh-buoc-shape {
  position: relative; z-index: 0;
  display: flex; flex: 1; align-items: center; gap: var(--sp-2); min-width: 0;
  min-height: calc(var(--tap) + var(--sp-5));
  padding: var(--sp-2) var(--sp-3);
  color: var(--primary); text-decoration: none;
  background: var(--hoaithanh-k-bg); border: var(--hoaithanh-line) solid var(--hoaithanh-k-line); border-radius: var(--radius);
}
a.hoaithanh-buoc-shape:hover { background: var(--hoaithanh-k-head); }
.hoaithanh-buoc-no {
  flex: none; display: grid; place-items: center; width: var(--hoaithanh-mark-w); height: var(--hoaithanh-mark-w);
  font-size: var(--fs-sm); font-weight: 700; color: var(--primary);
  background: var(--surface); border: var(--hoaithanh-line) solid var(--hoaithanh-k-line); border-radius: var(--radius-pill);
}
.hoaithanh-buoc-no .icon { width: var(--icon); height: var(--icon); }
.hoaithanh-buoc-text { display: flex; flex-direction: column; min-width: 0; line-height: var(--lh-tight); }
.hoaithanh-buoc-name { font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; }
.hoaithanh-buoc-sub { font-size: var(--fs-xs); color: var(--text); }
.hoaithanh-buoc-item[data-state="done"] .hoaithanh-buoc-no { color: var(--surface); background: var(--ok); border-color: var(--ok); }
.hoaithanh-buoc-item[data-state="current"] .hoaithanh-buoc-shape { background: var(--hoaithanh-k-head); border-width: var(--hoaithanh-line-strong); box-shadow: var(--sh-2); }
.hoaithanh-buoc-item[data-state="todo"] .hoaithanh-buoc-shape { color: var(--muted); background: var(--surface); border-style: dashed; }
.hoaithanh-buoc-item[data-state="todo"] .hoaithanh-buoc-sub { color: var(--muted); }
/* gates: a hexagon drawn by two clipped layers, so the focus ring of the link is not clipped */
.hoaithanh-buoc-item.hoaithanh-buoc-gate .hoaithanh-buoc-shape {
  --hoaithanh-hex: polygon(var(--hoaithanh-gate-notch) 0, calc(100% - var(--hoaithanh-gate-notch)) 0, 100% 50%, calc(100% - var(--hoaithanh-gate-notch)) 100%, var(--hoaithanh-gate-notch) 100%, 0 50%);
  padding-inline: calc(var(--hoaithanh-gate-notch) + var(--sp-1)) var(--hoaithanh-gate-notch);
  background: none; border: 0; border-radius: 0;
}
.hoaithanh-buoc-gate .hoaithanh-buoc-shape::before,
.hoaithanh-buoc-gate .hoaithanh-buoc-shape::after { content: ""; position: absolute; z-index: -1; clip-path: var(--hoaithanh-hex); }
.hoaithanh-buoc-gate .hoaithanh-buoc-shape::before { inset: 0; background: var(--hoaithanh-k-line); }
.hoaithanh-buoc-gate .hoaithanh-buoc-shape::after { inset: var(--hoaithanh-line); background: var(--hoaithanh-k-bg); }
.hoaithanh-buoc-gate[data-state="current"] .hoaithanh-buoc-shape { background: none; box-shadow: none; }
.hoaithanh-buoc-gate[data-state="current"] .hoaithanh-buoc-shape::after { inset: var(--hoaithanh-line-strong); background: var(--hoaithanh-k-head); }
.hoaithanh-buoc-gate[data-state="todo"] .hoaithanh-buoc-shape { background: none; }
.hoaithanh-buoc-gate[data-state="todo"] .hoaithanh-buoc-shape::after { background: var(--surface); }
.hoaithanh-buoc-gate .hoaithanh-buoc-no { border-radius: var(--radius-sm); }
/* the hexagon loses its notches to the text: a smaller mark leaves the words clear of the slanted edges */
.hoaithanh-buoc-item.hoaithanh-buoc-gate .hoaithanh-buoc-shape { gap: var(--sp-1); }
.hoaithanh-buoc-gate .hoaithanh-buoc-no { width: var(--hoaithanh-mark-w-sm); height: var(--hoaithanh-mark-w-sm); }
.hoaithanh-buoc-gate .hoaithanh-buoc-no .icon { width: var(--icon-sm); height: var(--icon-sm); }
/* "Đang ở đây" (a kit .tag) sits on the top edge of the current shape; it is a child of the li, so the hexagon never clips it */
.hoaithanh-buoc-here { position: absolute; z-index: 1; top: 0; inset-inline-start: 50%; transform: translate(-50%, calc(-100% - var(--sp-1))); }
[dir="rtl"] .hoaithanh-buoc-here { transform: translate(50%, calc(-100% - var(--sp-1))); }
.hoaithanh-buoc-item:first-child .hoaithanh-buoc-here { inset-inline-start: 0; transform: translateY(calc(-100% - var(--sp-1))); }
.hoaithanh-buoc-item:last-child .hoaithanh-buoc-here { inset-inline-start: auto; inset-inline-end: 0; transform: translateY(calc(-100% - var(--sp-1))); }
/* the two red return arrows under the row: Cổng A back to Khối 2, Cổng B back to Khối 3 */
.hoaithanh-buoc-loops { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: var(--hoaithanh-gap); margin-top: var(--sp-2); }
.hoaithanh-buoc-loop {
  position: relative; height: var(--sp-6);
  border: var(--hoaithanh-line) solid var(--hoaithanh-red); border-top: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.hoaithanh-buoc-loop[data-loop="a"] { grid-column: 2 / 4; margin-inline: calc((100% - var(--hoaithanh-gap)) / 4); }
.hoaithanh-buoc-loop[data-loop="b"] { grid-column: 4 / 7; margin-inline: calc((100% - 2 * var(--hoaithanh-gap)) / 6); }
.hoaithanh-buoc-loop::before {
  content: ""; position: absolute; top: calc(-1 * var(--hoaithanh-arrow) * 1.2);
  inset-inline-start: calc(-1 * var(--hoaithanh-arrow) / 2 - var(--hoaithanh-line) / 2);
  width: var(--hoaithanh-arrow); height: calc(var(--hoaithanh-arrow) * 1.2); background: var(--hoaithanh-red);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.hoaithanh-buoc-loop-label {
  position: absolute; bottom: 0; inset-inline-start: 50%; transform: translate(-50%, 50%);
  padding: 0 var(--sp-2); font-size: var(--fs-xs); font-weight: 600; line-height: var(--lh-tight);
  color: var(--hoaithanh-red); white-space: nowrap; background: var(--surface);
}
.hoaithanh-buoc-loop[data-count="0"] { border-color: var(--field-border); border-style: dashed; }
.hoaithanh-buoc-loop[data-count="0"]::before { background: var(--field-border); }
.hoaithanh-buoc-loop[data-count="0"] .hoaithanh-buoc-loop-label { color: var(--muted); }
/* the current step in words, under the row; only the phone shows it, where the shapes carry no text */
.hoaithanh-buoc-now { display: none; }
/* the custom properties go on the list and the loops: a container query styles what is inside .hoaithanh-buoc, not the box itself */
@container (max-width: 60rem) {
  .hoaithanh-buoc-list, .hoaithanh-buoc-loops { --hoaithanh-gap: var(--sp-3); }
  .hoaithanh-buoc-item:not([data-state="current"]) .hoaithanh-buoc-sub { display: none; }
  .hoaithanh-buoc-loop-long { display: none; }
}
/* phone: shapes only, at a fixed size so the row fits 7 across (5 boxes, 2 hexagons); the loops use the same columns */
@container (max-width: 40rem) {
  .hoaithanh-buoc-list, .hoaithanh-buoc-loops {
    --hoaithanh-gap: var(--sp-2);
    --hoaithanh-gate-notch: var(--hoaithanh-gate-notch-sm);
    --hoaithanh-box-w: calc(var(--hoaithanh-mark-w-sm) + 2 * var(--sp-1) + 2 * var(--hoaithanh-line-strong));
    --hoaithanh-gate-w: calc(var(--hoaithanh-mark-w-sm) + 2 * var(--hoaithanh-gate-notch-sm));
    grid-template-columns: var(--hoaithanh-box-w) var(--hoaithanh-box-w) var(--hoaithanh-gate-w) var(--hoaithanh-box-w) var(--hoaithanh-box-w) var(--hoaithanh-gate-w) var(--hoaithanh-box-w);
    justify-content: space-between;
  }
  .hoaithanh-buoc-shape { justify-content: center; min-height: var(--tap); padding: var(--sp-1); }
  .hoaithanh-buoc-no { width: var(--hoaithanh-mark-w-sm); height: var(--hoaithanh-mark-w-sm); font-size: var(--fs-xs); }
  .hoaithanh-buoc-no .icon { width: var(--icon-sm); height: var(--icon-sm); }
  .hoaithanh-buoc-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .hoaithanh-buoc-item.hoaithanh-buoc-gate .hoaithanh-buoc-shape { padding-inline: var(--hoaithanh-gate-notch); }
  .hoaithanh-buoc-loop[data-loop] { margin-inline: calc(var(--hoaithanh-box-w) / 2) calc(var(--hoaithanh-gate-w) / 2); }
  .hoaithanh-buoc-now { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-3) 0 0; font-size: var(--fs-sm); color: var(--primary); }
  .hoaithanh-buoc-now .icon { width: var(--icon-sm); height: var(--icon-sm); }
}

/* ------------------------------------------------------------------------------------------------
   G3 hoaithanh-sodo: the "Sơ đồ quy trình" redrawn as the customer's picture CK96-KEKT-03A (REQ-008, ASM-007):
   header band, red title band, the 7 blocks with their sub-boxes, blue arrows, the red return arrows in a gutter at
   the left with their labels, and the six side panes. data-mode="thu-nho" is the mini diagram of Tổng quan (counts
   per block, no sub-boxes). No kit part draws a process diagram. */
.hoaithanh-sodo { margin: 0; color: var(--text); background: var(--surface); border: 1px solid var(--panel-border); border-radius: var(--radius-lg); padding: var(--sp-5); }
.hoaithanh-sodo-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-4) var(--sp-6); padding-bottom: var(--sp-4); }
.hoaithanh-sodo-org { display: flex; align-items: center; gap: var(--sp-3); padding-inline-end: var(--sp-6); border-inline-end: var(--hoaithanh-line) solid var(--primary); }
.hoaithanh-sodo-org img { display: block; width: auto; height: calc(var(--hoaithanh-logo-h) * 1.6); }
.hoaithanh-sodo-org-name { margin: 0; font-size: var(--fs-xl); font-weight: 700; line-height: var(--lh-tight); color: var(--primary); text-transform: uppercase; }
.hoaithanh-sodo-title { flex: 1 1 28rem; min-width: 0; text-align: center; }
.hoaithanh-sodo-title h2 { margin: 0; font-size: var(--fs-2xl); font-weight: 700; line-height: var(--lh-tight); color: var(--primary); text-transform: uppercase; }
.hoaithanh-sodo-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); padding: var(--sp-1) var(--sp-5);
  font-size: var(--fs-lg); font-weight: 700; color: var(--on-primary); background: var(--primary); border-radius: var(--radius-pill);
}
.hoaithanh-sodo-lead { margin: var(--sp-2) 0 0; font-style: italic; color: var(--text); }
.hoaithanh-sodo-ver { padding: var(--sp-2) var(--sp-4); font-weight: 600; line-height: var(--lh); color: var(--primary); background: var(--primary-tint); border: 1px solid var(--primary-tint-line); border-radius: var(--radius); }
.hoaithanh-sodo-ver p { margin: 0; }
.hoaithanh-sodo-grid { display: grid; grid-template-columns: var(--hoaithanh-sodo-pane-w) minmax(0, 1fr) var(--hoaithanh-sodo-pane-w-r); gap: var(--sp-4); align-items: start; }
/* The full diagram measures itself (the S1 mini, data-mode="thu-nho", does not): side panes keep their widest size only while the
   figure is wide; narrower, they drop to their least width so the centre keeps the room the blocks need; narrower still, the right
   panes go under the flow, two side by side (the left panes stay beside it, as in the picture). */
.hoaithanh-sodo:not([data-mode]) { container: hoaithanh-sodo / inline-size; }
.hoaithanh-sodo-centre { min-width: 0; container: hoaithanh-flow / inline-size; }
@container hoaithanh-sodo (max-width: 80rem) {
  .hoaithanh-sodo-grid { grid-template-columns: var(--hoaithanh-sodo-pane-min) minmax(0, 1fr) var(--hoaithanh-sodo-pane-min-r); }
}
@container hoaithanh-sodo (max-width: 62rem) {
  .hoaithanh-sodo-grid { grid-template-columns: var(--hoaithanh-sodo-pane-min) minmax(0, 1fr); }
  .hoaithanh-sodo-grid > .hoaithanh-sodo-side:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
.hoaithanh-sodo-side { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
.hoaithanh-sodo-pane { border: var(--hoaithanh-line) solid var(--primary-tint-line); border-radius: var(--radius-lg); overflow: hidden; }
.hoaithanh-sodo-pane-head {
  display: flex; align-items: center; gap: var(--sp-2); margin: 0; padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-md); font-weight: 700; line-height: var(--lh-tight); color: var(--on-primary); text-transform: uppercase;
  background: var(--primary);
}
.hoaithanh-sodo-pane-head .icon { flex: none; }
.hoaithanh-sodo-pane-body { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3); font-size: var(--fs-sm); line-height: var(--lh-tight); }
.hoaithanh-sodo-pane-body p { margin: 0; }
.hoaithanh-sodo-note { padding: var(--sp-2) var(--sp-3); background: var(--hoaithanh-gate-bg); border: 1px solid var(--hoaithanh-gate-line); border-radius: var(--radius); }
.hoaithanh-sodo-note-red { background: var(--surface); border-color: var(--hoaithanh-red); }
.hoaithanh-sodo-em { font-weight: 700; color: var(--hoaithanh-red); }
.hoaithanh-sodo-syms { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-1) var(--sp-2); margin: 0; }
.hoaithanh-sodo-syms dt { font-weight: 700; color: var(--primary); }
.hoaithanh-sodo-syms dd { margin: 0; }
.hoaithanh-sodo-forms { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
.hoaithanh-sodo-steps { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.hoaithanh-sodo-steps > li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-2); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--panel-border); }
.hoaithanh-sodo-steps > li:last-child { padding-bottom: 0; border-bottom: 0; }
.hoaithanh-sodo-steps strong { color: var(--primary); }
.hoaithanh-sodo-steps ul { margin: var(--sp-1) 0 0; padding-inline-start: var(--sp-4); }
.hoaithanh-sodo-n {
  display: grid; place-items: center; width: var(--hoaithanh-mark-w); height: var(--hoaithanh-mark-w);
  font-weight: 700; color: var(--primary); background: var(--hoaithanh-k-bg); border: var(--hoaithanh-line) solid var(--hoaithanh-k-line); border-radius: var(--radius-pill);
}
.hoaithanh-sodo-factors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
.hoaithanh-sodo-factor { border: 1px solid var(--hoaithanh-k-line); border-radius: var(--radius); overflow: hidden; }
.hoaithanh-sodo-factor-h { margin: 0; padding: var(--sp-2); font-size: var(--fs-sm); line-height: var(--lh-tight); text-align: center; color: var(--primary); background: var(--hoaithanh-k-head); }
.hoaithanh-sodo-factor-sale .hoaithanh-sodo-factor-h { color: var(--hoaithanh-red); background: var(--danger-bg); }
.hoaithanh-sodo-factor-sale { border-color: var(--hoaithanh-red); }
.hoaithanh-sodo-factor .hoaithanh-list-ic { padding: var(--sp-2); }
/* the centre column: title band, then a grid of [gutter for the red arrows][blocks] */
.hoaithanh-sodo-band {
  margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-4); font-size: var(--fs-lg); font-weight: 700; line-height: var(--lh-tight);
  text-align: center; text-transform: uppercase; color: var(--surface); background: var(--hoaithanh-red); border-radius: var(--radius-lg);
}
.hoaithanh-sodo-flow { --hoaithanh-gate-mx: var(--sp-6); display: grid; grid-template-columns: var(--hoaithanh-sodo-gutter) minmax(0, 1fr); margin: 0; padding: 0; list-style: none; }
.hoaithanh-sodo-flow > .hoaithanh-sodo-row { display: contents; }
.hoaithanh-sodo-cell { grid-column: 2; min-width: 0; }
.hoaithanh-sodo-gut { position: relative; grid-column: 1; min-height: var(--sp-1); }
.hoaithanh-sodo-khoi {
  position: relative; display: block; padding: var(--sp-2) var(--sp-3) var(--sp-3);
  color: var(--text); text-decoration: none;
  background: var(--hoaithanh-k-bg); border: var(--hoaithanh-line) solid var(--hoaithanh-k-line); border-radius: var(--radius-lg);
}
a.hoaithanh-sodo-khoi:hover { box-shadow: var(--sh-2); }
.hoaithanh-sodo-khoi-head {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  margin: 0 auto var(--sp-2); padding: var(--sp-1) var(--sp-4); width: fit-content; max-width: 100%;
  color: var(--primary); background: var(--hoaithanh-k-head); border: 1px solid var(--hoaithanh-k-line); border-radius: var(--radius);
}
.hoaithanh-sodo-khoi-head > .icon { flex: none; width: var(--icon-lg); height: var(--icon-lg); }
.hoaithanh-sodo-khoi-title { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; line-height: var(--lh-tight); }
.hoaithanh-sodo-khoi-title strong { font-size: var(--fs-lg); font-weight: 700; text-transform: uppercase; }
.hoaithanh-sodo-khoi-title span { font-size: var(--fs-sm); color: var(--text); }
.hoaithanh-sodo-excel { color: var(--hoaithanh-excel); }
.hoaithanh-sodo-subs { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
/* sub-boxes per block as the picture draws them (Khối 1 six, Khối 2 four, Khối 3 four cost cards, Khối 4 three sheets); the
   container steps at the end of this block wrap them when the flow is narrow, so no word breaks and no figure is cut */
.hoaithanh-sodo-khoi[data-khoi="k1"] > .hoaithanh-sodo-subs { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.hoaithanh-sodo-khoi[data-khoi="k2"] > .hoaithanh-sodo-subs,
.hoaithanh-sodo-khoi[data-khoi="k3"] > .hoaithanh-sodo-subs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hoaithanh-sodo-khoi[data-khoi="k4"] > .hoaithanh-sodo-subs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hoaithanh-sodo-subs > li {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-1); min-width: 0;
  padding: var(--sp-2) var(--sp-1); font-size: var(--fs-xs); line-height: var(--lh-tight); text-align: center;
  background: var(--surface); border: 1px solid var(--hoaithanh-k-line); border-radius: var(--radius);
}
.hoaithanh-sodo-subs > li > .icon { width: var(--icon-lg); height: var(--icon-lg); color: var(--primary); }
.hoaithanh-sodo-subs > li.hoaithanh-sodo-cost { align-items: stretch; justify-content: flex-start; text-align: start; padding: var(--sp-2); }
.hoaithanh-sodo-cost strong { display: flex; align-items: center; justify-content: center; gap: var(--sp-1); font-size: var(--fs-sm); color: var(--primary); }
.hoaithanh-sodo-cost ul { margin: var(--sp-1) 0 0; padding-inline-start: var(--sp-3); }
.hoaithanh-sodo-total {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: var(--sp-1) var(--sp-3);
  margin: var(--sp-2) auto 0; padding: var(--sp-1) var(--sp-4); width: fit-content; max-width: 100%;
  font-weight: 700; color: var(--primary); background: var(--hoaithanh-gate-bg); border: 1px solid var(--hoaithanh-gate-line); border-radius: var(--radius);
}
.hoaithanh-sodo-total b { font-size: var(--fs-lg); }
.hoaithanh-sodo-total small { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
/* a gate: yellow hexagon with the shield, two clipped layers as in G2 */
.hoaithanh-sodo-gate {
  --hoaithanh-hex: polygon(var(--hoaithanh-gate-notch) 0, calc(100% - var(--hoaithanh-gate-notch)) 0, 100% 50%, calc(100% - var(--hoaithanh-gate-notch)) 100%, var(--hoaithanh-gate-notch) 100%, 0 50%);
  position: relative; z-index: 0; display: flex; align-items: center; justify-content: center; gap: var(--sp-3);
  margin-inline: var(--hoaithanh-gate-mx, var(--sp-6)); padding: var(--sp-2) calc(var(--hoaithanh-gate-notch) + var(--sp-3));
  color: var(--primary); text-decoration: none;
}
.hoaithanh-sodo-gate::before, .hoaithanh-sodo-gate::after { content: ""; position: absolute; z-index: -1; clip-path: var(--hoaithanh-hex); }
.hoaithanh-sodo-gate::before { inset: 0; background: var(--hoaithanh-k-line); }
.hoaithanh-sodo-gate::after { inset: var(--hoaithanh-line); background: var(--hoaithanh-k-bg); }
.hoaithanh-sodo-gate > .icon { flex: none; width: calc(var(--icon-lg) * 1.5); height: calc(var(--icon-lg) * 1.5); }
.hoaithanh-sodo-gate-text { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; line-height: var(--lh-tight); }
.hoaithanh-sodo-gate-text strong { font-size: var(--fs-lg); font-weight: 700; text-transform: uppercase; }
.hoaithanh-sodo-gate-text span { font-size: var(--fs-sm); color: var(--text); }
/* arrows between blocks; "✓ Đạt" beside the arrow under a gate */
.hoaithanh-sodo-arrow { position: relative; display: flex; align-items: center; justify-content: center; min-height: var(--sp-6); }
.hoaithanh-sodo-arrow::before { content: ""; position: absolute; top: 0; bottom: var(--hoaithanh-arrow); inset-inline-start: 50%; width: var(--hoaithanh-line-strong); background: var(--primary); transform: translateX(-50%); }
.hoaithanh-sodo-arrow::after { content: ""; position: absolute; bottom: 0; inset-inline-start: 50%; width: calc(var(--hoaithanh-arrow) * 2); height: calc(var(--hoaithanh-arrow) * 1.4); background: var(--primary); clip-path: polygon(0 0, 100% 0, 50% 100%); transform: translateX(-50%); }
.hoaithanh-sodo-arrow-dat { min-height: var(--sp-8); }
.hoaithanh-sodo-dat { display: inline-flex; align-items: center; gap: var(--sp-1); margin-inline-start: calc(var(--sp-8) + var(--sp-4)); font-size: var(--fs-lg); font-weight: 700; color: var(--ok); }
/* the red return arrows: three kinds of gutter cell. end (at the khối: arrowhead into the block), mid (straight down), start (at the gate, with the label) */
.hoaithanh-sodo-loop { --hoaithanh-x: 35%; }
.hoaithanh-sodo-loop::before, .hoaithanh-sodo-loop::after { content: ""; position: absolute; background: var(--hoaithanh-red); }
.hoaithanh-sodo-loop[data-part="mid"]::before { top: 0; bottom: 0; inset-inline-start: var(--hoaithanh-x); width: var(--hoaithanh-line-strong); }
.hoaithanh-sodo-loop[data-part="end"]::before { top: 50%; bottom: 0; inset-inline-start: var(--hoaithanh-x); width: var(--hoaithanh-line-strong); }
.hoaithanh-sodo-loop[data-part="start"]::before { top: 0; bottom: 50%; inset-inline-start: var(--hoaithanh-x); width: var(--hoaithanh-line-strong); }
.hoaithanh-sodo-loop[data-part="end"]::after,
.hoaithanh-sodo-loop[data-part="start"]::after { top: 50%; inset-inline-start: var(--hoaithanh-x); inset-inline-end: 0; height: var(--hoaithanh-line-strong); transform: translateY(-50%); }
.hoaithanh-sodo-loop[data-part="end"]::after { inset-inline-end: calc(var(--hoaithanh-arrow) * 1.4); }
.hoaithanh-sodo-loop[data-part="start"]::after { inset-inline-end: calc(-1 * var(--hoaithanh-gate-mx, var(--sp-6))); }
.hoaithanh-sodo-tip { position: absolute; top: 50%; inset-inline-end: 0; width: calc(var(--hoaithanh-arrow) * 1.4); height: calc(var(--hoaithanh-arrow) * 2); background: var(--hoaithanh-red); clip-path: polygon(0 0, 100% 50%, 0 100%); transform: translateY(-50%); }
.hoaithanh-sodo-loop-label {
  position: absolute; z-index: 1; top: calc(50% + var(--sp-2)); inset-inline-start: 0; inset-inline-end: var(--sp-1);
  padding: var(--sp-1); font-size: var(--fs-xs); font-weight: 700; line-height: var(--lh-tight); text-align: center;
  color: var(--hoaithanh-red); background: var(--surface); border: 1px solid var(--hoaithanh-red); border-radius: var(--radius);
}
.hoaithanh-sodo-loop-label span { display: block; font-weight: 500; }
.hoaithanh-sodo-loop-count { display: block; margin-top: var(--sp-1); padding-top: var(--sp-1); font-weight: 700; border-top: 1px dashed var(--hoaithanh-red); }
/* a quote is chosen: blocks still to come are outlines, the current one is ringed and tagged, passed ones keep their fill */
.hoaithanh-sodo-khoi[data-state="todo"], .hoaithanh-sodo-gate[data-state="todo"] { color: var(--muted); }
.hoaithanh-sodo-khoi[data-state="todo"] { background: var(--surface); border-style: dashed; }
.hoaithanh-sodo-khoi[data-state="todo"] .hoaithanh-sodo-khoi-head { background: var(--surface); }
.hoaithanh-sodo-gate[data-state="todo"]::after { background: var(--surface); }
.hoaithanh-sodo-khoi[data-state="current"] { border-width: var(--hoaithanh-line-strong); box-shadow: 0 0 0 var(--sp-1) var(--hoaithanh-k-head); }
.hoaithanh-sodo-mark { position: absolute; top: 0; inset-inline-end: var(--sp-3); transform: translateY(-50%); }
.hoaithanh-sodo-gate .hoaithanh-sodo-mark { inset-inline-end: calc(var(--hoaithanh-gate-notch) + var(--sp-3)); }
.hoaithanh-sodo-gate:has(> .hoaithanh-sodo-mark) { padding-top: var(--sp-5); }
/* mini diagram for Tổng quan */
.hoaithanh-sodo[data-mode="thu-nho"] { --hoaithanh-sodo-gutter: var(--hoaithanh-sodo-mini-gutter); padding: 0; border: 0; border-radius: 0; background: none; }
.hoaithanh-sodo[data-mode="thu-nho"] .hoaithanh-sodo-khoi { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); }
.hoaithanh-sodo[data-mode="thu-nho"] .hoaithanh-sodo-khoi > .icon { flex: none; width: var(--icon-lg); height: var(--icon-lg); color: var(--primary); }
.hoaithanh-sodo[data-mode="thu-nho"] .hoaithanh-sodo-gate { margin-inline: var(--sp-3); padding-block: var(--sp-2); justify-content: flex-start; gap: var(--sp-3); }
.hoaithanh-sodo[data-mode="thu-nho"] .hoaithanh-sodo-gate > .icon { width: var(--icon-lg); height: var(--icon-lg); }
.hoaithanh-sodo-mini-name { flex: 1; min-width: 0; line-height: var(--lh-tight); color: var(--primary); }
.hoaithanh-sodo-mini-name strong { display: block; font-size: var(--fs-md); }
.hoaithanh-sodo-mini-name span { font-size: var(--fs-sm); color: var(--text); }
.hoaithanh-sodo-count { flex: none; min-width: var(--hoaithanh-mark-w); font-size: var(--fs-xl); font-weight: 700; text-align: end; color: var(--primary); font-variant-numeric: tabular-nums; }
.hoaithanh-sodo-count small { font-size: var(--fs-xs); font-weight: 500; color: var(--text); }
.hoaithanh-sodo[data-mode="thu-nho"] .hoaithanh-sodo-arrow { min-height: var(--sp-4); }
.hoaithanh-sodo[data-mode="thu-nho"] .hoaithanh-sodo-loop-label { inset-inline-end: 0; padding: var(--sp-1) 0; }
/* the centre flow measures itself: a narrower gutter and gate margin, then fewer sub-boxes per row */
@container hoaithanh-flow (max-width: 48rem) {
  .hoaithanh-sodo-flow { --hoaithanh-sodo-gutter: var(--hoaithanh-sodo-mini-gutter); --hoaithanh-gate-mx: var(--sp-2); }
  .hoaithanh-sodo-loop-label { inset-inline-end: 0; padding-inline: 0; }
}
@container hoaithanh-flow (max-width: 38rem) {
  .hoaithanh-sodo-khoi[data-khoi="k1"] > .hoaithanh-sodo-subs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hoaithanh-sodo-khoi[data-khoi="k2"] > .hoaithanh-sodo-subs,
  .hoaithanh-sodo-khoi[data-khoi="k3"] > .hoaithanh-sodo-subs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container hoaithanh-flow (max-width: 24rem) {
  .hoaithanh-sodo-khoi[data-khoi="k1"] > .hoaithanh-sodo-subs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hoaithanh-sodo-khoi[data-khoi="k3"] > .hoaithanh-sodo-subs,
  .hoaithanh-sodo-khoi[data-khoi="k4"] > .hoaithanh-sodo-subs { grid-template-columns: minmax(0, 1fr); }
}
/* phone: one column, the panes become kit fold panels after the flow */
@media (max-width: 64rem) {
  .hoaithanh-sodo-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 40rem) {
  .hoaithanh-sodo { --hoaithanh-sodo-gutter: var(--hoaithanh-sodo-mini-gutter); padding: var(--sp-3); }
  .hoaithanh-sodo-org { padding-inline-end: 0; border-inline-end: 0; }
  .hoaithanh-sodo-title h2 { font-size: var(--fs-lg); }
  .hoaithanh-sodo-pill { font-size: var(--fs-sm); padding-inline: var(--sp-3); }
  .hoaithanh-sodo-band { font-size: var(--fs-sm); }
  .hoaithanh-sodo-khoi-title strong, .hoaithanh-sodo-gate-text strong { font-size: var(--fs-sm); }
  .hoaithanh-sodo-gate > .icon { width: var(--icon-lg); height: var(--icon-lg); }
  .hoaithanh-sodo-loop-label { inset-inline-end: 0; }
  .hoaithanh-sodo-dat { margin-inline-start: var(--sp-8); }
  .hoaithanh-sodo[data-mode="thu-nho"] .hoaithanh-sodo-gate { margin-inline: 0; padding-inline: calc(var(--hoaithanh-gate-notch) + var(--sp-1)); gap: var(--sp-2); }
}

/* ------------------------------------------------------------------------------------------------
   G4 hoaithanh-list-ic: a list whose lines start with an icon (✓ Mục tiêu, gate hints ✓ / ! / ✕). Kit has no
   icon list; .work-list is for rows that open something. The icon tone repeats the word, never alone. */
.hoaithanh-list-ic { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.hoaithanh-list-ic > li { display: flex; align-items: flex-start; gap: var(--sp-2); min-width: 0; }
.hoaithanh-list-ic > li > .icon { flex: none; width: var(--icon-sm); height: var(--icon-sm); margin-top: var(--sp-1); color: var(--muted); }
.hoaithanh-list-ic > li[data-tone="ok"] > .icon { color: var(--ok); }
.hoaithanh-list-ic > li[data-tone="warn"] > .icon { color: var(--warn); }
.hoaithanh-list-ic > li[data-tone="bad"] > .icon { color: var(--danger); }
.hoaithanh-list-ic > li[data-tone="info"] > .icon { color: var(--info); }
.hoaithanh-list-ic > li > div { min-width: 0; }

/* ------------------------------------------------------------------------------------------------
   G5 hoaithanh-giay: the CK96 quote form ("BẢNG BÁO GIÁ") inside a kit .paper: logo, red company name and address
   lines, the yellow dashed rule, the two-column info box, the STT / DIỄN GIẢI / ĐVT / SL / ĐƠN GIÁ / THÀNH TIỀN grid
   and the signature block (REQ-022, ASM-028). Kit .paper-head is a black letterhead with no coloured name or rule. */
/* overflow: clip keeps the turned kit .paper-watermark inside the sheet: turned, its box is wider than the paper and
   widened the stage by 250 px (KIT_GAPS.md, Defects D4). */
.hoaithanh-giay { font-family: var(--hoaithanh-paper-font); font-size: var(--hoaithanh-doc-fs); overflow: clip; }
.hoaithanh-giay-head { display: grid; grid-template-columns: var(--hoaithanh-doc-logo) minmax(0, 1fr); gap: var(--hoaithanh-doc-gap); align-items: center; padding-bottom: var(--hoaithanh-doc-gap); border-bottom: var(--hoaithanh-doc-rule) dashed var(--hoaithanh-yellow); }
.hoaithanh-giay-head img { display: block; width: 100%; height: auto; }
.hoaithanh-giay-org { color: var(--hoaithanh-red); }
.hoaithanh-giay-org p { margin: 0; }
.hoaithanh-giay-name { font-size: var(--hoaithanh-doc-name); font-weight: 700; text-align: center; text-transform: uppercase; }
.hoaithanh-giay-lines { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--hoaithanh-doc-gap); }
.hoaithanh-giay-title { margin: var(--hoaithanh-doc-gap) 0; font-size: var(--hoaithanh-doc-title); font-weight: 700; text-align: center; text-transform: uppercase; }
.hoaithanh-giay-tbl { width: 100%; border-collapse: collapse; font-size: inherit; }
.hoaithanh-giay-tbl th, .hoaithanh-giay-tbl td { padding: var(--hoaithanh-doc-cell); vertical-align: top; text-align: start; border: 0.3mm solid currentColor; }
.hoaithanh-giay-tbl thead th { font-weight: 700; text-align: center; vertical-align: middle; text-transform: uppercase; }
.hoaithanh-giay-tbl .hoaithanh-giay-num { text-align: end; white-space: nowrap; }
.hoaithanh-giay-tbl .hoaithanh-giay-c { text-align: center; }
.hoaithanh-giay-tbl tfoot th { text-align: end; }
.hoaithanh-giay-tbl tfoot td, .hoaithanh-giay-tbl tfoot th { font-weight: 700; }
/* the amount in words under Tổng thanh toán (ASM-028), and a quote number that never breaks */
.hoaithanh-giay-tbl .hoaithanh-giay-chu { font-style: italic; font-weight: 400; }
.hoaithanh-giay-so { white-space: nowrap; }
.hoaithanh-giay-info th { width: 22%; font-weight: 700; white-space: nowrap; }
.hoaithanh-giay-dg { margin: 0; padding: 0; list-style: none; }
.hoaithanh-giay-dg li + li { font-size: var(--hoaithanh-doc-fs-sm); }
.hoaithanh-giay p { margin: var(--hoaithanh-doc-gap) 0 0; }
.hoaithanh-giay-terms { margin: var(--hoaithanh-doc-gap) 0 0; padding: 0; list-style: none; }
.hoaithanh-giay-terms li::before { content: "* "; }
.hoaithanh-giay-sign { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: var(--hoaithanh-doc-gap); }
.hoaithanh-giay-sign div:last-child { text-align: center; }
.hoaithanh-giay-sign-space { height: 18mm; }

/* ------------------------------------------------------------------------------------------------
   G7 hoaithanh-frac: a fraction written as the diagram writes it (P = Z over 1 − m − h). */
.hoaithanh-frac { display: inline-grid; vertical-align: middle; text-align: center; line-height: var(--lh-tight); }
.hoaithanh-frac > span:first-child { padding: 0 var(--sp-1); border-bottom: var(--hoaithanh-line) solid currentColor; }
.hoaithanh-cong-thuc { font-weight: 600; color: var(--primary); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------------------------------------
   G8 hoaithanh-rail: the Z / P rail of Khối 3 (A · B · C · D · Z · m · h · P): kit dl rows with the formula under
   each total. Layout glue only: figures in tabular digits that never wrap, the big ones for Z and the price. */
.hoaithanh-rail-fig, .hoaithanh-rail-big { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hoaithanh-rail-big { font-size: var(--fs-xl); font-weight: 700; color: var(--primary); }

/* ------------------------------------------------------------------------------------------------
   Layout glue */
/* G10 hoaithanh-cell-wide: the least width of a text column: a typed name in a sheet row (the kit gives a .cell-input
   without size the least width) and the name column of a plain table, so the money columns do not squeeze it to a word per line */
.hoaithanh-cell-wide { min-width: var(--hoaithanh-cell-wide); }
/* G12 hoaithanh-cols-eq / hoaithanh-col-fill: side-by-side columns that end on one line (Tổng quan: Sơ đồ quy trình
   beside Việc chờ). Kit .page-cols aligns its columns to the top and gives no way to stretch them; the last panel of
   each column takes the rest of the height. */
.hoaithanh-cols-eq { align-items: stretch; }
.hoaithanh-col-fill { display: flex; flex-direction: column; gap: var(--sp-4); }
.hoaithanh-col-fill > :last-child { flex: 1 1 auto; }
.hoaithanh-row-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.hoaithanh-split { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); }
/* G9 hoaithanh-pop: a bare popover box around the kit .notif-pop. Kit .notif-pop sets display: grid, which beats the browser's hidden
   state of [popover], so on its own it never closes (KIT_GAPS.md, Defects). The wrapper takes the popover role instead. */
.hoaithanh-pop { inset: auto; margin: 0; padding: 0; overflow: visible; background: none; border: 0; }
.hoaithanh-sodo-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); }
/* G6 hoaithanh-login-page: a grid box that lets the kit .login-split fill the window. The kit defines .login-split twice; the
   later rule (the phone sign-in on a desktop) sets min-height: 30rem, so the split sign-in stops short of the window's foot
   (KIT_GAPS.md, Defects). The wrapper only stretches it. */
.hoaithanh-login-page { display: grid; min-height: 100dvh; }
@media print {
  .hoaithanh-sodo { page: a4-land-flow; zoom: 0.5; border: 0; }
}
