/* ===========================================================
   AuraSpa — app.css
   Console spa: công cụ, không phải thương hiệu. Chỉ dùng biến từ
   tokens.css — không viết mã màu hay số pixel thẳng (ngoại lệ:
   1px viền, 0, 100%, 50%). Mobile-first, vùng chạm tối thiểu --tap.
   =========================================================== */

/* Phông tự lưu (OFL, chép từ app khách). Họ tên riêng "Aura Sans" / "Aura Serif" chỉ được đưa vào ngăn xếp
   phông ở màn rộng (tokens.css) — điện thoại không dùng tới nên trình duyệt không tải. */
@font-face { font-family: "Aura Sans"; font-weight: 400; font-display: swap; src: url("/fonts/BeVietnamPro-Regular.ttf") format("truetype"); }
@font-face { font-family: "Aura Sans"; font-weight: 500; font-display: swap; src: url("/fonts/BeVietnamPro-Medium.ttf") format("truetype"); }
@font-face { font-family: "Aura Sans"; font-weight: 600 700; font-display: swap; src: url("/fonts/BeVietnamPro-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Aura Serif"; font-weight: 400 500; font-display: swap; src: url("/fonts/PlayfairDisplay-Medium.ttf") format("truetype"); }
@font-face { font-family: "Aura Serif"; font-weight: 600 700; font-display: swap; src: url("/fonts/PlayfairDisplay-SemiBold.ttf") format("truetype"); }

* { box-sizing: border-box; }

html { font-size: var(--fs-root); }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
}
body { font-size: var(--fs-md); }

body {
  padding-bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  overscroll-behavior-y: contain;
}

a { color: var(--forest); }
.ic { display: inline-flex; flex: none; }
.ic svg { width: 100%; height: 100%; display: block; }

h1 { font-size: var(--fs-xl); font-weight: var(--fw-sem); color: var(--forest); margin: var(--s-4) var(--s-3) var(--s-3); }
h2 { font-size: var(--fs-sm); font-weight: var(--fw-sem); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); margin: var(--s-5) var(--s-3) var(--s-2); }

/* Khung trang đăng nhập (_LayoutAuth): nền thương hiệu, một thẻ giữa màn hình. */
body.auth {
  min-height: 100vh; padding-bottom: 0;
  background: radial-gradient(70% 60% at 0 0, var(--gold-wash), transparent 60%), radial-gradient(60% 50% at 100% 100%, var(--gold-wash), transparent 60%), var(--forest-deep);
}
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-6); padding: var(--s-6) var(--s-4); }
.auth-brand { text-align: center; color: var(--cream); }
.auth-brand .logo { display: block; font-family: var(--font-display); font-size: var(--fs-3xl); font-weight: var(--fw-med); line-height: 1; }
.auth-brand .logo em { font-style: normal; color: var(--gold); }
.auth-brand small { display: block; margin-top: var(--s-2); font-size: var(--fs-2xs); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--on-dark-soft); }
.auth-card { width: 100%; max-width: var(--maxw-app); padding: var(--s-6); background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-3); }
.auth-card > * + * { margin-top: var(--s-3); }
.auth-card h1 { margin: 0 0 var(--s-4); font-size: var(--fs-xl); }
.auth-card form > button[type="submit"] { width: 100%; margin-top: var(--s-2); }
.auth-card p { margin-bottom: 0; }
.auth-card .auth-hint { margin: calc(-1 * var(--s-2)) 0 var(--s-4); font-size: var(--fs-sm); color: var(--ink-soft); }
/* Chọn chi nhánh: mỗi chi nhánh một nút lớn, bấm là vào. */
.pick-list { display: grid; gap: var(--s-2); }
.auth-card form > button.pick[type="submit"] { margin-top: 0; }
.pick {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: var(--s-9); padding: var(--s-2) var(--s-4) var(--s-2) var(--s-2);
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink);
  font-size: var(--fs-md); font-weight: var(--fw-sem); text-align: left;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.pick:hover, .pick:focus-visible { border-color: var(--gold); background: var(--row-hover); }
.pick-ic { display: grid; place-items: center; flex: none; width: var(--ava); height: var(--ava); padding: var(--s-2); border-radius: var(--r-sm); background: var(--forest); color: var(--gold-soft); }
.pick-ic svg { width: 100%; height: 100%; display: block; }
.pick-t { flex: 1; min-width: 0; }
.pick > .ic { width: var(--ic); height: var(--ic); color: var(--warn); }

/* ---------- Khung quản trị: thanh bên + nội dung ---------- */
.app { min-height: 100vh; }
.app-main { min-width: 0; }

.view { padding: 0 var(--s-3) var(--s-7); }
.view > * + * { margin-top: var(--s-3); }

.side {
  display: none; flex-direction: column;
  background: var(--forest-deep); color: var(--cream);
  overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--gold-line) transparent;
}
.side-scrim { display: none; }
/* Điện thoại: thanh bên là ngăn kéo mở bằng nút "Thêm". */
.app.menu-open .side { display: flex; position: fixed; top: 0; bottom: 0; left: 0; width: var(--side-w); z-index: 70; box-shadow: var(--sh-3); }
.app.menu-open .side-scrim { display: block; position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 65; background: var(--overlay); }

.side-brand { display: block; padding: var(--s-6) var(--s-5) var(--s-3); color: var(--cream); text-decoration: none; }
.side-brand .logo { display: block; font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: var(--fw-med); line-height: 1; }
.side-brand .logo em { font-style: normal; color: var(--gold); }
.side-brand small { display: block; margin-top: var(--s-2); font-size: var(--fs-2xs); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--on-dark-soft); }
.side-branch {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  margin: var(--s-2) var(--s-3) var(--s-3); padding: var(--s-2) var(--s-3);
  border: 1px solid var(--gold-line); border-radius: var(--r-md); background: var(--on-dark-wash);
  color: var(--cream); font-size: var(--fs-sm); text-decoration: none;
}
.side-branch small { display: block; font-size: var(--fs-2xs); color: var(--on-dark-soft); }
.side-branch .ic { width: var(--ic-sm); height: var(--ic-sm); color: var(--gold); }
a.side-branch:hover { border-color: var(--gold); }
.side-nav { flex: 1; padding-bottom: var(--s-3); }
.side-nav a {
  display: flex; align-items: center; gap: var(--s-3);
  min-height: var(--tap-sm); padding: var(--s-1) var(--s-3); margin: 1px var(--s-2);
  border-radius: var(--r-sm); color: var(--on-dark); text-decoration: none; font-size: var(--fs-sm);
}
.side-nav a .ic { width: var(--ic); height: var(--ic); color: var(--gold-soft); }
.side-nav a:hover { background: var(--on-dark-wash); color: var(--cream); }
.side-nav a[aria-current="page"] { background: var(--gold-wash); color: var(--surface); font-weight: var(--fw-sem); }
.side-nav a[aria-current="page"] .ic { color: var(--gold); }
.side-nav .badge {
  margin-left: auto; min-width: var(--s-5); padding: 0 var(--s-1); border-radius: var(--r-full);
  background: var(--gold); color: var(--forest-deep); text-align: center;
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums;
}
.side-sect { padding: var(--s-4) var(--s-5) var(--s-1); font-size: var(--fs-2xs); font-weight: var(--fw-sem); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--on-dark-faint); }
.side-foot { margin: 0; padding: var(--s-3) var(--s-2); border-top: 1px solid var(--gold-line); }
.side-foot button {
  display: flex; align-items: center; gap: var(--s-3); width: 100%;
  min-height: var(--tap-sm); padding: 0 var(--s-3);
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--on-dark); font-size: var(--fs-sm); font-weight: var(--fw-reg); text-align: left;
}
.side-foot button:hover { background: var(--on-dark-wash); color: var(--cream); }
.side-foot .ic { width: var(--ic); height: var(--ic); color: var(--gold-soft); }
.side a:focus-visible, .side button:focus-visible { outline-color: var(--gold); }

