/* BDS Studio – lõi giao diện. Xanh than · vàng ánh kim · kem. */
:root {
  --navy: #0F1E33; --navy-2: #172B4B; --navy-3: #22385C;
  --gold: #C9A24A; --gold-2: #A8842F; --gold-3: #E6C77A;
  --gold-soft: rgba(201, 162, 74, .14); --gold-line: rgba(201, 162, 74, .38);
  --gold-text: #7A5C14; /* chữ vàng trên nền sáng: 6.2:1 trên trắng, 5.6:1 trên kem (WCAG AA ≥ 4.5). Nền nút giữ --gold thương hiệu */
  --cream: #F7F3EA; --cream-2: #EFE8D8;
  --bg: var(--cream); --card: #FFFFFF; --surface: #FFFFFF; --surface-2: #FBF8F1; --field: #FFFFFF;
  --text: #0F1E33; --muted: #5F6979; --faint: #8C93A0;
  --line: rgba(15, 30, 51, .09); --line-2: rgba(15, 30, 51, .16);
  --ok: #2E7D4F; --ok-soft: rgba(46, 125, 79, .12);
  --warn: #B7791F; --warn-soft: rgba(201, 138, 26, .14);
  --danger: #B4423A; --danger-soft: rgba(180, 66, 58, .1);
  --info: #2F5D8A;
  --r-xl: 22px; --r-lg: 18px; --r: 14px; --r-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(15, 30, 51, .05);
  --shadow: 0 1px 2px rgba(15, 30, 51, .04), 0 10px 28px -14px rgba(15, 30, 51, .22);
  --shadow-lg: 0 30px 70px -24px rgba(8, 16, 30, .45);
  --font: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --nav-h: 66px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --topbar-bg: rgba(247, 243, 234, .86);
  --ribbon-bg: linear-gradient(90deg, #F3D57E, #E8BE55);
  --rib-h: 34px; --rib: 0px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1525; --card: #12223A; --surface: #12223A; --surface-2: #0F1D31; --field: #0D1A2C;
    --text: #EEE8DA; --muted: #A2ACBC; --faint: #7C879A;
    --line: rgba(238, 232, 218, .08); --line-2: rgba(238, 232, 218, .16);
    --gold: #D5B263; --gold-2: #E2C27A; --gold-soft: rgba(213, 178, 99, .14); --gold-text: #E2C27A;
    --ok: #5DBB87; --warn: #E2A84A; --danger: #E57C72; --info: #8AB4E0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .6);
    --topbar-bg: rgba(10, 21, 37, .82);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1525; --card: #12223A; --surface: #12223A; --surface-2: #0F1D31; --field: #0D1A2C;
  --text: #EEE8DA; --muted: #A2ACBC; --faint: #7C879A;
  --line: rgba(238, 232, 218, .08); --line-2: rgba(238, 232, 218, .16);
  --gold: #D5B263; --gold-2: #E2C27A; --gold-soft: rgba(213, 178, 99, .14); --gold-text: #E2C27A;
  --ok: #5DBB87; --warn: #E2A84A; --danger: #E57C72; --info: #8AB4E0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .6);
  --topbar-bg: rgba(10, 21, 37, .82);
  color-scheme: dark;
}

/* ── nền tảng ── */
html { font-size: 16px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[data-size="l"] { font-size: 18px; }
html[data-size="xl"] { font-size: 21px; }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 1rem; line-height: 1.5; font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
img, svg, video, canvas { max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--gold-text); }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.break { overflow-wrap: anywhere; }
.lead { font-size: 1.05rem; font-weight: 500; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.emoji { font-size: 1.35em; line-height: 1; }
:focus-visible { outline: 2.5px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
::selection { background: var(--gold-soft); }

/* ── khởi động ── */
.app-boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: var(--navy); }
.boot { display: grid; justify-items: center; gap: 22px; }
.boot-mark { border-radius: 20px; box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .6); }
.boot-bar { width: 120px; height: 3px; border-radius: 3px; background: rgba(201, 162, 74, .18); overflow: hidden; }
.boot-bar span { display: block; width: 40%; height: 100%; background: var(--gold); border-radius: 3px; animation: bootbar 1.1s var(--ease) infinite; }
.boot-note { color: var(--cream); }
@keyframes bootbar { from { transform: translateX(-110%); } to { transform: translateX(260%); } }

/* ── dải dùng thử ── */
.ribbon {
  position: sticky; top: 0; z-index: 45; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: nowrap;
  height: var(--rib-h); padding: 0 16px; white-space: nowrap; overflow: hidden; background: var(--ribbon-bg); color: #3A2A06; font-size: .82rem; font-weight: 600; text-align: center;
}
.ribbon-dot { width: 7px; height: 7px; border-radius: 50%; background: #6B4B07; box-shadow: 0 0 0 3px rgba(107, 75, 7, .18); }
.ribbon > span:not(.ribbon-dot) { overflow: hidden; text-overflow: ellipsis; }
html[data-mode="demo"] { --rib: var(--rib-h); }
.ribbon-link { flex: 0 0 auto; color: #3A2A06; text-decoration: underline; text-underline-offset: 3px; font-weight: 700; min-height: 24px; }

/* ── nút ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent; font-weight: 600; font-size: .95rem; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background-color .2s, border-color .2s, opacity .2s; position: relative;
  text-decoration: none; max-width: 100%;
}
.btn span { overflow: hidden; text-overflow: ellipsis; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #D6B261, var(--gold) 55%, #B9913B); color: #1A1404; border-color: rgba(120, 88, 20, .35); box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 8px 18px -10px rgba(168, 132, 47, .9); }
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 12px 24px -10px rgba(168, 132, 47, .95); }
.btn-secondary { background: var(--surface); border-color: var(--line-2); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { border-color: var(--gold-line); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--gold-soft); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(180, 66, 58, .25); }
.btn-danger:hover { background: rgba(180, 66, 58, .16); }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; flex: 0 0 auto; }
.btn .ico { flex: 0 0 auto; }
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-color: var(--text) transparent var(--text) transparent; animation: spin .8s linear infinite; }
.btn-primary.is-busy::after { border-color: #1A1404 transparent #1A1404 transparent; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 4px; }
.link-btn { background: none; border: 0; color: var(--gold-text); font-weight: 600; min-height: 44px; cursor: pointer; padding: 0 4px; justify-self: center; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.spinner { display: inline-block; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--gold-soft); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* nút "?" – vùng chạm 44px, hình tròn nhỏ */
.help-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; margin: -10px -8px -10px -4px;
  background: none; border: 0; color: var(--gold-text); font-weight: 700; font-size: .8rem; cursor: pointer; flex: 0 0 auto; vertical-align: middle;
}
.help-btn::before { content: ''; position: absolute; inset: 11px; border-radius: 50%; border: 1.5px solid var(--gold-line); background: var(--gold-soft); transition: background .2s; }
.help-btn:hover::before { background: rgba(201, 162, 74, .26); }
.help-top { margin: 0; font-size: .95rem; }
.help-top::before { inset: 7px; }
/* 17/11: nút trợ giúp dùng biểu tượng help (đã có vòng tròn) – nền vàng nhạt, không viền thứ 2 */
.help-btn .ico { position: relative; }
.help-btn::before { border-color: transparent; }

/* ── badge / trạng thái ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; line-height: 1.4; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge-gold { background: var(--gold-soft); color: var(--gold-text); border-color: var(--gold-line); }
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge-info { background: rgba(47, 93, 138, .1); color: var(--info); border-color: transparent; }
.st { font-weight: 700; }
.st-ok { color: var(--ok); }
.st-bad { color: var(--danger); }
.st-wait { color: var(--faint); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.org-panel .org-dept { display: inline-flex; align-items: center; gap: 2px; } /* Phòng ban – core/org_depts.js */

/* ── tiến độ ── */
.progress { position: relative; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold-2), var(--gold), var(--gold-3)); transition: width .5s var(--ease); }
.meter { display: grid; gap: 8px; padding: 14px 16px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.meter-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: .92rem; }
.meter-bar.warn .progress-bar { background: linear-gradient(90deg, #C9661A, var(--warn)); }
.warn-text { color: var(--warn); font-size: .88rem; font-weight: 600; }
.stack { display: grid; gap: 10px; }

/* ── form ── */
.field { display: grid; gap: 7px; min-width: 0; }
.field-label { display: flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.field-hint { font-size: .8rem; color: var(--faint); }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--field); color: var(--text); font-size: 1rem; transition: border-color .2s, box-shadow .2s; -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
/* QA 18/11: ô chọn không bao giờ rộng hơn chỗ chứa (tên dài trong <option> đẩy hộp thoại "Đẩy số" tràn màn 390 px) */
select { max-width: 100%; min-width: 0; }
select { padding-right: 38px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 52%, calc(100% - 15px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.field-toggle { grid-template-columns: 1fr auto; align-items: center; min-height: 52px; padding: 4px 0; }
/* QA 18/11: chữ giải thích thêm vào ô bật/tắt (quyền từng phần, "🧪 Thử nghiệm…") nằm hết bề ngang dưới nhãn – trước: rơi vào cột công tắc, ép cột nhãn còn 1 chữ */
.field-toggle > :not(.field-label):not(.switch) { grid-column: 1 / -1; min-width: 0; }
.switch { -webkit-appearance: none; appearance: none; width: 52px; height: 30px; border-radius: 999px; background: var(--line-2); position: relative; cursor: pointer; transition: background .2s; margin: 7px 0; flex: 0 0 auto; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .25s var(--ease); }
.switch:checked { background: var(--gold); }
.switch:checked::after { transform: translateX(22px); }
.form-err { color: var(--danger); font-size: .9rem; font-weight: 500; min-height: 0; }
.form-err:empty { display: none; }
/* 17/11: xác nhận email bằng mã 6 số (core/email_verify.js) */
.ev-box { display: grid; gap: .5rem; }
.ev-box[hidden], .ev-box [hidden] { display: none; }
.ev-err { color: var(--danger); font-weight: 500; }
.ev-err:empty { display: none; }
.ev-ok { color: var(--ok, #1f7a4d); font-weight: 600; }
.ev-code .field input { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.grid-2, .grid-3 { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.set-body > .sub-block:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
#set-security .field-number { max-width: 260px; }
.sub-block { padding-top: 16px; margin-top: 16px; border-top: 1px dashed var(--line-2); display: grid; gap: 12px; }
.section-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 6px; }

/* phân đoạn */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); max-width: 100%; flex-wrap: wrap; }
.seg-btn { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: .9rem; cursor: pointer; transition: background .2s, color .2s, box-shadow .2s; }
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 30, 51, .12), 0 0 0 1px var(--gold-line); }
.field > .seg { justify-self: start; }
.seg-sm .seg-btn { padding: 0 11px; font-size: .84rem; }
.seg[hidden] { display: none; }

/* ── thẻ ── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-ico { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; border-radius: 12px; background: var(--gold-soft); color: var(--gold-text); }
.card-titles { flex: 1 1 auto; min-width: 0; }
.card-title { font-size: 1.05rem; font-weight: 700; }
.card-sub { color: var(--muted); font-size: .88rem; }
.card-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.card-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.card-more { display: none; margin-top: 8px; min-height: 44px; padding: 0 2px; background: none; border: 0; color: var(--gold-text); font-weight: 600; font-size: .9rem; cursor: pointer; }
body[data-density="compact"] .card-detail:not(.open) { display: none; }
body[data-density="compact"] .card-more { display: inline-flex; align-items: center; }
.card-ok { border-color: rgba(46, 125, 79, .3); }
.card-warn { border-color: rgba(201, 138, 26, .35); }

/* ── danh sách ── */
.list { list-style: none; margin: 0; padding: 0; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); overflow: hidden; }
.row { padding: 12px 16px; min-height: 56px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-click { cursor: pointer; transition: background .15s; }
.row-click:hover { background: var(--surface-2); }
.row-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-width: 0; }
.row-text { display: grid; gap: 2px; min-width: 0; }
.row-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-size: .9rem; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 36px 16px; text-align: center; color: var(--muted); }
.empty-ico { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--gold-soft); color: var(--gold-text); }
/* 1.0.21: chức năng chỉ dùng trên máy tính – thẻ báo khi mở trên điện thoại / máy tính bảng */
.desk-only { display: grid; justify-items: center; gap: 12px; text-align: center; max-width: 520px; margin: 24px auto; }
.desk-only-ico { font-size: 2.2rem; line-height: 1; }
.desk-only-title { font-size: 1.15rem; margin: 0; }
.desk-only-text { margin: 0; overflow-wrap: anywhere; }
.desk-only-acts { justify-content: center; flex-wrap: wrap; }
.loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px 16px; color: var(--muted); }
.prose { display: grid; gap: 8px; }
.prose p { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ── toast ── */
.toasts { position: fixed; z-index: 200; left: 16px; right: 16px; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 520px; padding: 12px 16px; border-radius: 14px;
  background: var(--navy); color: var(--cream); box-shadow: var(--shadow-lg); font-size: .92rem; font-weight: 500;
  opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .25s var(--ease), transform .25s var(--ease); pointer-events: auto;
  border: 1px solid rgba(201, 162, 74, .25);
}
.toast.in { opacity: 1; transform: none; }
.toast .ico { color: var(--gold); flex: 0 0 auto; }
.toast-ok .ico { color: #7FD3A3; }
.toast-error .ico { color: #F19A90; }
.toast-warn .ico { color: #F0C064; }
.app-auth ~ .toasts, .toasts:only-child { bottom: 24px; }
/* Hộp thoại đang mở: toast lên dải trên cùng (hộp thoại chừa sẵn dải này), không bao giờ đè dòng chi phí / nút của hộp thoại */
.modal-open .toasts { top: calc(8px + env(safe-area-inset-top)); bottom: auto; left: 16px; right: 16px; justify-items: center; }
.modal-open .toast { max-width: min(520px, 100%); padding: 8px 14px; min-height: 44px; }
.modal-open .toast > span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; } /* 3 dòng: câu cảnh báo hiện đủ, không cắt "…" */
/* 17/11 QA điện thoại: toast lên dải trên cùng, gọn 2 dòng – không che dòng danh sách / nút Gọi-Zalo ở đáy màn; chạm để tắt */
@media (max-width: 639px) {
  .toasts, .app-auth ~ .toasts, .toasts:only-child { top: calc(8px + env(safe-area-inset-top)); bottom: auto; align-content: start; }
  .toast { padding: 8px 14px; min-height: 44px; transform: translateY(-10px) scale(.98); }
  .toast:not(:has(details)) > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}

/* ── modal ── */
.modal-back {
  --toast-band: calc(84px + env(safe-area-inset-top)); /* dải trên cùng dành cho toast khi hộp thoại mở */
  position: fixed; inset: 0; z-index: 150; display: flex; align-items: flex-end; justify-content: center;
  max-width: 100vw; /* QA 18/11: trang lỡ tràn ngang (vùng cố định nở theo trang trên điện thoại) → hộp thoại vẫn đúng bề rộng màn, nút không lọt ra ngoài */
  background: rgba(8, 15, 28, .5); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); opacity: 0; transition: opacity .2s var(--ease);
}
.modal-back.in { opacity: 1; }
.modal {
  width: 100%; max-height: min(90vh, calc(100vh - var(--toast-band))); max-height: min(90dvh, calc(100dvh - var(--toast-band))); display: flex; min-width: 0; flex-direction: column; background: var(--card); color: var(--text);
  border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg); transform: translateY(24px); transition: transform .28s var(--ease);
  padding-bottom: env(safe-area-inset-bottom); border: 1px solid var(--line);
}
.modal-back.in .modal { transform: none; }
.modal { max-width: 100%; }
.modal-body :is(input, select, textarea) { max-width: 100%; min-width: 0; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 18px 12px 6px 22px; }
.modal-title { flex: 1 1 auto; font-size: 1.15rem; font-weight: 700; }
.modal-body { padding: 8px 22px 18px; overflow: auto; overflow-x: hidden; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.modal-body > *, .modal-body .table-wrap { min-width: 0; max-width: 100%; }
.modal-body .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 14px 22px 20px; border-top: 1px solid var(--line); }
@media (min-width: 640px) {
  .modal-back { align-items: center; padding: var(--toast-band) 24px 24px; }
  .modal { max-width: 500px; border-radius: 22px; transform: translateY(12px) scale(.98); max-height: min(90vh, calc(100vh - var(--toast-band) - 24px)); max-height: min(90dvh, calc(100dvh - var(--toast-band) - 24px)); }
  .modal-wide { max-width: 680px; }
}
/* 22/11: điện thoại, hộp thoại mở → toast được 3 dòng (cao ~84px, từ 8px) → dải chừa trên hộp thoại ≥ 8 + 84 + khe, không thì đè đầu hộp thoại */
@media (max-width: 639px) { .modal-back { --toast-band: calc(100px + env(safe-area-inset-top)); } }
.building { display: grid; justify-items: center; gap: 12px; text-align: center; padding: 6px 0; }
.building .progress { width: 100%; }
.building-ico { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: var(--gold-soft); border: 1px dashed var(--gold-line); }
.building-meta { color: var(--muted); font-size: .9rem; }
.handoff { display: grid; gap: 12px; }
.handoff-prompt { font-size: .9rem; background: var(--surface-2) !important; }
.handoff-img { display: grid; gap: 8px; padding: 14px; border: 2px dashed var(--gold-line, var(--line)); border-radius: var(--r, 12px); background: var(--surface-2); }
.handoff-img.over, .handoff-img:focus-visible { border-color: var(--gold); background: var(--gold-soft); outline: none; }
.handoff-img-hint { margin: 0; }
.handoff-img-preview { display: grid; gap: 4px; justify-items: start; }
.handoff-img-preview img { max-width: 100%; max-height: 260px; border-radius: 8px; object-fit: contain; background: var(--surface); }
.handoff-img-err { color: var(--danger); }
.handoff-img-err:empty { display: none; }

/* ── xác thực / khoá ── */
.auth, .lock-overlay {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(201, 162, 74, .22), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(201, 162, 74, .12), transparent 60%),
    linear-gradient(160deg, #13274A, var(--navy) 55%, #091426);
}
.app-auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.app-auth .auth { flex: 1 1 auto; min-height: 0; }
.lock-overlay { position: fixed; inset: 0; z-index: 120; overflow: auto; animation: fadein .25s var(--ease); }
.auth-card {
  width: 100%; max-width: 420px; display: grid; gap: 14px; padding: 30px 26px 26px; border-radius: 26px;
  background: var(--card); color: var(--text); box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .65); border: 1px solid rgba(201, 162, 74, .28);
  animation: rise .45s var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.brand-mark { border-radius: 16px; box-shadow: 0 10px 24px -10px rgba(15, 30, 51, .55); flex: 0 0 auto; }
.brand-name { font-weight: 700; font-size: 1.2rem; letter-spacing: -.01em; }
.brand-tag { font-size: .84rem; color: var(--muted); }
.auth-title { font-size: 1.55rem; font-weight: 700; }
.auth-lead { color: var(--muted); font-size: .95rem; }
.auth-form { display: grid; gap: 14px; margin-top: 4px; }
.auth-form .btn-primary { min-height: 50px; font-size: 1rem; margin-top: 4px; }
.lock-ico { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--gold-soft); color: var(--gold-text); border: 1px solid var(--gold-line); }
.strength { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin-top: -4px; }
.sbars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.sbar { height: 5px; border-radius: 4px; background: var(--line-2); transition: background .25s; }
.slabel { font-size: .8rem; font-weight: 600; color: var(--muted); min-width: 64px; text-align: right; }
.strength[data-score="0"] .sbar:nth-child(-n+1), .strength[data-score="1"] .sbar:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] .sbar:nth-child(-n+2) { background: var(--warn); }
.strength[data-score="3"] .sbar:nth-child(-n+3) { background: #6BA368; }
.strength[data-score="4"] .sbar { background: var(--ok); }
.strength[data-score=""] .sbar { background: var(--line-2); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.app.is-locked .frame { visibility: hidden; }

/* ── khung (điện thoại trước) ── */
.app-shell { min-height: 100vh; min-height: 100dvh; }
.frame { min-height: 100vh; min-height: 100dvh; }
.nav {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 0 4px env(safe-area-inset-bottom); background: color-mix(in srgb, var(--card) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-top: 1px solid var(--line);
}
.nav-brand, .nav-foot { display: none; }
.nav-items { display: grid; grid-template-columns: repeat(var(--nav-n, 6), minmax(0, 1fr)); height: var(--nav-h); }
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 44px;
  color: var(--muted); text-decoration: none; font-size: clamp(10.5px, .66rem, 12.5px); font-weight: 600; letter-spacing: .01em; position: relative; transition: color .2s;
}
.nav-ico { display: grid; place-items: center; width: 48px; height: 30px; border-radius: 999px; transition: background .25s var(--ease), color .2s; }
.nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.nav-item.on { color: var(--text); }
.nav-item.on .nav-ico { background: var(--gold-soft); color: var(--gold-text); }
.main { min-width: 0; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); }
.topbar {
  position: sticky; top: var(--rib); z-index: 20; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px 16px; background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line);
}
.top-back { display: none; margin-left: -8px; }
.in-module .top-back { display: inline-flex; }
.top-titles { flex: 1 1 120px; min-width: 0; }
.top-title { font-size: 1.12rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-sub { display: none; color: var(--muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; margin-left: auto; max-width: 100%; flex-wrap: wrap; justify-content: flex-end; } /* 18/11: máy 360 px có thanh cuộn + số thay đổi chờ gửi 2 chữ số → không lòi ra mép phải (xuống dòng thay vì tràn) */
.top-lock { display: none; }
.sync { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; height: 44px; padding: 0 8px; border: 0; background: none; cursor: pointer; border-radius: 12px; color: var(--muted); font-size: .76rem; font-weight: 600; }
.sync:hover { background: var(--gold-soft); }
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); box-shadow: 0 0 0 4px rgba(140, 147, 160, .18); transition: background .3s, box-shadow .3s; }
.sync[data-state="ok"] .sync-dot { background: #3DAA6A; box-shadow: 0 0 0 4px rgba(61, 170, 106, .18); }
.sync[data-state="pending"] .sync-dot { background: #E0A92E; box-shadow: 0 0 0 4px rgba(224, 169, 46, .2); animation: pulse 1.6s ease-in-out infinite; }
.sync[data-state="off"] .sync-dot { background: #9AA1AD; }
.sync-text:empty { display: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(224, 169, 46, .05); } }
.panes { min-width: 0; }
.view { padding: 16px 16px 24px; max-width: 1180px; margin: 0 auto; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }
.view:focus { outline: none; }
.view, .sheet-body, .modal-body { container-type: inline-size; }
.nav-label-full { display: none; }
.view.enter { animation: viewin .32s var(--ease) both; }
@keyframes viewin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.detail { display: none; }
.module-host { min-width: 0; }

/* hero màn */
.hero {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 20px; border-radius: var(--r-xl); color: var(--cream);
  background:
    radial-gradient(420px 220px at 100% 0%, rgba(201, 162, 74, .28), transparent 65%),
    linear-gradient(140deg, var(--navy-2), var(--navy) 60%, #0A162A);
  box-shadow: 0 18px 40px -22px rgba(15, 30, 51, .7); border: 1px solid rgba(201, 162, 74, .2);
}
.hero::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; border: 1px solid rgba(201, 162, 74, .22); }
.hero-text { position: relative; z-index: 1; display: grid; gap: 4px; min-width: 0; }
.hero-kicker { color: var(--gold-3); font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.hero-title { font-size: 1.5rem; font-weight: 700; color: #FFFDF7; overflow-wrap: anywhere; }
.hero-sub { color: rgba(247, 243, 234, .74); font-size: .92rem; }
.hero-mark { position: relative; z-index: 1; display: grid; place-items: center; width: 64px; height: 64px; flex: 0 0 auto; border-radius: 20px; background: rgba(201, 162, 74, .14); color: var(--gold-3); border: 1px solid rgba(201, 162, 74, .32); }

/* thẻ module */
.tiles { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 600px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 1000px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile {
  display: flex; align-items: center; gap: 14px; min-height: 84px; padding: 16px 14px 16px 16px; border-radius: var(--r-lg);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--text); text-decoration: none; min-width: 0;
  transition: transform .2s var(--ease), box-shadow .25s var(--ease), border-color .2s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--gold-line); box-shadow: 0 2px 4px rgba(15, 30, 51, .04), 0 18px 34px -18px rgba(15, 30, 51, .35); }
.tile-ico { display: grid; place-items: center; width: 54px; height: 54px; flex: 0 0 auto; border-radius: 16px; background: linear-gradient(145deg, var(--gold-soft), rgba(201, 162, 74, .05)); border: 1px solid var(--gold-line); }
.tile-text { display: grid; gap: 3px; flex: 1 1 auto; min-width: 0; }
.tile-title { font-weight: 700; font-size: 1.02rem; }
.tile-desc { color: var(--muted); font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-chev { color: var(--faint); flex: 0 0 auto; transition: transform .2s var(--ease), color .2s; }
.tile:hover .tile-chev { transform: translateX(3px); color: var(--gold-text); }
.tile.is-building { background: var(--surface-2); box-shadow: none; border-style: dashed; cursor: default; }
.tile.is-building .tile-ico { filter: grayscale(1); opacity: .55; border-style: dashed; }
.tile.is-building .tile-title { color: var(--muted); }
.tile.is-building:hover { transform: none; }
.tile-badge { justify-self: start; display: inline-flex; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; color: var(--warn); background: var(--warn-soft); }
.tile-prog { display: grid; gap: 4px; margin-top: 4px; }
.tile-prog .progress { height: 6px; opacity: .8; }
.tile-meta { font-size: .76rem; color: var(--faint); }

/* ── sheet ── */
.sheet { background: var(--bg); display: flex; flex-direction: column; min-width: 0; }
.sheet-page {
  position: fixed; inset: 0; z-index: 60; transform: translateX(100%); transition: transform .3s var(--ease); max-width: 100vw;
  box-shadow: -20px 0 50px -20px rgba(0, 0, 0, .35); overflow: hidden;
}
.sheet-page.in { transform: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 8px; border-bottom: 1px solid var(--line); background: var(--topbar-bg); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 2; }
.sheet-title { flex: 1 1 auto; min-width: 0; font-size: 1.08rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-actions { display: flex; gap: 6px; }
.sheet-body { flex: 1 1 auto; overflow: auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
/* 1.0.6 (17/11): cột lưới không bị nội dung rộng (bảng, hàng nút, chuỗi dài) kéo quá khung – điện thoại 360–412px không tràn ngang */
.view > *, .sheet-body > * { min-width: 0; }

/* ── Cài đặt ── */
.settings, .settings-host { display: grid; gap: 12px; min-width: 0; }
.set-sec { padding: 0; overflow: hidden; }
.set-sum { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px 12px 16px; cursor: pointer; list-style: none; font-weight: 700; }
.set-sum::-webkit-details-marker { display: none; }
.set-sum-title { flex: 1 1 auto; min-width: 0; }
.set-sum .help-btn { margin: -8px 0; }
.set-chev { color: var(--faint); transition: transform .25s var(--ease); display: grid; }
.set-sec[open] > .set-sum .set-chev { transform: rotate(90deg); color: var(--gold-text); }
.set-sec[open] > .set-sum { border-bottom: 1px solid var(--line); }
.set-body { padding: 16px; display: grid; gap: 14px; min-width: 0; }
.checks { display: grid; gap: 8px; }
.ds-wipe { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 4px 0; cursor: pointer; } /* ô "Máy bị mất – xoá dữ liệu trên máy" (device_slots.js, users.js) */
.ds-wipe input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--danger); }
.check { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l s" "t t"; gap: 2px 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.check-label { grid-area: l; font-weight: 600; }
.check > .muted { grid-area: t; overflow-wrap: anywhere; }
.check-st { grid-area: s; font-size: 1.1rem; }
.check-mods { margin-top: 4px; }
.secret { display: grid; gap: 8px; }
.secret-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.devices .list { margin-top: 2px; }

/* ── màn hình rộng ≥ 900px: thanh bên + 2 cột ── */
@media (min-width: 900px) {
  :root { --nav-w: 252px; }
  .frame { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .nav {
    position: sticky; top: var(--rib); bottom: auto; height: calc(100vh - var(--rib)); height: calc(100dvh - var(--rib)); padding: 22px 14px 18px; display: flex; flex-direction: column; gap: 22px;
    background: linear-gradient(180deg, #12254A, var(--navy) 40%, #0A1628); border-top: 0; border-right: 1px solid rgba(201, 162, 74, .16);
    -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--cream);
  }
  .nav-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 4px; text-decoration: none; color: #FFFDF7; }
  .nav-brand img { border-radius: 11px; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .6); }
  .nav-brand-text { display: grid; line-height: 1.25; min-width: 0; }
  .nav-brand-text strong { font-size: 1.02rem; letter-spacing: -.01em; }
  .nav-brand-text small { color: rgba(247, 243, 234, .55); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-items { display: grid; grid-template-columns: 1fr; gap: 4px; height: auto; align-content: start; }
  .nav-item { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 12px; border-radius: 13px; font-size: .95rem; font-weight: 500; color: rgba(247, 243, 234, .72); }
  .nav-item:hover { background: rgba(247, 243, 234, .06); color: #FFFDF7; }
  .nav-ico { width: 26px; height: 26px; background: none !important; }
  .nav-label-short { display: none; }
  .nav-label-full { display: inline; }
  .nav-item.on { background: linear-gradient(90deg, rgba(201, 162, 74, .2), rgba(201, 162, 74, .05)); color: #FFFDF7; font-weight: 600; }
  .nav-item.on::before { content: ''; position: absolute; left: -14px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
  .nav-item.on .nav-ico { color: var(--gold-3); }
  .nav-foot { display: block; margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(247, 243, 234, .08); }
  .nav-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
  .avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(145deg, var(--gold-3), var(--gold-2)); color: var(--navy); font-weight: 700; flex: 0 0 auto; }
  .nav-user-text { display: grid; min-width: 0; line-height: 1.3; }
  .nav-user-text strong { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .nav-user-text small { color: rgba(247, 243, 234, .55); font-size: .76rem; }
  .main { padding-bottom: 0; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
  .topbar { padding: 14px 24px 14px 32px; gap: 10px 14px; }
  .top-title { font-size: 1.3rem; }
  .top-sub { display: block; }
  .top-lock { display: inline-flex; }
  .panes { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
  .has-sheet .panes { grid-template-columns: minmax(0, 1fr) minmax(400px, 42%); }
  .view { padding: 28px 32px 48px; gap: 22px; width: 100%; }
  .has-sheet .detail { display: block; position: sticky; top: calc(73px + var(--rib)); height: calc(100vh - 73px - var(--rib)); border-left: 1px solid var(--line); background: var(--surface-2); overflow-x: clip; }
  .sheet-col { height: 100%; opacity: 0; transform: translateX(16px); transition: opacity .25s var(--ease), transform .3s var(--ease); background: var(--surface-2); }
  .sheet-col.in { opacity: 1; transform: none; }
  .sheet-col .sheet-head { padding: 10px 14px; background: var(--surface-2); }
  .sheet-body { padding: 20px 24px 32px; }
  .hero { padding: 30px 32px; }
  .hero-title { font-size: 1.85rem; }
  .hero-mark { width: 76px; height: 76px; border-radius: 24px; }
  .toasts { left: auto; right: 24px; bottom: 24px; justify-items: end; }
  .tile { min-height: 96px; padding: 18px; }
}

@media (max-width: 380px) {
  .view { padding: 14px 12px 22px; }
  .topbar { padding-left: 12px; padding-right: 8px; }
  .top-actions { gap: 2px; }
  .hero { padding: 18px 16px; }
  .hero-title { font-size: 1.3rem; }
  .hero-mark { width: 52px; height: 52px; border-radius: 16px; }
  .auth-card { padding: 24px 18px 20px; }
  .field > .seg { justify-self: start; }
.seg-sm .seg-btn { padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print {
  .nav, .topbar, .ribbon, .toasts { display: none !important; }
  .main { padding: 0; }
  body { background: #fff; }
}

/* Cài đặt › Phiên bản & Cập nhật (core/updates.js) */
.ver-part { display: grid; gap: 10px; padding: 12px 0; }
.ver-part + .ver-part, .ver-notes:not(:empty) { border-top: 1px solid var(--line); }
.ver-part .row-line { justify-content: space-between; }
.ver-steps { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.ver-notes:not(:empty) { padding-top: 12px; display: grid; gap: 8px; }

/* ───────── §7 Người dùng + vai trò (users.js) ───────── */
.avatar-sm { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(145deg, var(--gold-3), var(--gold-2)); color: var(--navy); font-weight: 700; font-size: .9rem; flex: 0 0 auto; }
.whoami { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.whoami-text { display: grid; min-width: 0; flex: 1 1 auto; line-height: 1.3; }
.whoami-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.whoami-text small { color: var(--muted); font-size: .8rem; }
.auth-who { margin: 0 0 4px; color: var(--muted); }
.auth-who strong { color: var(--text); }
.user-row { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; }
.user-row .row-text { flex: 1 1 auto; }
.user-row .row-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: 0 1 auto; }
@media (max-width: 480px) { .user-row { flex-wrap: wrap; } .user-badges { width: 100%; justify-content: flex-start; padding-left: 46px; } }
.stack { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.user-modal .modal-body, .invite-modal .modal-body { grid-template-columns: minmax(0, 1fr); }
.role-table .table-wrap { overflow-x: auto; }
.mono, input.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: .06em; }
.temp-pw { display: grid; gap: 6px; padding: 12px; border-radius: var(--r); background: var(--gold-soft); border: 1px dashed var(--gold-line); }
.role-table > summary { cursor: pointer; color: var(--gold-text); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.table-roles th, .table-roles td { font-size: .82rem; padding: 6px 8px; text-align: center; white-space: nowrap; }
.table-roles tbody th { text-align: left; font-weight: 500; white-space: normal; text-transform: none; letter-spacing: normal; color: var(--text); background: none; font-size: .85rem; }
@media (min-width: 640px) { .user-modal .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.invite-text { white-space: pre-wrap; word-break: break-word; margin: 0; padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-2); font: .92rem/1.55 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; user-select: all; }
.pick-users { display: grid; gap: 8px; }
.pick-user { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px; text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r); cursor: pointer; font: inherit; }
.pick-user:hover, .pick-user:focus-visible { border-color: var(--gold); background: var(--gold-soft); }
.pick-user.on { border-color: var(--gold); }
.pick-user-text { display: grid; flex: 1 1 auto; min-width: 0; line-height: 1.3; }
.pick-user-text small { color: var(--muted); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: none; }
.steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; align-items: start; line-height: 1.5; }
.step-n { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: var(--gold-3); font-weight: 700; font-size: .85rem; }
.steps code { padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); font-size: .88em; overflow-wrap: anywhere; }
.mytg-why { margin: 0 0 12px; }
.mytg-manual > summary { cursor: pointer; color: var(--muted); min-height: 44px; display: flex; align-items: center; }
/* 21/11: Telegram – thẻ nhắc ở màn chính + nối nhanh qua bot công ty */
.tg-nag { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 14px; padding: 14px 16px; border-left: 4px solid var(--warn); }
.tg-nag-text { flex: 1 1 220px; min-width: 0; display: grid; gap: 4px; }
.tg-nag-warn { margin: 0; color: var(--danger); font-size: .92rem; }
.tg-nag .btn { flex: 0 0 auto; }
@media (max-width: 520px) { .tg-nag .btn { width: 100%; justify-content: center; } }
.mytg-join { display: grid; gap: 10px; margin: 0 0 14px; }
.mytg-join a.btn { text-decoration: none; }
.mytg-own > summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* ── 1.0.4 (thợ B): ô tài khoản + menu Đăng xuất, thẻ "app tự sửa", chú thích chấm đỏ, Kiểm tra toàn bộ ── */
.nav-user { width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 13px; min-height: 52px; }
.nav-user:hover, .nav-user:focus-visible, .nav-user[aria-expanded="true"] { background: rgba(247, 243, 234, .08); }
.nav-user-more { margin-left: auto; color: rgba(247, 243, 234, .55); font-size: 1.1rem; line-height: 1; padding: 0 4px; }
.top-account { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; background: none; border: 0; border-radius: 50%; cursor: pointer; flex: 0 0 auto; }
.top-account .avatar-sm { width: 32px; height: 32px; }
.top-account:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
@media (min-width: 900px) { .top-account { display: none; } }
.acct-menu { position: fixed; z-index: 90; display: grid; gap: 2px; padding: 8px; background: var(--card); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-lg); }
.acct-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.acct-who { display: grid; min-width: 0; line-height: 1.3; }
.acct-who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-who small { color: var(--muted); font-size: .8rem; }
.acct-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; background: none; border: 0; border-radius: var(--r-sm); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.acct-item:hover, .acct-item:focus-visible { background: var(--surface-2); outline: none; }
.acct-danger { color: var(--danger); font-weight: 600; }

.heal-host { display: grid; gap: 10px; padding: 0 16px; }
.heal-host:empty { display: none; }
.heal-card { margin: 10px 0 0; padding: 14px 16px; border-left: 4px solid var(--warn); }
.heal-card[data-kind="signature"], .heal-card[data-kind="old_server"] { border-left-color: var(--danger); }
.heal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.heal-ico { color: var(--warn); display: inline-flex; }
.heal-line { margin: 2px 0; }
.heal-card .btn-row { margin-top: 8px; }
.heal-card[data-kind="backup"], .heal-card[data-kind="deployment"] { border-left-color: var(--danger); }
.heal-cause, .ver-cause { margin: 2px 0 4px; font-weight: 600; }
/* U23: "Chi tiết kỹ thuật" – nguyên câu máy chủ (đã bỏ khoá/vé), mã, bước, giờ + nút Chép */
.upd-tech { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; min-width: 0; }
.upd-tech > summary { cursor: pointer; color: var(--muted); }
.upd-tech-raw { margin: 6px 0 0; padding: 8px 10px; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  font-family: inherit; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); font-size: .82em; line-height: 1.45; user-select: text; -webkit-user-select: text; }
.upd-tech .btn-row { margin-top: 6px; align-items: center; }
@media (min-width: 900px) { .heal-host { padding: 0 24px 0 32px; } }

.dot-tap { cursor: pointer; position: relative; }
.dot-tap::before { content: ''; position: absolute; inset: -12px; } /* vùng chạm ≥ 33px quanh chấm đỏ */
.dot-pop { position: fixed; z-index: 90; padding: 12px; background: var(--card); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-lg); display: grid; gap: 10px; }
.dot-pop-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: .92rem; }

.fullcheck { display: grid; gap: 10px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.fc-sum { margin: 0; font-weight: 600; }
.fc-sum.is-bad { color: var(--danger); }
.fc-sum.is-ok { color: var(--ok); }
.fc-list { display: grid; gap: 6px; }
.fc-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); }
.fc-row[data-ok="0"] { border-color: var(--danger-soft); background: var(--danger-soft); }
.fc-mark { font-size: 1.05rem; line-height: 1.5; }
.fc-text { display: grid; min-width: 0; line-height: 1.4; overflow-wrap: anywhere; }
.fc-fix { grid-column: 1 / -1; padding: 8px 10px; border-radius: var(--r-sm); background: var(--card); border: 1px dashed var(--line-2); }
.fc-fix[hidden] { display: none; }
.fc-fix p { margin: 0 0 6px; }
@media (max-width: 480px) { .fc-row { grid-template-columns: 26px minmax(0, 1fr); } .fc-row > .btn { grid-column: 2; justify-self: start; } }
/* P2-27: "Chi tiết kỹ thuật" trong thông báo lỗi (câu gốc, đã bỏ khoá) */
.toast-detail { margin-top: 4px; }
.toast-detail summary { cursor: pointer; opacity: .85; }
.toast-detail code { display: block; white-space: pre-wrap; word-break: break-word; font-size: 12px; opacity: .85; max-height: 8em; overflow: auto; }
.support-contact a { font-weight: 600; }

/* 17/11 "Đưa BDS Studio ra màn hình điện thoại" (core/a2hs.js): màn Xong của trợ lý, gợi ý gọn trong app (core/pwa_hint.js), Cài đặt › Phiên bản */
.a2hs { display: grid; gap: 10px; min-width: 0; padding: 14px; border-radius: var(--r, 14px); background: var(--surface); border: 1.5px solid var(--gold-line); box-shadow: var(--shadow-sm); text-align: left; }
.a2hs p, .a2hs ol, .a2hs h3 { margin: 0; }
.a2hs-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.a2hs-logo { flex: 0 0 auto; border-radius: 10px; }
.a2hs-head-text { display: grid; gap: 2px; min-width: 0; }
.a2hs-title { font-size: 1.05rem; line-height: 1.3; }
.a2hs-body { display: grid; gap: 10px; min-width: 0; }
.a2hs-ok { font-weight: 600; color: var(--ok); }
.a2hs-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.a2hs-tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; }
.a2hs-tab.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 30, 51, .12), 0 0 0 1px var(--gold-line); }
.a2hs-tab:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.a2hs-panel { display: grid; gap: 8px; min-width: 0; }
.a2hs-panel[hidden], .a2hs [hidden] { display: none !important; }
.a2hs-steps { list-style: none; counter-reset: a2hs; padding: 0; display: grid; gap: 8px; overflow-wrap: anywhere; }
.a2hs-steps > li { counter-increment: a2hs; position: relative; padding-left: 34px; line-height: 1.75; min-height: 26px; }
.a2hs-steps > li::before { content: counter(a2hs); position: absolute; left: 0; top: 1px; width: 24px; height: 24px; border-radius: 50%; background: var(--gold-soft); border: 1px solid var(--gold-line); color: var(--text); font-weight: 700; font-size: .82rem; line-height: 22px; text-align: center; }
.a2hs-key { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; padding: 1px 8px; margin: 0 1px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 600; line-height: 1.5; white-space: nowrap; }
.a2hs-key-ico { padding: 2px 5px; }
.a2hs-key .a2hs-art { color: #0A84FF; flex: 0 0 auto; }
.a2hs-key[data-key="kebab"] .a2hs-art, .a2hs-key[data-key="menu"] .a2hs-art, .a2hs-key[data-key="install"] .a2hs-art { color: var(--text); }
.a2hs-note { font-size: .88rem; color: var(--muted); padding: 8px 10px; border-radius: 10px; background: var(--surface-2); line-height: 1.75; overflow-wrap: anywhere; }
.a2hs-note.is-hot { color: var(--text); border: 1px solid var(--gold-line); background: var(--gold-soft); }
.a2hs-inapp { padding: 10px 12px; border-radius: 10px; background: var(--warn-soft); border: 1px solid rgba(201, 138, 26, .35); display: grid; gap: 6px; line-height: 1.6; overflow-wrap: anywhere; }
.a2hs-install { display: grid; gap: 6px; }
.a2hs-install .btn { min-height: 52px; font-size: 1.05rem; }
.a2hs-qr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.a2hs-qr-img { flex: 0 0 auto; background: #fff; padding: 6px; border-radius: 10px; line-height: 0; }
.a2hs-qr-img svg { width: 168px; height: 168px; }
.a2hs-qr-text { flex: 1 1 220px; display: grid; gap: 6px; min-width: 0; }
.a2hs-qr-none { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.a2hs-acts { justify-content: flex-end; }
.a2hs-mini { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.a2hs-mini p { margin: 0; flex: 1 1 220px; }
.a2hs-compact { padding: 0; border: 0; box-shadow: none; background: transparent; gap: 8px; }
.a2hs-compact .a2hs-title { font-size: .98rem; padding-right: 36px; }
.a2hs-compact .a2hs-steps { gap: 4px; font-size: .92rem; }
.a2hs-compact .a2hs-tab { min-height: 40px; font-size: .86rem; }
.a2hs-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; }
.a2hs-row-text { flex: 1 1 220px; display: grid; gap: 2px; min-width: 0; }
.wiz-done .a2hs-wrap { margin: 14px 0 6px; }
.a2hs-modal .modal-body > .a2hs { border: 0; box-shadow: none; padding: 0; }

/* Gợi ý gọn trong app (core/pwa_hint.js) – chỉ điện thoại, 3 lần mở đầu sau khi cài, nằm trong luồng trang (không che nút) */
.pwa-hint { position: relative; margin: 12px 16px 0; padding: 12px 14px; border-radius: var(--r, 14px); background: var(--surface); border: 1px solid var(--gold-line); box-shadow: var(--shadow-sm); min-width: 0; }
.pwa-hint-x { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 10px; }
.pwa-hint-x:hover { background: var(--gold-soft); }
/* gợi ý "Đưa ra màn hình điện thoại": ngoài Bảng tin thu gọn 1 dòng (core/pwa_hint.js › "Xem cách làm").
   18/11: áp cho MỌI bề rộng (gợi ý chỉ hiện trên điện thoại/máy tính bảng theo UA). Trước nằm trong @media ≤899px nên điện thoại xoay
   ngang / máy tính bảng (≥900px) hiện đủ khung kèm thừa nút "📲 Cài app…", lần mở sau không thu gọn. */
.pwa-hint-more { display: none; }
/* 18/11: thu gọn = ĐÚNG 1 dòng – nút "📲 Cài app ra màn hình chính" (bấm mở đủ các bước) + × (Bảng tin: sau lần xem đầu – .is-compact) */
:is(#app:not([data-screen="home"]) .pwa-hint, .pwa-hint.is-compact):not(.is-open) { padding: 2px 48px 2px 4px; min-height: 48px; display: flex; align-items: center; }
:is(#app:not([data-screen="home"]) .pwa-hint, .pwa-hint.is-compact):not(.is-open) .a2hs { display: none; }
:is(#app:not([data-screen="home"]) .pwa-hint, .pwa-hint.is-compact):not(.is-open) .pwa-hint-more { display: inline-flex; min-width: 0; border: 0; background: none; box-shadow: none; font-weight: 600; white-space: nowrap; }

/* 17/11: khung "Tải dữ liệu lần đầu" (core/firstload.js) – chuyển từ <style> chèn bằng JS sang đây (CSP style-src 'self' chặn style nội tuyến) */
.firstload{position:fixed;left:50%;top:72px;transform:translateX(-50%);z-index:95;width:min(520px,calc(100vw - 24px));max-height:calc(100vh - 72px - var(--nav-h,64px) - 16px);overflow:auto;padding:14px 16px;display:grid;gap:8px;box-shadow:var(--shadow,0 8px 30px rgba(0,0,0,.18))}
.firstload.fl-inline{position:static;transform:none;width:auto;max-height:none;margin:8px 16px 0;box-shadow:none;border:1.5px solid var(--gold,#C9A24A)}
.firstload .fl-title{margin:0;font-size:1.05rem}.firstload .fl-lead{margin:0}.firstload .fl-steps{margin:0;padding-left:0;list-style:none;display:grid;gap:4px}
.firstload .fl-steps li[data-state="ok"] .fl-ico{color:var(--ok,#1e7a3c);font-weight:700}.firstload .fl-steps li[data-state="fail"] .fl-ico{color:var(--danger,#b3261e)}
.firstload .fl-warn{margin:0;color:var(--warn,#7a4b00);font-weight:600}.firstload .fl-slow{display:grid;gap:6px}.firstload .fl-slow[hidden]{display:none}

/* ═══════════ 17/11 ĐIỆN THOẠI (rà soát mobile-first – tests/e2e/mobile_audit.spec.mjs) ═══════════
   Chỉ thêm, không sửa khối cũ. #app trước bộ chọn: thắng CSS riêng của gói (nạp sau) mà không cần !important. */
/* vùng an toàn (tai thỏ / thanh Home) cho các khung nổi còn thiếu */
.firstload { top: calc(72px + env(safe-area-inset-top)); }
.rename-banner { bottom: calc(var(--nav-h, 64px) + 12px + env(safe-area-inset-bottom)); }
.wiz-portal-banner { bottom: calc(12px + env(safe-area-inset-bottom)); }
.lock-overlay { padding-top: calc(32px + env(safe-area-inset-top)); padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
/* chữ gợi ý dưới ô nhập và dòng phụ của ô chức năng: --faint chỉ đạt 3,1:1 trên nền trắng → --muted (5,5:1, đạt WCAG AA) */
.field-hint, .tile-meta { color: var(--muted); }
@media (max-width: 899px) {
  /* nhãn thanh dưới dễ đọc hơn trên máy ≥ 400 px (10,5 → 11,5 px) */
  .nav-item { font-size: clamp(11.5px, .72rem, 12.5px); }
}
@media (max-width: 400px) {
  .nav-item { font-size: clamp(10.5px, .66rem, 12.5px); }   /* máy 360–400 px: giữ cỡ cũ để "Chờ duyệt" không bị cắt "…" */
}
@media (max-width: 899px) {
  /* chạm ≥ 44 px */
  :root .wiz-chip button { min-height: 44px; font-size: .85rem; }   /* :root – thắng wizard.css nạp sau */
  :root .wiz-step summary { min-height: 44px; display: flex; align-items: center; }
  :root .field-file input[type=file] { min-height: 44px; }
  .field-toggle > .field-label { align-self: stretch; display: flex; align-items: center; min-height: 44px; }
  .a2hs-compact .a2hs-tab { min-height: 44px; }
  :is(#app, .sheet, .modal) :is(button.cu-heat, button.cu-disc) { min-height: 44px; }
  #app .sl-chip { min-height: 44px; }
  /* Khách hàng: Xuất CSV / Nhập khách / Nối landing thành 1 hàng cuộn ngang (trước: 3 dòng, đẩy danh sách khách xuống dưới màn đầu) */
  #app .bds-tools:not(.bds-wrap) { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  #app .bds-tools:not(.bds-wrap)::-webkit-scrollbar { display: none; }
  #app .bds-tools:not(.bds-wrap) > * { flex: 0 0 auto; }
  #app .xk-pack .card-actions { flex: 0 1 auto; min-width: 0; max-width: 100%; }   /* Gói chức năng: hàng nhãn xuống dòng, không đẩy tràn ngang */
  #app .bds-check, .modal .bds-check, .sheet .bds-check { min-height: 44px; align-items: center; }
  .modal .bds-check input, .sheet .bds-check input, #app .bds-check input { margin-top: 0; }
  [data-testid$="privacy-a"] { display: inline-flex; align-items: center; min-height: 44px; }
  .field-hint { font-size: .875rem; }   /* 12,8 → 14 px trên điện thoại */
  /* ô nhập ≥ 16 px: iOS không tự phóng to khi chạm vào ô */
  #app .sl-f :is(input, select, textarea), .modal .sl-f :is(input, select, textarea), .sheet .sl-f :is(input, select, textarea) { font-size: 1rem; }
  #app .ix-feeds textarea, #app .ix-fact input { font-size: 1rem; }
  :is(#app, .modal, .sheet) .lb-f :is(input, select, textarea), :is(#app, .modal, .sheet) .lb select { font-size: 1rem; }   /* Trình tạo landing */
  :is(#app, .modal, .sheet) .lb-ic { min-width: 44px; min-height: 44px; }
  :is(#app, .modal, .sheet) .lb-sw { min-width: 44px; min-height: 44px; justify-content: center; }
  /* nút Lưu của biểu mẫu dài luôn trong tầm ngón cái (dính đáy khung cuộn) */
  .sheet-body .bds-form > .bds-row.bds-end:last-child, .modal-body .bds-form > .bds-row.bds-end:last-child {
    position: sticky; bottom: 0; z-index: 3; margin: 0 -16px; padding: 10px 16px; border-top: 1px solid var(--line);
  }
  .sheet-body .bds-form > .bds-row.bds-end:last-child { background: var(--bg); margin-bottom: calc(-24px - env(safe-area-inset-bottom)); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .modal-body .bds-form > .bds-row.bds-end:last-child { background: var(--card); margin: 0 -22px -18px; padding: 10px 22px 12px; }
  /* bàn phím ảo đang mở (core/ui.js đặt .kb-open + --vvh/--vvt theo visualViewport): hộp thoại & trang trượt co theo vùng nhìn thấy,
     ô đang gõ và nút Lưu không bị bàn phím che; thanh dưới / nút nổi tạm ẩn cho rộng chỗ */
  .kb-open .modal-back { top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100%); }
  .kb-open .modal { max-height: calc(var(--vvh, 100dvh) - 8px); }
  .kb-open .sheet-page { top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100%); }
  .kb-open .nav, .kb-open #ai-fab, .kb-open .wiz-pill { display: none; }
  /* mất mạng: chữ cạnh chấm đồng bộ làm thanh trên tràn ngang ở 360–390 px (trình duyệt thu nhỏ cả trang) → ẩn chữ,
     thay bằng dải "Đang ngoại tuyến" ngay dưới thanh trên (CSS :has – không cần JS) */
  .sync[data-state="off"] .sync-text { display: none; }
  .topbar:has(.sync[data-state="off"])::after {
    content: 'Đang ngoại tuyến – vẫn xem, sửa được; có mạng sẽ tự gửi'; position: absolute; left: 0; right: 0; top: 100%;
    padding: 4px 16px; background: color-mix(in srgb, var(--warn) 18%, var(--card)); color: var(--text); font-size: .85rem; font-weight: 600; text-align: center; border-bottom: 1px solid var(--line);
  }
  /* chữ/số dài (mã, link, số tài khoản) xuống dòng, không đẩy tràn ngang */
  .view, .sheet-body, .modal-body { overflow-wrap: break-word; }
}

/* QA dữ liệu 18/11: thanh tiến độ lần kéo dữ liệu đầu tiên (app.js paintPullProgress) – nổi trên thanh điều hướng dưới của điện thoại */
.pull-progress { position: fixed; left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: grid; gap: 6px;
  padding: 10px 12px; border-radius: 12px; background: var(--card, #fff); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
@media (min-width: 900px) { .pull-progress { left: auto; right: 20px; bottom: 20px; width: 360px; } }
/* 📖 Hướng dẫn (core/help_links.js) – link tới trang hướng dẫn cho khách, vùng bấm ≥ 44px */
.help-doc { margin: .5rem 0 0; }
.help-doc a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .25rem; font-weight: 600; color: inherit; text-decoration: underline; text-decoration-color: var(--gold-2); text-underline-offset: 3px; }

/* ── Gói an toàn khi nhà mạng chặn: tiến trình đăng nhập, chẩn đoán, băng rôn ngoại tuyến ── */
.login-progress { margin: 0; color: var(--muted); font-size: .92rem; font-weight: 600; }
.login-progress:empty { display: none; }
.login-help { display: grid; gap: 10px; padding: 12px; border-radius: var(--r-sm); background: var(--warn-soft); border: 1px solid var(--warn); }
.login-help[hidden] { display: none; }
.login-help > * { min-width: 0; }
.login-help-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.login-help-acts .btn { flex: 1 1 120px; }
.login-help > .btn, .off-banner .btn { white-space: normal; text-align: center; line-height: 1.25; padding-top: 8px; padding-bottom: 8px; min-width: 0; }
.nd-steps { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 8px; }
.nd-step { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; align-items: start; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.nd-step[data-ok="1"] { border-color: var(--ok); background: var(--ok-soft); }
.nd-step[data-ok="0"] { border-color: var(--danger); background: var(--danger-soft); }
.nd-mark { font-weight: 800; font-size: 1.1rem; text-align: center; }
.nd-label { display: grid; min-width: 0; overflow-wrap: anywhere; }
.nd-det { color: var(--muted); font-size: .88rem; }
.nd-verdict { font-weight: 700; margin: 6px 0; }
.nd-advice { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 4px; }
.nd-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.nd-report { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; font-size: .78rem; }
.off-banner { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 16px; font-weight: 600; font-size: .9rem; border-bottom: 1px solid var(--warn); background: linear-gradient(var(--warn-soft), var(--warn-soft)), var(--bg); color: var(--text); }
.off-banner.off-bad { background: linear-gradient(var(--danger-soft), var(--danger-soft)), var(--bg); border-color: var(--danger); }
.off-banner.off-ok { background: linear-gradient(var(--ok-soft), var(--ok-soft)), var(--bg); border-color: var(--ok); }
.off-text { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.off-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: 0 0 auto; }
.off-bad .off-dot { background: var(--danger); }
.off-ok .off-dot { background: var(--ok); }

/* ── 20/11 (v7) ── */
/* link thẳng tới mục không mở được (app.js › deniedNote): thẻ giải thích dưới tiêu đề màn */
.denied-note { display: grid; gap: 8px; border-color: var(--gold-line); }
.denied-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.05rem; }
.denied-note p { margin: 0; }
/* ô 2 cột (vd "Thêm người dùng"): ô không có dòng gợi ý không bị kéo cao bằng ô bên cạnh – các ô nhập cao bằng nhau */
.grid-2 > .field, .grid-3 > .field { align-content: start; }
/* Cài đặt › "Nâng cao" (settings.js › advancedGroup): các mục ít dùng nằm trong một mục gấp */
.set-adv-body { gap: 10px; }
.set-adv-body > .set-sec { box-shadow: none; }
.set-sum-count { font-weight: 500; white-space: nowrap; }
/* bản bán: trang cài đặt chưa chọn "Xem thử" → không băng "CHƯA CÀI THẬT" (app.js › watchWizardRibbon) */
html[data-wiz-chooser="1"] #app.app-wiz > .ribbon { display: none; }
