/* ==========================================================================
   app.css — giao diện app Kho vật tư kỹ thuật WinCommerce (2026-09-23)
   --------------------------------------------------------------------------
   Theo quy tắc chung WCM (DESIGN_SYSTEM.md bản 2, app gốc là app cửa hàng):
   cùng token, cùng kiểu topbar / đầu trang / bộ lọc / menu / thẻ số / thẻ /
   bảng / hộp thoại / đăng nhập. App có hai màn (Tổng quan, Danh sách kho) và
   một màn chi tiết mở từ danh sách, nên không dựng thanh bên: hai tab nằm trên
   topbar (quy tắc #14), giống app khảo sát nhận diện.
   Thay cho design-system.css + ui-polish.css + inventory-specific.css (bản 1).

   tailwind.css (Tailwind v3, dựng lúc deploy) nạp TRƯỚC file này, nên cùng độ
   đặc hiệu thì quy tắc ở đây thắng. Giao diện mới không dựa vào utility của
   Tailwind; nó chỉ còn giữ phần reset (preflight).
   ========================================================================== */
:root {
  --paper: #F2F6FC;
  --surface: #FFFFFF;
  --sub: #F6F8FC;
  --tile: #F1F5FA;
  --line: #E7EDF6;
  --line-strong: #D3DEEC;
  --ink: #26364A;
  --ink-2: #5D6B7E;
  --faint: #8593A5;

  --red: #E81C24;            /* đỏ chữ "Win" của logo — nút chính */
  --red-deep: #C4161D;
  --red-soft: #FDECEC;
  --sky: #4A84F4;
  --sky-ink: #2D5FC4;
  --sky-wash: #EAF1FE;

  /* Màu biểu đồ (chỉ dùng trong biểu đồ và chấm chú thích).
     Nghĩa cố định: Miền Bắc rose · Miền Trung amber · Miền Nam sky · Miền Tây mint. */
  --rose: #F24B64;
  --amber: #F6AA2A;
  --mint: #16B884;

  /* Chip trạng thái có nghĩa (sắp hết hàng / lỗi) */
  --rose-wash: #FDE8EC;  --rose-ink: #C42A3E;
  --amber-wash: #FEF1DA; --amber-ink: #8A6008;

  --menu-shadow: 0 16px 40px -16px rgba(38, 54, 74, .28), 0 2px 6px rgba(38, 54, 74, .06);
}

button, input, select, textarea { font: inherit; color: inherit; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0; padding: 0; min-height: 100vh;
  font-family: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px; line-height: 1.45;
  background: var(--paper);
  color: var(--ink);
}
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
button:disabled, input:disabled, select:disabled { cursor: not-allowed; }
/* Khối có display riêng (flex/grid) vẫn phải ẩn được bằng class "hidden" mà JS bật tắt. */
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.is-center { text-align: center; }
.is-mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; }

/* ---- Topbar + tab ---- */
.wcm-topbar {
  position: sticky; top: 0; z-index: 30;
  height: 58px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.wcm-topbar__left, .wcm-topbar__right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wcm-topbar__left { gap: 14px; }
.wcm-topbar__logo { display: block; height: 32px; width: auto; margin-left: -6px; flex: none; }
.wcm-topbar__divider { width: 1px; height: 22px; background: var(--line); flex: none; }
.wcm-tabs { display: flex; align-items: center; gap: 4px; }
.wcm-tab {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px;
  border: 0; border-radius: 9px; background: transparent; color: var(--ink-2);
  font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.wcm-tab > i { font-size: 14px; color: var(--faint); width: 16px; text-align: center; transition: color .15s ease; }
.wcm-tab:hover { background: var(--tile); color: var(--ink); }
.wcm-tab.is-active { background: var(--sky-wash); color: var(--sky-ink); font-weight: 600; }
.wcm-tab.is-active > i { color: var(--sky-ink); }
.wcm-tab__count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--tile); color: var(--ink-2); font-size: 11.5px; font-weight: 600; line-height: 20px; text-align: center; }
.wcm-tab.is-active .wcm-tab__count { background: var(--surface); color: var(--sky-ink); }
.wcm-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 10px; max-width: 340px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap;
}
.wcm-chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); flex: none; }
.wcm-role { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--tile); color: var(--ink-2); }
.wcm-role[data-role="admin"] { background: var(--red-soft); color: var(--red); }
.wcm-logout {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface);
  color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer; transition: background-color .15s ease;
}
.wcm-logout:hover { background: var(--tile); color: var(--ink); }
.wcm-logout:disabled { opacity: .6; cursor: not-allowed; }

