/* ============ Design tokens ============ */
:root {
  --bg: #f4f5fa;
  --surface: #ffffff;
  --surface-2: #eef0f8;
  --text: #141a2e;
  --muted: #4a5270;
  --border: #d5d9e8;
  --primary: #3538c9;
  --primary-hover: #2a2da8;
  --primary-soft: #e8e9fb;
  --on-primary: #ffffff;
  --focus: #1a5fd6;

  --ok: #0b6b43;       --ok-bg: #def5e8;
  --warn: #7a4b00;     --warn-bg: #fff0cc;
  --danger: #a8231b;   --danger-bg: #fde5e2;
  --info: #1d4f9f;     --info-bg: #e2ecfb;

  --sev-high: #a8231b;   --sev-high-bg: #fde5e2;
  --sev-med: #7a4b00;    --sev-med-bg: #fff0cc;
  --sev-low: #1d4f9f;    --sev-low-bg: #e2ecfb;

  --s1: #3538c9; --s2: #0b7a6a; --s3: #b25a00;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(20, 26, 46, .06), 0 4px 14px rgba(20, 26, 46, .05);
  --gap: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1120;
    --surface: #171b30;
    --surface-2: #1f2440;
    --text: #eceffa;
    --muted: #aab1cf;
    --border: #2e3558;
    --primary: #8a8dff;
    --primary-hover: #a5a8ff;
    --primary-soft: #262a52;
    --on-primary: #0e1120;
    --focus: #7db0ff;
    --ok: #62d9a1;      --ok-bg: #12332a;
    --warn: #ffcf70;    --warn-bg: #3a2c0c;
    --danger: #ff9d94;  --danger-bg: #3d1a19;
    --info: #9cc2ff;    --info-bg: #17284a;
    --sev-high: #ff9d94;  --sev-high-bg: #3d1a19;
    --sev-med: #ffcf70;   --sev-med-bg: #3a2c0c;
    --sev-low: #9cc2ff;   --sev-low-bg: #17284a;
    --s1: #8a8dff; --s2: #4fd2bd; --s3: #ffb35c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  }
}