/* Tab con của mục đang mở (ví dụ Kho: Tồn kho · Định mức · Kiểm kho · Đồ vải · Chuyển kho). */
.subtabs {
  display: flex; gap: var(--s-1); padding: 0 var(--s-3);
  background: var(--surface); border-bottom: 1px solid var(--line);
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a {
  display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-3);
  border-bottom: var(--bw-accent) solid transparent;
  color: var(--ink-soft); font-size: var(--fs-sm); font-weight: var(--fw-med); text-decoration: none; white-space: nowrap;
}
.subtabs a:hover { color: var(--forest); }
.subtabs a[aria-current="page"] { color: var(--forest); font-weight: var(--fw-sem); border-bottom-color: var(--gold); }

@media (min-width: 760px) {
  .app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .side { display: flex; position: sticky; top: 0; height: 100vh; }
  .app.menu-open .side { position: sticky; width: auto; box-shadow: none; }
  .app.menu-open .side-scrim { display: none; }
  .app .topbar, .app .bottomnav { display: none; }
  .subtabs { position: sticky; top: 0; z-index: 30; padding: 0 var(--s-7); }
  .view { padding: var(--s-5) var(--s-7) var(--s-9); max-width: calc(var(--maxw-page) + var(--s-7) + var(--s-7)); }
  /* Màn có bảng / lưới / tổng quan được rộng hơn; biểu mẫu thường giữ bề rộng dễ đọc. */
  .view:has(table), .view:has(.view-wide) { max-width: calc(var(--maxw-wide) + var(--s-7) + var(--s-7)); }
  h1 { font-size: var(--fs-2xl); margin: var(--s-2) 0 var(--s-4); }
  h2 { margin-left: 0; margin-right: 0; }
  #toast-region { left: var(--side-w); bottom: var(--s-6); }
}

/* ---------- Thanh trên ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--forest);
  color: var(--cream);
  padding: env(safe-area-inset-top, 0) 0 0;
}
.topbar-in {
  min-height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
}
.topbar .tb-title { flex: 1; min-width: 0; }
.topbar .tb-title b { display: block; font-size: var(--fs-md); font-weight: var(--fw-sem); line-height: var(--lh-tight); }
.topbar .tb-title small { display: block; font-size: var(--fs-2xs); color: rgba(247, 243, 234, .66); }
.topbar .tb-link { color: var(--cream); font-size: var(--fs-xs); text-decoration: none; opacity: .85; }
.tb-form { margin: 0; display: inline; }
.tb-link-btn {
  background: none; border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 var(--s-2);
  color: var(--cream); font-size: var(--fs-xs); font-weight: var(--fw-reg);
  text-decoration: underline; cursor: pointer;
}
a.tb-link-btn { text-decoration: underline; }

/* ---------- Bottom nav (tầm ngón cái) ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
}
.bottomnav-in { display: flex; width: 100%; max-width: var(--maxw-app); margin: 0 auto; }
.bottomnav a, .bottomnav-more {
  flex: 1;
  min-height: var(--bottomnav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--ink-soft);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-med);
  position: relative;
  padding: var(--s-1) 2px;
  background: none; border: 0; border-radius: 0;
}
.bottomnav-more .ic { width: 22px; height: 22px; }
.bottomnav a .ic { width: 22px; height: 22px; }
.bottomnav a .ic svg { width: 100%; height: 100%; }
.bottomnav a[aria-current="page"] { color: var(--forest); font-weight: var(--fw-sem); }
.bottomnav a[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; left: 22%; right: 22%;
  height: 3px; border-radius: 0 0 var(--r-xs) var(--r-xs); background: var(--gold);
}
.bottomnav a .badge {
  position: absolute; top: var(--s-2); left: 54%;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--risk); color: var(--surface);
  font-size: 10px; font-weight: var(--fw-bold);
  display: flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* ---------- Panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.panel + .panel { margin-top: var(--s-3); }
.panel-body { padding: var(--s-4); }

/* ---------- Biểu mẫu ---------- */
label { display: block; font-weight: var(--fw-med); margin-bottom: var(--s-1); font-size: var(--fs-sm); }
input[type="text"], input[type="tel"], input[type="password"], input[type="number"], input[type="date"], input[type="time"],
input[type="month"], input[type="search"], input[type="email"], input[type="url"], input:not([type]), select, textarea {
  width: 100%;
  min-height: var(--tap);
  font-size: var(--fs-md);
  font-family: inherit;
  padding: 0 var(--s-3);
  margin-bottom: var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
}
textarea { padding: var(--s-2) var(--s-3); min-height: var(--s-10); line-height: var(--lh-base); }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: var(--bw-accent) solid var(--forest);
  outline-offset: 1px;
}
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
button, .btn {
  min-height: var(--tap);
  font-size: var(--fs-md);
  font-weight: var(--fw-sem);
  font-family: inherit;
  padding: 0 var(--s-4);
  border: 1px solid var(--forest);
  border-radius: var(--r-sm);
  background: var(--forest);
  color: var(--cream);
  cursor: pointer;
}
button.secondary, .btn.secondary {
  background: var(--surface);
  color: var(--forest);
}
button.danger, .btn.danger {
  background: var(--surface);
  color: var(--risk-ink);
  border-color: var(--risk);
}
.option-row { display: flex; align-items: center; gap: var(--s-2); min-height: var(--tap); margin-bottom: var(--s-1); font-weight: var(--fw-reg); }
.option-row input { width: auto; min-height: auto; margin: 0; }

.error {
  color: var(--risk-ink);
  background: var(--risk-bg);
  border-radius: var(--r-sm);
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-sm);
}