/* ---- Vùng nội dung ---- */
.wcm-main { max-width: 1480px; margin: 0 auto; padding: 24px; }
.wcm-view { display: flex; flex-direction: column; gap: 16px; }

/* ---- Đầu trang ---- */
.wcm-pagehead { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 20px; }
.wcm-pagehead__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.wcm-pagehead__title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.wcm-pagehead__title h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.wcm-eyebrow { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--tile); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.wcm-pagehead__meta { font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.wcm-pagehead__meta::before { content: '·'; margin-right: 8px; color: var(--faint); }
.wcm-pagehead__actions { display: flex; align-items: center; gap: 8px; }
.wcm-pagehead__back { margin-right: 4px; }

/* ---- Nút ---- */
.wcm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500;
  white-space: nowrap; cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.wcm-btn:hover:not(:disabled) { background: var(--tile); color: var(--ink); }
.wcm-btn:disabled { opacity: .55; cursor: not-allowed; }
.wcm-btn > i { font-size: 13px; color: var(--faint); }
.wcm-btn:hover:not(:disabled) > i { color: var(--ink-2); }
.wcm-btn--primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.wcm-btn--primary > i, .wcm-btn--primary:hover:not(:disabled) > i { color: currentColor; }
.wcm-btn--primary:hover:not(:disabled) { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.wcm-btn--danger { background: var(--rose-ink); border-color: var(--rose-ink); color: #fff; font-weight: 600; }
.wcm-btn--danger > i, .wcm-btn--danger:hover:not(:disabled) > i { color: currentColor; }
.wcm-btn--danger:hover:not(:disabled) { background: #A82233; border-color: #A82233; color: #fff; }
/* Nút xoá phụ trong hộp thoại: chữ đỏ, không nền (quy tắc 4.3 — nguy hiểm trong menu/hộp thoại phụ). */
.wcm-btn--ghost-danger { border-color: transparent; background: transparent; color: var(--rose-ink); padding: 0 8px; }
.wcm-btn--ghost-danger > i { color: currentColor; }
.wcm-btn--ghost-danger:hover:not(:disabled) { background: var(--rose-wash); color: var(--rose-ink); }
.wcm-btn--ghost-danger:hover:not(:disabled) > i { color: currentColor; }
.wcm-btn--sm { height: 28px; padding: 0 9px; border-radius: 7px; font-size: 12px; gap: 5px; }
.wcm-btn--sm > i { font-size: 11px; }
.wcm-btn--icon { width: 34px; padding: 0; }
.wcm-btn--sm.wcm-btn--icon { width: 28px; }
.wcm-btn__chev, .wcm-filter-toggle__chev { font-size: 10px !important; transition: transform .2s ease; }
[aria-expanded="true"] > .wcm-btn__chev { transform: rotate(180deg); }
.wcm-filter-toggle[aria-expanded="false"] .wcm-filter-toggle__chev { transform: rotate(-90deg); }
.wcm-filter-toggle__count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--sky); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }
/* Nút icon trong bảng / thẻ (sửa, xoá) */
.wcm-icon-btn { width: 28px; height: 28px; display: inline-grid; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--faint); cursor: pointer; transition: background-color .15s ease, color .15s ease; }
.wcm-icon-btn > i { font-size: 12.5px; }
.wcm-icon-btn:hover:not(:disabled) { background: var(--tile); color: var(--ink); }
.wcm-icon-btn--danger:hover:not(:disabled) { background: var(--rose-wash); color: var(--rose-ink); }

/* ---- Menu "Thao tác dữ liệu" ---- */
.wcm-menu-wrap { position: relative; }
.wcm-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  width: 264px; padding: 4px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--menu-shadow);
}
.wcm-menu__item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink);
  font-size: 13px; font-weight: 500; text-align: left; white-space: nowrap; cursor: pointer;
}
.wcm-menu__item > i { width: 16px; text-align: center; font-size: 14px; color: var(--faint); flex: none; }
.wcm-menu__item:hover:not(:disabled), .wcm-menu__item:focus-visible { background: var(--tile); outline: none; }
.wcm-menu__item:disabled { opacity: .55; cursor: not-allowed; }
.wcm-menu__item--danger, .wcm-menu__item--danger > i { color: var(--rose-ink); }
.wcm-menu__item--danger:hover:not(:disabled), .wcm-menu__item--danger:focus-visible { background: var(--rose-wash); }
.wcm-menu__sep { height: 1px; margin: 4px 6px; background: var(--line); }
/* Mục chỉ dành cho Admin: Staff không thấy (server vẫn chặn lại lần nữa). */
body:not([data-access="admin"]) [data-admin-only] { display: none !important; }

