/*
 * SHT Văn phòng phẩm · giao diện "giấy tờ văn phòng ngân hàng".
 * --navy là mực bút bi xanh (chữ nhấn, liên kết, nút chính, đường kẻ đầu trang).
 * --orange là điểm nhấn phụ: bước hiện tại, thẻ cần chú ý. Mục đang chọn dùng chữ xanh đậm kèm vạch chỉ báo.
 * Nền giấy trắng xanh nhạt, bảng kẻ dòng như sổ cái. Màu thương hiệu lấy từ /theme.css (CMS).
 * Chữ ngắn (nút, nhãn, số, ngày giờ) không xuống dòng; chữ dài (tên sản phẩm, địa chỉ) xuống tối đa 2 dòng.
 * Không dùng style nội tuyến (CSP chặn).
 */

/* ---------- Font tự phát (Roboto, Roboto Condensed · SIL OFL 1.1) ---------- */
@font-face { font-family: "Roboto"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/roboto-vietnamese-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Roboto"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/roboto-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/roboto-condensed-vietnamese-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB; }
@font-face { font-family: "Roboto Condensed"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/fonts/roboto-condensed-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Token ---------- */
:root {
  /* Thương hiệu (ghi đè bởi /theme.css theo CMS) */
  --navy: #31519E; --navy-dark: #233A73; --navy-tint: #EAEEF6;
  --orange: #F7941D; --orange-tint: #FEF1E2; --orange-hl: #FBC98E;
  /* Giấy, mực, đường kẻ */
  --paper: #F4F6F9; --sheet: #FFFFFF; --ink: #1D2433; --muted: #586174; --rule: #DDE2EA; --rule-soft: #ECEFF4; --line: var(--rule);
  --orange-text: #96470A;
  --green: #0B6E4F; --green-tint: #E5F3EC; --red: #C62828; --red-tint: #FCEBEA;
  --display: "Roboto Condensed", "Arial Narrow", "Segoe UI", Arial, sans-serif;
  --text: "Roboto", "Segoe UI", Arial, sans-serif;
  --r: 6px;
}

/* ---------- Nền ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--text); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--paper);
  font-variant-numeric: lining-nums; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--navy); text-underline-offset: 2px; }
a:hover { color: var(--navy-dark); }
h1, h2, h3 { margin: 0; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.title { font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 36px; letter-spacing: -.005em; color: var(--ink); text-wrap: balance; }
.kick { font-size: 13px; color: var(--muted); }
.sub { display: block; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.ell { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.num { text-align: right; font-variant-numeric: tabular-nums lining-nums; }
.strong { font-weight: 600; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.m0 { margin: 0; }

/* Dải cảnh báo bản chạy thử */
.envbar { background: #FFF4CC; color: #5C4A00; border-bottom: 1px solid #F0D98C; padding: 5px 16px; text-align: center; font-size: 12.5px; font-weight: 500; }

/* ---------- Khung trang khách hàng ---------- */
.topbar { color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--rule-soft); background: var(--sheet); }
.topbar .in { max-width: 1200px; margin: 0 auto; padding: 6px 24px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.header { background: var(--sheet); border-bottom: 3px solid var(--navy); }
.header .in { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; }
.logo img { height: 44px; width: auto; display: block; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; font-weight: 500; }
.nav a { height: 40px; padding: 0 10px; display: flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); border-radius: 4px; white-space: nowrap; }
.nav a:hover { color: var(--navy); background: var(--paper); }
.nav a.on { color: var(--navy-dark); font-weight: 700; background: var(--navy-tint); box-shadow: inset 0 -2px 0 var(--navy); border-radius: 4px 4px 0 0; }
.nav .cart { border: 1.5px solid var(--navy); color: var(--navy); margin-left: 6px; }
.nav .cart b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--navy); color: #FFFFFF; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.nav .cart.on { background: var(--navy-tint); }
.nav form { margin: 0 0 0 6px; }
.nav .bell { position: relative; width: 40px; justify-content: center; padding: 0; }
.dotcount { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #FFFFFF; font-size: 11px; display: flex; align-items: center; justify-content: center; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.wrap.narrow { max-width: 900px; }

.hsearch { flex: 1 1 320px; max-width: 520px; display: flex; min-width: 0; margin: 0; }
.hsearch input { flex: 1 1 auto; min-width: 0; height: 42px; border: 1px solid #C9D0DB; border-right: 0; border-radius: var(--r) 0 0 var(--r); padding: 0 14px; font: inherit; background: var(--sheet); color: var(--ink); }
.hsearch input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-tint); }
.hsearch button { height: 42px; padding: 0 18px; border: 0; border-radius: 0 var(--r) var(--r) 0; background: var(--navy); color: #FFFFFF; font: inherit; font-weight: 600; cursor: pointer; }

/* Chân trang */
.footer { background: var(--sheet); color: var(--muted); border-top: 3px solid var(--navy); margin-top: 40px; font-size: 13.5px; line-height: 21px; }
.footer a { color: var(--ink); text-decoration: none; } .footer a:hover { color: var(--navy); text-decoration: underline; }
.footer .cols4 { max-width: 1200px; margin: 0 auto; padding: 32px 24px 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px 40px; }
.footer h3 { margin: 0 0 10px; font-family: var(--display); font-size: 16px; font-weight: 700; color: var(--ink); }
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer p { margin: 0; }
.footer b { color: var(--ink); font-weight: 600; }
.footer .flogo { align-self: flex-start; }
.footer .flogo img { height: 40px; display: block; }
.footer .fbar { border-top: 1px solid var(--rule); }
.footer .fbar .in { max-width: 1200px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 12.5px; }
.fbar .row a { color: var(--muted); }
.tagline { display: block; color: var(--navy); font-weight: 600; font-size: 13px; margin-bottom: 4px; }

/* ---------- Khung quản trị (SHT, Vipo) ---------- */
.admin { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 232px; max-width: 256px; background: var(--sheet); border-right: 1px solid var(--rule); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.side .logo { align-self: flex-start; margin: 0 8px 16px; }
.side .logo img { height: 40px; }
.side a { min-height: 38px; padding: 0 10px; border-radius: 4px; color: var(--ink); text-decoration: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 500; }
.side a:hover { color: var(--navy); background: var(--paper); }
.side a.on { font-weight: 700; color: var(--navy-dark); background: var(--navy-tint); box-shadow: inset 3px 0 0 var(--navy); border-radius: 0 4px 4px 0; }
.side a .badge, .side a b.badge { margin-left: auto; min-width: 24px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--navy-tint); color: var(--navy); font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.side.vipo { border-right: 3px solid var(--navy); }
.side .portal { margin: -8px 8px 14px; font-size: 12.5px; color: var(--navy); font-weight: 600; }
.side .who { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--rule); font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.side .who .ell:first-child { color: var(--ink); font-weight: 600; }
.side .who a.acct { min-height: 30px; padding: 0; color: var(--navy); font-weight: 500; }
.side .who button { margin-top: 8px; align-self: flex-start; }
.main { flex: 999 1 640px; min-width: 0; padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 20px; }

/* ---------- Thành phần chung ---------- */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 20px; padding-bottom: 4px; }
.page-head > div:first-child { flex: 1 1 360px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
/* Cụm nút bên phải tiêu đề: luôn nằm ngang trên một dòng */
.page-head > .row, .page-head > a, .page-head > form { flex: 0 0 auto; flex-wrap: nowrap; }
.kick a { color: inherit; }

/* Tờ giấy: nền trắng, viền kẻ mảnh, không bóng */
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.card.accent { border-left: 4px solid var(--orange); }
.cardh { min-height: 54px; padding: 10px 16px; border-bottom: 1px solid var(--rule); display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.card.accent .cardh { background: var(--orange-tint); }
.h2 { font-family: var(--display); font-size: 18px; line-height: 24px; font-weight: 700; color: var(--ink); text-wrap: balance; }
.h3 { font-size: 15px; font-weight: 600; }
.pad { padding: 14px 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
/* Nút trong cột dọc giữ đúng bề rộng chữ, không kéo dài hết khung */
.stack > .btn, .stack > button.btn, .stack > a.btn { align-self: flex-start; }
.stack > .btn.block { align-self: stretch; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .grow { flex: 3 1 520px; min-width: 0; }
.cols > .aside { flex: 1 1 320px; min-width: 0; }
/* Màn có bảng rộng: cột phụ xuống dưới khi khung chính hẹp hơn ~1200px, để bảng không phải kéo ngang */
.cols.wide > .grow { flex-basis: 860px; }
.grow1 { flex: 1 1 240px; min-width: 0; }
.empty { padding: 20px 16px; color: var(--muted); margin: 0; }
.inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline.end { justify-content: flex-end; }
.anchor { display: block; position: relative; top: -12px; }
.prewrap { white-space: pre-line; margin: 0; line-height: 24px; }

/* Nút: mực xanh cho hành động chính, viền cho hành động phụ */
.btn { min-height: 40px; padding: 0 16px; border-radius: var(--r); font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; cursor: pointer; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.big { min-height: 48px; padding: 0 24px; font-size: 15px; }
.btn.fit { align-self: flex-start; margin-top: 4px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.pri { border: 0; background: var(--navy); color: #FFFFFF; }
.pri:hover { background: var(--navy-dark); color: #FFFFFF; }
.navy { border: 0; background: var(--navy-dark); color: #FFFFFF; }
.navy:hover { color: #FFFFFF; filter: brightness(1.12); }
.sec { border: 1px solid #C9D0DB; background: var(--sheet); color: var(--ink); font-weight: 500; }
.sec:hover { border-color: var(--navy); color: var(--navy); }
.dng { border: 1px solid var(--red); background: var(--sheet); color: var(--red); }
.dng:hover { background: var(--red-tint); }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--navy); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; white-space: nowrap; }
.linkbtn.danger { color: var(--red); }

/* Nhãn trạng thái: như dấu mộc nhỏ, chữ đậm trên nền nhạt */
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border-radius: 4px; border: 1px solid transparent; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.c-blue { background: var(--navy-tint); color: var(--navy-dark); border-color: #CDD6EA; }
.c-orange { background: var(--orange-tint); color: var(--orange-text); border-color: #F5D3AA; }
.c-green { background: var(--green-tint); color: var(--green); border-color: #BFE0CF; }
.c-red { background: var(--red-tint); color: var(--red); border-color: #F2C2BF; }
.c-grey { background: #F1F3F6; color: #3C424C; border-color: var(--rule); }
.warn { color: var(--orange-text); font-weight: 500; }
.bad { color: var(--red); font-weight: 500; }
.ok { color: var(--green); font-weight: 500; }
.ok-bg { background: var(--green-tint); } .warn-bg { background: var(--orange-tint); } .bad-bg { background: var(--red-tint); }

.flash { padding: 10px 14px; border-radius: var(--r); font-weight: 500; border-left: 4px solid currentColor; }
.flash.ok { background: var(--green-tint); color: var(--green); }
.flash.err { background: var(--red-tint); color: var(--red); }

/* Ô nhập */
.fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lbl { font-size: 12.5px; font-weight: 500; color: #3C4352; }
.inp { height: 40px; border: 1px solid #C9D0DB; border-radius: var(--r); padding: 0 10px; font: inherit; background: var(--sheet); color: var(--ink); min-width: 0; }
.inp:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-tint); }
.inp[readonly], .inp[disabled] { background: var(--paper); color: var(--muted); }
textarea.inp { height: auto; padding: 8px 10px; line-height: 1.5; }
.inp.sm { height: 34px; }
.inp.qty { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.inp.w100 { width: 100px; } .inp.w140 { width: 140px; } .inp.w160 { width: 160px; }
.inp.err { border-color: var(--red); }
.field-err { color: var(--red); font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.chk { width: 18px; height: 18px; margin: 0; vertical-align: middle; accent-color: var(--navy); cursor: pointer; }
.radio { display: flex; align-items: center; gap: 8px; min-height: 32px; cursor: pointer; }
.radio input { width: 18px; height: 18px; accent-color: var(--navy); }
fieldset.plain { border: 0; margin: 0; padding: 0; min-width: 0; }
input.swatch { width: 52px; height: 40px; padding: 2px; border: 1px solid #C9D0DB; border-radius: var(--r); background: var(--sheet); cursor: pointer; }

/* Bộ lọc và thẻ chuyển: mục đang chọn được tô dạ quang */
.filters { padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; border-bottom: 1px solid var(--rule); }
.filters .grow { flex: 1 1 220px; }
/* Thẻ chuyển kiểu gạch chân: vạch xanh nằm đúng trên đường kẻ đáy */
.tabs { padding: 0 8px; display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--rule); scrollbar-width: thin; }
.tab { flex-shrink: 0; min-height: 44px; padding: 0 12px; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; white-space: nowrap; box-shadow: inset 0 -2px 0 transparent; }
.tab:hover { color: var(--navy); box-shadow: inset 0 -2px 0 var(--rule); }
.tab.on { color: var(--navy-dark); font-weight: 700; box-shadow: inset 0 -3px 0 var(--navy); }
.tab b { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--rule-soft); color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: center; }
.tab.on b { background: var(--navy); color: #FFFFFF; }
.cmstabs { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); white-space: nowrap; }
.dl dd { margin: 0; min-width: 0; }

/* Chỉ số: một dải ô kẻ như sổ, không tách thành thẻ rời */
/* Hàng cuối tự giãn đủ chiều ngang nên không còn ô trống. */
.kpis { display: flex; flex-wrap: wrap; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
/* Mọi ô chia đều một hàng; chỉ xuống hàng khi mỗi ô hẹp hơn 150px */
.kpi { flex: 1 1 0; min-width: 150px; background: var(--sheet); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
a.kpi:hover { background: var(--navy-tint); color: var(--ink); }
.kpi .lbl { color: var(--muted); }
.kpi .v { font-family: var(--display); font-size: 26px; line-height: 32px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi .more { color: var(--navy); }
.kpi.ok-bg, .kpi.warn-bg, .kpi.bad-bg { background-image: none; }
.kpi.ok-bg { background: var(--green-tint); } .kpi.warn-bg { background: var(--orange-tint); } .kpi.bad-bg { background: var(--red-tint); }
.bigv { font-family: var(--display); font-size: 24px; font-weight: 700; }

/* ---------- Bảng kiểu sổ cái ---------- */
.scroll { overflow-x: auto; position: relative; }
.tbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.tbl th { height: 42px; padding: 0 10px; background: #F7F9FB; color: #3C4352; font-family: var(--display); font-size: 13.5px; font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--rule); }
.tbl th .sub { font-family: var(--text); font-weight: 400; font-size: 11.5px; }
/* Tiêu đề cột số canh phải cùng giá trị bên dưới */
.tbl th.num { text-align: right; }
.tbl th.two { white-space: normal; height: 52px; line-height: 16px; vertical-align: middle; }
.tbl td { height: 52px; padding: 4px 10px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; overflow: hidden; }
.tbl tbody tr:hover td { background: #FAFBFD; }
.tbl tr.total td { background: #F7F9FB; border-top: 2px solid var(--navy); border-bottom: 0; font-weight: 700; }
.tbl tr.total td.num:last-child { color: var(--navy-dark); font-size: 15px; }
.tbl .w44 { width: 44px; } .tbl .w56 { width: 56px; } .tbl .w90 { width: 90px; } .tbl .w110 { width: 110px; } .tbl .w130 { width: 130px; }
.tbl .w150 { width: 150px; } .tbl .w160 { width: 160px; } .tbl .w180 { width: 180px; } .tbl .w200 { width: 200px; } .tbl .w220 { width: 220px; } .tbl .w240 { width: 240px; } .tbl .w300 { width: 300px; }
.tbl.min520 { min-width: 520px; } .tbl.min640 { min-width: 640px; } .tbl.min800 { min-width: 800px; } .tbl.min940 { min-width: 940px; } .tbl.min1100 { min-width: 1100px; }
.tbl tr.noted td { background: #FFF7F5; }
.tbl tr.short td { background: #FFF8EF; }
.tbl tr.picked td { background: var(--navy-tint); }
.tbl tr.branchrow td { background: #F7F9FB; }
.wrapcell { white-space: normal !important; line-height: 19px; padding-top: 8px !important; padding-bottom: 8px !important; }
.indent { padding-left: 18px; }
.pc { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pc img { width: 36px; height: 36px; flex-shrink: 0; object-fit: contain; border-radius: 4px; border: 1px solid var(--rule); background: var(--sheet); }
.pc > span { min-width: 0; display: flex; flex-direction: column; }
/* Chữ dài trong ô (tên sản phẩm, địa chỉ, chi tiết): xuống tối đa 2 dòng rồi mới cắt, không cắt cụt ở 1 dòng */
.tbl td .ell { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
/* Dòng phụ (chi nhánh, mã, trạng thái chi tiết) giữ một dòng cho gọn bảng */
.tbl td .sub.ell { display: block; white-space: nowrap; text-overflow: ellipsis; }
.tbl td.num, .tbl td.num .sub, .tbl td .nw, .nw { white-space: nowrap; }
/* Thao tác cuối dòng: nằm ngang một hàng, cách nhau đủ rộng để bấm */
.tact { display: flex; align-items: center; justify-content: flex-end; gap: 6px 16px; flex-wrap: nowrap; white-space: nowrap; }
.tact form { margin: 0; display: inline-flex; }
.tact.start { justify-content: flex-start; }
.tcell { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }

/* Thanh chọn nhiều dòng */
.selbar { position: sticky; top: 0; z-index: 1; padding: 10px 16px; background: var(--navy-tint); border-bottom: 1px solid var(--rule); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.selbar .info { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.selbar .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.selbar .acts .btn { flex: 0 0 auto; }
.selbar [data-selcount] { font-variant-numeric: tabular-nums; }

/* ---------- Tiến trình, lịch sử, việc cần làm ---------- */
.steps { list-style: none; margin: 0; display: flex; flex-direction: column; }
.steps:not(.pad) { padding: 0; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 8px 0; }
.steps .dot { width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid #C5CBD3; background: var(--sheet); }
.steps li.done .dot { border-color: var(--navy); background: var(--navy); }
.steps li.now .dot { border-color: var(--orange); background: var(--orange); }
.steps li.now b { color: var(--orange-text); }

/* Tiến trình đơn: các bước nối bằng đường kẻ, bước hiện tại tô dạ quang */
.progress { list-style: none; margin: 0; padding: 18px 16px 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 14px 0; }
.progress li { display: flex; flex-direction: column; gap: 2px; position: relative; padding: 36px 10px 0 0; }
.progress li::before { content: ""; position: absolute; top: 13px; left: 28px; right: 0; height: 2px; background: var(--rule); }
.progress li:last-child::before { display: none; }
.progress li.done::before { background: var(--navy); }
.progress .pdot { position: absolute; top: 0; left: 0; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #C5CBD3; background: var(--sheet); color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; z-index: 1; }
.progress li.done .pdot { border-color: var(--navy); background: var(--navy); color: #FFFFFF; }
.progress li.now .pdot { border-color: var(--orange); background: var(--sheet); color: var(--ink); box-shadow: 0 0 0 4px var(--orange-tint); }
.progress li.now .strong { color: var(--ink); }
.progress li.stop .pdot { border-color: var(--red); background: var(--red); color: #FFFFFF; }
.progress li.skip { opacity: .55; }
.progress li.todo .strong { color: var(--muted); font-weight: 500; }
/* Tiến trình 9 bước: đủ 9 cột trên màn rộng, 5 cột trên màn vừa, không để 1 bước lẻ một mình */
.progress.p9 { grid-template-columns: repeat(9, minmax(0, 1fr)); }
.progress.p9 .strong { font-size: 13px; line-height: 18px; }
@media (max-width: 1180px) { .progress.p9 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.timeline { list-style: none; margin: 0; display: flex; flex-direction: column; }
.timeline:not(.pad) { padding: 0; }
.timeline li { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule-soft); }
.timeline li:last-child { border-bottom: 0; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { padding: 12px 16px; border-top: 1px solid var(--rule-soft); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.todo li:first-child { border-top: 0; }
.flow { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 12.5px; color: var(--muted); }
.flow li { padding: 3px 8px; border-radius: 4px; background: var(--sheet); border: 1px solid var(--rule); }
.flow li + li::before { content: "› "; color: var(--navy); }

/* Trao đổi trên đơn */
.msg { display: flex; gap: 10px; align-items: flex-start; }
.msg > div { min-width: 0; padding: 10px 12px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--rule-soft); display: flex; flex-direction: column; gap: 2px; }
.msg.mine { justify-content: flex-end; }
.msg.mine > div { background: var(--navy-tint); border-color: #D6DDED; max-width: 75%; }
.avatar { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; background: var(--navy); color: #FFFFFF; font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.addline { border-top: 1px solid var(--rule); align-items: flex-end; }
details.confirm summary { list-style: none; width: fit-content; }
details.confirm summary::-webkit-details-marker { display: none; }
details.confirm[open] summary { display: none; }

/* Thông báo */
.notify { list-style: none; margin: 0; padding: 0; }
.notify li { display: grid; grid-template-columns: 14px 1fr auto; gap: 12px; align-items: start; padding: 12px 16px; border-top: 1px solid var(--rule-soft); }
.notify li:first-child { border-top: 0; }
.notify li.unread { background: #F6F8FD; }
.notify a { color: var(--ink); text-decoration: none; min-width: 0; display: flex; flex-direction: column; }
.notify a:hover .strong { text-decoration: underline; }
.notify .dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: #C5CBD3; }
.notify li.unread .dot { background: var(--navy); }
.notify .dot.warn { background: var(--orange); } .notify .dot.ok { background: var(--green); }
.notify .when { white-space: nowrap; }

/* Biểu đồ cột, thước */
.bars { display: flex; gap: 12px; align-items: flex-end; min-height: 170px; }
.bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.bar .col { width: 100%; max-width: 56px; height: 120px; border-bottom: 2px solid var(--ink); display: flex; align-items: flex-end; }
.bar .fill { width: 100%; background: var(--navy); border-radius: 3px 3px 0 0; height: 0; }
.fill.h0 { height: 3%; } .fill.h1 { height: 10%; } .fill.h2 { height: 20%; } .fill.h3 { height: 30%; } .fill.h4 { height: 40%; } .fill.h5 { height: 50%; }
.fill.h6 { height: 60%; } .fill.h7 { height: 70%; } .fill.h8 { height: 80%; } .fill.h9 { height: 90%; } .fill.h10 { height: 100%; }
.meter { display: inline-block; vertical-align: middle; width: 110px; height: 8px; border-radius: 4px; background: var(--rule-soft); overflow: hidden; }
.meter .fillx { display: block; height: 100%; background: var(--navy); width: 2%; }
.fillx.w0 { width: 3%; } .fillx.w1 { width: 10%; } .fillx.w2 { width: 20%; } .fillx.w3 { width: 30%; } .fillx.w4 { width: 40%; } .fillx.w5 { width: 50%; }
.fillx.w6 { width: 60%; } .fillx.w7 { width: 70%; } .fillx.w8 { width: 80%; } .fillx.w9 { width: 90%; } .fillx.w10 { width: 100%; }
.sub.inl { display: inline; }
.brk { overflow-wrap: anywhere; }
/* Danh sách điểm giao trong ô bảng: mỗi đơn vị một dòng, tên đậm, địa chỉ nhạt; dòng dài thì cắt ở 1 dòng kèm đủ chữ khi rê chuột */
.dests { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 18px; }
.dests li { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dests b { font-weight: 600; }

/* ---------- Trang mua hàng ---------- */
/* Đầu trang: tiêu đề lớn bên trái, đường đi 4 bước duyệt bên phải */
.hero { background: var(--sheet); border: 1px solid var(--rule); border-top: 4px solid var(--navy); border-radius: var(--r); padding: 26px 28px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px 32px; align-items: center; }
.hero > div:first-child { flex: 1 1 380px; min-width: 0; }
.hero h1 { text-wrap: balance; margin: 0 0 6px; font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 40px; letter-spacing: -.01em; color: var(--navy); }
.hero p { margin: 0; color: var(--muted); font-size: 15px; max-width: 60ch; }
.hero .tagline { color: var(--muted); font-weight: 500; }
.hero-more { margin: 10px 0 0; padding-top: 10px; border-top: 1px dashed var(--rule); }
.hsteps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 0; }
.hsteps li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; }
.hsteps li:not(:last-child)::after { content: ""; width: 22px; height: 0; border-top: 2px dashed #B7C0CE; margin: 0 8px 0 2px; }
.hsteps b { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--navy); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; flex-shrink: 0; }
.sent { background: var(--green-tint); border: 1px solid #BFE0CF; border-left: 4px solid var(--green); border-radius: var(--r); padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.sent h2 { margin: 0; color: var(--green); font-family: var(--display); font-size: 22px; }
.sent p { margin: 4px 0 0; }
.sent .hsteps b { background: var(--sheet); }

/* Danh mục: dòng chữ, mục đang xem tô dạ quang */
.cats { display: flex; gap: 4px; overflow-x: auto; padding: 0; border-bottom: 1px solid var(--rule); scrollbar-width: thin; }
.cats a { flex-shrink: 0; min-height: 44px; padding: 0 12px; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; box-shadow: inset 0 -2px 0 transparent; }
.cats a:hover { color: var(--navy); box-shadow: inset 0 -2px 0 var(--rule); }
.cats a.on { color: var(--navy-dark); font-weight: 700; box-shadow: inset 0 -3px 0 var(--navy); }
.cats a b { color: var(--muted); font-weight: 500; font-size: 12.5px; }

/* Lưới sản phẩm như trang catalogue: ô ngăn bằng đường kẻ */
.grid-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.pcard { background: var(--sheet); padding: 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pcard .img { height: 128px; border-radius: 4px; background: var(--sheet); display: flex; align-items: center; justify-content: center; color: #A9B0BA; font-size: 12px; text-decoration: none; }
.pcard span.img > span, .pcard a.img > span { width: 100%; height: 100%; border: 1px dashed var(--rule); border-radius: 4px; display: flex; align-items: center; justify-content: center; }
.pcard .img img { max-height: 128px; max-width: 100%; object-fit: contain; }
.pcard .name { font-weight: 500; min-height: 42px; line-height: 21px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); text-decoration: none; }
.pcard a.name:hover { color: var(--navy); text-decoration: underline; }
.pcard .price { font-family: var(--display); font-size: 19px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; margin-top: auto; }
.pcard form { display: flex; gap: 6px; margin: 0; }
.pcard .inp.qty { width: 68px; }
.pager { justify-content: center; margin: 4px 0 8px; gap: 6px; }

.crumbs { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.pdetail { padding: 24px; display: flex; flex-wrap: wrap; gap: 28px; }
.pdetail .pimg { flex: 1 1 340px; max-width: 460px; display: flex; flex-direction: column; gap: 8px; }
.pdetail .pimg img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; border: 1px solid var(--rule-soft); border-radius: var(--r); background: var(--sheet); }
.pdetail .pimg > span:first-child { aspect-ratio: 1 / 1; border-radius: var(--r); border: 1px dashed var(--rule); display: flex; align-items: center; justify-content: center; color: #A9B0BA; }
.pdetail .pinfo { flex: 1 1 420px; min-width: 0; }
.ptitle { margin: 0; font-family: var(--display); font-size: 28px; line-height: 34px; font-weight: 700; text-wrap: balance; }
/* Giá phải trả: vệt dạ quang dưới số */
.pricebox { padding: 14px 16px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--rule); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.pricebox .big { font-family: var(--display); font-size: 32px; font-weight: 700; color: var(--navy-dark); font-variant-numeric: tabular-nums; }
.pricebox .sub { flex-basis: 100%; }
.desc { border-top: 1px solid var(--rule); padding-top: 14px; }
.desc p { white-space: pre-line; margin: 8px 0 0; max-width: 75ch; }

.about { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 24px; display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.about > .stack { flex: 1 1 360px; }
.about p { margin: 0; color: #3C4352; max-width: 70ch; }
.about .tiles { flex: 1 1 380px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.about .tiles div { background: var(--sheet); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.about .tiles b { color: var(--ink); font-size: 14px; align-self: flex-start; }
.about .tiles .here { box-shadow: inset 3px 0 0 var(--orange); }
.shipto { display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--rule); background: #F7F9FB; }

/* ---------- Đăng nhập: tờ phiếu có dòng kẻ ---------- */
.login { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--paper); }
.login .brand { flex: 1 1 420px; padding: 48px; display: flex; flex-direction: column; gap: 22px; justify-content: center;
  background: var(--sheet) repeating-linear-gradient(to bottom, transparent 0, transparent 31px, #F0F2F6 31px, #F0F2F6 32px);
  border-right: 3px solid var(--navy); }
.login .brand .logo { align-self: flex-start; }
.login .brand .title { font-size: 40px; line-height: 46px; color: var(--navy); max-width: 17ch; text-wrap: balance; }
.login .hsteps { flex-direction: column; align-items: flex-start; gap: 0; }
.login .hsteps li { min-height: 32px; }
.login .hsteps li:not(:last-child)::after { display: none; }
.login .brand p { color: #3C4352; max-width: 46ch; margin: 0; font-size: 15px; line-height: 24px; }
.login .form { flex: 1 1 480px; padding: 48px; display: flex; align-items: center; justify-content: center; }
.login .card { width: 100%; max-width: 420px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login .card h2 { font-family: var(--display); font-size: 24px; font-weight: 700; }
.login .card a { align-self: center; font-size: 13.5px; }

/* ---------- Quản trị: màn riêng ---------- */
.picker { flex: 0 0 280px; max-width: 100%; }
.picker .list { max-height: 640px; overflow-y: auto; display: flex; flex-direction: column; }
.picker .list a { padding: 10px 16px; border-top: 1px solid var(--rule-soft); color: var(--ink); text-decoration: none; display: flex; flex-direction: column; border-left: 3px solid transparent; }
.picker .list a:hover { background: #FAFBFD; }
.picker .list a.on { background: var(--navy-tint); border-left-color: var(--navy); }
.picker .list .ell { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
.drop { border: 2px dashed #A9B0BA; border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; color: #3C4352; }
.errors { margin: 0; padding-left: 18px; color: var(--red); font-size: 13.5px; }
.formula { margin: 0; padding-left: 34px; display: flex; flex-direction: column; gap: 4px; }
.addunit { border-top: 1px solid var(--rule); }
/* CMS: hai khung mỗi hàng, khung banner trải hết hàng; màn hẹp về một cột */
.cmsgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.cmsgrid > .span2 { grid-column: 1 / -1; }
.bannergrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.row.top { align-items: flex-start; }
.half { flex: 1 1 180px; min-width: 0; }
.noteeditor { border-top: 1px solid var(--rule); background: #F7F9FB; display: flex; flex-direction: column; gap: 10px; }
.noteeditor .row { align-items: flex-end; }
.notelist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.notelist li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--rule-soft); }
.sumgrid { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; border-top: 1px solid var(--rule); }
.sumgrid div { display: flex; flex-direction: column; gap: 2px; }
.sumgrid dt { font-size: 12.5px; color: var(--muted); }
.sumgrid dd { margin: 0; font-weight: 700; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.sumgrid dd .sub { white-space: nowrap; font-weight: 400; }
.sumgrid .big dd { font-family: var(--display); font-size: 22px; color: var(--ink); }
.sumgrid .big dd > span:first-child { color: var(--navy-dark); }
.tplnotes { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.fieldcards { display: flex; flex-wrap: wrap; gap: 10px; }
.fieldcard { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: #F7F9FB; }
.fieldcard > span { display: flex; flex-direction: column; }
details.addfield summary { list-style: none; display: inline-flex; cursor: pointer; }
details.addfield summary::-webkit-details-marker { display: none; }
details.addfield[open] summary { margin-bottom: 10px; }
details.addfield .row { align-items: flex-end; }
.editpanel { display: flex; flex-direction: column; gap: 12px; background: var(--navy-tint); border-bottom: 1px solid var(--rule); scroll-margin-top: 12px; }
.fld.end { justify-content: flex-end; align-items: flex-start; }
code.temppw { font-size: 16px; padding: 2px 8px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 4px; user-select: all; }
.bannerrow { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--rule); border-radius: var(--r); }
.bannerrow .row { align-items: flex-end; }

/* Phiếu nhập kho in được */
body.printpage { background: #FFFFFF; }
.receipt { max-width: 820px; margin: 0 auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 16px; }
.receipt h1 { text-align: center; font-family: var(--display); font-size: 24px; margin: 8px 0 0; color: var(--ink); }
.receipt header > div { display: flex; flex-direction: column; gap: 2px; }
.receipt .signs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; text-align: center; margin-top: 24px; min-height: 120px; }
.receipt .signs div { display: flex; flex-direction: column; gap: 4px; }
@media print { .noprint, .envbar { display: none !important; } .receipt { padding: 0; } .tbl tr.total td { background: none; } }

/* ---------- Màn hẹp ---------- */
@media (max-width: 720px) {
  .wrap, .main { padding: 16px; }
  /* Menu quản trị trên điện thoại: logo + tài khoản một hàng, menu thành dải cuộn ngang thay vì chiếm hết màn đầu */
  .side { max-width: none; min-width: 0; flex: 1 1 100%; border-right: 0; border-bottom: 1px solid var(--rule); flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px 0; }
  .side.vipo { border-right: 0; border-bottom: 3px solid var(--navy); }
  .side .logo { margin: 0; } .side .logo img { height: 32px; }
  .side .portal { display: none; }
  .side .who { order: 2; margin: 0 0 0 auto; padding: 0; border: 0; flex-direction: row; align-items: center; gap: 12px; }
  .side .who .ell { display: none; }
  .side .who button { margin-top: 0; }
  .side > nav { order: 3; flex: 1 1 100%; min-width: 0; flex-direction: row; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .side > nav a { flex-shrink: 0; white-space: nowrap; }
  .side a.on { box-shadow: inset 0 -3px 0 var(--navy); border-radius: 4px 4px 0 0; }
  .dl { grid-template-columns: 1fr; }
  .cmsgrid, .bannergrid { grid-template-columns: 1fr; }
  .page-head > .row { flex: 1 1 100%; flex-wrap: wrap; }
  .title { font-size: 26px; line-height: 32px; }
  .hero { padding: 20px 18px; }
  .hero h1 { font-size: 28px; line-height: 34px; }
  .login .brand, .login .form { padding: 24px 16px; }
  .login .brand { border-right: 0; border-bottom: 3px solid var(--navy); }
  .login .brand .title { font-size: 32px; line-height: 38px; }
  .kpis.three .kpi { flex-basis: 100%; }
  .progress.p9 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