/* Lưới tên nhân viên — ô tối thiểu 72px (S-10) */
.tech-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-2); }
.tech-btn {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--s-10);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  text-decoration: none; color: var(--ink); text-align: center; padding: var(--s-2);
  background: var(--surface);
  font-weight: var(--fw-med);
}

/* ---------- Nút nhỏ + bảng dùng chung ---------- */
.btn.sm, button.sm { min-height: var(--btn-sm); padding: 0 var(--s-3); font-size: var(--fs-xs); white-space: nowrap; }
.btn.ghost, button.ghost { background: none; border-color: transparent; color: var(--ink-soft); padding: 0 var(--s-2); }
.btn.ghost:hover, button.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.sm svg { width: var(--ic); height: var(--ic); display: block; }

.view table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); background: var(--surface); }
.view th { text-align: left; font-weight: var(--fw-sem); color: var(--ink-soft); background: var(--surface-2); }
.view th, .view td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--line-soft); vertical-align: top; }

/* ---------- Màn Hôm nay ---------- */
.page-head .eyebrow { margin: 0; font-size: var(--fs-2xs); font-weight: var(--fw-sem); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--warn-ink); }
/* Điện thoại không tải phông thương hiệu nên tiêu đề lớn dùng phông giao diện; màn rộng mới đổi sang serif. */
h1.display { margin: var(--s-1) 0 0; font-weight: var(--fw-sem); font-size: var(--fs-xl); line-height: var(--lh-tight); color: var(--forest); }
.today { padding-top: var(--s-4); }
.today > * + * { margin-top: var(--s-4); }

.brief {
  display: flex; gap: var(--s-4); align-items: flex-start;
  padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); color: var(--cream);
  background: radial-gradient(60% 140% at 100% 0, var(--gold-line), transparent 70%), linear-gradient(135deg, var(--forest), var(--forest-mid));
}
.brief-ic { width: var(--ic-box); height: var(--ic-box); padding: var(--s-2); border-radius: var(--r-md); background: var(--gold-wash); color: var(--gold); flex: none; }
.brief-ic svg { width: 100%; height: 100%; display: block; }
.brief p { margin: 0; line-height: var(--lh-base); }
.brief b { color: var(--gold-soft); font-weight: var(--fw-sem); }
.brief .brief-k { font-size: var(--fs-2xs); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--on-dark-soft); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.stat {
  display: block; padding: var(--s-3) var(--s-4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-1);
  color: var(--ink); text-decoration: none;
}
a.stat:hover { border-color: var(--line-strong); box-shadow: var(--sh-2); }
.stat p { margin: 0; }
.stat-k { display: flex; align-items: center; gap: var(--s-2); font-size: var(--fs-xs); color: var(--ink-soft); }
.stat-k .ic { width: var(--ic-sm); height: var(--ic-sm); color: var(--warn); }
.stat-v { margin-top: var(--s-1); font-size: var(--fs-2xl); font-weight: var(--fw-sem); line-height: var(--lh-tight); font-variant-numeric: tabular-nums; color: var(--forest-deep); white-space: nowrap; }
.stat .stat-v { margin-top: var(--s-1); }
.stat-v small { font-size: var(--fs-sm); font-weight: var(--fw-med); color: var(--ink-soft); }
.stat-d { font-size: var(--fs-xs); color: var(--ink-soft); }
.stat-d.risk { color: var(--risk-ink); font-weight: var(--fw-med); }
.stat-d.ok { color: var(--ok-ink); font-weight: var(--fw-med); }

.tabs { display: flex; gap: var(--s-1); margin-top: var(--s-6); border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: var(--s-2);
  min-height: var(--tap); padding: 0 var(--s-3);
  background: none; border: 0; border-bottom: var(--bw-accent) solid transparent; border-radius: 0;
  color: var(--ink-soft); font-size: var(--fs-sm); font-weight: var(--fw-med); white-space: nowrap;
}
.tab-c { padding: 0 var(--s-2); border-radius: var(--r-full); background: var(--sand); color: var(--ink-soft); font-size: var(--fs-2xs); font-weight: var(--fw-sem); font-variant-numeric: tabular-nums; }
.tab.on { color: var(--forest); font-weight: var(--fw-sem); border-bottom-color: var(--gold); }
.tab.on .tab-c { background: var(--forest); color: var(--cream); }

