/* ERP Nghĩa Sơn — theo bộ nhận diện Nghĩa Sơn (web: Be Vietnam Pro / Cormorant Garamond; văn bản in: Times New Roman, chữ đen) */
:root {
  --ns-red: #940000;
  --ns-green: #76B96A;
  --ns-forest: #133012;
  --ns-green-dk: #2F6B2A;
  --ns-bg: #F3F9F5;
  --ns-head: #E3F1E0;
  --ns-line: #DDE6DF;
  --ns-muted: #5C665E;
  --text: #000;
  --card: #fff;
  --ok: #2F6B2A; --ok-bg: #E3F1E0;
  --wait: #7A5200; --wait-bg: #FFF3D6;
  --bad: #940000; --bad-bg: #FBE6E6;
  --radius: 8px;
  --body: 'Be Vietnam Pro', Arial, sans-serif;
  --heading: 'Cormorant Garamond', Georgia, serif;
  --doc: 'Times New Roman', 'Liberation Serif', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ns-bg); color: var(--text); font: 14px/1.5 var(--body); }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; }
h1 { font-family: var(--heading); font-size: 30px; font-weight: 700; line-height: 1.15; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.muted { color: var(--ns-muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .3px; }
.r { text-align: right; } .c { text-align: center; }
.spacer { flex: 1; }
.boot, .loading { padding: 40px; color: var(--ns-muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--ns-line); background: #fff; color: #000; border-radius: var(--radius); font: 500 14px var(--body); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ns-green); }
.btn.primary { background: var(--ns-red); border-color: var(--ns-red); color: #fff; }
.btn.primary:hover { background: #7a0000; }
.btn.danger { color: var(--bad); border-color: #e9b9b9; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: wait; }
.icon-btn { border: 0; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; color: var(--ns-muted); padding: 2px 6px; border-radius: 4px; }
.icon-btn:hover { background: var(--bad-bg); color: var(--bad); }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef1ef; color: var(--ns-muted); white-space: nowrap; font-family: var(--body); }
.pill.live, .st-ok { background: var(--ok-bg); color: var(--ok); }
.st-wait { background: var(--wait-bg); color: var(--wait); }
.st-bad { background: var(--bad-bg); color: var(--bad); }
.st-draft { background: #eef1ef; color: var(--ns-muted); }
.badge.demo { background: var(--wait-bg); color: var(--wait); font-weight: 700; font-size: 11px; padding: 3px 8px; border-radius: 4px; letter-spacing: .5px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: #fff; border: 1px solid var(--ns-line); border-radius: 12px; padding: 32px; width: min(460px, 100%); }
.login-logo { width: 150px; display: block; margin-bottom: 16px; }
.login-card h1 { font-size: 32px; }
.demo-note { background: var(--wait-bg); padding: 10px 12px; border-radius: var(--radius); margin: 16px 0 12px; font-size: 13px; }
.demo-users { display: grid; gap: 8px; }
.demo-user { display: flex; gap: 12px; align-items: center; text-align: left; padding: 10px 12px; border: 1px solid var(--ns-line); border-radius: var(--radius); background: #fff; cursor: pointer; font: inherit; }
.demo-user:hover { border-color: var(--ns-green); background: var(--ns-bg); }
.demo-user small, .user-name small { display: block; color: var(--ns-muted); font-size: 12px; }
.av { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--ns-forest); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* ---------- shell ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 16px; background: #fff; border-bottom: 3px solid var(--ns-red); }
.brand img { height: 46px; display: block; }
.brand-title { font-family: var(--heading); font-weight: 700; font-size: 22px; color: var(--ns-forest); }
.brand-title span { color: var(--ns-red); }
.menu-btn { display: none; border: 0; background: none; font-size: 22px; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--ns-line); border-radius: var(--radius); overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 12px; font: 600 13px var(--body); cursor: pointer; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--ns-line); }
.seg button.on { background: var(--ns-forest); color: #fff; }
.seg button:disabled { color: #bbb; cursor: not-allowed; }
.user { display: flex; align-items: center; gap: 10px; }
.layout { display: flex; min-height: calc(100vh - 64px); }
.sidebar { width: 240px; flex: none; background: var(--ns-forest); color: #fff; padding: 14px 10px; position: sticky; top: 64px; height: calc(100vh - 64px); overflow: auto; }
.sidebar a { display: block; text-decoration: none; color: #fff; padding: 8px 10px; border-radius: 6px; }
.sidebar a:hover { background: rgba(255,255,255,.08); }
.sidebar a.on { background: rgba(118,185,106,.25); }
.nav-home { font-weight: 600; margin-bottom: 8px; }
.nav-dept-h { display: flex !important; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .3px; font-size: 13px; }
.nav-dept-h .dot { width: 8px; height: 8px; border-radius: 50%; outline: 2px solid rgba(255,255,255,.6); }
.nav-dept.locked { opacity: .45; }
.nav-apps { margin: 2px 0 8px 18px; border-left: 1px solid rgba(255,255,255,.2); }
.nav-apps a { font-size: 13px; padding: 6px 10px; }
.nav-apps a.soon { opacity: .6; }
.view { flex: 1; min-width: 0; padding: 24px 28px 80px; max-width: 1400px; }

.crumb { font-size: 13px; color: var(--ns-muted); margin-bottom: 8px; }
.crumb a { color: var(--ns-muted); }
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sec { font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--ns-muted); margin: 24px 0 10px; }
.alert { background: var(--bad-bg); color: var(--bad); padding: 10px 14px; border-radius: var(--radius); margin: 12px 0; }
.alert.warn { background: var(--wait-bg); color: var(--wait); }
.empty { color: var(--ns-muted); text-align: center; padding: 28px; }
.empty.big { background: #fff; border: 1px dashed var(--ns-line); border-radius: 12px; padding: 48px; }
.empty.big h2 { font-family: var(--heading); font-size: 28px; color: #000; }

/* ---------- cards / grids ---------- */
.card { background: var(--card); border: 1px solid var(--ns-line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.dept-card { display: block; text-decoration: none; background: #fff; border: 1px solid var(--ns-line); border-top: 4px solid var(--c); border-radius: var(--radius); padding: 16px; transition: transform .12s, box-shadow .12s; }
.dept-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(19,48,18,.08); }
.dept-card.locked { opacity: .55; }
.dept-code { font-weight: 700; letter-spacing: .5px; }
.dept-name { font-family: var(--heading); font-size: 22px; font-weight: 700; margin: 2px 0 6px; }
.dept-meta { font-size: 12px; color: var(--ns-muted); }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.app-card { display: flex; gap: 12px; align-items: center; text-decoration: none; background: #fff; border: 1px solid var(--ns-line); border-radius: var(--radius); padding: 14px; }
.app-card:hover { border-color: var(--ns-green); }
.app-card.soon .app-ic { opacity: .45; }
.app-card.locked { opacity: .5; pointer-events: none; }
.app-ic { width: 42px; height: 42px; flex: none; border-radius: 8px; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.app-tx { flex: 1; min-width: 0; }
.app-tx small { display: block; color: var(--ns-muted); font-size: 12px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--ns-line); border-left: 4px solid var(--ns-green); border-radius: var(--radius); padding: 12px 14px; }
.kpi small { display: block; color: var(--ns-muted); font-size: 12px; }
.kpi b { font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi span { display: block; font-size: 12px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 220px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; padding: 0; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { background: var(--ns-head); text-align: left; font-size: 12px; font-weight: 700; padding: 9px 10px; white-space: nowrap; }
.tbl td { padding: 9px 10px; border-top: 1px solid var(--ns-line); white-space: nowrap; }
.tbl tbody tr[data-id] { cursor: pointer; }
.tbl tbody tr[data-id]:hover { background: var(--ns-bg); }
.tbl.edit td { padding: 4px; }
.tbl.edit input { width: 100%; min-width: 70px; }
.tbl tfoot td { border-top: 2px solid var(--ns-line); padding: 8px 10px; }

/* ---------- forms ---------- */
input, select, textarea { font: 14px var(--body); padding: 8px 10px; border: 1px solid var(--ns-line); border-radius: 6px; background: #fff; color: #000; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ns-green); outline-offset: -1px; border-color: var(--ns-green); }
input.up { text-transform: uppercase; }
select:disabled { background: #f3f4f3; }
.form label { display: block; font-size: 12px; font-weight: 600; color: #222; }
.form label > input, .form label > select, .form label > textarea { margin-top: 4px; font-weight: 400; }
.form label > small { display: block; font-weight: 500; margin-top: 3px; }
.form label > small.ok { color: var(--ok); } .form label > small.bad { color: var(--bad); }
.form > label, .form label + label { margin-top: 12px; }
.grid { display: grid; gap: 12px; }
.grid label + label { margin-top: 0; }
.g4 { grid-template-columns: repeat(4, 1fr); } .g3 { grid-template-columns: repeat(4, 1fr); }
.sec-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sec-h h3 { margin: 0; }
.checklist { display: grid; }
.ck-row { display: grid; grid-template-columns: minmax(240px, 2fr) auto minmax(160px, 1.2fr); gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--ns-line); }
.ck-row:first-child { border-top: 0; }
.ck-t small { display: block; color: var(--ns-muted); font-style: italic; }
.ck-opts { display: flex; gap: 6px; }
.ck-opt { position: relative; }
.ck-opt input { position: absolute; opacity: 0; }
.ck-opt span { display: inline-block; padding: 6px 12px; border: 1px solid var(--ns-line); border-radius: 6px; font-weight: 600; font-size: 13px; cursor: pointer; background: #fff; }
.ck-opt input:focus-visible + span { outline: 2px solid var(--ns-green); }
.ck-opt.ok input:checked + span { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.ck-opt.ng input:checked + span { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.ck-opt.na input:checked + span { background: #eef1ef; border-color: var(--ns-muted); }
.stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.stage { border: 1px solid var(--ns-line); border-radius: var(--radius); padding: 10px; }
.stage.need { border-style: dashed; border-color: #d9a3a3; }
.stage.busy { opacity: .6; pointer-events: none; }
.stage-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.stage-h .btn { font-weight: 600; }
.thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.thumbs figure { margin: 0; position: relative; }
.thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; background: var(--ns-bg); display: block; }
.thumbs .icon-btn { position: absolute; top: 2px; right: 2px; background: rgba(255,255,255,.9); font-size: 14px; }
.sticky-actions { position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 16px; background: #fff; border: 1px solid var(--ns-line); border-radius: var(--radius); box-shadow: 0 -4px 14px rgba(0,0,0,.05); }
.hist { margin: 0; padding-left: 18px; } .hist li { margin-bottom: 6px; }

/* ---------- biểu mẫu nhiều bước (CLR, FI…) ---------- */
.hide { display: none !important; }
.ok { color: var(--ok); } .bad { color: var(--bad); }
.g5 { grid-template-columns: repeat(5, 1fr); }
.span2 { grid-column: span 2; }
.hint-box { margin-top: 4px; min-height: 37px; display: flex; align-items: center; padding: 0 10px; background: var(--ns-bg); border-radius: 6px; font-weight: 500; }
.tabbar { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; position: sticky; top: 64px; z-index: 10; background: var(--ns-bg); padding: 8px 0; scrollbar-width: none; }
.tabbar button { flex: none; display: flex; align-items: center; gap: 8px; border: 1px solid var(--ns-line); background: #fff; border-radius: 999px; padding: 7px 14px 7px 7px; font: 600 13px var(--body); cursor: pointer; white-space: nowrap; }
.tabbar button b { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--ns-bg); font-size: 12px; }
.tabbar button.on { background: var(--ns-red); border-color: var(--ns-red); color: #fff; }
.tabbar button.on b { background: rgba(255,255,255,.25); }
.cp { display: flex; flex-direction: column; gap: 10px; }
.cp.ng { border-color: var(--bad); box-shadow: inset 3px 0 0 var(--bad); }
.cp-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.cp-h > b { flex: 1 1 260px; font-size: 15px; }
.pts { margin: 0; padding-left: 22px; color: var(--ns-muted); font-size: 13px; }
textarea.note { background: #FFF8D6; border-color: #E9D58A; }
.slot .thumbs, .lrow .thumbs { align-items: center; }
.cam { width: 76px; height: 76px; border: 1.5px dashed var(--ns-green); border-radius: 6px; display: grid !important; place-items: center; font-size: 12px !important; color: var(--ns-green-dk) !important; cursor: pointer; background: #fff; }
.cam:hover { background: var(--ns-bg); }
.busy { opacity: .5; pointer-events: none; }
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.form label.doc-chk { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; padding: 8px 10px; border: 1px solid var(--ns-line); border-radius: 6px; cursor: pointer; }
.doc-chk input { width: 18px; height: 18px; flex: none; accent-color: var(--ns-green-dk); }
.doc-chk:has(input:checked) { background: var(--ok-bg); border-color: var(--ok); }
.thumbs.mini { flex-wrap: nowrap; min-width: 140px; }
.thumbs.mini img { width: 44px; height: 44px; }
.cam.sm { width: 44px; height: 44px; font-size: 10px !important; }
.lrow { display: flex; flex-direction: column; gap: 10px; }
.lrow-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lrow-h > b { font-size: 16px; }
.lrow-h .tot { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.line { display: grid; grid-template-columns: minmax(140px, 1.6fr) repeat(4, minmax(58px, .6fr)) minmax(76px, .7fr) auto; gap: 8px; align-items: end; }
.line input.c { text-align: center; font-size: 15px; }
.line input.qty { font-weight: 700; background: var(--ns-bg); }
.line input.qty.man { outline: 1.5px dashed var(--wait); }
.load-tot { position: sticky; top: 118px; z-index: 5; }
.load-tot .lt b { font-size: 22px; }
.prog { height: 7px; border-radius: 4px; background: var(--ns-bg); overflow: hidden; margin-top: 6px; }
.prog i { display: block; height: 100%; background: var(--ns-green); }
.prog i.over { background: var(--bad); }
.val { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.val li { display: flex; gap: 8px; align-items: flex-start; }
.tbl td.ok { color: var(--ok); font-weight: 600; } .tbl td.bad { color: var(--bad); font-weight: 600; }
.dt.kv th { width: 18%; }
.dt ol { margin: 2px 0 0; padding-left: 18px; font-size: 10.5pt; }
.doc-p { margin: 4px 0 0; font-size: 11pt; }
.doc-title small { font-size: 11pt; }
@media (max-width: 1100px) { .g5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .line { grid-template-columns: repeat(4, 1fr); background: var(--ns-bg); padding: 8px; border-radius: 6px; }
  .line > label:first-child { grid-column: 1 / -2; }
  .line > .icon-btn { grid-column: -2 / -1; justify-self: end; align-self: center; }
  .line > label:nth-child(6) { grid-column: 1 / -1; }
  .g5 { grid-template-columns: repeat(2, 1fr); }
  .tabbar { top: 64px; }
  .load-tot { top: 116px; }
}
@media (max-width: 560px) {
  .g5 { grid-template-columns: 1fr 1fr; } .span2 { grid-column: 1 / -1; }
  /* thanh nút dưới: 2 hàng — điều hướng ở trên, Lưu / Nộp to ở dưới */
  .sticky-actions { flex-wrap: wrap; gap: 8px; padding: 10px; }
  .sticky-actions .spacer { display: none; }
  .sticky-actions .btn { padding: 8px 10px; justify-content: center; }
  .sticky-actions #save, .sticky-actions #submit { flex: 1 1 40%; }
  .sticky-actions #cancel, .sticky-actions #prev, .sticky-actions #next { flex: 1 1 25%; }
}
.tbl.edit select { min-width: 92px; }

/* ---------- FI Report (BM04 / BM05) ---------- */
.tbl.edit input.cell-bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); font-weight: 600; }
.grid-p1 input { min-width: 64px; }
.p2-tbl td.crit { white-space: normal; min-width: 260px; font-size: 12.5px; color: #333; }
.p2-tbl input.lv-in { width: 56px; min-width: 56px; }
.lv-na { display: block; width: 56px; height: 34px; border-radius: 6px; background: repeating-linear-gradient(135deg, #eef1ef 0 6px, #e2e7e3 6px 12px); }
.sticky-sum { position: sticky; top: 118px; z-index: 5; }
.doc-h-form { grid-template-columns: auto 1fr auto; }
.doc-form-title { text-align: center; font-weight: 700; font-size: 15pt; }
.doc-form-title small { display: block; font-weight: 400; font-size: 10.5pt; }
.small-print { font-size: 9.5pt; }
.dt.dt-tight th, .dt.dt-tight td { padding: 2px 4px; font-size: 10pt; }
.dt td.na { background: #e9ece9; color: #888; }
.doc-photos.mini { grid-template-columns: repeat(3, 1fr); gap: 4px; }
.doc .pb:empty { height: 0; }
@media print { .doc .pb:empty { break-before: page; } }

/* ---------- biểu đồ thanh ngang (một chuỗi, một màu) ---------- */
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.charts .card { margin-bottom: 0; }
.hbars { display: grid; gap: 6px; }
.hb-row { display: grid; grid-template-columns: minmax(110px, 34%) 1fr auto; align-items: center; gap: 10px; padding: 2px 0; cursor: default; }
.hb-row:hover .hb-track i { filter: brightness(1.15); }
.hb-l { font-size: 13px; color: #222; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 14px; display: block; }
.hb-track i { display: block; height: 100%; background: var(--ns-green-dk); border-radius: 0 4px 4px 0; }
.hb-v { font-size: 12.5px; font-variant-numeric: tabular-nums; color: #222; min-width: 64px; text-align: right; }
.hb-tip { position: fixed; z-index: 120; display: none; pointer-events: none; background: #fff; color: #000; border: 1px solid var(--ns-line); border-radius: 6px; padding: 6px 10px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(0,0,0,.12); max-width: 320px; }
@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }

/* ---------- app nhúng (RFQ & Báo giá) ---------- */
.view.flush { padding: 8px 12px 0; max-width: none; }
.frame-crumb { margin: 0 4px 6px; }
.app-frame { display: block; width: 100%; height: calc(100vh - 64px - 40px); border: 1px solid var(--ns-line); border-radius: var(--radius); background: #fff; }

/* ---------- cài app (PWA) ---------- */
.login-install { margin-top: 14px; text-align: center; }
.dep-chks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.form .dep-chks label, .dep-chks label { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.dep-chks input { width: auto; }
.tbl tr.row-pending td { background: #FFFBEA; }
.steps-ol { margin: 0; padding-left: 20px; line-height: 1.7; }
.signup { margin-top: 16px; border-top: 1px solid var(--ns-line); padding-top: 12px; }
.signup summary { cursor: pointer; font-weight: 600; color: var(--ns-green-dk); }
.signup .form { margin-top: 10px; }
.modal-bg { position: fixed; inset: 0; z-index: 200; background: rgba(10, 25, 10, .55); display: grid; place-items: center; padding: 16px; }
.modal-box { background: #fff; border-radius: 12px; padding: 20px; width: min(420px, 100%); border-top: 4px solid var(--ns-red); }
.modal-box ol { padding-left: 20px; line-height: 1.7; }
/* tai thỏ / thanh home iPhone khi mở toàn màn hình */
.topbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.sticky-actions { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
@media (display-mode: standalone) { .topbar { padding-top: env(safe-area-inset-top); height: calc(64px + env(safe-area-inset-top)); } }

/* ---------- toast ---------- */
#toast { position: fixed; right: 16px; bottom: 16px; z-index: 99; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ns-forest); color: #fff; padding: 10px 14px; border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.toast.error { background: var(--ns-red); }
.toast.ok { background: var(--ns-green-dk); }

/* ---------- văn bản biên bản (theo chuẩn văn bản Nghĩa Sơn: Times New Roman, chữ đen, tiêu đề bảng #E3F1E0) ---------- */
.doc { background: #fff; color: #000; font-family: var(--doc); font-size: 13pt; line-height: 1.35; padding: 28px 32px; border: 1px solid var(--ns-line); border-radius: var(--radius); margin-bottom: 16px; }
.doc-h { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; border-bottom: 1px solid #000; padding-bottom: 10px; }
.doc-logo { width: 32mm; display: block; }
.doc-org b { display: block; font-size: 12pt; }
.doc-org span { font-size: 11pt; }
.doc-no { display: grid; grid-template-columns: auto auto; gap: 0 6px; font-size: 11pt; }
.doc-title { text-align: center; font-family: var(--doc); font-size: 16pt; margin: 14px 0 6px; }
.doc-title small { display: block; font-size: 12pt; font-weight: 400; }
.doc h4 { font-size: 12pt; margin: 14px 0 6px; }
.dt { width: 100%; border-collapse: collapse; font-size: 11pt; }
.dt th, .dt td { border: 1px solid #000; padding: 4px 6px; vertical-align: top; }
.dt th { background: var(--ns-head); font-weight: 700; text-align: left; }
.dt.info th { width: 22%; }
.dt td.ng { font-weight: 700; }
.dt .en { font-size: 10pt; }
.dt .r, .dt th.r { text-align: right; } .dt .c, .dt th.c { text-align: center; }
.dt td.pre { white-space: pre-wrap; }
.doc-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.doc-photos figure { margin: 0; break-inside: avoid; }
.doc-photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border: 1px solid #000; display: block; background: #f3f3f3; }
.doc-photos figcaption { font-size: 10pt; text-align: center; }
.sign { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 11pt; text-align: center; }
.sign th { font-weight: 700; padding: 4px; }
.sign i { font-weight: 400; }
.sign tr.sp td { height: 70px; }
.stamp { display: inline-block; border: 2px solid #000; padding: 2px 10px; font-weight: 700; font-size: 10pt; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .g4, .g3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .menu-btn { display: block; }
  .sidebar { position: fixed; left: 0; top: 64px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.show { transform: none; }
  .user-name, .brand-title { display: none; }
  .view { padding: 16px 16px 80px; }
  .ck-row { grid-template-columns: 1fr; gap: 6px; }
  .doc { padding: 16px; font-size: 12pt; }
  .doc-h { grid-template-columns: auto 1fr; }
  .doc-no { grid-column: 1 / -1; }
  .doc-photos { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .g4, .g3 { grid-template-columns: 1fr; }
  .topbar { gap: 8px; padding: 0 10px; }
  .badge.demo, .user .av { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi b { font-size: 22px; }
  .brand img { height: 38px; }
  .user .btn { padding: 4px 8px; }
  .seg button { padding: 6px 8px; }
  h1 { font-size: 24px; }
}

/* ---------- in ấn ---------- */
@page { size: A4; margin: 12mm; }
@media print {
  body { background: #fff; }
  .topbar, .sidebar, .no-print, #toast, .crumb { display: none !important; }
  .layout { display: block; }
  .view { padding: 0; max-width: none; }
  .doc { border: 0; padding: 0; margin: 0; font-size: 12pt; }
  .dt th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .dt tr, .doc-photos figure { break-inside: avoid; }
  h4.pb { break-before: page; }
  .doc-photos { grid-template-columns: repeat(3, 1fr); }
}