/* ---- Bộ lọc ---- */
.wcm-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.wcm-filters.is-collapsed { display: none; }
.wcm-field {
  display: flex; align-items: center; gap: 8px; flex: 1 1 160px; min-width: 0;
  height: 34px; padding: 0 4px 0 10px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease; cursor: pointer;
}
.wcm-field--search { flex: 2 1 220px; padding-right: 10px; cursor: text; }
.wcm-field--action { padding-right: 3px; cursor: text; }
.wcm-field:hover { border-color: #BCCBDD; }
.wcm-field:focus-within { border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-wash); }
.wcm-field__icon { font-size: 13px; color: var(--faint); flex: none; }
.wcm-field select, .wcm-field input {
  flex: 1; min-width: 0; height: 32px; border: 0; background: transparent; outline: none;
  color: var(--ink); font-size: 13px; font-weight: 500; cursor: inherit;
}
.wcm-field input::placeholder { color: var(--faint); font-weight: 400; }
.wcm-field select:focus-visible, .wcm-field input:focus-visible { outline: none; }
.wcm-field__suffix { flex: none; padding-right: 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.wcm-field .wcm-btn--sm, .wcm-field .wcm-icon-btn { flex: none; }
.wcm-check {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  color: var(--ink-2); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; user-select: none;
}
.wcm-check input { width: 15px; height: 15px; margin: 0; accent-color: var(--sky); cursor: pointer; }
.wcm-check:hover { background: var(--tile); color: var(--ink); }
.wcm-check:has(input:checked) { background: var(--sky-wash); border-color: #C9DAFB; color: var(--sky-ink); }

/* ---- Thẻ số ---- */
.wcm-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 1024px) { .wcm-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.wcm-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; min-width: 0; }
.wcm-kpi__label { margin: 0; display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcm-kpi__label > i { font-size: 12px; color: var(--faint); width: 14px; text-align: center; flex: none; }
.wcm-kpi__value { margin: 6px 0 0; font-size: 24px; font-weight: 600; line-height: 1.2; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.wcm-kpi__sub { margin: 2px 0 0; font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }

/* ---- Thẻ ---- */
.wcm-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; min-width: 0; }
.wcm-card--flush { padding: 0; overflow: hidden; }
.wcm-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.wcm-card__head--bar { margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.wcm-card__title { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--ink); }
.wcm-card__title > i { font-size: 14px; color: var(--faint); width: 16px; text-align: center; }
.wcm-card__desc { margin: 3px 0 0 24px; font-size: 12px; color: var(--ink-2); }
.wcm-card__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
/* Ô lọc ở đầu thẻ có bề rộng cố định: để co giãn thì trình duyệt tính theo bề rộng
   nội dung của input và đẩy ô thứ hai xuống hàng dưới. */
.wcm-card__actions .wcm-field { flex: none; width: 250px; }
.wcm-card__actions .wcm-check { flex: none; }
.wcm-card__aside { flex: none; display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--tile); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.wcm-card__body { padding: 16px; }

/* ---- Lưới ---- */
.wcm-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1024px) {
  .wcm-grid--charts { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .wcm-grid--thirds { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
}

/* ---- Biểu đồ ---- */
.wcm-chart-box { position: relative; width: 100%; }
.wcm-legend-inline { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 12px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.wcm-legend-inline span { display: inline-flex; align-items: center; gap: 6px; }
.wcm-legend-inline span::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--dot); }
.wcm-donut { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: center; }
@media (min-width: 640px) { .wcm-donut { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.wcm-legend { display: grid; gap: 8px; }
.wcm-legend__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); }
.wcm-legend__name { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.wcm-legend__name::before { content: ''; width: 10px; height: 10px; border-radius: 3px; background: var(--dot); flex: none; }
.wcm-legend__value { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wcm-legend__value small { font-size: 12px; font-weight: 500; color: var(--ink-2); margin-left: 4px; }
.wcm-legend__total { display: flex; justify-content: space-between; gap: 10px; margin-top: 2px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--ink-2); }
.wcm-legend__total b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- Bảng ---- */
.wcm-table-wrap { overflow: auto; }
.wcm-table-wrap--bordered { border: 1px solid var(--line); border-radius: 10px; }
.wcm-table-wrap--tall { max-height: 560px; }
.wcm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.wcm-table th { position: sticky; top: 0; z-index: 1; padding: 9px 12px; background: var(--sub); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: left; white-space: nowrap; }
.wcm-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--ink); white-space: nowrap; vertical-align: middle; }
.wcm-table tbody tr:last-child td { border-bottom: 0; }
.wcm-table tbody tr:hover td { background: #FAFBFD; }
.wcm-table th.is-num, .wcm-table td.is-num { text-align: right; }
.wcm-table th.is-center, .wcm-table td.is-center { text-align: center; }
.wcm-table .is-name { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.wcm-table .is-strong { font-weight: 600; }
.wcm-table .is-muted { color: var(--ink-2); }
.wcm-table .is-wrap { white-space: normal; min-width: 220px; }
.wcm-table .is-actions { text-align: right; width: 1%; }
.wcm-table .is-actions > div { display: inline-flex; align-items: center; gap: 4px; }
.wcm-table--compact th, .wcm-table--compact td { padding: 7px 10px; font-size: 12.5px; }
.wcm-table-empty { padding: 14px 16px; font-size: 13px; color: var(--ink-2); text-align: center; }

/* Chip trạng thái — chỉ dùng cho trạng thái có nghĩa (vd sắp hết hàng) */
.wcm-status { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--tile); color: var(--ink-2); vertical-align: middle; }
.wcm-status--bad { background: var(--rose-wash); color: var(--rose-ink); }
.wcm-status--warn { background: var(--amber-wash); color: var(--amber-ink); }
.wcm-tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--tile); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
/* Chấm miền là chú giải màu của biểu đồ (Bắc rose, Trung amber, Nam sky, Tây mint). */
.wcm-tag--region::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--faint)); }
.wcm-rank { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--tile); color: var(--ink-2); font-size: 12px; font-weight: 600; }

