/* NQC WMS – Navy + Cam NQC, Light/Dark, Responsive desktop / tablet / mobile */
:root {
  --navy: #1B2A4A; --navy-2: #24365E; --navy-3: #2F4473;
  --orange: #F47920; --orange-soft: #FDEBDD; --green: #4DB848; --green-soft: #E3F4E2;
  --red: #D93025; --red-soft: #FDE7E5; --amber: #E8A100; --amber-soft: #FFF4D6; --blue: #4471C4; --blue-soft: #E5ECF8;
  --bg: #F4F6FA; --surface: #FFFFFF; --surface-2: #F7F8FB; --border: #E2E6EE; --text: #1A1A1A; --muted: #5F6B7A; --faint: #98A2B3;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 10px; --sidebar: 248px; --topbar: 56px;
  --font: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1522; --surface: #172033; --surface-2: #1C2740; --border: #2A3653; --text: #E8ECF4; --muted: #A3AEC2; --faint: #6F7C95;
    --orange-soft: #3A2616; --green-soft: #18321A; --red-soft: #3B1A19; --amber-soft: #3A2F10; --blue-soft: #1A2744;
    --shadow: 0 1px 3px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1522; --surface: #172033; --surface-2: #1C2740; --border: #2A3653; --text: #E8ECF4; --muted: #A3AEC2; --faint: #6F7C95;
  --orange-soft: #3A2616; --green-soft: #18321A; --red-soft: #3B1A19; --amber-soft: #3A2F10; --blue-soft: #1A2744;
  --shadow: 0 1px 3px rgba(0,0,0,.4); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
/* iPhone tai thỏ / Dynamic Island & thanh home khi chạy như ứng dụng */
.topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar) + env(safe-area-inset-top)); padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.sidebar { padding-top: env(safe-area-inset-top); }
@media (display-mode: standalone) { body { overscroll-behavior-y: contain; } }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
code, .mono { font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; } .bold { font-weight: 600; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #C9D3E6; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { width: 34px; height: 34px; }
.brand b { color: #fff; font-size: 15px; display: block; letter-spacing: .3px; }
.brand span { font-size: 11px; color: #94A3C0; }
.nav { padding: 8px 8px 24px; flex: 1; }
.nav .sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: #7D8BA8; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #D5DDEC; font-size: 13.5px; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.active { background: var(--orange); color: #fff; }
.nav a .ic { width: 18px; text-align: center; opacity: .9; }
.nav a .cnt { margin-left: auto; background: rgba(255,255,255,.15); color: #fff; border-radius: 10px; padding: 0 7px; font-size: 11px; line-height: 18px; }
.nav a .cnt.red { background: var(--red); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding: 0 16px; position: sticky; top: 0; z-index: 20; }
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; padding-left: 34px; }
.topbar .search .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.topbar .spacer { flex: 1; }
.iconbtn { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; font-size: 16px; }
.iconbtn:hover { background: var(--surface-2); }
.iconbtn .dot { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 10px; border-radius: 9px; padding: 0 5px; line-height: 16px; min-width: 16px; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 9px; }
.user-chip:hover { background: var(--surface-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--orange); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.view { padding: 18px 20px 80px; max-width: 1600px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head .t { flex: 1; min-width: 200px; }
.page-head .t p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.page-head .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sync { font-size: 11px; color: var(--faint); display: flex; align-items: center; gap: 5px; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.sync.off i { background: var(--red); }
.bottomnav, .mob-only { display: none; }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .hd { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.card > .hd h2 { flex: 1; font-size: 14.5px; }
.card > .bd { padding: 14px; }
.card > .bd.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.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)); }
.g-21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); position: relative; overflow: hidden; cursor: default; }
.kpi[data-href] { cursor: pointer; } .kpi[data-href]:hover { border-color: var(--orange); }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 3px; letter-spacing: -.3px; }
.kpi .s { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--navy-3); }
.kpi.or::before { background: var(--orange); } .kpi.gr::before { background: var(--green); } .kpi.rd::before { background: var(--red); } .kpi.am::before { background: var(--amber); } .kpi.bl::before { background: var(--blue); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn.pri { background: var(--orange); border-color: var(--orange); color: #fff; } .btn.pri:hover { filter: brightness(.95); }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); border-color: var(--red-soft); } .btn.danger:hover { background: var(--red-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { border-color: transparent; background: transparent; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; height: 36px; padding: 0 10px; width: 100%; min-width: 0; }
textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--orange) 45%, transparent); border-color: var(--orange); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--orange); vertical-align: middle; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
label.f .req { color: var(--red); }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 14px; }
.form .span2 { grid-column: span 2; } .form .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters > * { width: auto; }
.filters input[type=search], .filters .grow { flex: 1; min-width: 180px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a.active { color: var(--orange); border-bottom-color: var(--orange); text-decoration: none; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.pill.gr { background: var(--green-soft); color: #2E7D2A; border-color: transparent; } .pill.rd { background: var(--red-soft); color: var(--red); border-color: transparent; }
.pill.am { background: var(--amber-soft); color: #8A5D00; border-color: transparent; } .pill.bl { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.pill.or { background: var(--orange-soft); color: #B4520C; border-color: transparent; } .pill.nv { background: var(--navy); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .pill.gr { color: #8ED98A; } :root[data-theme="dark"] .pill.am { color: #F3C54D; } :root[data-theme="dark"] .pill.or { color: #F7A766; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.gr { color: #8ED98A; } :root:not([data-theme="light"]) .pill.am { color: #F3C54D; } :root:not([data-theme="light"]) .pill.or { color: #F7A766; } }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--text); margin-bottom: 4px; font-size: 14px; }
.notice { padding: 10px 12px; border-radius: 8px; background: var(--blue-soft); color: var(--text); font-size: 13px; margin-bottom: 12px; border-left: 3px solid var(--blue); }
.notice.warn { background: var(--amber-soft); border-color: var(--amber); } .notice.err { background: var(--red-soft); border-color: var(--red); } .notice.ok { background: var(--green-soft); border-color: var(--green); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.steps { display: flex; gap: 0; margin: 4px 0 14px; overflow-x: auto; }
.steps .st { flex: 1; min-width: 110px; text-align: center; font-size: 12px; color: var(--faint); position: relative; padding-top: 22px; }
.steps .st::before { content: ""; position: absolute; top: 6px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--border); z-index: 1; }
.steps .st::after { content: ""; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--border); }
.steps .st:first-child::after { display: none; }
.steps .st.done { color: var(--text); } .steps .st.done::before, .steps .st.done::after { background: var(--green); }
.steps .st.cur { color: var(--orange); font-weight: 600; } .steps .st.cur::before { background: var(--orange); box-shadow: 0 0 0 4px var(--orange-soft); }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.bar > i { display: block; height: 100%; background: var(--orange); }
.bar.gr > i { background: var(--green); }

/* ---------- Tables ---------- */
.tbl-wrap { overflow: auto; max-height: calc(100vh - 230px); }
.tbl-wrap.auto { max-height: none; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 12px; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 2; cursor: default; user-select: none; }
table.t th.sortable { cursor: pointer; } table.t th.sortable:hover { color: var(--text); }
table.t td { padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.t tr.clk { cursor: pointer; } table.t tr.clk:hover td { background: var(--surface-2); }
table.t td.num, table.t th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.t tfoot td { font-weight: 700; background: var(--surface-2); position: sticky; bottom: 0; }
table.t tr.warn td { background: var(--amber-soft); } table.t tr.bad td { background: var(--red-soft); }
.more { padding: 10px; text-align: center; }
.lines td input, .lines td select { height: 32px; }
.lines td { padding: 5px 6px; }

/* ---------- Modal / Toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10,16,30,.55); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; animation: fade .15s; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0,0,0,.3); display: flex; flex-direction: column; max-height: 90vh; }
.modal.wide { max-width: 980px; } .modal.mid { max-width: 760px; }
.modal .hd { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal .hd h2 { flex: 1; }
.modal .bd { padding: 16px; overflow-y: auto; }
.modal .ft { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 13px; animation: fade .2s; border-left: 4px solid var(--green); }
.toast.err { border-left-color: var(--red); } .toast.warn { border-left-color: var(--amber); }
.toast ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; opacity: .9; }

/* ---------- Typeahead ---------- */
.ta { position: relative; }
.ta-list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.15); z-index: 60; max-height: 320px; overflow-y: auto; min-width: 320px; }
.ta-list div { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 13px; }
.ta-list div:hover, .ta-list div.on { background: var(--orange-soft); }
.ta-list div small { display: block; color: var(--muted); }

/* ---------- Alerts ---------- */
.alert-row { display: flex; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.alert-row:last-child { border-bottom: 0; }
.alert-row .lv { width: 4px; align-self: stretch; border-radius: 3px; background: var(--blue); flex: none; }
.alert-row.CRITICAL .lv { background: var(--red); } .alert-row.WARNING .lv { background: var(--amber); }
.alert-row .m { flex: 1; min-width: 0; font-size: 13px; }
.alert-row .m small { color: var(--muted); display: block; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .art { background: linear-gradient(150deg, var(--navy) 0%, #13203B 60%, #0E1830 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login .art::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 60px solid rgba(244,121,32,.12); }
.login .art h1 { font-size: 30px; margin: 18px 0 10px; } .login .art p { color: #B9C4DA; max-width: 460px; }
.login .art ul { color: #D6DDEB; padding-left: 18px; line-height: 1.9; }
.login .frm { display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--surface); }
.login form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- Scanner ---------- */
#scan-reader { width: 100%; max-width: 520px; margin: 0 auto; border-radius: 10px; overflow: hidden; background: #000; min-height: 220px; }
#scan-reader video { width: 100% !important; }
.scan-result { margin-top: 12px; }

/* ---------- Labels (tem QR) ---------- */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(62mm, 1fr)); gap: 4mm; }
.label { border: 1px dashed #999; border-radius: 6px; padding: 3mm; display: flex; gap: 3mm; background: #fff; color: #000; break-inside: avoid; font-size: 9pt; line-height: 1.25; }
.label img { width: 24mm; height: 24mm; flex: none; }
.label b { font-size: 9.5pt; } .label .hdr { font-size: 7pt; color: #F47920; font-weight: 700; letter-spacing: .4px; }

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .sidebar, .topbar, .bottomnav, .no-print, .page-head .acts, #toasts, .fab { display: none !important; }
  .shell { display: block; } .view { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; } .print-only { display: block; }
  .tbl-wrap { max-height: none; overflow: visible; } table.t th { position: static; background: #eee; color: #000; }
  table.t td, table.t th { border: 1px solid #999; padding: 4px 6px; }
  a { color: #000; }
}
.doc-print h1 { text-align: center; color: var(--orange); font-size: 20px; margin: 10px 0 2px; }
.sign { display: grid; grid-template-columns: repeat(5, 1fr); text-align: center; margin-top: 26px; font-size: 12px; }
.sign div b { display: block; } .sign div span { display: block; height: 60px; }

/* ---------- Responsive ---------- */
@media (max-width: 1400px) { .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1180px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-21 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 90; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .mob-only { display: inline-flex; }
  .g2, .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .view { padding: 12px 12px calc(90px + env(safe-area-inset-bottom)); }
  .topbar { padding-left: 10px; padding-right: 10px; gap: 6px; }
  input, select, textarea { font-size: 16px; } /* iOS không tự phóng to khi chạm ô nhập */
  .btn { height: 40px; } .btn.sm { height: 34px; } .btn.xs { height: 28px; }
  .topbar .user-chip .nm, .desk-only { display: none !important; }
  .g4 { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 10px 12px; } .kpi .v { font-size: 18px; }
  .form { grid-template-columns: 1fr 1fr; } .form .span2 { grid-column: 1 / -1; }
  .kv { grid-template-columns: 120px 1fr; }
  .page-head h1 { font-size: 18px; }
  .page-head .acts { width: 100%; } .page-head .acts .btn { flex: 1; }
  .bottomnav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); z-index: 50; padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 10.5px; color: var(--muted); position: relative; }
  .bottomnav a .ic { font-size: 19px; line-height: 1; }
  .bottomnav a.active { color: var(--orange); text-decoration: none; }
  .bottomnav a.scan .ic { background: var(--orange); color: #fff; width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-top: -22px; box-shadow: 0 4px 14px rgba(244,121,32,.45); }
  .bottomnav a .dot { position: absolute; top: 3px; left: 55%; background: var(--red); color: #fff; font-size: 9.5px; border-radius: 8px; padding: 0 4px; line-height: 14px; }
  #toasts { bottom: 74px; left: 12px; right: 12px; max-width: none; }
  /* Bảng → thẻ trên điện thoại */
  table.t.cards thead { display: none; }
  table.t.cards, table.t.cards tbody, table.t.cards tr, table.t.cards td { display: block; width: 100%; }
  table.t.cards tr { border: 1px solid var(--border); border-radius: 10px; margin: 0 0 8px; padding: 8px 10px; background: var(--surface); }
  table.t.cards td { border: 0; padding: 2px 0; display: flex; gap: 10px; justify-content: space-between; text-align: right; }
  table.t.cards td::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; flex: none; max-width: 45%; }
  table.t.cards td.main { display: block; text-align: left; font-weight: 600; font-size: 14px; padding-bottom: 4px; }
  table.t.cards td.main::before { display: none; }
  table.t.cards td.mhide { display: none; }
  table.t.cards tfoot { display: block; }
  .tbl-wrap { max-height: none; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 14px 14px 0 0; }
  .login { grid-template-columns: 1fr; } .login .art { display: none; }
  .sign { grid-template-columns: repeat(3, 1fr); row-gap: 14px; }
}

/* Ma trận phân quyền */
.pm { width: 30px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--faint); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pm.base { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.pm.gr { background: var(--green); color: #fff; border-color: transparent; }
.pm.rd { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.pm.off { opacity: .6; }
.pm:disabled { cursor: not-allowed; opacity: .45; }
