/* HSVFE: giao diện hệ thống hồ sơ VFE, theo chuẩn nhận diện VFE (brand kit VFE-05, 13/11/2026) */
@font-face { font-family: "Be Vietnam Pro"; font-weight: 400; font-display: swap; src: url(/fonts/BeVietnamPro-Regular.ttf) format("truetype"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 500; font-display: swap; src: url(/fonts/BeVietnamPro-Medium.ttf) format("truetype"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 600; font-display: swap; src: url(/fonts/BeVietnamPro-SemiBold.ttf) format("truetype"); }
@font-face { font-family: "Be Vietnam Pro"; font-weight: 700; font-display: swap; src: url(/fonts/BeVietnamPro-Bold.ttf) format("truetype"); }
@font-face { font-family: "Lora"; font-weight: 500; font-display: swap; src: url(/fonts/Lora-Medium.ttf) format("truetype"); }

:root {
  /* Màu thương hiệu VFE: navy chủ đạo, đỏ chỉ cho nút chính + điểm nhấn nhỏ, xanh phụ cho liên kết / tiến trình */
  --navy: #1b2350; --navy-hover: #343d69; --red: #c41c1c; --blue: #1f3da7;
  --ink: #242b40; --muted: #626a7c; --line: #dedfdc; --line-2: #ecebe7; --paper: #f7f6f2; --white: #fff;
  --head-bg: #f7f7f5; --tag-bg: #eef0f6; --note-bg: #f1f3f9;
  --green: #27634e; --green-bg: #eaf3ec; --amber: #805617; --amber-bg: #fff3d5;
  --gray-tag: #555d6d; --gray-tag-bg: #eeeeed; --red-text: #a61717; --red-bg: #fbeceb;
  --sans: "Be Vietnam Pro", Arial, sans-serif; --serif: "Lora", Georgia, serif;
  --r-btn: 5px; --r-card: 7px; --r-panel: 8px; --r-tag: 3px;
  --side: 220px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.65 var(--sans); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0; text-wrap: balance; color: var(--navy); font-weight: 600; }
p { text-wrap: pretty; }
a { color: var(--blue); text-underline-offset: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.9px; text-transform: uppercase; color: var(--blue); margin-bottom: 8px; }
.boot { padding: 60px 20px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }
svg.i { width: 19px; height: 19px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* Khung: sidebar navy như admin VFE */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.shell > div { min-width: 0; }
.side { background: var(--navy); color: #d8dbea; padding: 28px 18px 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: block; text-decoration: none; color: #fff; padding: 0 3px; }
.brand-logo { display: block; background: #fff; padding: 8px; border-radius: 4px; width: 150px; }
.brand-logo img { display: block; width: 100%; height: auto; }
.brand-sub { display: block; margin-top: 14px; font-size: 12px; line-height: 1.5; color: #d8dbea; }
.nav { margin-top: 30px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 4px; color: #d8dbea; text-decoration: none; font-size: 12.5px; font-weight: 500; white-space: nowrap; min-height: 42px; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.on { background: var(--navy-hover); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--red); }
.nav .count { margin-left: auto; font-size: 11.5px; font-weight: 600; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .12); margin: 12px 4px; }
.side-foot { margin-top: auto; padding: 14px 4px 0; font-size: 12px; color: #b9bdd2; border-top: 1px solid rgba(255, 255, 255, .12); }
.side-foot b { color: #fff; display: block; font-size: 13px; font-weight: 600; }
.side-foot button { margin-top: 10px; background: none; border: 1px solid rgba(255, 255, 255, .28); color: #fff; border-radius: var(--r-btn); padding: 7px 12px; cursor: pointer; font-size: 12px; font-weight: 600; min-height: 36px; }
.side-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.side-acts button { margin-top: 0; white-space: nowrap; }
.main { min-width: 0; padding: 30px 32px 64px; }
.topbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 27px; letter-spacing: -.7px; font-weight: 600; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Thành phần */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-panel); }
.card-pad { padding: 22px 23px; }
.card h2 { font-size: 17px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 22px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 17px; border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--white); color: var(--navy); font-weight: 600; font-size: 12.5px; line-height: 1.4; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #c4c6c2; background: #fbfbf9; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-hover); border-color: var(--navy-hover); }
.btn.cta { background: var(--red); border-color: var(--red); color: #fff; }
.btn.cta:hover { background: #a91818; border-color: #a91818; }
.btn.danger { color: var(--red-text); border-color: #ecc9c6; }
.btn.danger:hover { background: var(--red-bg); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(27, 35, 80, .05); }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: var(--r-tag); font-size: 11px; font-weight: 600; line-height: 1.5; background: var(--gray-tag-bg); color: var(--gray-tag); white-space: nowrap; }
.chip.navy { background: var(--tag-bg); color: var(--navy); }
.chip.red { background: var(--red-bg); color: var(--red-text); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.amber { background: var(--amber-bg); color: var(--amber); }
.chip.blue { background: var(--note-bg); color: var(--blue); }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; background: currentColor; }
.empty { padding: 30px 18px; text-align: center; color: var(--muted); }
.note { border-left: 3px solid var(--blue); background: var(--note-bg); padding: 14px 18px; font-size: 12.5px; }
.note.warm { border-color: #b1832b; background: var(--amber-bg); }

/* Biểu mẫu */
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--navy); min-width: 0; }
label.f .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=date], input[type=month], input[type=number], input[type=search], input[type=tel], select, textarea {
  width: 100%; min-width: 0; min-height: 42px; border: 1px solid #cdd0d6; border-radius: 4px; padding: 9px 11px; background: #fff; font-size: 13.5px; color: var(--ink); }
input:disabled, select:disabled, textarea:disabled { background: #f6f6f3; color: var(--muted); }
textarea { resize: vertical; min-height: 76px; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--navy); flex-shrink: 0; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 9px; font-weight: 400; font-size: 13px; color: var(--ink); cursor: pointer; min-height: 36px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.filters select, .filters input:not([type=checkbox]) { width: 100%; min-width: 0; min-height: 38px; padding: 7px 10px; font-size: 13px; }
.filters input[type=search] { grid-column: span 2; }
.filters .check { white-space: nowrap; }

/* Bảng */
.table-wrap { overflow-x: auto; max-width: 100%; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 10px; font-weight: 600; letter-spacing: .7px; text-transform: uppercase; color: var(--muted); background: var(--head-bg); padding: 13px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 13px 13px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fafaf7; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.name-cell b { min-width: 150px; }
.name-cell b { display: block; font-weight: 600; color: var(--navy); text-wrap: pretty; }
.name-cell span { color: var(--muted); font-size: 12px; white-space: nowrap; }
.bar { height: 6px; border-radius: 99px; background: #e9e9e5; overflow: hidden; min-width: 70px; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 99px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line-2); }

/* Ô số */
.stat { padding: 18px 20px; }
.stat .k { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat .v { font-family: var(--serif); font-size: 34px; font-weight: 500; color: var(--navy); margin-top: 4px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .v.red { color: var(--red); }
.stat .v.green { color: var(--green); }
.stat a { text-decoration: none; color: inherit; display: block; }
.stat:hover { border-color: #c4c6c2; }
.hbars { display: flex; flex-direction: column; gap: 11px; padding: 18px 22px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(60px, 1fr) 40px; gap: 12px; align-items: center; font-size: 13px; }
.hbar:hover .lb { color: var(--blue); }
.hbar .lb { min-width: 0; text-wrap: pretty; line-height: 1.4; }
.hbar .tr { height: 10px; background: #ecebe6; border-radius: 99px; overflow: hidden; }
.hbar .tr i { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.hbar .n { text-align: right; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }

/* Hồ sơ chi tiết */
.case-head { padding: 22px 23px; display: flex; gap: 18px; justify-content: space-between; flex-wrap: wrap; align-items: flex-start; }
.case-head h1 { font-size: 27px; letter-spacing: -.7px; font-weight: 600; }
.case-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13px; margin-top: 6px; }
.case-meta b { color: var(--ink); font-weight: 600; }
.progress-big { min-width: 230px; }
.progress-big .bar { height: 8px; margin-top: 8px; }
.tabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); padding: 0 23px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 13px 0; font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--navy); }
.tabs button.on { color: var(--navy); font-weight: 600; border-bottom-color: var(--red); }
.tabs button .chip { font-size: 10px; padding: 1px 6px; }
.tab-body { padding: 22px 23px; }
.phase { margin-bottom: 22px; }
.phase-h { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13.5px; margin-bottom: 8px; color: var(--navy); }
.phase-h .cnt { font-weight: 500; color: var(--muted); font-size: 12px; }
.step { border: 1px solid var(--line); border-radius: var(--r-card); margin-bottom: 6px; background: #fff; }
.step-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: start; padding: 11px 14px; cursor: pointer; }
.step-row:hover { background: #fcfcfa; border-radius: var(--r-card); }
.step-row .t { font-weight: 500; color: var(--ink); text-wrap: pretty; }
.step-row .sub { color: var(--muted); font-size: 12px; margin-top: 4px; display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; }
.step-row .due { text-align: right; font-size: 12.5px; white-space: nowrap; }
.step.done .t { color: var(--muted); text-decoration: line-through; text-decoration-color: #c2c4c9; }
.step.late { border-color: #ecc9c6; border-left: 3px solid var(--red); }
.tick { width: 24px; height: 24px; border-radius: 50%; border: 1.6px solid #b8bcc6; background: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; margin-top: 1px; }
.tick:hover { border-color: var(--navy); }
.step.done .tick { background: var(--green); border-color: var(--green); }
.step.done .tick::after { content: ""; width: 9px; height: 5px; border: solid #fff; border-width: 0 0 2px 2px; transform: rotate(-45deg) translate(1px, -1px); }
.step.doing .tick { border-color: var(--amber); background: var(--amber-bg); }
.step.skip .tick { border-style: dashed; }
.step.skip .t { color: var(--muted); }
.step-detail { border-top: 1px solid var(--line-2); padding: 14px 16px 16px 54px; display: grid; gap: 14px; }
.guide { white-space: pre-wrap; border-left: 3px solid var(--blue); background: var(--note-bg); padding: 12px 16px; font-size: 13px; color: var(--ink); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.anchors { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; background: #fbfaf7; border: 1px solid var(--line); border-radius: var(--r-panel); padding: 16px 18px; margin-bottom: 20px; }
.anchors .ah { grid-column: 1 / -1; font-weight: 600; font-size: 13.5px; color: var(--navy); }
.feed { display: flex; flex-direction: column; gap: 10px; }
.msg { border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px 14px; background: #fff; }
.msg.system { background: #fbfaf7; border-style: dashed; }
.msg.portal { border-left: 3px solid var(--blue); }
.msg .h { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.msg .h b { color: var(--navy); font-size: 13px; font-weight: 600; }
.msg .b { white-space: pre-wrap; text-wrap: pretty; }
.docs-cat { margin-bottom: 18px; }
.docs-cat h3 { font-size: 13.5px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.doc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 300px) auto; gap: 6px 16px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-card); margin-bottom: 6px; background: #fff; }
.doc .nm { font-weight: 500; color: var(--navy); min-width: 0; overflow-wrap: anywhere; }
.doc .acts { display: flex; gap: 12px; align-items: center; justify-content: flex-end; white-space: nowrap; }
@media (max-width: 760px) { .doc { grid-template-columns: 1fr; } .doc .acts { justify-content: flex-start; flex-wrap: wrap; } }
.drop { border: 1.6px dashed #c4c6c2; border-radius: var(--r-panel); padding: 18px; text-align: center; color: var(--muted); background: #fff; }
.drop.over { border-color: var(--blue); background: var(--note-bg); }
.iv { border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px 14px; margin-bottom: 8px; background: #fff; }
.iv .h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.iv .h b { color: var(--navy); }
.iv .h > button:last-child { margin-left: auto; }
.iv-count { display: flex; gap: 6px; margin: 8px 0 16px; }
.iv-count i { width: 30px; height: 6px; border-radius: 99px; background: #e2e2de; }
.iv-count i.on { background: var(--blue); }

/* Hộp thoại */
.dlg-bg { position: fixed; inset: 0; background: rgba(27, 35, 80, .42); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.dlg { background: #fff; border-radius: var(--r-panel); width: 100%; max-width: 720px; box-shadow: 0 18px 50px rgba(27, 35, 80, .22); }
.dlg.narrow { max-width: 460px; }
.dlg-h { padding: 18px 23px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.dlg-h h2 { font-size: 19px; }
.dlg-b { padding: 20px 23px; }
.dlg-f { padding: 14px 23px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.x { background: none; border: 0; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); padding: 4px 8px; min-width: 36px; min-height: 36px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: var(--r-btn); font-size: 13px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 80; max-width: calc(100vw - 32px); text-align: center; }
#toast.on { opacity: 1; }
#toast.err { background: var(--red-text); }

/* Đăng nhập */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--paper); }
.login-art { background: var(--navy); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 30px; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; right: -80px; bottom: -80px; width: 320px; height: 320px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 50%; box-shadow: 0 0 0 60px rgba(255, 255, 255, .03), 0 0 0 120px rgba(255, 255, 255, .025); }
.login-art .brand-logo { width: 174px; }
.login-art h2 { color: #fff; font-family: var(--serif); font-weight: 500; font-size: 38px; letter-spacing: -1px; line-height: 1.2; max-width: 440px; }
.login-art p { color: #c9cde0; max-width: 420px; margin: 14px 0 0; }
.login-art .eyebrow { color: #aab6f0; }
.login-art small { color: #9aa0bd; font-size: 11px; position: relative; z-index: 1; }
.login-box { display: grid; place-items: center; padding: 40px 24px; }
.login .card { width: 100%; max-width: 420px; padding: 32px 30px; }
.login h1 { font-size: 24px; letter-spacing: -.5px; margin: 0 0 6px; }
.login .card > p { color: var(--muted); margin: 0 0 20px; }
.login form { display: grid; gap: 14px; }
.login form p { margin: 0; }
.login .btn { min-height: 46px; }
.code-input { font-size: 26px !important; letter-spacing: .4em; text-align: center; font-weight: 600; color: var(--navy) !important; }

/* Mẫu quy trình */
.tpl-phase { border: 1px solid var(--line); border-radius: var(--r-panel); margin-bottom: 14px; background: #fff; }
.tpl-phase-h { display: flex; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-2); background: var(--head-bg); border-radius: var(--r-panel) var(--r-panel) 0 0; }
.tpl-step { padding: 12px 14px; border-bottom: 1px solid var(--line-2); display: grid; gap: 8px; }
.tpl-step:last-child { border-bottom: 0; }
.tpl-line { display: grid; grid-template-columns: minmax(0, 1fr) 210px auto; gap: 8px; align-items: start; }
.tpl-title { resize: none; overflow: hidden; min-height: 40px; line-height: 1.45; font-weight: 500; }
.tpl-phase-h input { flex: 1; min-width: 0; }
.rule-ed select { max-width: 100%; }
.rule-ed { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.rule-ed select, .rule-ed input { width: auto; min-height: 34px; padding: 5px 8px; font-size: 12.5px; }
.rule-ed input[type=number] { width: 72px; }
.mini { font-size: 12px; color: var(--muted); }

/* Cổng học viên: kiểu trang công khai VFE (header trắng, logo, tiêu đề Lora) */
.portal-top { background: #fff; border-bottom: 1px solid var(--line); }
.portal-top-in { max-width: 920px; margin: 0 auto; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.portal-top img { width: 150px; height: auto; display: block; }
.portal-top .who { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); }
.portal-top .who b { color: var(--navy); font-weight: 600; }
.portal-main { max-width: 920px; margin: 0 auto; padding: 26px 18px 64px; display: grid; gap: 18px; }
.portal-main h1 { font-family: var(--serif); font-weight: 500; font-size: 34px; letter-spacing: -1px; line-height: 1.2; }
.portal-foot { max-width: 920px; margin: 0 auto; padding: 0 18px 30px; font-size: 10.5px; color: var(--muted); }
.portal-foot a { color: var(--muted); }
.todo-item { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--r-card); background: #fff; }
.todo-item b { color: var(--navy); font-weight: 600; }
.todo-item > div { flex: 1; min-width: 0; }
.todo-item > .btn, .todo-item > .chip { flex-shrink: 0; white-space: nowrap; }
.tl { display: grid; gap: 2px; }
.tl-step { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; font-size: 13.5px; padding: 5px 0; }
.tl-step .s { width: 15px; height: 15px; border-radius: 50%; border: 1.6px solid #b8bcc6; margin-top: 4px; }
.tl-step.done .s { background: var(--green); border-color: var(--green); }
.tl-step.doing .s { background: var(--amber-bg); border-color: var(--amber); }
.tl-step.done .tx { color: var(--muted); }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } .main { padding: 26px 24px 60px; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 262px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .topbar img { width: 120px; height: auto; display: block; }
  .topbar button { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); color: var(--navy); border-radius: var(--r-btn); padding: 8px 12px; min-height: 44px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
  .main { padding: 20px 16px 60px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .step-detail { padding-left: 16px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
  .tpl-line { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: minmax(0, 1.2fr) minmax(60px, 1fr) 34px; }
  .login { grid-template-columns: 1fr; }
  .login-art { padding: 26px 22px; gap: 18px; }
  .login-art h2 { font-size: 26px; }
  .login-art p, .login-art small { display: none; }
  .login-art .brand-logo { width: 135px; }
  .login-box { place-items: start center; padding: 24px 16px 40px; }
  .tabs { padding: 0 16px; gap: 22px; }
  .tab-body, .case-head, .card-pad { padding: 18px 16px; }
  .card-head, .filters, .pager { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 520px) {
  body { font-size: 13px; }
  .g4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 14px 14px; }
  .stat .v { font-size: 28px; }
  .page-head h1, .case-head h1 { font-size: 23px; }
  .portal-main h1 { font-size: 27px; }
  .portal-top img { width: 125px; }
  .todo-item { flex-direction: column; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters input[type=search] { grid-column: 1 / -1; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 36px; }
}

/* Luồng nghiệp vụ */
.flow-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.flow-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-btn); background: #fff; color: var(--navy); text-decoration: none; font-size: 12.5px; font-weight: 500; min-height: 40px; }
.flow-tabs a:hover { border-color: #c4c6c2; }
.flow-tabs a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.flow-tabs .no { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; color: var(--blue); }
.flow-tabs a.on .no { color: #aab6f0; }
.flow-head { margin-bottom: 18px; max-width: 820px; }
.flow-head h2 { font-size: 22px; letter-spacing: -.4px; margin-bottom: 6px; }
.flow-head p { margin: 0 0 12px; }
.flow-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.flow-col { background: #efeee9; border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px; min-width: 0; }
.flow-col.main { background: #eceef4; }
.flow-col-h { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); margin: 2px 2px 12px; }
.flow-card { background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--gray-tag); border-radius: var(--r-card); padding: 14px 15px; margin-bottom: 10px; }
.flow-card .ph { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.flow-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.flow-card h3 { font-size: 14px; line-height: 1.45; text-wrap: pretty; margin-bottom: 4px; }
.flow-card p { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.flow-card .due { font-size: 12px; background: var(--head-bg); border-radius: 4px; padding: 7px 10px; margin-top: 4px; }
.flow-card .due b { color: var(--navy); }
.flow-card .due.none { color: var(--muted); }
.flow-card .note-red { font-size: 12px; color: var(--red-text); border-left: 2px solid var(--red); padding-left: 9px; margin-top: 8px; text-wrap: pretty; }
.flow-card details { margin-top: 8px; font-size: 12px; }
.flow-card summary { cursor: pointer; color: var(--blue); font-weight: 500; min-height: 28px; }
.flow-card details p { color: var(--ink); margin: 6px 0 0; }
.flow-arrow { display: flex; justify-content: center; color: #9aa0b4; margin: -4px 0 6px; }
.a-staff { border-top-color: var(--navy); } .a-staff .actor { background: var(--tag-bg); color: var(--navy); }
.a-head, .a-lead { border-top-color: var(--blue); } .a-head .actor, .a-lead .actor { background: var(--note-bg); color: var(--blue); }
.a-student, .a-both { border-top-color: var(--green); } .a-student .actor, .a-both .actor { background: var(--green-bg); color: var(--green); }
.a-sales { border-top-color: #b1832b; } .a-sales .actor { background: var(--amber-bg); color: var(--amber); }
.confirm-list { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
.confirm-list b { color: var(--navy); }
.confirm-list p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
@media (max-width: 1100px) { .flow-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .flow-col.main { grid-column: 1 / -1; order: -1; } }
@media (max-width: 760px) { .flow-cols { grid-template-columns: minmax(0, 1fr); } .flow-tabs a { font-size: 12px; } }

/* Danh sách hồ sơ trên điện thoại: mỗi hồ sơ là một thẻ, không kéo ngang. */
@media (max-width: 760px) {
  table.t.cases-t thead { display: none; }
  table.t.cases-t, table.t.cases-t tbody { display: block; }
  table.t.cases-t tr { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
  table.t.cases-t td { display: block; padding: 0; border: 0; min-width: 0 !important; }
  table.t.cases-t td:nth-child(1) { grid-column: 1 / -1; }
  table.t.cases-t td:nth-child(2), table.t.cases-t td:nth-child(3), table.t.cases-t td:nth-child(4) { font-size: 12.5px; color: var(--muted); }
  table.t.cases-t td:nth-child(3) .small { display: inline; margin-left: 4px; }
  table.t.cases-t td:nth-child(5) { grid-column: 1 / -1; font-size: 13px; }
  table.t.cases-t td:nth-child(6) { grid-column: 1 / 3; }
  table.t.cases-t td:nth-child(7) { text-align: left; }
  table.t.cases-t td:nth-child(7) .chip::after { content: " bước trễ"; }
  table.t.cases-t td:nth-child(8) { grid-column: 1 / -1; }
  table.t.cases-t td:nth-child(8):has(> .small.muted:only-child) { display: none; }
}

/* Ô nhập trong lưới: nhãn / ô / gợi ý dùng chung hàng (subgrid), nhãn dài 2 dòng thì cả hàng nhãn cao theo, ô nhập luôn thẳng hàng */
:is(.form-grid, .anchors, .g2, .g3, .g4) > label.f { display: grid; grid-template-rows: subgrid; grid-row: span 3; row-gap: 6px; align-content: start; }
:is(.form-grid, .anchors, .g2, .g3, .g4) > label.f > :not(.hint):last-child { grid-row: 2; }
.check.boxed { min-height: 42px; padding: 0 12px; border: 1px solid #cdd0d6; border-radius: 4px; background: #fff; display: flex; }

/* Trợ lý hướng dẫn */
.nav button.nav-guide { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 4px; color: #d8dbea; background: none; border: 0; font: inherit; font-size: 12.5px; font-weight: 500; min-height: 42px; cursor: pointer; text-align: left; white-space: nowrap; }
.nav button.nav-guide:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.guide-fab { position: fixed; right: 22px; bottom: 22px; z-index: 40; display: inline-flex; align-items: center; gap: 8px; padding: 0 16px 0 13px; min-height: 44px; border-radius: 99px; border: 0; background: var(--navy); color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 20px rgba(27, 35, 80, .28); }
.guide-fab:hover { background: var(--navy-hover); }
.guide-fab svg { width: 19px; height: 19px; }
.guide-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 45; width: min(400px, 100vw); background: #fff; border-left: 1px solid var(--line); box-shadow: -10px 0 30px rgba(27, 35, 80, .12); display: flex; flex-direction: column; }
.g-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 14px; border-bottom: 1px solid var(--line-2); }
.g-head .eyebrow { margin-bottom: 4px; }
.g-head h2 { margin: 0; font-size: 18px; color: var(--navy); line-height: 1.35; }
.g-body { flex: 1; overflow-y: auto; padding: 4px 20px 20px; }
.g-body section { padding: 16px 0; border-bottom: 1px solid var(--line-2); }
.g-body section:last-child { border-bottom: 0; }
.g-body h3 { margin: 0 0 10px; font-size: 13px; color: var(--navy); font-weight: 700; }
.g-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.g-row h3 { margin: 0; }
.g-acts { display: flex; flex-direction: column; gap: 8px; }
.g-act { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-card); background: #fff; color: var(--ink); text-decoration: none; text-align: left; font: inherit; font-size: 13px; cursor: pointer; width: 100%; }
.g-act:hover { border-color: var(--blue); }
.g-act > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.g-act > span .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-act.warn { border-left: 3px solid var(--red); }
.g-act svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--muted); }
.g-lead { margin: 0 0 10px; padding: 10px 12px; background: var(--note-bg); border-radius: var(--r-card); font-size: 13px; line-height: 1.55; }
.g-tips { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--ink); }
.g-tips li + li { margin-top: 6px; }
.g-check { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.g-check li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; font-size: 13px; line-height: 1.5; }
.g-check li a { color: var(--blue); font-weight: 600; text-decoration: none; }
.g-check li.done a, .g-check li.done > div > span { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.g-tick { width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 1.6px solid #b8bcc8; background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; color: #fff; }
.g-check li.done .g-tick { background: var(--green); border-color: var(--green); }
.g-tick:disabled { cursor: default; }
.g-tick svg { width: 13px; height: 13px; }
.g-more a { color: var(--blue); font-size: 13px; font-weight: 600; text-decoration: none; }
.g-foot { padding: 14px 20px 18px; border-top: 1px solid var(--line-2); background: #fbfaf7; }
.g-foot .small { margin-top: 2px; padding-left: 26px; }
@media (max-width: 760px) {
  .guide-fab { right: 14px; bottom: 14px; }
  .guide-panel { top: auto; height: 86vh; width: 100vw; border-left: 0; border-top: 1px solid var(--line); border-radius: 12px 12px 0 0; box-shadow: 0 -10px 30px rgba(27, 35, 80, .16); }
}

/* Bảng nhóm quyền */
table.perm-t { min-width: 900px; }
table.perm-t th { text-align: center; vertical-align: bottom; }
table.perm-t th:first-child, table.perm-t td.pm-l { text-align: left; }
table.perm-t th .pm-n { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; margin-top: 2px; text-transform: none; letter-spacing: 0; }
table.perm-t td { text-align: center; font-size: 12.5px; }
table.perm-t td.pm-l { font-weight: 500; color: var(--ink); min-width: 220px; }
table.perm-t td.pm-yes svg { width: 17px; height: 17px; color: var(--green); vertical-align: middle; }
table.perm-t td.pm-no { color: #a9adb8; }
table.perm-t td.pm-part { color: var(--blue); font-weight: 600; white-space: nowrap; }

/* Tiến trình: giai đoạn thu gọn */
.steps-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.steps-bar h2 { margin: 0; font-size: 15px; }
.phase { margin-bottom: 10px; }
.phase:not(.closed) { margin-bottom: 18px; }
button.phase-h { width: 100%; background: none; border: 0; padding: 8px 4px; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--navy); cursor: pointer; text-align: left; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-radius: var(--r-card); margin-bottom: 4px; }
button.phase-h:hover { background: #f3f3ef; }
.phase.closed button.phase-h { background: #fbfaf7; border: 1px solid var(--line-2); padding: 10px 12px; margin-bottom: 0; }
.phase-h .pn { min-width: 0; }
.phase-h .pd { margin-left: auto; font-weight: 400; }
.chev { display: inline-grid; place-items: center; width: 18px; height: 18px; flex-shrink: 0; transition: transform .15s; }
.chev svg { width: 16px; height: 16px; }
[aria-expanded="false"] > .chev, .phase.closed .chev, details:not([open]) > summary .chev { transform: rotate(-90deg); }
.done-fold { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 14px; margin-bottom: 6px; border: 1px dashed var(--line); border-radius: var(--r-card); background: #fbfaf7; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; text-align: left; }
.done-fold:hover { border-color: var(--blue); }
.done-fold svg { width: 15px; height: 15px; color: var(--green); }
.done-fold .lnk, .lnk-btn { color: var(--blue); font-weight: 600; }
.done-fold .lnk { margin-left: auto; }
.lnk-btn { background: none; border: 0; padding: 4px 0 0; font: inherit; font-size: 12.5px; cursor: pointer; }
.red-t { color: var(--red-text); font-weight: 600; }

/* Sơ đồ hồ sơ */
.diag { border: 1px solid var(--line); border-radius: var(--r-panel); background: #fff; padding: 14px 18px 16px; margin-bottom: 18px; }
.diag.closed { padding: 10px 18px; }
.diag-h { display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.diag-t { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; padding: 4px 0; font: inherit; font-weight: 700; font-size: 14px; color: var(--navy); cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-btn); overflow: hidden; }
.seg button { background: #fff; border: 0; padding: 7px 14px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 34px; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--navy); color: #fff; }
.diag-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.legend, .diag-foot .marks { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span, .diag-foot .marks span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.lg { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lg.done { background: var(--green); } .lg.cur { background: var(--blue); } .lg.late { background: var(--red); } .lg.todo { background: #fff; border: 1.6px solid #b8bcc8; }

/* Chuỗi giai đoạn: vòng số + đường nối sang giai đoạn sau */
.flow-map { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px 14px; }
.fm { position: relative; min-width: 0; }
.fm:not(.last):not(.row-end)::after { content: ""; position: absolute; top: 15px; left: 38px; right: -14px; height: 2px; background: #dcdde2; }
.fm.done:not(.last):not(.row-end)::after { background: var(--green); }
.fm button { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; width: 100%; background: none; border: 0; padding: 0; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.fm-n { position: relative; z-index: 1; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: #fff; border: 1.6px solid #b8bcc8; color: var(--muted); }
.fm-n svg { width: 16px; height: 16px; }
.fm.done .fm-n { background: var(--green); border-color: var(--green); color: #fff; }
.fm.cur .fm-n { border: 2px solid var(--blue); color: var(--blue); box-shadow: 0 0 0 4px #e6ebf8; }
.fm.late .fm-n { border: 2px solid var(--red); color: var(--red); box-shadow: 0 0 0 4px var(--red-bg); }
.fm-name { font-size: 12.5px; font-weight: 600; line-height: 1.4; color: var(--navy); text-wrap: pretty; }
.fm.todo .fm-name { color: var(--muted); }
.fm-meta { font-size: 11.5px; color: var(--muted); }
.fm-meta b { color: var(--red-text); font-weight: 600; }
.fm .bar { width: 100%; min-width: 0; height: 4px; }
.fm.done .bar i { background: var(--green); } .fm.late .bar i { background: var(--red); }
.fm button:hover .fm-name { color: var(--blue); }

/* Dòng thời gian */
.tl { margin-top: 14px; }
.tl-row { display: grid; grid-template-columns: 210px minmax(0, 1fr); align-items: stretch; border-bottom: 1px solid var(--line-2); }
.tl-row:last-child { border-bottom: 0; }
.tl-l { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 7px 10px 7px 0; background: none; border: 0; font: inherit; font-size: 12.5px; text-align: left; color: var(--ink); cursor: pointer; }
div.tl-l { cursor: default; }
.tl-num { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--tag-bg); color: var(--navy); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.tl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
button.tl-l:hover .tl-name { color: var(--blue); }
.tl-track { position: relative; min-height: 34px; margin: 0 8px; }
.tl-axis .tl-track { min-height: 26px; }
.tl-tick { position: absolute; top: 6px; transform: translateX(-50%); font-size: 11px; color: var(--muted); white-space: nowrap; }
.tl-tick.today { top: auto; bottom: -1px; font-weight: 700; color: var(--red-text); font-size: 10.5px; background: #fff; padding: 0 3px; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed var(--red); opacity: .55; }
.tl-bar { position: absolute; top: 50%; height: 8px; margin-top: -4px; border-radius: 99px; background: #e4e5ea; }
.tl-bar.done { background: #cfe4d7; } .tl-bar.cur { background: #d6def4; } .tl-bar.late { background: #f3d3d0; }
.tl-dot { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; border: 1.6px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); cursor: help; }
.tl-dot.static { position: static; margin: 0; display: inline-block; cursor: default; }
.tl-dot.done { background: var(--green); } .tl-dot.done-late { background: #c58a1d; } .tl-dot.late { background: var(--red); } .tl-dot.skip { background: #c9cbd2; }
.tl-dot.todo { background: #fff; border: 1.6px solid #8d93a3; }
.tl-mark { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: var(--navy); transform: rotate(45deg); cursor: help; }
.tl-mark.static { position: static; margin: 0 2px 0 0; display: inline-block; width: 8px; height: 8px; cursor: default; }
@media (max-width: 760px) {
  .diag { padding: 12px 14px 14px; }
  .flow-map { grid-template-columns: 1fr; gap: 0; }
  .fm { padding: 0 0 14px; }
  .fm button { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 12px; row-gap: 3px; }
  .fm button > :not(.fm-n) { grid-column: 2; }
  .fm-n { grid-row: 1 / span 3; }
  .fm:not(.last)::after { content: ""; position: absolute; top: 34px; bottom: 0; left: 15px; right: auto; width: 2px; height: auto; background: #dcdde2; }
  .fm.done:not(.last)::after { background: var(--green); }
  .tl-row { grid-template-columns: 96px minmax(0, 1fr); }
  .tl-num { display: none; }
}

/* Nhật ký: nhóm dòng hệ thống, tin dài */
.msg-group { border: 1px dashed var(--line); border-radius: var(--r-card); background: #fbfaf7; }
.msg-group > summary { list-style: none; display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 10px 14px; cursor: pointer; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.msg-group > summary::-webkit-details-marker { display: none; }
.msg-group > summary > .small { margin-left: auto; font-weight: 400; }
.msg-group[open] > .feed { padding: 0 10px 10px; }
.msg .b.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.tl-none { position: absolute; left: 0; top: 50%; transform: translateY(-50%); font-size: 11.5px; color: #a0a4ae; background: #fff; padding-right: 6px; }
@media (max-width: 760px) {
  .tl-row { grid-template-columns: minmax(0, 1fr); border-bottom: 0; }
  .tl-row .tl-l { padding: 8px 0 0; }
  .tl-name { white-space: normal; overflow: visible; }
  .tl-axis .tl-l, .tl-marks .tl-l { display: none; }
  .tl-row .tl-track { min-height: 22px; border-bottom: 1px solid var(--line-2); margin: 0 6px; }
  .tl-axis .tl-track { border-bottom: 0; }
  .diag-foot .marks span { white-space: normal; }
}
/* Nút Hướng dẫn chỉ là icon tròn, không chiếm chỗ */
.guide-fab { width: 44px; height: 44px; min-height: 44px; padding: 0; justify-content: center; border-radius: 50%; right: 18px; bottom: 18px; opacity: .92; }
.guide-fab:hover { opacity: 1; }
.guide-fab svg { width: 22px; height: 22px; }
@media (max-width: 760px) { .guide-fab { width: 42px; height: 42px; min-height: 42px; right: 12px; bottom: 12px; } }

/* Mẫu quy trình: chế độ Luồng */
.tf-legend { margin: -4px 0 14px; }
.tf-lane { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-panel); padding: 14px; }
.tf-head { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.tf-head > .tf-badge { width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.tf-hb { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tf-name { font-weight: 700; font-size: 14px; color: var(--navy); line-height: 1.4; }
textarea.tf-name { min-height: 38px; padding: 7px 9px; font-size: 13.5px; }
.tf-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.tf-tools .btn { min-height: 30px; padding: 4px 9px; font-size: 12px; }
.danger-t { color: var(--red-text) !important; }
.tf-steps { display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; min-height: 80px; padding: 4px; border-radius: var(--r-card); background: #f8f8f5; }
.tf-card { flex: 1 1 210px; max-width: 300px; min-width: 0; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: var(--r-card); padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 7px; transition: box-shadow .12s, border-color .12s; }
.tf-card:hover, .tf-card:focus-visible { box-shadow: 0 4px 14px rgba(27, 35, 80, .1); border-color: #c8ccd8; outline: none; }
.tf-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tf-num { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.tf-grip { margin-left: auto; display: grid; place-items: center; width: 30px; height: 30px; margin-right: -6px; border-radius: 4px; cursor: grab; color: #8d93a3; touch-action: none; }
.tf-grip:hover { background: var(--tag-bg); color: var(--navy); }
.tf-grip svg { width: 18px; height: 18px; }
.tf-grip svg path { stroke-width: 3.2; stroke-linecap: round; }
.tf-title { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.45; text-wrap: pretty; }
.tf-rule { display: flex; gap: 6px; align-items: flex-start; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.tf-rule svg { width: 13px; height: 13px; flex-shrink: 0; margin-top: 2px; }
.tf-add { flex: 0 1 170px; max-width: 300px; min-height: 76px; border: 1.5px dashed #c3c6cf; border-radius: var(--r-card); background: transparent; color: var(--blue); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.tf-add:hover { border-color: var(--blue); background: #fff; }
.tf-conn { display: flex; align-items: center; gap: 12px; padding: 4px 0 4px 28px; min-height: 40px; }
.tf-arrow { width: 22px; height: 22px; display: grid; place-items: center; color: #9aa0ad; position: relative; }
.tf-arrow::before { content: ""; position: absolute; top: -10px; bottom: 50%; left: 50%; width: 2px; margin-left: -1px; background: #d3d5dc; }
.tf-arrow svg { width: 18px; height: 18px; position: relative; }
.tf-insert { background: none; border: 0; padding: 4px 8px; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-radius: 4px; opacity: .65; }
.tf-insert:hover, .tf-conn:hover .tf-insert { opacity: 1; color: var(--blue); background: #eef1fa; }
.tf-mark { flex: 0 0 4px; align-self: stretch; min-height: 70px; border-radius: 4px; background: var(--blue); }
.tf-dragging { opacity: .35; }
.tf-ghost { position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; box-shadow: 0 14px 34px rgba(27, 35, 80, .25); transform-origin: 0 0; opacity: .95; max-width: 300px; }
body.tf-dragmode, body.tf-dragmode * { cursor: grabbing !important; user-select: none; }
.dlg .f.wide > .fl, .f > .fl { font-size: 12px; font-weight: 600; color: var(--navy); }
div.f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.save-bar { position: sticky; bottom: 14px; z-index: 30; margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; background: var(--navy); color: #fff; border-radius: var(--r-panel); box-shadow: 0 8px 24px rgba(27, 35, 80, .25); font-size: 13px; font-weight: 600; max-width: 520px; }
@media (max-width: 760px) {
  .tf-lane { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .tf-head { flex-direction: row; flex-wrap: wrap; align-items: center; }
  .tf-hb { flex: 1; }
  .tf-card, .tf-add { max-width: none; flex-basis: 100%; }
  .tf-mark { flex: 0 0 100%; min-height: 4px; height: 4px; }
  .tf-conn { padding-left: 16px; }
  .save-bar { bottom: 66px; }
}

/* Mẫu quy trình: sơ đồ làn bơi */
.sw-legend { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin: -4px 0 12px; }
.sw { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-panel); background: #fff; }
.sw-inner { position: relative; display: grid; width: max-content; min-width: 100%; }
.sw-corner, .sw-col-h { position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 12px; font-size: 11.5px; font-weight: 700; color: var(--navy); z-index: 3; display: flex; gap: 8px; align-items: center; line-height: 1.35; }
.sw-corner { left: 0; z-index: 4; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.sw-pn { flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 10.5px; }
.sw-lane-h { position: sticky; left: 0; z-index: 2; background: #f6f6f2; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line-2); padding: 12px; font-size: 12px; font-weight: 700; color: var(--navy); line-height: 1.4; text-wrap: balance; }
.sw-lane-h.alt { background: #efefea; }
.sw-cell { position: relative; padding: 12px 24px 30px; border-bottom: 1px solid var(--line-2); background: #fbfbf8; display: flex; flex-direction: column; gap: 12px; min-height: 84px; }
.sw-cell.alt { background: #f6f6f2; }
.sw-cell.hot { background: #e9eefb; box-shadow: inset 0 0 0 2px var(--blue); }
.sw-node { position: relative; z-index: 1; background: #fff; border: 1px solid #d9dbe1; border-left: 3px solid var(--blue); border-radius: 8px; padding: 9px 10px 10px; box-shadow: 0 1px 2px rgba(27, 35, 80, .05); cursor: pointer; display: flex; flex-direction: column; gap: 5px; }
.sw-node:hover, .sw-node:focus-visible { box-shadow: 0 4px 14px rgba(27, 35, 80, .12); outline: none; }
.sw-node.a-student { border-left-color: #2f7fd1; } .sw-node.a-both { border-left-color: var(--green); } .sw-node.a-head { border-left-color: #c58a1d; } .sw-node.a-sales { border-left-color: #7a5ab8; } .sw-node.a-staff { border-left-color: var(--navy); }
.sw-top { display: flex; align-items: center; gap: 5px; min-height: 22px; }
.sw-top .tf-grip { width: 26px; height: 26px; }
.sw-title { font-size: 12.5px; font-weight: 600; line-height: 1.4; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; text-wrap: pretty; }
.sw-rule { font-size: 11px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sw-add { position: absolute; left: 50%; bottom: 5px; transform: translateX(-50%); width: 24px; height: 20px; border: 1px dashed #b9bdc8; border-radius: 4px; background: transparent; color: var(--blue); font: inherit; font-weight: 700; font-size: 14px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .12s; z-index: 1; }
.sw-cell:hover .sw-add, .sw-add:focus-visible { opacity: 1; }
@media (hover: none) { .sw-add { opacity: .7; } }
.sw-svg { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 0; overflow: visible; }
.sw-edge { fill: none; stroke: #a3a8b5; stroke-width: 1.4; }
.sw-labels { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.sw-elab { position: absolute; transform: translate(-50%, -50%); background: #fff; border: 1px solid #d9dbe1; border-radius: 3px; padding: 1px 5px; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.sw-inner { --lw: 140px; }
@media (max-width: 760px) { .sw-inner { --lw: 92px; } .sw-lane-h { padding: 10px 8px; font-size: 11px; } .sw-corner { font-size: 10px; padding: 8px; } }
.sw-edge.back { stroke: var(--red); stroke-dasharray: 5 4; }
.sw-elab.back { color: var(--red-text); border-color: #ecc9c6; background: var(--red-bg); }
.sw-dep { font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 5px; } .sw-dep.back { color: var(--red-text); }
@media (max-width: 760px) { .tf-hb { flex: 1 1 calc(100% - 44px); } .tf-tools { width: 100%; padding-left: 40px; } }

/* Sơ đồ làn bơi theo tiến độ (hồ sơ học viên) */
.sw-node.st-done { border-left-color: var(--green); background: #f6faf7; }
.sw-node.st-done .sw-title { color: var(--muted); }
.sw-node.st-doing { border-left-color: #c58a1d; }
.sw-node.st-late { border-left-color: var(--red); background: #fffafa; }
.sw-node.st-todo { border-left-color: #c3c6cf; }
.sw-node.st-skip { border-left-color: #c3c6cf; opacity: .6; }
.sw-due { font-size: 11px; color: var(--muted); }
.sw-node.st-late .sw-due { color: var(--red-text); font-weight: 600; }
.sw-node.st-done .sw-due { color: var(--green); }
.sw-tick { width: 20px; height: 20px; border-radius: 50%; border: 1.6px solid #b8bcc8; background: #fff; display: grid; place-items: center; padding: 0; cursor: pointer; color: #fff; flex-shrink: 0; }
.sw-tick:hover { border-color: var(--green); }
.st-done .sw-tick { background: var(--green); border-color: var(--green); }
.sw-tick svg { width: 12px; height: 12px; }
.sw-top .tf-grip { margin-left: auto; }
.diag .sw { margin-top: 4px; }
.flow-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; margin-top: 18px; align-items: start; }
.sw-node.a-lead { border-left-color: #8a5a2b; } .sw-node.a-system { border-left-color: #8d93a3; } .sw-node.a-ceo { border-left-color: #333a55; }

/* Ô mật khẩu có nút hiện / ẩn */
.pw { position: relative; display: block; }
.pw input { width: 100%; padding-right: 44px; }
.pw-eye { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: transparent; color: #5b6280; border-radius: 6px; cursor: pointer; padding: 0; }
.pw-eye:hover { color: #1b2350; background: rgba(27, 35, 80, .06); }
.pw-eye:focus-visible { outline: 2px solid #1f3da7; outline-offset: 1px; }
.pw-eye .i { width: 18px; height: 18px; }
.pw input::-ms-reveal { display: none; }