.tgroup-h { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--s-1) var(--s-3); margin: 0 var(--s-1) var(--s-2); }
.tgroup-h b { font-size: var(--fs-sm); font-weight: var(--fw-sem); color: var(--forest); }
.tgroup-h span { font-size: var(--fs-xs); color: var(--ink-soft); }
.tlist { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.tlist-sub {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-4); background: var(--surface-2); border-top: 1px solid var(--line-soft);
  font-size: var(--fs-2xs); font-weight: var(--fw-sem); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft);
}
.tlist-sub:first-child { border-top: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }
.tlist-sub span { padding: 0 var(--s-2); border-radius: var(--r-full); background: var(--sand); }
.trow { display: grid; grid-template-columns: var(--ic-box) minmax(0, 1fr); gap: var(--s-2) var(--s-3); align-items: center; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line-soft); }
.trow:first-child { border-top: 0; }
.trow:hover { background: var(--row-hover); }
/* Phần gấp lại của một nhóm dài: dòng đầu vẫn có vạch ngăn, nút "Xem thêm" là dòng cuối của khối. */
.tfold .trow:first-child { border-top: 1px solid var(--line-soft); border-radius: 0; }
.tfold .trow:last-child { border-radius: 0; }
.tfold-btn {
  display: block; width: 100%; min-height: var(--tap-sm); padding: var(--s-2) var(--s-4);
  background: none; border: 0; border-top: 1px solid var(--line-soft); border-radius: 0;
  color: var(--warn-ink); font-size: var(--fs-xs); font-weight: var(--fw-sem); text-align: left;
}
.tfold-btn:hover { background: var(--row-hover); }
.tfold:last-child .tfold-btn { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.trow:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.trow:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.trow-ic { width: var(--ic-box); height: var(--ic-box); padding: var(--s-2); border-radius: var(--r-md); }
.trow-ic svg { width: 100%; height: 100%; display: block; }
.trow-ic.risk { background: var(--risk-bg); color: var(--risk-ink); }
.trow-ic.warn { background: var(--warn-bg); color: var(--warn-ink); }
.trow-ic.ok { background: var(--ok-bg); color: var(--ok-ink); }
.trow p { margin: 0; }
.trow .title { font-weight: var(--fw-sem); }
.trow .detail { font-size: var(--fs-xs); color: var(--ink-soft); }
.trow-when { display: none; font-size: var(--fs-xs); color: var(--ink-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.trow-act { grid-column: 2; display: flex; align-items: center; gap: var(--s-1); }
.trow-act form { margin: 0; }
.more-menu { position: relative; }
.more-panel {
  position: absolute; right: 0; top: calc(100% + var(--s-1)); z-index: 20; min-width: calc(var(--s-10) * 3);
  padding: var(--s-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-3);
}
.more-panel form { margin: 0; }
.more-panel button {
  display: block; width: 100%; min-height: var(--tap-sm); padding: 0 var(--s-3);
  background: none; border: 0; border-radius: var(--r-sm);
  color: var(--ink); font-size: var(--fs-sm); font-weight: var(--fw-reg); text-align: left;
}
.more-panel button:hover { background: var(--surface-2); }
.more-panel .more-k { margin: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-2xs); font-weight: var(--fw-sem); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }
.more-panel .more-danger { margin-top: var(--s-1); padding-top: var(--s-1); border-top: 1px solid var(--line-soft); }
.more-panel .more-danger button { color: var(--risk-ink); }

@media (min-width: 760px) {
  .today { padding-top: 0; }
  h1.display { font-family: var(--font-display); font-weight: var(--fw-med); font-size: var(--fs-display); }
  .trow { grid-template-columns: var(--ic-box) minmax(0, 1fr) auto auto; }
  .trow-when { display: block; }
  .trow-act { grid-column: auto; }
}
@media (min-width: 1100px) {
  .stats { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
}

/* ---------- Trạng thái rỗng ---------- */
.empty-state {
  text-align: center;
  padding: var(--s-8) var(--s-4);
  color: var(--ink-soft);
}
.empty-state .title { font-weight: var(--fw-sem); color: var(--ink); margin-bottom: var(--s-1); }

/* ---------- Phân trang ---------- */
.pager { display: flex; justify-content: center; padding: var(--s-4) 0; }
.pager button { width: 100%; max-width: 280px; }

/* ---------- Toast ---------- */
#toast-region {
  position: fixed; left: 0; right: 0; bottom: calc(var(--bottomnav-h) + var(--s-3) + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  pointer-events: none;
}
.toast {
  background: var(--forest-deep); color: var(--cream);
  border-radius: var(--r-md);
  padding: var(--s-2) var(--s-4);
  box-shadow: var(--sh-2);
  font-size: var(--fs-sm);
  pointer-events: auto;
  animation: toast-fade var(--dur-slow) linear 4.5s forwards;
}
@keyframes toast-fade {
  from { opacity: 1; }
  to { opacity: 0; }
}

[x-cloak] { display: none !important; }

/* ---------- Module Kho: tìm kiếm & bộ lọc ---------- */
.search-form { display: flex; gap: var(--s-2); margin-top: var(--s-3); }
.search-input {
  flex: 1;
  min-height: var(--tap-lg);
  font-size: var(--fs-md);
  font-family: inherit;
  padding: 0 var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
}
.filter-tabs { display: flex; gap: var(--s-2); margin-top: var(--s-2); }
.filter-tabs a {
  flex: 1;
  min-height: var(--tap-sm);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: var(--fs-sm);
  font-weight: var(--fw-med);
}
.filter-tabs a.active { background: var(--forest); border-color: var(--forest); color: var(--cream); }

/* ---------- Module Kho: danh sách hàng hoá / dòng tồn kho ---------- */
.item-row, .stock-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-3);
}
.item-row .info, .stock-row .info { flex: 1; min-width: 0; }
.item-row .name, .stock-row .name { font-weight: var(--fw-sem); }
.item-row .meta { color: var(--ink-soft); font-size: var(--fs-sm); margin-top: 2px; }
.item-row .cost { font-variant-numeric: tabular-nums; color: var(--ink-soft); font-size: var(--fs-sm); white-space: nowrap; }
.badge-inactive {
  display: inline-block;
  background: var(--surface-3); color: var(--ink-soft);
  font-size: var(--fs-2xs); font-weight: var(--fw-sem);
  border-radius: var(--r-xs);
  padding: 2px var(--s-2);
  margin-left: var(--s-2);
}
.fab-bottom { position: sticky; bottom: calc(var(--bottomnav-h) + var(--s-3) + env(safe-area-inset-bottom, 0px)); margin-top: var(--s-5); }
.fab-bottom .btn { display: block; width: 100%; text-align: center; text-decoration: none; line-height: var(--tap); }

/* ---------- Module Kho: biểu mẫu hàng hoá ---------- */
.form-error { color: var(--risk-ink); background: var(--risk-bg); border-radius: var(--r-sm); padding: var(--s-2) var(--s-3); font-size: var(--fs-sm); }
.deactivate-form { margin-top: var(--s-6); }
.deactivate-form button { width: 100%; }

/* ---------- Module Kho: màn tồn kho ---------- */
.stock-group summary { list-style: none; cursor: pointer; }
.stock-group summary::-webkit-details-marker { display: none; }
.stock-group[open] summary .chevron { transform: rotate(90deg); }
.stock-group summary .chevron { display: inline-block; transition: transform var(--dur) var(--ease); }
.stock-row { flex-wrap: wrap; }
.stock-row .actions { display: flex; gap: var(--s-2); width: 100%; margin-top: var(--s-2); }
.stock-row .actions .btn { flex: 1; min-height: var(--tap); text-align: center; text-decoration: none; line-height: var(--tap); }
.level-bar { width: 100%; margin-top: var(--s-2); }
.level-bar .track { height: var(--s-1); border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.level-bar .fill { height: 100%; border-radius: var(--r-full); }
.level-bar.status-out .fill { background: var(--risk); }
.level-bar.status-low .fill { background: var(--warn); }
.level-bar.status-ok .fill { background: var(--ok); }
.level-bar .label { display: inline-block; margin-top: var(--s-1); font-size: var(--fs-2xs); font-weight: var(--fw-sem); }
.level-bar.status-out .label { color: var(--risk-ink); }
.level-bar.status-low .label { color: var(--warn-ink); }
.level-bar.status-ok .label { color: var(--ok-ink); }

.sumbar {
  position: sticky; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  margin-top: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  display: flex; justify-content: space-between; align-items: center; gap: var(--s-3);
  font-size: var(--fs-sm);
  box-shadow: var(--sh-2);
}
.sumbar .value { font-weight: var(--fw-sem); font-variant-numeric: tabular-nums; color: var(--ink); }

.min-qty-edit { margin-top: var(--s-2); font-size: var(--fs-xs); }
.min-qty-edit summary { color: var(--ink-soft); cursor: pointer; }
.min-qty-edit form { display: flex; gap: var(--s-2); margin-top: var(--s-2); }
.min-qty-edit input { flex: 1; margin-bottom: 0; min-height: var(--tap-sm); }
.min-qty-edit button { min-height: var(--tap-sm); font-size: var(--fs-xs); padding: 0 var(--s-3); }

/* ---------- Module Kho: nhập / xuất / điều chỉnh ---------- */
.stock-form-header { text-align: center; padding: var(--s-3) 0; }
.stock-form-header .item-name { font-size: var(--fs-lg); font-weight: var(--fw-sem); }
.stock-form-header .current-qty { font-size: var(--fs-2xl); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; margin-top: var(--s-1); }
.qty-input {
  width: 100%;
  min-height: var(--tap-lg);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-sem);
  font-family: inherit;
  text-align: center;
  padding: 0 var(--s-3);
  margin-bottom: var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
}
.quick-add { display: flex; gap: var(--s-2); margin-bottom: var(--s-4); }
.quick-add button { flex: 1; min-height: var(--tap); }
.adjust-summary { display: flex; justify-content: space-between; padding: var(--s-3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: var(--s-3); font-size: var(--fs-sm); }
.adjust-summary .diff { font-weight: var(--fw-sem); font-variant-numeric: tabular-nums; }
.submit-bottom { position: sticky; bottom: calc(var(--bottomnav-h) + var(--s-3) + env(safe-area-inset-bottom, 0px)); margin-top: var(--s-5); }
.submit-bottom button { width: 100%; }

/* ---------- Trang 403 ---------- */
.error-page {
  max-width: var(--maxw-app);
  margin: var(--s-9) auto;
  padding: 0 var(--s-4);
  text-align: center;
}
.error-page .code { font-size: var(--fs-3xl); color: var(--risk); font-weight: var(--fw-bold); }

/* ---------- Chat (C-09) ---------- */
.chat-back { margin: var(--s-3) 0 0; font-size: var(--fs-sm); }
.chat-back a { text-decoration: none; }
.chat-note { color: var(--ink-soft); font-size: var(--fs-sm); background: var(--surface-3); border-radius: var(--r-sm); padding: var(--s-2) var(--s-3); }
.chat-review-link { font-size: var(--fs-sm); }
.chat-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.chat-item {
  display: flex; gap: var(--s-3); align-items: center;
  min-height: var(--tap-lg); padding: var(--s-3);
  text-decoration: none; color: var(--ink);
}
.chat-item + .chat-item { border-top: 1px solid var(--line); }
.chat-item .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-item .title { font-weight: var(--fw-sem); }
.chat-item .preview { color: var(--ink-soft); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-1); font-size: var(--fs-2xs); color: var(--ink-soft); }
.chat-item .unread {
  min-width: var(--s-5); padding: 0 var(--s-1); border-radius: var(--r-full);
  background: var(--forest); color: var(--cream); text-align: center; font-weight: var(--fw-bold);
}
.chat-item .readonly { color: var(--ink-soft); }
.chat-messages { display: flex; flex-direction: column; gap: var(--s-2); }
/* Cuộn tới tin cuối mà không bị ô soạn (sticky) và thanh dưới (fixed) che. */
.chat-messages > * { scroll-margin-bottom: calc(var(--bottomnav-h) + var(--tap) + var(--s-6)); }
.msg, .chat-card {
  max-width: calc(100% - var(--s-9)); padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line);
}
.msg.mine { align-self: flex-end; background: var(--ok-bg); border-color: var(--ok-bg); }
.msg-meta { display: flex; gap: var(--s-2); align-items: center; font-size: var(--fs-2xs); color: var(--ink-soft); }
.msg-meta .sender { font-weight: var(--fw-sem); color: var(--ink); }
.msg-body { margin: var(--s-1) 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-body.muted { color: var(--ink-soft); font-style: italic; }
.msg-image { display: block; max-width: 100%; height: auto; margin-top: var(--s-1); border-radius: var(--r-sm); }
.tag-chip { padding: 0 var(--s-2); border-radius: var(--r-full); background: var(--warn-bg); color: var(--warn-ink); font-weight: var(--fw-sem); }
.chat-card { max-width: 100%; border-left: var(--s-1) solid var(--gold); }
.chat-card .card-title { margin: var(--s-1) 0 0; font-weight: var(--fw-sem); }
.chat-card .card-summary { margin: var(--s-1) 0 0; font-size: var(--fs-sm); }
.chat-card .card-warning { margin: var(--s-1) 0 0; font-size: var(--fs-xs); color: var(--warn-ink); }
.chat-card .card-hint { margin: var(--s-2) 0 0; font-size: var(--fs-xs); color: var(--ink-soft); }
.chat-card .card-state { margin-left: auto; font-weight: var(--fw-sem); }
.chat-card.state-confirmed { border-left-color: var(--ok); }
.chat-card.state-rejected, .chat-card.state-expired { border-left-color: var(--line-strong); opacity: .8; }
.card-actions { display: flex; gap: var(--s-2); margin-top: var(--s-3); }
.card-actions form { flex: 1; margin: 0; }
.card-actions button { width: 100%; }
.chat-composer {
  position: sticky; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px));
  display: flex; gap: var(--s-2); padding: var(--s-2) 0; background: var(--surface-2);
}
.chat-composer input { flex: 1; margin-bottom: 0; }