/* ---- Danh sách xếp hạng (NV KT giữ nhiều nhất) ---- */
.wcm-ranklist { display: flex; flex-direction: column; }
.wcm-ranklist__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.wcm-ranklist__row:last-child { border-bottom: 0; }
.wcm-ranklist__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wcm-ranklist__who b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcm-ranklist__who small, .wcm-ranklist__val small { display: block; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.wcm-ranklist__val { text-align: right; flex: none; }
.wcm-ranklist__val b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- Lưới kho ---- */
.wcm-wh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.wcm-wh {
  display: flex; flex-direction: column; gap: 12px; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  cursor: pointer; transition: border-color .15s ease;
}
.wcm-wh:hover { border-color: #BFD3FA; }
.wcm-wh__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wcm-wh__tags { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wcm-wh__tools { display: flex; align-items: center; gap: 2px; }
.wcm-wh__name { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcm-wh__manager { margin: 3px 0 0; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcm-wh__manager > i { font-size: 11px; color: var(--faint); }
.wcm-wh__stats { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--sub); }
.wcm-wh__stats small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.wcm-wh__stats b { display: block; margin-top: 2px; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.wcm-wh__open { width: 100%; }
.wcm-empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 36px 24px; text-align: center; }
.wcm-empty-state > i { font-size: 20px; color: var(--faint); margin-bottom: 4px; }
.wcm-empty-state strong { font-size: 14px; font-weight: 600; color: var(--ink); }
.wcm-empty-state p { margin: 0; max-width: 420px; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.wcm-empty-state .wcm-btn { margin-top: 8px; }
.wcm-wh-grid > .wcm-empty-state { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }

/* ---- Tab con trong một kho ---- */
.wcm-subtabs { display: flex; align-items: center; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }

/* ---- Bàn thao tác (form ngang) ---- */
.wcm-opform { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 720px) { .wcm-opform { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) {
  .wcm-opform--dispatch { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1.7fr) minmax(0, 1.3fr) minmax(0, .75fr) minmax(0, 1.3fr); }
  .wcm-opform--transfer { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.1fr) minmax(0, 1.6fr) minmax(0, 1.2fr) minmax(0, .65fr) minmax(0, .9fr); }
}
.wcm-opform .wcm-field { flex: none; width: 100%; }
.wcm-label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.wcm-label .wcm-req { color: var(--rose-ink); margin-left: 2px; }
.wcm-input, .wcm-select {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface);
  color: var(--ink); font-size: 13px; font-weight: 500; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.wcm-input::placeholder { color: var(--faint); font-weight: 400; }
.wcm-input:focus, .wcm-select:focus { border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-wash); }
.wcm-input[readonly] { background: var(--sub); color: var(--ink-2); cursor: default; }
.wcm-input--mono { font-family: ui-monospace, 'SFMono-Regular', Consolas, monospace; }

/* ---- Sổ NV KT giữ vật tư: một khối cho mỗi người ---- */
.wcm-people { display: flex; flex-direction: column; gap: 12px; }
.wcm-person { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.wcm-person__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--sub); border-bottom: 1px solid var(--line); }
.wcm-person__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wcm-person__avatar { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.wcm-person__who b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.wcm-person__who small { display: block; font-size: 12px; color: var(--ink-2); }
.wcm-person__total { text-align: right; flex: none; }
.wcm-person__total small { display: block; font-size: 12px; color: var(--ink-2); }
.wcm-person__total b { font-size: 14px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---- Hộp thoại ---- */
.wcm-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(38, 54, 74, .45); overscroll-behavior: contain; }
.wcm-modal__box { position: relative; width: 100%; max-width: 460px; max-height: min(90vh, 820px); overflow: auto; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px -24px rgba(38, 54, 74, .4); }
.wcm-modal__box--wide { max-width: 580px; }
.wcm-modal__box--narrow { max-width: 380px; }
.wcm-modal__close { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--faint); cursor: pointer; }
.wcm-modal__close:hover { background: var(--tile); color: var(--ink); }
.wcm-modal__title { margin: 0 40px 4px 0; font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.wcm-modal__sub { margin: 0 0 16px; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.wcm-modal__icon { width: 40px; height: 40px; margin-bottom: 12px; display: grid; place-items: center; border-radius: 50%; font-size: 16px; background: var(--rose-wash); color: var(--rose-ink); }
.wcm-modal__message { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.wcm-modal__message b { font-weight: 600; color: var(--ink); }
.wcm-modal__message .wcm-warn { display: block; margin-top: 8px; color: var(--rose-ink); font-weight: 500; }
.wcm-modal__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 20px; }
.wcm-modal__actions--split { justify-content: space-between; }
.wcm-modal__actions > div { display: flex; gap: 8px; }
.wcm-form { display: grid; gap: 14px; }
.wcm-form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.wcm-form__row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wcm-form__row--wide-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.wcm-note { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--sub); font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.wcm-note + .wcm-note { margin-top: 10px; }
.wcm-note b { font-weight: 600; color: var(--ink); }
.wcm-note p { margin: 0; }
.wcm-note p + p { margin-top: 6px; }
.wcm-note__title { display: flex; align-items: center; gap: 8px; margin-bottom: 4px !important; font-weight: 600; color: var(--ink); }
.wcm-note__title > i { color: var(--mint); }

/* Ô chọn tệp Excel */
.wcm-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 16px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--sub); text-align: center; cursor: pointer; transition: background-color .15s ease, border-color .15s ease; }
.wcm-drop:hover { background: var(--tile); border-color: #BCCBDD; }
.wcm-drop > i { font-size: 18px; color: var(--faint); }
.wcm-drop strong { font-size: 13px; font-weight: 600; color: var(--ink); }
.wcm-drop span { font-size: 12px; color: var(--ink-2); }
.wcm-preview { margin-top: 14px; }
.wcm-preview__head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.wcm-preview__head b { font-weight: 600; color: var(--ink); }
.wcm-preview .wcm-table-wrap { max-height: 190px; }

/* Biên bản bàn giao (văn bản in) */
.wcm-doc { padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13px; }
.wcm-doc__head { text-align: center; padding-bottom: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.wcm-doc__org { margin: 0; font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; }
.wcm-doc__title { margin: 4px 0 2px; font-size: 15px; font-weight: 700; color: var(--ink); }
.wcm-doc__no { margin: 0; font-size: 12px; color: var(--ink-2); }
.wcm-doc__info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin-bottom: 14px; }
.wcm-doc__info small { display: block; font-size: 12px; color: var(--ink-2); }
.wcm-doc__info b { font-weight: 600; color: var(--ink); }
.wcm-doc__label { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.wcm-doc__sign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; text-align: center; }
.wcm-doc__sign p { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.wcm-doc__sign small { display: block; margin: 2px 0 40px; font-size: 12px; font-style: italic; color: var(--ink-2); }

/* Thông báo góc màn hình */
.wcm-toasts { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.wcm-toast {
  display: flex; align-items: flex-start; gap: 10px; width: min(380px, calc(100vw - 32px)); padding: 11px 14px 11px 12px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--sky); border-radius: 10px;
  box-shadow: var(--menu-shadow); font-size: 13px; font-weight: 500; line-height: 1.45; color: var(--ink);
  pointer-events: auto; animation: wcmToastIn .2s ease-out both; transition: opacity .3s ease, transform .3s ease;
}
.wcm-toast > i { margin-top: 2px; font-size: 14px; color: var(--sky); flex: none; }
.wcm-toast[data-tone="success"] { border-left-color: var(--mint); }
.wcm-toast[data-tone="success"] > i { color: var(--mint); }
.wcm-toast[data-tone="error"] { border-left-color: var(--rose); }
.wcm-toast[data-tone="error"] > i { color: var(--rose); }
.wcm-toast.is-leaving { opacity: 0; transform: translateY(8px); }
@keyframes wcmToastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- Màn đăng nhập ---- */
.wcm-auth-gate { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; background: var(--paper); }
.wcm-auth-gate.hidden { display: none !important; }
.wcm-auth-card { width: min(100%, 430px); padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px -32px rgba(31, 36, 48, .35); }
.wcm-auth-logo { display: block; height: 40px; width: auto; margin: 0 0 18px -6px; }
.wcm-auth-title { margin: 0; font-size: 20px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.wcm-auth-desc { margin: 6px 0 20px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.wcm-auth-label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.wcm-auth-input-wrap { position: relative; }
.wcm-auth-input-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--faint); pointer-events: none; }
.wcm-auth-input {
  width: 100%; height: 44px; padding: 0 44px 0 38px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-size: 14px; outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
.wcm-auth-input::placeholder { color: var(--faint); }
.wcm-auth-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(232, 28, 36, .12); }
.wcm-auth-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--faint); cursor: pointer; }
.wcm-auth-toggle:hover { background: var(--tile); color: var(--ink); }
.wcm-auth-error { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--rose-wash); color: var(--rose-ink); font-size: 12.5px; font-weight: 500; line-height: 1.45; }
.wcm-auth-submit { margin-top: 14px; width: 100%; height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; background: var(--red); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; transition: background-color .15s ease; }
.wcm-auth-submit:hover:not(:disabled) { background: var(--red-deep); }
.wcm-auth-submit:disabled { opacity: .7; cursor: progress; }

/* ---- Thanh cuộn ---- */
.wcm-table-wrap::-webkit-scrollbar, .wcm-subtabs::-webkit-scrollbar { width: 8px; height: 8px; }
.wcm-table-wrap::-webkit-scrollbar-thumb, .wcm-subtabs::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid var(--surface); }

