/* Trợ lý pháp luật PCCC — chàm đêm + cam lửa. Một họ chữ: Be Vietnam Pro (dựng cho tiếng Việt). */
:root {
  --bg: #F6F5FB; --surface: #FFFFFF; --surface-2: #F0EEF8; --ink: #19163A; --ink-2: #5C5880; --ink-3: #8C88AE;
  --line: #E4E1F0; --night: #14113A; --night-2: #221C5E; --night-ink: #EDEBFF; --night-ink-2: #A9A4D6; --night-line: rgba(255,255,255,.09);
  --ember: #FF5B2E; --ember-2: #FF8A3D; --ember-soft: #FFE9E1; --violet: #5546FF; --violet-soft: #ECEAFF;
  --ok: #158A57; --ok-soft: #DDF4E9; --warn: #A86400; --warn-soft: #FFF1D6; --bad: #C73434; --bad-soft: #FDE4E4;
  --r-s: 8px; --r-m: 14px; --r-l: 22px; --r-pill: 999px;
  --shadow: 0 1px 2px rgba(20,17,58,.06), 0 8px 28px rgba(20,17,58,.08);
  --font: "Be Vietnam Pro", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0C24; --surface: #17143A; --surface-2: #1E1A4A; --ink: #EDEBFF; --ink-2: #ADA8D8; --ink-3: #7D78A8;
    --line: #2B2760; --night: #0A081C; --night-2: #171345; --ember-soft: #3A1C1A; --violet-soft: #23205A;
    --ok: #4CC98C; --ok-soft: #12352A; --warn: #F2B14C; --warn-soft: #3A2A10; --bad: #FF7A7A; --bad-soft: #3D1A20;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--violet); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- khung */
.shell { display: grid; grid-template-columns: 280px 1fr; height: 100vh; height: 100dvh; }
.side { position: relative; display: flex; flex-direction: column; background: var(--night); color: var(--night-ink);
  overflow: hidden; isolation: isolate; }
.side::after { content: ""; position: absolute; z-index: -1; left: -30%; right: -30%; bottom: -160px; height: 360px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255,91,46,.45), transparent 70%), radial-gradient(closest-side at 70% 60%, rgba(85,70,255,.5), transparent 75%);
  filter: blur(18px); }
.brand { display: flex; gap: 11px; align-items: center; padding: 20px 18px 14px; text-decoration: none; color: inherit; }
.mark { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--ember-2), var(--ember) 55%, #E23A1B); box-shadow: 0 6px 18px rgba(255,91,46,.35); }
.mark svg { width: 20px; height: 20px; }
.brand b { font-weight: 800; font-size: 15px; letter-spacing: -.01em; line-height: 1.3; display: block; max-width: 190px; }
.side-btn { margin: 4px 14px 10px; display: flex; align-items: center; gap: 9px; padding: 10px 14px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.08); border: 1px solid var(--night-line); color: var(--night-ink); cursor: pointer; font-weight: 600; text-align: left; }
.side-btn:hover { background: rgba(255,255,255,.14); }
.side-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 12px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.side-h { font-size: 12px; color: var(--night-ink-2); padding: 14px 12px 6px; font-weight: 600; }
.conv { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 12px; border-radius: 10px; border: 0; background: none;
  color: var(--night-ink); cursor: pointer; text-align: left; font-size: 14px; }