/* Lịch làm (L-05) — đăng ký ca và lưới xếp lịch */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); margin: var(--s-3) 0; }
.week-nav .btn { min-width: var(--tap); text-align: center; }
.shift-day { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-3); margin: 0 0 var(--s-3); background: var(--surface); }
.shift-day legend { font-weight: var(--fw-sem); padding: 0 var(--s-1); }
.shift-choices { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-2); }
.shift-chip { display: flex; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-3); border: 1px solid var(--line-strong); border-radius: var(--r-full); font-weight: var(--fw-reg); }
.shift-chip input { width: auto; min-height: auto; margin: 0; }
.sched-wrap { overflow-x: auto; margin: var(--s-3) 0; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.sched-table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.sched-table th, .sched-table td { border-bottom: 1px solid var(--line); padding: var(--s-2); text-align: left; vertical-align: top; white-space: nowrap; }
.sched-table thead th { background: var(--surface-2); }
.sched-table td.cell-off { background: var(--surface-3); }
.sched-table td.cell-only { outline: 1px solid var(--warn); outline-offset: -1px; }
.sched-table td.short { color: var(--risk-ink); background: var(--risk-bg); font-weight: var(--fw-sem); }
.sched-slot { display: flex; align-items: center; gap: var(--s-1); min-height: var(--tap-sm); font-weight: var(--fw-reg); }
.sched-slot input { width: auto; min-height: auto; margin: 0; }
.sched-slot.wanted { font-weight: var(--fw-sem); }
.sched-slot.warn { color: var(--risk-ink); }
.note-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 var(--s-3); }
.note-actions form { margin: 0; }
.msg-audio { display: block; width: 100%; margin-top: var(--s-1); }
/* Chấm công + việc đầu ca (T-04) */
.punch-form { display: flex; align-items: center; gap: var(--s-2); margin: 0; }
.punch-form .time-input { width: calc(var(--s-10) + var(--s-2)); }
.task-photos { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.task-photos img { width: var(--s-10); height: var(--s-10); object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); }