/* ---- Màn hẹp ---- */
@media (max-width: 1100px) {
  .wcm-chip--data { display: none; }
}
@media (max-width: 760px) {
  .wcm-topbar { padding: 0 12px; height: 54px; gap: 8px; }
  .wcm-topbar__logo { height: 24px; }
  .wcm-topbar__divider { display: none; }
  .wcm-topbar__left { gap: 8px; }
  .wcm-tab { padding: 0 9px; height: 34px; }
  .wcm-tabs .wcm-tab > span { display: none; }
  .wcm-role { display: none; }
  .wcm-logout span { display: none; }
  .wcm-logout { width: 32px; padding: 0; justify-content: center; }
  .wcm-main { padding: 16px; }
  .wcm-view { gap: 12px; }
  .wcm-pagehead { padding: 14px 16px; }
  .wcm-pagehead__actions { width: 100%; }
  .wcm-pagehead__actions > .wcm-btn { flex: 1; }
  .wcm-pagehead__actions .wcm-menu-wrap { flex: 1; display: flex; }
  .wcm-pagehead__actions .wcm-menu-wrap > .wcm-btn { flex: 1; }
  .wcm-field, .wcm-field--search { flex-basis: 100%; }
  .wcm-card { padding: 16px; }
  .wcm-card--flush { padding: 0; }
  .wcm-card__head { flex-direction: column; }
  .wcm-card__head--bar { flex-direction: row; }
  .wcm-card__actions { width: 100%; }
  .wcm-card__actions .wcm-field { flex: 1 1 100%; width: auto; }
  .wcm-card__actions .wcm-check { flex: 1 1 100%; justify-content: center; }
  .wcm-card__actions > .wcm-btn { flex: 1; }
  .wcm-card__desc { margin-left: 0; }
  .wcm-kpi__value { font-size: 20px; }
  .wcm-form__row, .wcm-form__row--3, .wcm-form__row--wide-2 { grid-template-columns: minmax(0, 1fr); }
  .wcm-auth-card { padding: 22px; }
  .wcm-toasts { right: 16px; bottom: 16px; }
}
/* Số tiền đầy đủ ("5.501.387.000 ₫") không vừa thẻ số nửa màn điện thoại. */
@media (max-width: 520px) {
  .wcm-kpis { grid-template-columns: minmax(0, 1fr); gap: 8px; }
}