.conv span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.conv:hover, .conv.on { background: rgba(255,255,255,.09); }
.conv.on { box-shadow: inset 2px 0 0 var(--ember); }
.conv .x { opacity: 0; border: 0; background: none; color: var(--night-ink-2); cursor: pointer; padding: 0 4px; font-size: 16px; }
.conv:hover .x, .conv:focus-within .x { opacity: 1; }
.side-foot { padding: 12px 12px 16px; border-top: 1px solid var(--night-line); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.ava { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: var(--night-2); border: 1px solid var(--night-line); color: var(--night-ink); }
.me div { flex: 1; min-width: 0; line-height: 1.3; }
.me b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me small { color: var(--night-ink-2); font-size: 12px; }
.icon-btn { border: 0; background: none; color: inherit; cursor: pointer; padding: 6px; border-radius: 8px; line-height: 0; }
.icon-btn:hover { background: rgba(127,120,200,.16); }
.icon-btn svg { width: 18px; height: 18px; }
.login-btn { width: 100%; justify-content: center; margin: 0; background: var(--ember); border-color: transparent; color: #fff; }
.login-btn:hover { background: #F24A1C; }
.side-link { display: flex; gap: 9px; align-items: center; padding: 8px 12px; border-radius: 10px; color: var(--night-ink); text-decoration: none; font-size: 14px; }
.side-link:hover { background: rgba(255,255,255,.09); }
.side-link svg { width: 17px; height: 17px; opacity: .85; }

.main { position: relative; display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 22px; min-height: 58px; }
.top h1 { font-size: 15px; font-weight: 600; margin: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--ink-2); }
.menu-btn { display: none; }

/* chế độ trả lời */
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 5px 13px; border-radius: var(--r-pill); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- hội thoại */
.thread { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.col { max-width: 780px; margin: 0 auto; padding: 8px 24px 24px; }
.msg-u { display: flex; justify-content: flex-end; margin: 22px 0 10px; }
.msg-u div { max-width: 84%; background: var(--surface-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 18px 18px 4px 18px; white-space: pre-wrap; }
.msg-b { display: grid; grid-template-columns: 32px 1fr; gap: 14px; margin: 10px 0 26px; }
.msg-b .mark { width: 30px; height: 30px; border-radius: 9px; box-shadow: none; }
.msg-b .mark svg { width: 17px; height: 17px; }
.ans { min-width: 0; }
.ans p { margin: 0 0 12px; }
.ans ul { margin: 0 0 12px; padding-left: 20px; }
.ans li { margin: 4px 0; }
.ans em { color: var(--ink-2); font-size: 13.5px; }
.ans .err { color: var(--bad); background: var(--bad-soft); padding: 10px 14px; border-radius: var(--r-m); }
.stage { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 14px; margin: 4px 0 12px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ember); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(.75); opacity: .55; } 50% { transform: scale(1.15); opacity: 1; } }
.stage-sub { color: var(--ink-3); font-size: 13px; margin: -8px 0 10px 19px; }
.caret::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 2px; vertical-align: -2px; background: var(--ember); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.cites { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.cites-h { font-size: 13px; color: var(--ink-2); font-weight: 600; width: 100%; margin-bottom: 2px; }
.chip { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; padding: 5px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 13px; color: var(--ink); text-align: left; }
.chip:hover { border-color: var(--violet); }
.chip span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--ok); }
.dot.off { background: var(--ink-3); }
.acts { display: flex; gap: 4px; align-items: center; color: var(--ink-3); flex-wrap: wrap; }
.act { display: inline-flex; gap: 6px; align-items: center; border: 0; background: none; color: var(--ink-2); cursor: pointer; padding: 5px 9px; border-radius: 8px; font-size: 13px; }
.act:hover { background: var(--surface-2); color: var(--ink); }
.act.on { color: var(--ember); }
.act svg { width: 15px; height: 15px; }
.tech { margin-top: 8px; font-size: 13px; color: var(--ink-2); border: 1px dashed var(--line); border-radius: var(--r-m); padding: 10px 14px; }
.tech dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; }
.tech dt { color: var(--ink-3); }
.tech dd { margin: 0; }

/* màn hình chào */
.hello { min-height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 40px 0 20px; }
.hello h2 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.12; letter-spacing: -.03em; font-weight: 800; margin: 0 auto 16px; max-width: 18ch; text-wrap: balance; }
.hello p { color: var(--ink-2); max-width: 56ch; margin: 0 auto 30px; font-size: 16px; text-wrap: pretty; }
.hello .sugg { width: 100%; text-align: left; }
.facts { display: flex; gap: 22px; flex-wrap: wrap; margin: 0 0 28px; color: var(--ink-2); font-size: 14px; }
.facts b { color: var(--ink); font-weight: 700; }
.sugg { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sugg button { text-align: left; padding: 13px 16px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink); line-height: 1.45; }
.sugg button:hover { border-color: var(--ember); }

/* ô nhập */
.dock { padding: 0 24px 16px; }
.composer { max-width: 780px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; padding: 8px 8px 8px 20px; border-radius: 26px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.composer:focus-within { border-color: color-mix(in srgb, var(--ember) 55%, var(--line)); }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: none; padding: 9px 0; max-height: 220px; line-height: 1.5; }
.send { width: 40px; height: 40px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--ember); color: #fff; cursor: pointer; }
.send:disabled { background: var(--line); color: var(--ink-3); cursor: not-allowed; }
.send svg { width: 18px; height: 18px; }
.note { max-width: 780px; margin: 8px auto 0; text-align: center; color: var(--ink-3); font-size: 12px; }