/* Chăm sóc da (U1): mã kích hoạt app khách — chữ to, cách đều để nhân viên đọc to cho khách */
.activation-code { font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: var(--s-2); font-variant-numeric: tabular-nums; margin: var(--s-3) 0; }
.care-days { display: flex; gap: var(--s-1); margin: var(--s-2) 0; }
.care-day { flex: 1; text-align: center; padding: var(--s-1) 0; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: var(--fs-xs); color: var(--ink-soft); }
.care-day.done { background: var(--ok-bg); border-color: var(--ok); color: var(--ok-ink); font-weight: var(--fw-sem); }
.care-day.has-diary { text-decoration: underline dotted; } /* có nhật ký da ba chạm (U-16) — chữ ở title + dòng "Da:" */

/* ---------- Thiết lập: Cấu hình + Chi nhánh (29/11/2026) ---------- */
/* Công tắc hai / ba lựa chọn: phạm vi "Cả chuỗi | Riêng chi nhánh", Bật | Tắt. */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg > a, .seg > button {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--btn-sm); padding: 0 var(--s-4);
  background: none; border: 0; border-radius: 0; color: var(--ink-soft); font-size: var(--fs-xs); font-weight: var(--fw-med); text-decoration: none; white-space: nowrap;
}
.seg > * + * { border-left: 1px solid var(--line-strong); }
.seg > a:hover, .seg > button:hover { background: var(--row-hover); color: var(--forest); }
.seg > a[aria-current="page"], .seg > button[aria-pressed="true"] { background: var(--forest); color: var(--cream); font-weight: var(--fw-sem); }
.link-btn { min-height: auto; padding: 0; background: none; border: 0; color: var(--warn-ink); font-size: var(--fs-xs); font-weight: var(--fw-med); text-decoration: underline; }
.tagline { display: inline-block; padding: 0 var(--s-2); border-radius: var(--r-full); background: var(--surface-2); color: var(--ink-soft); font-size: var(--fs-2xs); }
.tagline.on { background: var(--ok-bg); color: var(--ok-ink); font-weight: var(--fw-sem); }
.tagline.warn { background: var(--warn-bg); color: var(--warn-ink); }
.tagline.risk { background: var(--risk-bg); color: var(--risk-ink); font-weight: var(--fw-sem); }

.setup-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s-3); }
.setup-head h1 { margin-bottom: 0; }
.setup-lead { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.setup-cols { display: grid; gap: var(--s-4); margin-top: var(--s-4); }
.setup-nav { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; padding-bottom: var(--s-1); }
.setup-nav::-webkit-scrollbar { display: none; }
.setup-nav a { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); min-height: var(--btn-sm); padding: 0 var(--s-3); border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); color: var(--forest); font-size: var(--fs-xs); text-decoration: none; white-space: nowrap; }
.setup-nav a span { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.setup-nav a:hover { border-color: var(--gold); }
.setup-main { display: grid; gap: var(--s-4); min-width: 0; }
.setup-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); scroll-margin-top: calc(var(--tap) + var(--topbar-h) + var(--s-4)); }
.setup-card > h2 { margin: 0; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line-soft); color: var(--forest); }
.setup-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-4); margin: 0; padding: var(--s-4); }
.setup-kv dt { font-size: var(--fs-xs); color: var(--ink-soft); }
.setup-kv dd { margin: 0; font-weight: var(--fw-sem); font-variant-numeric: tabular-nums; }
.setup-foot { margin: 0; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line-soft); font-size: var(--fs-xs); color: var(--ink-soft); }
.srow { display: grid; gap: var(--s-2) var(--s-5); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line-soft); scroll-margin-top: calc(var(--tap) + var(--topbar-h) + var(--s-4)); }
.setup-card > h2 + .srow { border-top: 0; }
.srow:target { background: var(--row-hover); box-shadow: inset var(--bw-accent) 0 0 var(--gold); }
.srow-t b { font-weight: var(--fw-sem); }
.srow-d { margin: 0; font-size: var(--fs-xs); color: var(--ink-soft); }
.srow-src { display: flex; flex-wrap: wrap; gap: var(--s-1); margin: var(--s-1) 0 0; }
.srow-c { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-1); min-width: 0; }
.srow-f { display: flex; align-items: flex-start; gap: var(--s-2); width: 100%; margin: 0; }
.srow-f input, .srow-f select, .srow-f textarea { flex: 1; min-width: 0; margin-bottom: 0; }
.srow-f input, .srow-f select { min-height: var(--btn-sm); }
.srow-f button.sm { flex: none; }
.srow-reset { margin: 0; }

/* Chi nhánh: mỗi chi nhánh một thẻ, trạng thái sẵn sàng hiện bằng nhãn. */
.bgrid { display: grid; gap: var(--s-3); }
.bcard { display: grid; gap: var(--s-3); padding: var(--s-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.bcard-h { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.bcard-h b { display: block; font-size: var(--fs-md); font-weight: var(--fw-sem); color: var(--forest); }
.bcard-h p { margin: 0; font-size: var(--fs-xs); color: var(--ink-soft); }
.bcard-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); margin: 0; }
.bcard-kv div { padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--surface-2); }
.bcard-kv dt { font-size: var(--fs-2xs); color: var(--ink-soft); }
.bcard-kv dd { margin: 0; font-weight: var(--fw-sem); font-variant-numeric: tabular-nums; }
.bcard-tags { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.form-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: var(--s-4); }
.form-sec > h2 { margin: 0 0 var(--s-3); color: var(--forest); }
.form-sec .meta { margin: calc(-1 * var(--s-1)) 0 var(--s-3); font-size: var(--fs-xs); color: var(--ink-soft); }
.form-grid { display: grid; gap: 0 var(--s-4); }
.form-actions { display: flex; align-items: center; gap: var(--s-3); }