/* ============ Base ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 var(--font); min-height: 100vh;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--primary); color: var(--on-primary); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 8px; }
.noscript { padding: 24px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============ Shell ============ */
.topbar {
  position: sticky; top: 0; z-index: 20; background: #1e2330; color: #f4f6fb;
  border-bottom: 1px solid #2e3548;
}
.topbar-inner { max-width: 1440px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; color: #ffffff; }
.brand img { width: 26px; height: 26px; border-radius: 6px; }
.brand span { font-size: 1.05rem; letter-spacing: -.01em; }
.spacer { flex: 1; }
.role-pill {
  display: inline-flex; align-items: center; padding: 5px 14px; border-radius: 999px;
  font-size: .82rem; font-weight: 700; color: #fff; white-space: nowrap;
}
.role-pill.auditor { background: #18806c; }
.role-pill.council { background: #6e44b5; }
.top-link { color: #d8deef; text-decoration: none; font-size: .88rem; font-weight: 600; }
.top-link:hover { color: #ffffff; text-decoration: underline; }
.btn.top-logout { min-height: 32px; padding: 4px 10px; font-size: .82rem; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.22); }
.btn.top-logout:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.nav-toggle { display: inline-flex; background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.24); }
.app-shell { display: block; max-width: 1440px; margin: 0 auto; min-height: calc(100vh - 54px); }
.nav {
  display: none; flex-direction: column; gap: 4px; padding: 12px 14px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.nav.open { display: flex; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px;
  border-radius: 6px; border-left: 4px solid transparent; text-decoration: none; color: var(--text); font-weight: 500;
}
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] {
  background: var(--surface-2); color: var(--text); font-weight: 700;
  border-left-color: #18806c;
}
.count-badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 8px; font-size: .75rem; line-height: 1.6; font-weight: 700; min-width: 22px; text-align: center; }
@media (prefers-color-scheme: dark) { .count-badge { color: #1a0a09; } }
.user-menu { display: none; align-items: center; gap: 10px; }
.pack-chip { font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: #cfd6ea; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pack-chip strong { color: #ffffff; }

@media (min-width: 980px) {
  .btn.nav-toggle { display: none; }
  .app-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: stretch; }
  .nav {
    display: flex; flex-direction: column; padding: 18px 10px;
    border-right: 1px solid var(--border); border-bottom: 0; gap: 4px;
    position: sticky; top: 53px; height: calc(100vh - 53px); overflow-y: auto;
  }
  .nav a { padding: 10px 12px; font-size: .94rem; }
  .user-menu { display: flex; }
  .mobile-user { display: none !important; }
}
.mobile-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top: 1px dashed var(--border); margin-top: 6px; }

main { max-width: 1180px; width: 100%; margin: 0 auto; padding: 24px 24px 72px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head p { margin: 0; color: var(--muted); max-width: 62ch; }
.crumbs { font-size: .9rem; margin-bottom: 8px; }

/* ============ Components ============ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card + .card, .stack > * + * { margin-top: var(--gap); }
.grid { display: grid; gap: var(--gap); }
@media (min-width: 760px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }

.btn {
  appearance: none; font: inherit; font-weight: 650; cursor: pointer; border-radius: 10px;
  padding: 10px 18px; min-height: 44px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.btn .spin { width: 16px; height: 16px; }

.spin {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent;
  display: inline-block; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

label { font-weight: 600; display: block; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { color: var(--muted); font-size: .875rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 110px; resize: vertical; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
.field-error { color: var(--danger); font-size: .9rem; margin-top: 6px; }
.field.invalid input, .field.invalid textarea { border-color: var(--danger); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 3px 10px;
  border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.badge.critical { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.badge.high { background: var(--sev-high-bg); color: var(--sev-high); }
.badge.medium { background: var(--sev-med-bg); color: var(--sev-med); }
.badge.low { background: var(--sev-low-bg); color: var(--sev-low); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.neutral { background: var(--surface-2); color: var(--muted); border-color: var(--border); }

.notice { border-radius: var(--radius-sm); padding: 12px 14px; border: 1px solid var(--border); background: var(--surface-2); }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.notice.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.notice.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.notice.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.notice strong { color: inherit; }

.state { text-align: center; padding: 36px 16px; }
.state h2 { margin-bottom: 6px; }
.state p { color: var(--muted); max-width: 52ch; margin: 0 auto 16px; }
.state .icon { font-size: 2rem; margin-bottom: 6px; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-line { height: 14px; margin: 10px 0; }
.sk-block { height: 110px; }

/* Bảng và thẻ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
caption { text-align: left; padding: 10px 12px; font-weight: 650; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); font-weight: 650; font-size: .82rem; text-transform: none; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.item {
  display: grid; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); grid-template-columns: 1fr;
}
.item .title { font-weight: 650; }
@media (min-width: 760px) { .item { grid-template-columns: 1fr auto; align-items: center; } }
.item.severity-critical { border-left: 5px solid var(--danger); }
.item.severity-high { border-left: 5px solid var(--sev-high); }
.item.severity-medium { border-left: 5px solid var(--sev-med); }
.item.severity-low { border-left: 5px solid var(--sev-low); }

.hbar-list { display: grid; gap: 10px; margin-top: 8px; }
.hbar-row { display: grid; grid-template-columns: minmax(140px, 210px) 1fr auto; align-items: center; gap: 10px; font-size: .9rem; }
.hbar-track { height: 14px; border-radius: 6px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.hbar-fill { height: 100%; border-radius: 5px; background: var(--primary); transition: width .2s ease; }
.hbar-fill.danger { background: var(--danger); }
.hbar-fill.warn { background: #d89a00; }
.hbar-fill.ok { background: #18806c; }

.filters { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
@media (min-width: 760px) { .filters { grid-template-columns: repeat(5, 1fr); } }
.filters .field { margin: 0; }
.filters label { font-size: .82rem; color: var(--muted); }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; font-weight: 600; color: var(--text); min-height: 40px; }
.tab[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

.council-row {
  display: block; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  font: inherit; color: var(--text); cursor: pointer;
}
.council-row:last-child { margin-bottom: 0; }
.council-row.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--surface-2); }
.council-row:hover { background: var(--surface-2); }

/* Thang điểm tuân thủ */
.score-row { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.score-row:last-child { border-bottom: 0; }
.score-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.score-val { font-size: 1.6rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.bar { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--ok); }
.bar.mid > span { background: #d89a00; }
.bar.low > span { background: var(--danger); }
.delta { font-weight: 650; font-size: .88rem; }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); } .delta.flat { color: var(--muted); }

.kpi { display: grid; gap: 2px; }
.kpi .value { font-size: 1.9rem; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .label { color: var(--muted); font-size: .9rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .9rem; }
.chip strong { font-variant-numeric: tabular-nums; }

/* Khối bằng chứng */
.evidence { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: .88rem; }
.quote { border-left: 4px solid var(--primary); padding: 6px 0 6px 14px; margin: 8px 0; }
.kv { display: grid; grid-template-columns: 1fr; gap: 2px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .85rem; }
.kv dd { margin: 0 0 10px; }
@media (min-width: 640px) { .kv { grid-template-columns: 170px 1fr; } .kv dd { margin: 0; padding-bottom: 8px; } .kv dt { padding-bottom: 8px; } }

.trace { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.trace li { position: relative; padding: 8px 0 8px 36px; border-left: 2px solid var(--border); margin-left: 12px; }
.trace li::before {
  counter-increment: step; content: counter(step); position: absolute; left: -13px; top: 8px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--primary); color: var(--primary); font-size: .75rem; font-weight: 700; display: grid; place-items: center;
}
.trace .tier { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

details > summary { cursor: pointer; font-weight: 650; padding: 8px 0; }

.stepper { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; }
.stepper li { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 500; }
.stepper .n { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .8rem; font-weight: 700; border: 2px solid var(--border); color: var(--muted); }
.stepper li.current { color: var(--primary); font-weight: 700; }
.stepper li.current .n { border-color: var(--primary); color: var(--primary); }
.stepper li.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
fieldset legend { max-width: 100%; }

/* Biểu đồ */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: .88rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Toast và modal */
.toasts { position: fixed; z-index: 60; left: 12px; right: 12px; bottom: 16px; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 560px; width: 100%; background: var(--text); color: var(--bg); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.error { background: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { .toast.ok, .toast.error { color: #0e1120; } }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font-size: 1.1rem; cursor: pointer; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 10, 24, .6); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 22px; max-width: 520px; width: 100%; box-shadow: var(--shadow); max-height: 90vh; overflow: auto; }
.modal .actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; margin-top: 18px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.login-card { width: 100%; max-width: 420px; }
.login-card .brand { justify-content: center; margin-bottom: 14px; font-size: 1.2rem; }
.demo-box { margin-top: 16px; font-size: .9rem; }
.demo-box code { user-select: all; }

.copyable { display: flex; gap: 8px; align-items: stretch; }
.copyable pre { flex: 1; margin: 0; overflow-x: auto; }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-family: var(--mono); font-size: .85rem; white-space: pre; overflow-x: auto; margin: 0; }

.decision-bar { display: grid; gap: 10px; }
@media (min-width: 640px) { .decision-bar { grid-template-columns: 1fr 1fr; } }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); }

ul.plain, ol.plain { margin: 6px 0 0; padding-left: 20px; }
ul.plain li, ol.plain li { margin: 2px 0; }

.turn { border-left: 4px solid var(--border); padding: 8px 12px; border-radius: 6px; margin: 8px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.turn .who { display: block; font-weight: 700; font-size: 12.5px; margin-bottom: 2px; }
.turn.user { border-left-color: var(--info); background: var(--info-bg); }
.turn.user .who { color: var(--info); }
.turn.ai { border-left-color: var(--primary); background: var(--surface-2); }
.turn.ai .who { color: var(--primary); }

.codeview { position: relative; margin: 8px 0; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.codeview .bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.codeview pre { margin: 0; padding: 8px 0; overflow: auto; max-height: 420px; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.codeview .ln { display: block; padding: 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; border-left: 4px solid transparent; }
.codeview .ln.hl-user { border-left-color: var(--info); background: var(--info-bg); }
.codeview .ln.hl-ai { border-left-color: var(--primary); background: var(--surface); }
.codeview .tag { float: right; margin-left: 8px; font: 700 11px system-ui, sans-serif; padding: 0 6px; border-radius: 999px; }
.codeview .hl-user .tag { background: var(--info); color: #fff; }
.codeview .hl-ai .tag { background: var(--primary); color: #fff; }

.codeview .ln.o-system { border-left-color: var(--ok); }
.codeview .ln.o-extension, .codeview .ln.o-connector { border-left-color: var(--warn); }
.codeview .ln.o-monitor { border-left-color: var(--muted); opacity: .9; }
.codeview .ln.o-unknown { border-left-color: var(--border); border-left-style: dashed; }
.codeview .chip { float: right; margin-left: 6px; font: 700 11px system-ui, sans-serif; padding: 0 6px; border-radius: 999px; border: 1px solid currentColor; }
.codeview .o-system .chip { color: var(--ok); }
.codeview .o-extension .chip, .codeview .o-connector .chip { color: var(--warn); }
.codeview .o-monitor .chip { color: var(--muted); }
.codeview .o-unknown .chip { color: var(--muted); }
.codeview .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 12px; }
.codeview .legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }
.codeview .legend .l-system::before { background: var(--ok); }
.codeview .legend .l-extension::before { background: var(--warn); }
.codeview .legend .l-monitor::before { background: var(--muted); }
.addedbox { border: 1px dashed var(--border); border-radius: 8px; padding: 8px 12px; margin: 8px 0; background: var(--surface); }
.addedbox ul { margin: 6px 0 0; padding-left: 20px; }

/* luồng xử lý */
.flowbox { border: 1px solid var(--border); border-radius: var(--radius, 10px); padding: 10px 12px; margin-top: 10px; background: var(--surface); }
.flowbox .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.flow { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: fstep; }
.flow > li { position: relative; padding: 8px 0 8px 36px; border-left: 2px solid var(--border); margin-left: 12px; }
.flow > li::before {
  counter-increment: fstep; content: counter(fstep); position: absolute; left: -13px; top: 8px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--info, var(--primary)); color: var(--info, var(--primary)); font-size: .75rem; font-weight: 700; display: grid; place-items: center;
}
.flow .mono { overflow-wrap: anywhere; }