/* bảng điều khoản bên phải */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px rgba(20,17,58,.18); transform: translateX(105%); transition: transform .22s ease; z-index: 40; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer header { padding: 18px 22px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer header div { flex: 1; }
.drawer h3 { margin: 0; font-size: 17px; line-height: 1.35; }
.drawer .sub { color: var(--ink-2); font-size: 13px; margin-top: 4px; }
.drawer .body { overflow-y: auto; padding: 18px 22px 30px; white-space: pre-wrap; line-height: 1.7; font-size: 14.5px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.ember { background: var(--ember-soft); color: var(--ember); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.change { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--r-m); background: var(--warn-soft); color: var(--warn); font-size: 13.5px; white-space: normal; }

/* hộp thoại */
.veil { position: fixed; inset: 0; background: rgba(10,8,28,.55); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 60; padding: 16px; }
.dialog { width: min(440px, 100%); background: var(--surface); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; max-height: 92vh; display: flex; flex-direction: column; }
.dialog.wide { width: min(760px, 100%); }
.dialog-head { padding: 26px 28px 18px; background: linear-gradient(140deg, var(--night) 0%, var(--night-2) 70%, #3A1F5E 100%); color: var(--night-ink); position: relative; overflow: hidden; }
.dialog-head::after { content: ""; position: absolute; right: -60px; top: -80px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255,91,46,.55), transparent); }
.dialog-head h3 { margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.02em; position: relative; z-index: 1; }
.dialog-head p { margin: 6px 0 0; color: var(--night-ink-2); font-size: 14px; position: relative; z-index: 1; }
.dialog-body { padding: 22px 28px 26px; overflow-y: auto; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.field small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 4px; }
.input, .field input, .field select, .field textarea { width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--bg); outline: 0; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--violet); background: var(--surface); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.pri { background: var(--ember); border-color: var(--ember); color: #fff; }
.btn.pri:hover { background: #F24A1C; }
.btn.dark { background: var(--night); border-color: var(--night); color: var(--night-ink); }
.btn.ghost { border-color: transparent; background: none; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 13px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.form-err { color: var(--bad); font-size: 14px; margin: 0 0 12px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--night); color: var(--night-ink); padding: 11px 20px; border-radius: var(--r-pill);
  box-shadow: var(--shadow); z-index: 80; font-size: 14px; max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); color: #fff; }

/* ---------- quản trị */
.page { max-width: 1180px; margin: 0 auto; padding: 6px 28px 60px; }
.page-h { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 14px 0 22px; }
.page-h h2 { margin: 0; font-size: 30px; letter-spacing: -.03em; font-weight: 800; line-height: 1.1; flex: 1; min-width: 240px; }
.page-h p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; font-weight: 400; letter-spacing: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 16px 18px; }
.tile .k { color: var(--ink-2); font-size: 13px; }
.tile .v { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1.2; margin-top: 4px; }
.tile .s { color: var(--ink-3); font-size: 12.5px; }
.tile.hot { background: linear-gradient(150deg, var(--night), var(--night-2)); color: var(--night-ink); border-color: transparent; }
.tile.hot .k, .tile.hot .s { color: var(--night-ink-2); }
.meter { height: 6px; border-radius: 6px; background: var(--surface-2); margin-top: 10px; overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--ember-2), var(--ember)); border-radius: 6px; }
.tile.hot .meter { background: rgba(255,255,255,.12); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px 20px; margin-bottom: 14px; }
.panel h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 1fr 44px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar .t { position: relative; padding: 5px 10px; border-radius: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar .t i { position: absolute; inset: 0 auto 0 0; background: var(--ember-soft); z-index: 0; border-radius: 8px; }
.bar .t span { position: relative; z-index: 1; }
.bar b { text-align: right; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 220px; flex: 1; max-width: 360px; padding: 8px 13px; }
.toolbar select.input { flex: none; min-width: 0; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.item { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: center; padding: 13px 18px; border-top: 1px solid var(--line); cursor: pointer; }
.item:first-child { border-top: 0; }
.item:hover { background: var(--surface-2); }
.item .code { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--violet); }
.item .t { font-weight: 600; line-height: 1.4; }
.item .m { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.item .r { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.empty { padding: 34px 20px; text-align: center; color: var(--ink-2); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ember); }

/* cây luồng */
.tree { display: grid; gap: 14px; }
.step { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); overflow: hidden; }
.step-h { padding: 12px 16px; background: var(--surface-2); display: flex; gap: 12px; align-items: baseline; }
.step-h .code { font-family: var(--mono); font-weight: 700; color: var(--ember); font-size: 13px; }
.branch { padding: 13px 16px 13px 18px; border-top: 1px solid var(--line); position: relative; }
.branch::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--violet-soft); }
.branch .when { font-weight: 600; }
.branch .ap { font-size: 12.5px; color: var(--ink-2); margin-left: 6px; }
.branch .kl { margin: 6px 0; white-space: pre-wrap; }
.branch .go { font-size: 13px; color: var(--violet); font-weight: 600; }
.refs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ref { font-size: 12.5px; padding: 3px 9px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; color: var(--ink); }
.ref.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.ref.th { font-family: var(--mono); color: var(--ink-2); cursor: default; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; }