@media (min-width: 760px) {
  .setup-cols { grid-template-columns: calc(var(--s-10) * 3) minmax(0, 1fr); align-items: start; }
  .setup-nav { position: sticky; top: calc(var(--tap) + var(--s-4)); flex-direction: column; overflow: visible; padding: var(--s-2); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
  .setup-nav a { border: 0; border-radius: var(--r-sm); background: none; }
  .setup-nav a:hover { background: var(--row-hover); }
  .setup-card { scroll-margin-top: calc(var(--tap) + var(--s-4)); }
  .srow { grid-template-columns: minmax(0, 1fr) calc(var(--s-10) * 4); align-items: start; scroll-margin-top: calc(var(--tap) + var(--s-4)); }
  .srow.wide { grid-template-columns: minmax(0, 1fr); }
  .setup-kv { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.setup-head h1 { margin-left: 0; margin-right: 0; }
.bcard-kv dd { font-size: var(--fs-sm); white-space: nowrap; }

/* ---------- Danh sách dạng bảng của back-office (Nhân sự, Kỹ năng KTV — 29/11/2026) ---------- */
.list-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s-3); }
.list-head h1 { margin-left: 0; margin-right: 0; margin-bottom: 0; }
.list-head .btn { min-height: var(--tap-sm); }
.list-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2) var(--s-3); margin-top: var(--s-4); }
.list-tools form { margin: 0; }
.list-tools select { width: auto; min-height: var(--btn-sm); margin-bottom: 0; }
.list-count { margin-left: auto; font-size: var(--fs-xs); color: var(--ink-soft); }
.form-note { margin: 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn-ink); font-size: var(--fs-sm); }
.form-sec.form-danger { margin-top: var(--s-4); }
.form-actions form { margin: 0; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); background: var(--surface); }
.table-scroll > .dtable { border: 0; border-radius: 0; box-shadow: none; }
.view table.dtable { border: 1px solid var(--line); border-radius: var(--r-lg); border-collapse: separate; border-spacing: 0; overflow: hidden; box-shadow: var(--sh-1); }
.dtable th, .dtable td { vertical-align: middle; }
.dtable thead th { font-size: var(--fs-2xs); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.dtable tbody tr:last-child > * { border-bottom: 0; }
.dtable tbody tr:hover > * { background: var(--row-hover); }
.dtable tbody th { background: var(--surface); color: var(--ink); font-weight: var(--fw-sem); white-space: nowrap; }
.dtable-act { text-align: right; white-space: nowrap; }
.person { display: flex; align-items: center; gap: var(--s-3); }
.person-ava { display: grid; place-items: center; flex: none; width: var(--ic-box); height: var(--ic-box); border-radius: 50%; background: var(--sand); color: var(--forest); font-weight: var(--fw-sem); }
.person b { display: block; font-weight: var(--fw-sem); }
.person small { display: block; font-size: var(--fs-2xs); color: var(--ink-soft); }

/* Nhãn mức kỹ năng: ô trong bảng và chú giải. */
.lv { display: inline-block; padding: 0 var(--s-2); border-radius: var(--r-full); font-size: var(--fs-xs); font-weight: var(--fw-med); text-decoration: none; white-space: nowrap; background: var(--surface-2); color: var(--ink-soft); }
.lv.top { background: var(--forest); color: var(--cream); }
.lv.ok { background: var(--ok-bg); color: var(--ok-ink); }
.lv.learn { background: var(--warn-bg); color: var(--warn-ink); }
.lv.bad { background: var(--risk-bg); color: var(--risk-ink); font-weight: var(--fw-sem); }
.lv.none { background: none; border: 1px dashed var(--line-strong); color: var(--ink-soft); }
.lv.any { background: none; color: var(--line-strong); }
a.lv:hover { box-shadow: var(--sh-inset-gold); }
.dtable.skills thead th { white-space: normal; vertical-align: bottom; min-width: calc(var(--s-10) * 1.5); }
.dtable.skills thead th span { display: block; font-size: var(--fs-xs); letter-spacing: 0; text-transform: none; color: var(--ink-soft); }
.dtable.skills thead th.req span { color: var(--forest); }
.dtable.skills thead th form { margin: 0; }
.dtable.skills thead th small, .dtable.skills thead th .link-btn { font-size: var(--fs-2xs); font-weight: var(--fw-reg); letter-spacing: 0; text-transform: none; }
.dtable.skills thead th.req .link-btn { color: var(--ok-ink); font-weight: var(--fw-sem); }

/* Điện thoại: bảng nhân sự xếp thành thẻ, mỗi ô một dòng "nhãn: giá trị". Bảng kỹ năng giữ dạng bảng, cuộn ngang. */
@media (max-width: 759px) {
  .dtable:not(.skills) thead { display: none; }
  .dtable:not(.skills), .dtable:not(.skills) tbody, .dtable:not(.skills) tr, .dtable:not(.skills) td { display: block; }
  .view table.dtable:not(.skills) { border: 0; background: none; box-shadow: none; overflow: visible; }
  .dtable:not(.skills) tr { margin-bottom: var(--s-3); padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--sh-1); }
  .dtable:not(.skills) td { padding: var(--s-1) 0; border: 0; }
  .dtable:not(.skills) td[data-label] { display: flex; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-sm); }
  .dtable:not(.skills) td[data-label]::before { content: attr(data-label); color: var(--ink-soft); }
  .dtable:not(.skills) .dtable-act { text-align: left; padding-top: var(--s-2); }
  .dtable:not(.skills) .dtable-act:empty { display: none; }
}
.form-sec.form-danger .meta { margin: var(--s-3) 0 0; }

/* ---------- Lịch làm · Chấm công · Việc đầu ca (scenario 4, 29/11/2026) ---------- */
/* Thanh chuyển màn con trong một mục: gọn như công tắc, không còn bốn ô to chiếm cả hàng. */
.filter-tabs { display: inline-flex; gap: 0; max-width: 100%; margin-top: var(--s-3); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); overflow-x: auto; scrollbar-width: none; }
.filter-tabs a { flex: none; min-height: var(--btn-sm); padding: 0 var(--s-4); border: 0; border-radius: 0; font-size: var(--fs-xs); white-space: nowrap; }
.filter-tabs a + a { border-left: 1px solid var(--line-strong); }
.filter-tabs a:hover { background: var(--row-hover); color: var(--forest); }
.filter-tabs a.active { font-weight: var(--fw-sem); }
.week-nav { display: inline-flex; align-items: center; justify-content: flex-start; gap: var(--s-2); margin: 0; }
.week-nav strong { font-size: var(--fs-sm); white-space: nowrap; }
.week-nav .btn { min-width: var(--btn-sm); padding: 0; }
.list-head h1 .tagline { margin-left: var(--s-2); vertical-align: middle; font-family: var(--font-ui); font-weight: var(--fw-med); }
.form-note ul { margin: var(--s-1) 0 0; padding-left: var(--s-4); }