/* ---- In biên bản: chỉ in phần văn bản trong hộp thoại ---- */
@media print {
  body:has(#modal-handover-protocol:not(.hidden)) > *:not(#modal-handover-protocol) { display: none !important; }
  #modal-handover-protocol { position: static; padding: 0; background: none; }
  #modal-handover-protocol .wcm-modal__box { max-width: none; max-height: none; overflow: visible; padding: 0; border: 0; box-shadow: none; }
  #modal-handover-protocol [data-print-hide] { display: none !important; }
  #modal-handover-protocol .wcm-doc { border: 0; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Lớp "Đang cập nhật số liệu…" (DESIGN_SYSTEM.md §4.10) — cùng thông số app bảo trì:
   nền trang mờ nhẹ phía sau, thẻ trắng nhỏ ở giữa, vòng quay xanh 18px. */
.wcm-loading { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(244, 247, 251, .7); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.wcm-loading.hidden { display: none !important; }
.wcm-loading__card { display: flex; align-items: center; gap: 12px; padding: 15px 20px; background: #FFFFFF; border-radius: 14px; font-size: 13px; font-weight: 600; color: #26364A; }
.wcm-loading__spinner { flex: none; width: 18px; height: 18px; border: 2.5px solid #E7EDF6; border-top-color: #4A84F4; border-radius: 50%; animation: wcm-loading-spin .7s linear infinite; }
@keyframes wcm-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .wcm-loading__spinner { animation-duration: 2s; } }
@media print { .wcm-loading { display: none !important; } }