/* trình soạn YAML */
.editor-wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 14px; align-items: start; }
.code-area { width: 100%; min-height: 560px; font-family: var(--mono); font-size: 13px; line-height: 1.6; padding: 14px 16px; border-radius: var(--r-m);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); tab-size: 2; white-space: pre; overflow: auto; resize: vertical; }
.code-area:focus { outline: 0; border-color: var(--violet); }
.side-panel { position: sticky; top: 8px; display: grid; gap: 12px; max-height: calc(100vh - 120px); overflow-y: auto; }
.msgs { font-size: 13px; display: grid; gap: 5px; }
.msgs div { padding: 6px 10px; border-radius: 8px; }
.msgs .e { background: var(--bad-soft); color: var(--bad); }
.msgs .w { background: var(--warn-soft); color: var(--warn); }
.msgs .o { background: var(--ok-soft); color: var(--ok); }
.found { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; }
.found button { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px; cursor: pointer; font-size: 13px; color: var(--ink); }
.found button:hover { border-color: var(--violet); }
.found code { font-family: var(--mono); font-size: 12px; color: var(--violet); }
.diff { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 0; overflow-x: auto; }
.diff div { padding: 0 14px; white-space: pre; }
.diff .a { background: var(--ok-soft); color: var(--ok); }
.diff .d { background: var(--bad-soft); color: var(--bad); }
.diff .h { color: var(--ink-3); }
.qa { border-top: 1px solid var(--line); padding: 14px 18px; }
.qa:first-child { border-top: 0; }
.qa .q { font-weight: 600; cursor: pointer; }
.qa .meta { color: var(--ink-3); font-size: 12.5px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qa .full { margin-top: 12px; }
.steps { counter-reset: s; display: grid; gap: 14px; }
.stepbox { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); padding: 16px 18px; }
.stepbox h3 { margin: 0 0 10px; font-size: 16px; display: flex; gap: 10px; align-items: center; }
.stepbox h3::before { counter-increment: s; content: counter(s); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;
  background: var(--night); color: var(--night-ink); flex: none; }
.stepbox.off { opacity: .55; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.chart { width: 100%; height: 150px; }

/* ---------- màn hình nhỏ */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-105%); transition: transform .22s ease; }
  .side.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.35); }
  .menu-btn { display: inline-flex; }
  .top { padding: 10px 14px; }
  .col, .dock { padding-left: 14px; padding-right: 14px; }
  .page { padding: 4px 14px 50px; }
  .grid2, .editor-wrap { grid-template-columns: 1fr; }
  .side-panel { position: static; max-height: none; }
  .item { grid-template-columns: 1fr; gap: 4px; }
  .item .r { justify-content: flex-start; }
  .kv { grid-template-columns: 1fr; gap: 0 0; }
  .kv dd { margin-bottom: 8px; }
}
.scrim { position: fixed; inset: 0; background: rgba(10,8,28,.5); z-index: 45; }

/* vết xử lý */
.pre { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; max-height: 55vh; overflow: auto; margin: 8px 0 0; }
details.fold { margin-top: 10px; }
details.fold > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--violet); }
.stepbox .meta { display: flex; gap: 6px; flex-wrap: wrap; margin: -2px 0 12px; }
.stepbox.err { border-color: var(--bad); }
.errbox { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 10px; white-space: pre-wrap; }
.tbl.small td, .tbl.small th { padding: 6px 10px; font-size: 13px; }

.edited { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.edited-note { color: var(--ink-3); font-size: 13px; margin: 4px 0 10px; }
.edit-box { border: 1px solid var(--ember); border-radius: var(--r-m); padding: 14px 16px; margin: 6px 0 10px; background: var(--surface); }