.sched-wrap { border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.sched-table thead th { font-size: var(--fs-2xs); letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }
.sched-table th .meta { display: block; font-size: var(--fs-2xs); font-weight: var(--fw-reg); letter-spacing: 0; text-transform: none; color: var(--ink-soft); }
.sched-table thead th.today { color: var(--forest); box-shadow: inset 0 calc(-1 * var(--bw-accent)) 0 var(--gold); }
.sched-table tbody th { font-weight: var(--fw-sem); }
.sched-table tfoot th { font-weight: var(--fw-med); color: var(--ink-soft); }
.sched-table tfoot td { font-variant-numeric: tabular-nums; }
/* Mỗi ca là một ô bấm: chưa xếp viền đứt mờ, đã xếp tô đậm. Ô chọn thật (checkbox) ẩn đi nhưng vẫn nhận bàn phím. */
.sched-slot { position: relative; display: block; min-height: 0; margin: 0 0 var(--s-1); cursor: pointer; }
.sched-slot:last-child { margin-bottom: 0; }
.sched-slot input { position: absolute; width: 0; height: 0; min-height: 0; opacity: 0; }
.sched-slot span { display: block; padding: var(--s-1) var(--s-2); border: 1px dashed var(--line-strong); border-radius: var(--r-sm); color: var(--ink-soft); font-size: var(--fs-xs); text-align: center; }
.sched-slot:hover span { border-color: var(--gold); }
.sched-slot input:checked + span { border: 1px solid var(--forest); background: var(--forest); color: var(--cream); font-weight: var(--fw-sem); }
.sched-slot input:focus-visible + span { box-shadow: var(--sh-inset-gold); }
.sched-slot input:disabled + span { cursor: default; }
.sched-slot.wanted span { color: var(--ink); font-weight: var(--fw-bold); }
.sched-slot.warn input:checked + span { border-color: var(--risk); background: var(--risk); }
.sched-key { padding: 0 var(--s-2); border: 1px dashed var(--line-strong); border-radius: var(--r-sm); color: var(--ink-soft); font-size: var(--fs-2xs); white-space: nowrap; }
.sched-key.on { border: 1px solid var(--forest); background: var(--forest); color: var(--cream); }
.sched-key.off { border: 1px solid var(--surface-3); background: var(--surface-3); }
.sched-key.only { border: 1px solid var(--warn); color: var(--ink); font-weight: var(--fw-bold); }
.sched-key.bad { border: 1px solid var(--risk); background: var(--risk); color: var(--surface); }
.dtable .punch-form { justify-content: flex-end; }
.punch-form .time-input { min-height: var(--btn-sm); margin-bottom: 0; }
@media (max-width: 759px) {
  .dtable:not(.skills) .punch-form { justify-content: flex-start; }
  .list-count { margin-left: 0; }
}
@media (min-width: 760px) {
  /* Thanh nút dính đáy là của điện thoại; máy tính đặt nút cuối khối, vừa chữ. */
  .fab-bottom { position: static; }
  .fab-bottom .btn, .fab-bottom button { display: inline-flex; width: auto; line-height: inherit; }
}
.view-wide > .form-sec, .view-wide > table.dtable, .view-wide > .table-scroll, .view-wide > .sched-wrap, .view-wide > form > .sched-wrap, .view-wide > .setup-lead, .view-wide > h2 { margin-top: var(--s-4); }
.view-wide > .item-row + .item-row, .view-wide > div > .item-row + .item-row { margin-top: var(--s-2); }
.view-wide > .form-sec { max-width: var(--maxw-page); }

/* Scenario 5 — Dịch vụ & giá, Khách hàng: cột số canh phải, ô tìm trong hàng công cụ. */
.dtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.dtable tr.muted-row td { color: var(--ink-soft); }
.dtable .note-cell { max-width: calc(var(--s-10) * 4); color: var(--ink-soft); font-size: var(--fs-xs); }
.search-form { display: flex; align-items: center; gap: var(--s-2); flex: 1; min-width: 0; max-width: calc(var(--s-10) * 6); }
.search-form input[type="search"] { flex: 1; min-width: 0; min-height: var(--btn-sm); margin-bottom: 0; }
.search-form a { font-size: var(--fs-xs); white-space: nowrap; }
@media (max-width: 759px) {
  .dtable:not(.skills) td.num { text-align: left; }
  .dtable:not(.skills) td[data-label].num { text-align: right; }
}

/* Trang /demo (chỉ máy phát triển): danh sách việc và tờ nhắc kịch bản. */
.demo-list { margin: 0 0 var(--s-3); padding-left: var(--s-5); display: grid; gap: var(--s-2); font-size: var(--fs-sm); }
.demo-list:last-child { margin-bottom: 0; }
.demo-cue { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); flex-wrap: wrap; padding: var(--s-3) 0; }
.demo-cue + .demo-cue { border-top: 1px solid var(--line-soft); }
.demo-cue > div { flex: 1 1 50%; min-width: 0; }
.demo-cue form { margin: 0; }
.demo-cue p { margin: var(--s-1) 0 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.form-note.demo-ok { margin-bottom: var(--s-3); background: var(--ok-bg); color: var(--forest); }

/* Màn thu tiền của một phiếu (/cashier/pay, 30/11/2026): ô số, hình thức là nút chọn một chạm, bảng khoản đã thu. */
.list-head-links { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.pay-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(var(--s-10) * 2), 1fr)); gap: var(--s-3); margin: var(--s-4) 0; }
.pay-methods { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: 0 0 var(--s-4); }
.pay-method { position: relative; margin: 0; cursor: pointer; }
.pay-method input { position: absolute; width: 0; height: 0; min-height: 0; opacity: 0; }
.pay-method span { display: inline-flex; align-items: center; min-height: var(--tap-sm); padding: 0 var(--s-4); border: 1px solid var(--line); border-radius: var(--r-full); background: var(--surface); font-size: var(--fs-sm); font-weight: var(--fw-med); color: var(--ink); }
.pay-method:hover span { border-color: var(--line-strong); }
.pay-method input:checked + span { border-color: var(--forest); background: var(--ok-bg); color: var(--forest); font-weight: var(--fw-sem); }
.pay-method input:focus-visible + span { box-shadow: 0 0 0 var(--bw-accent) var(--gold); }
input.pay-amount { font-size: var(--fs-lg); font-weight: var(--fw-sem); font-variant-numeric: tabular-nums; }
.form-note.pay-done { margin-top: var(--s-3); background: var(--ok-bg); color: var(--forest); }
.pay-list, .pay-more { margin-top: var(--s-4); }
.pay-list .meta { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); }
.pay-more > summary { cursor: pointer; font-weight: var(--fw-med); color: var(--forest); }
.pay-inline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: var(--s-3) 0 0; }
.pay-inline select, .pay-inline input { width: auto; flex: 1; min-width: calc(var(--s-10) * 2); margin-bottom: 0; }
.pay-void > summary { cursor: pointer; font-size: var(--fs-xs); color: var(--ink-soft); }
.pay-void form { display: flex; gap: var(--s-2); margin: var(--s-2) 0 0; }
.pay-void input { margin-bottom: 0; }
tr.is-off td { color: var(--ink-soft); text-decoration: line-through; }
tr.is-off td .tagline { text-decoration: none; }
.pay-sum .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (min-width: 760px) { .pay-sum { grid-template-columns: repeat(3, 1fr); } .pay-sum .stat:last-child:nth-child(odd) { grid-column: auto; } }
