/* ============================================================
   GIAO DIỆN MỚI (10/2026) — CHỈ ÁP DỤNG CHO 2 TAB:
   "Lập phiếu xuất" (#tab-create) và "Danh mục" (#tab-catalog)
   Nguyên tắc: chữ to, ít màu, mỗi bước một khối, nút rõ nghĩa.
   ============================================================ */

.ui-scope {
  --ui-ink: #001c44;
  --ui-muted: #4c6177;
  --ui-faint: #8495a7;
  --ui-line: #d2dde5;
  --ui-line-strong: #b5c4d0;
  --ui-wash: #f0f6f8;
  --ui-paper: #ffffff;
  --ui-brand: #0c5776;
  --ui-brand-hover: #001c44;
  --ui-brand-soft: #d5f8fa;
  --ui-amber: #a4492a;
  --ui-amber-line: #efc1b1;
  --ui-amber-soft: #fbe7e0;
  --ui-danger: #b42318;
  --ui-focus: #2d99ae;
  --ui-radius: 10px;
  --ui-radius-sm: 7px;

  font-family: "Be Vietnam Pro", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ui-ink);
  font-variant-numeric: tabular-nums;
}
.ui-scope button,
.ui-scope input,
.ui-scope select,
.ui-scope textarea { font-family: inherit; }

.ui-page { max-width: 1320px; margin: 0 auto; padding-bottom: 8px; }

.ui-page-head { margin: 6px 0 18px; }
.ui-page-head h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; color: var(--ui-ink); }
.ui-page-head p { color: var(--ui-muted); margin-top: 2px; max-width: 70ch; }

/* ---------- Bước ---------- */
.ui-step {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 16px;
  background: var(--ui-paper);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  padding: 20px 22px 22px 18px;
  margin-bottom: 14px;
}
.ui-step-num {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--ui-brand);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.ui-step-body { min-width: 0; }
.ui-step-title { font-size: 19px; font-weight: 700; line-height: 40px; }
.ui-step-help { color: var(--ui-muted); font-size: 14px; margin: -4px 0 14px; }
.ui-step-headrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

/* ---------- Ô nhập ---------- */
.ui-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.ui-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ui-span-2 { grid-column: span 2; }
.ui-span-4 { grid-column: 1 / -1; }
.ui-label { font-size: 14px; font-weight: 600; color: var(--ui-ink); }
.ui-label-note { font-weight: 400; color: var(--ui-faint); margin-left: 6px; }
.ui-req { color: var(--ui-danger); font-weight: 700; }

.ui-scope .ui-input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--ui-line-strong);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-paper);
  color: var(--ui-ink);
  font-size: 15px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ui-scope textarea.ui-input { height: auto; padding: 10px 14px; line-height: 1.5; resize: vertical; }
.ui-scope .ui-input::placeholder { color: #a0aebb; }
.ui-scope .ui-input:hover { border-color: #8b9bad; }
.ui-scope .ui-input:focus { border-color: var(--ui-focus); box-shadow: 0 0 0 3px rgba(45, 153, 174, 0.18); }
.ui-scope .ui-input-strong { font-weight: 700; letter-spacing: 0.01em; }

.ui-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ui-inline .ui-input { flex: 1; min-width: 240px; }
.ui-hint { font-size: 13.5px; color: var(--ui-muted); }
.ui-flex-fill { flex: 1; }

/* ---------- Nút ---------- */
.ui-btn {
  height: 42px;
  padding: 0 18px;
  border-radius: var(--ui-radius-sm);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.ui-btn-lg { height: 50px; padding: 0 26px; font-size: 16px; }
.ui-btn-square { width: 42px; padding: 0; font-size: 20px; }
.ui-btn-primary { background: var(--ui-brand); color: #fff; }
.ui-btn-primary:hover { background: var(--ui-brand-hover); }
.ui-btn-dark { background: var(--ui-ink); color: #fff; }
.ui-btn-dark:hover { background: #000; }
.ui-btn-ghost { background: var(--ui-paper); border-color: var(--ui-line-strong); color: var(--ui-ink); }
.ui-btn-ghost:hover { border-color: var(--ui-brand); color: var(--ui-brand); }
.ui-scope :focus-visible { outline: 3px solid rgba(45, 153, 174, 0.45); outline-offset: 2px; }

.ui-chip {
  height: 42px; padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--ui-line-strong);
  background: var(--ui-paper);
  font-size: 14px; font-weight: 500; color: var(--ui-ink);
  cursor: pointer;
}
.ui-chip.active { border-color: var(--ui-brand); background: var(--ui-brand-soft); color: var(--ui-brand); font-weight: 600; }

/* ---------- Bước 1: khách hàng ---------- */
.ui-kh-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ui-scope .pxk-kh-pill {
  height: auto;
  min-height: 72px;
  padding: 12px 16px;
  border-radius: var(--ui-radius);
  border: 1.5px solid var(--ui-line);
  background: var(--ui-paper);
  color: var(--ui-ink);
  text-align: left;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  cursor: pointer;
  box-shadow: none;
  transition: border-color 0.12s, background 0.12s;
}
.ui-scope .pxk-kh-pill:hover { border-color: var(--ui-brand); color: var(--ui-ink); }
.ui-scope .pxk-kh-pill .kh-name { font-size: 18px; font-weight: 700; line-height: 1.25; }
.ui-scope .pxk-kh-pill .kh-sub { font-size: 13px; color: var(--ui-muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.ui-scope .pxk-kh-pill.active {
  border-color: var(--ui-brand);
  background: var(--ui-brand);
  color: #fff;
  box-shadow: none;
}
.ui-scope .pxk-kh-pill.active .kh-sub { color: rgba(255, 255, 255, 0.82); }
.ui-scope .pxk-kh-pill.pxk-kh-none { border-style: dashed; background: var(--ui-wash); }
.ui-scope .pxk-kh-pill.pxk-kh-none .kh-name { font-size: 16px; font-weight: 600; }
.ui-scope .pxk-kh-pill.pxk-kh-none.active { background: var(--ui-ink); border-color: var(--ui-ink); border-style: solid; }

.ui-day-list { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--ui-line); }
.ui-day-list:empty { display: none; }
.ui-scope .pxk-day-lbl { font-size: 14px; font-weight: 600; color: var(--ui-ink); margin-right: 4px; }
.ui-scope .pxk-day-pill {
  height: 42px; padding: 0 20px;
  border-radius: 999px;
  border: 1.5px solid var(--ui-line-strong);
  background: var(--ui-paper);
  font-size: 15px; font-weight: 600; color: var(--ui-ink);
  cursor: pointer;
}
.ui-scope .pxk-day-pill:hover { border-color: var(--ui-brand); color: var(--ui-brand); background: var(--ui-paper); }
.ui-scope .pxk-day-pill.active { border-color: var(--ui-brand); background: var(--ui-brand-soft); color: var(--ui-brand); font-weight: 700; }

/* ---------- Bước 3: kiểu phiếu ---------- */
.ui-seg { display: inline-flex; align-items: center; gap: 4px; padding: 4px; background: var(--ui-wash); border: 1px solid var(--ui-line); border-radius: 999px; }
.ui-seg-label { font-size: 13px; color: var(--ui-muted); padding: 0 8px 0 10px; }
.ui-seg-btn {
  height: 36px; padding: 0 16px; border: none; border-radius: 999px;
  background: transparent; color: var(--ui-muted);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.ui-seg-btn:hover { color: var(--ui-ink); }
.ui-seg-btn.active { background: var(--ui-paper); color: var(--ui-brand); box-shadow: 0 1px 2px rgba(0, 28, 68, 0.14); }

/* ---------- Bộ chi tiết (JiaYu) ---------- */
.ui-scope .ui-bo { display: none; gap: 14px; align-items: center; flex-wrap: wrap; margin: 4px 0 14px; padding: 14px 16px; background: var(--ui-amber-soft); border: 1px solid var(--ui-amber-line); border-radius: var(--ui-radius); }
.ui-scope .ui-bo.show { display: flex; }
.ui-bo-text { display: flex; flex-direction: column; flex: 1 1 320px; font-size: 14px; color: #6b2f1a; }
.ui-bo-text strong { font-size: 15px; color: #5a2614; }
.ui-bo-list { display: flex; gap: 8px; flex-wrap: wrap; }
.ui-scope .pxk-bo-btn {
  height: 46px; padding: 0 18px;
  border-radius: var(--ui-radius-sm);
  border: 1.5px solid var(--ui-amber);
  background: var(--ui-paper);
  color: #5a2614; font-size: 16px; font-weight: 700;
  cursor: pointer;
}
.ui-scope .pxk-bo-btn small { font-size: 13px; font-weight: 500; color: var(--ui-amber); margin-left: 4px; }
.ui-scope .pxk-bo-btn:hover { background: var(--ui-amber); color: #fff; }
.ui-scope .pxk-bo-btn:hover small { color: #fff; }
.ui-scope .pxk-bo-empty { font-size: 14px; color: #6b2f1a; }

/* ---------- Bảng nhập ---------- */
#tab-create .ui-grid-wrap {
  border: 1px solid var(--ui-line-strong);
  border-radius: var(--ui-radius-sm);
  max-height: 620px;
  background: var(--ui-paper);
}
#tab-create #excel-grid { font-size: 15px; font-family: inherit; }
#tab-create #excel-grid th {
  background: var(--ui-wash);
  color: var(--ui-ink);
  font-weight: 700;
  font-size: 14px;
  padding: 11px 6px;
  border: 1px solid var(--ui-line);
  border-bottom: 2px solid var(--ui-line-strong);
}
#tab-create #excel-grid td { border: 1px solid var(--ui-line); background: var(--ui-paper); height: 46px; }
#tab-create #excel-grid tbody tr:hover td { background: #f3f9fb; }
#tab-create #excel-grid tbody td:first-child { color: var(--ui-faint); font-weight: 600; }
#tab-create #excel-grid .excel-cell { font-family: inherit; font-size: 15px; min-height: 44px; padding: 6px 10px; color: var(--ui-ink); }
#tab-create #excel-grid .excel-cell:focus { background: #e9f8fb; box-shadow: inset 0 0 0 2px var(--ui-focus); font-weight: 600; }
#tab-create #excel-grid .excel-cell.size-val-cell { padding: 6px 2px; font-size: 16px; font-weight: 500; }
#tab-create #excel-grid .td-total-cell { font-size: 17px !important; font-weight: 700; color: var(--ui-brand); background: #f2f9fb; }
#tab-create #excel-grid th.th-size-col { min-width: 56px; }
#tab-create #excel-grid th.th-total-col { min-width: 90px; }
#tab-create .size-header-input {
  font-family: inherit;
  font-size: 15px; font-weight: 700;
  color: var(--ui-ink);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 1px dashed var(--ui-line-strong);
  border-radius: 4px;
  max-width: 80px;
  padding: 3px 2px;
}
#tab-create .size-header-input:hover { background: var(--ui-paper); border-color: var(--ui-line-strong); }
#tab-create .size-header-input:focus { background: #fff6f2; border: 1px solid #e0a58f; color: var(--ui-ink); box-shadow: none; }

/* Dòng cộng */
#tab-create #excel-grid tfoot td {
  background: var(--ui-wash);
  border: 1px solid var(--ui-line);
  border-top: 2px solid var(--ui-ink);
  height: 54px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ui-ink);
}
#tab-create #excel-grid tfoot .foot-size-total { font-size: 18px; font-weight: 800; text-align: center; color: var(--ui-ink); }
#tab-create #excel-grid tfoot .foot-grand-total { font-size: 22px; font-weight: 800; text-align: center; color: #fff; background: var(--ui-brand); }

/* Dòng chi tiết & đồng bộ đôi */
#tab-create #excel-grid tr.row-chitiet td { background: #fff8f5; }
#tab-create #excel-grid tr.row-chitiet td:first-child { border-left: 4px solid var(--ui-amber-line); }
#tab-create #excel-grid tr.row-dongbo td { background: var(--ui-amber-soft); border-top: 2px solid var(--ui-amber-line); }
#tab-create #excel-grid tr.row-dongbo td:first-child { border-left: 4px solid var(--ui-amber); }
#tab-create #excel-grid tr.row-dongbo .excel-cell { font-weight: 800; font-style: italic; color: #5a2614; }
#tab-create .btn-del-block {
  display: block; margin: 2px auto 0;
  border: none; background: transparent;
  color: var(--ui-danger); font-size: 12px; font-weight: 600; font-style: normal;
  cursor: pointer; text-decoration: underline;
}

.ui-grid-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.ui-grid-tools .ui-hint { margin-left: 6px; }

/* ---------- Tùy chỉnh thêm ---------- */
.ui-more { margin-top: 18px; border-top: 1px solid var(--ui-line); padding-top: 12px; }
.ui-more > summary { cursor: pointer; font-size: 14.5px; font-weight: 600; color: var(--ui-muted); list-style: none; display: inline-flex; align-items: center; gap: 8px; }
.ui-more > summary::-webkit-details-marker { display: none; }
.ui-more > summary::before { content: "+"; display: inline-flex; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--ui-line-strong); align-items: center; justify-content: center; font-size: 15px; line-height: 1; }
.ui-more[open] > summary::before { content: "−"; }
.ui-more > summary:hover { color: var(--ui-ink); }
.ui-more-body { display: flex; flex-direction: column; gap: 18px; padding-top: 14px; }
.ui-scope .ui-size-box { margin: 0; }
.ui-scope .ui-size-box.show,
.ui-scope .ui-addr { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Thanh thao tác cố định ---------- */
.ui-actionbar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 6px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  box-shadow: 0 -6px 20px rgba(0, 28, 68, 0.08);
}
.ui-total { flex: 1; display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; color: var(--ui-muted); font-size: 15px; }
.ui-total strong { font-size: 28px; font-weight: 800; color: var(--ui-ink); letter-spacing: -0.01em; }
.ui-actionbar-right { display: flex; gap: 10px; }

/* ============================================================
   TAB DANH MỤC
   ============================================================ */
.ui-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
#tab-catalog .ui-tab {
  height: 46px; padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--ui-line-strong);
  background: var(--ui-paper);
  color: var(--ui-ink);
  font-size: 15px; font-weight: 600;
  cursor: pointer; margin: 0;
}
#tab-catalog .ui-tab:hover { border-color: var(--ui-brand); color: var(--ui-brand); }
#tab-catalog .ui-tab.active { background: var(--ui-brand); border-color: var(--ui-brand); color: #fff; }

.ui-panel { background: var(--ui-paper); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 18px; margin-bottom: 14px; }
.ui-panel-title { font-size: 19px; font-weight: 700; margin-bottom: 14px; }

#tab-catalog .cat-pane { display: none; }
#tab-catalog .cat-pane.active { display: block; }
#tab-catalog .cat-muted { color: var(--ui-muted); font-size: 13.5px; }
#tab-catalog .cat-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
#tab-catalog .cat-toolbar .ui-input { width: auto; min-width: 220px; }

#tab-catalog .cat-table-wrap { border: 1px solid var(--ui-line); border-radius: var(--ui-radius-sm); max-height: 560px; overflow: auto; }
#tab-catalog .cat-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
#tab-catalog .cat-table th {
  background: var(--ui-wash); color: var(--ui-ink);
  font-weight: 700; font-size: 14px; text-align: left;
  padding: 11px 10px;
  border: none; border-bottom: 2px solid var(--ui-line-strong);
  position: sticky; top: 0; z-index: 2; white-space: nowrap;
}
#tab-catalog .cat-table td { padding: 12px 10px; border: none; border-bottom: 1px solid var(--ui-line); vertical-align: top; }
#tab-catalog .cat-table tbody tr:hover td { background: #f3f9fb; }
#tab-catalog .cat-table td.c,
#tab-catalog .cat-table th:first-child { text-align: center; }
#tab-catalog .cat-table td.c { white-space: nowrap; }
#tab-catalog .cat-table-edit td { padding: 0; vertical-align: middle; border-right: 1px solid var(--ui-line); }
#tab-catalog .cat-table-edit td.c { padding: 0 6px; }
#tab-catalog .cat-cell { width: 100%; height: 46px; border: none; background: transparent; padding: 0 10px; font-size: 15px; font-family: inherit; color: var(--ui-ink); outline: none; }
#tab-catalog select.cat-cell { cursor: pointer; }
#tab-catalog .cat-cell.r { text-align: right; font-weight: 600; }
#tab-catalog .cat-cell:focus { background: #e9f8fb; box-shadow: inset 0 0 0 2px var(--ui-focus); }
#tab-catalog .cat-row-hidden td { color: var(--ui-faint); }
#tab-catalog .cat-row-new td { background: #eefafc; }
#tab-catalog .cat-row-saved td { background: #cdf3f7 !important; }

#tab-catalog .btn-xs {
  height: 34px; padding: 0 14px !important; font-size: 14px !important; font-weight: 600;
  border-radius: var(--ui-radius-sm); font-family: inherit;
}
#tab-catalog .btn-outline.btn-xs { background: var(--ui-paper); border: 1px solid var(--ui-line-strong); color: var(--ui-ink); }
#tab-catalog .btn-outline.btn-xs:hover { border-color: var(--ui-brand); color: var(--ui-brand); }
#tab-catalog .btn-danger.btn-xs { background: var(--ui-paper); border: 1px solid #e3b4ae; color: var(--ui-danger); }
#tab-catalog .btn-danger.btn-xs:hover { background: var(--ui-danger); color: #fff; }

#tab-catalog .cat-form { margin-top: 0; display: flex; flex-direction: column; gap: 14px; background: var(--ui-paper); border: 1px solid var(--ui-line); }
#tab-catalog .cat-form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }
#tab-catalog .cat-textarea { min-height: 84px; }
#tab-catalog .cat-checks { display: flex; gap: 8px 18px; flex-wrap: wrap; margin-bottom: 6px; }
#tab-catalog .cat-check { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; font-size: 15px; font-weight: 500; color: var(--ui-ink); cursor: pointer; padding: 4px 0; }
#tab-catalog .cat-check input { width: 18px; height: 18px; accent-color: var(--ui-brand); }

#tab-catalog .cat-paste { margin: 0 0 12px; padding: 0 0 12px; border: none; border-bottom: 1px solid var(--ui-line); border-radius: 0; background: none; }
#tab-catalog .cat-paste .ui-more-body > div { display: flex; }

#tab-catalog .cat-bo-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
#tab-catalog .cat-bo-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
#tab-catalog .cat-bo-card { background: var(--ui-paper); border: 1px solid var(--ui-line); border-left: 4px solid var(--ui-amber-line); border-radius: var(--ui-radius); padding: 14px; }
#tab-catalog .cat-bo-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
#tab-catalog .cat-bo-head strong { font-size: 17px; }
#tab-catalog .cat-bo-head > div:first-child { display: flex; flex-direction: column; }
#tab-catalog .cat-bo-head > div:last-child { display: flex; gap: 6px; }
#tab-catalog .cat-mini { width: 100%; border-collapse: collapse; font-size: 14px; }
#tab-catalog .cat-mini th { background: var(--ui-wash); font-weight: 600; text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--ui-line); }
#tab-catalog .cat-mini td { padding: 7px 8px; border-bottom: 1px solid var(--ui-line); }
#tab-catalog .cat-mini td.c { text-align: center; }

/* ---------- Màn hình nhỏ ---------- */
@media (max-width: 1100px) {
  .ui-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tab-catalog .cat-bo-layout { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .ui-step { display: block; padding: 16px; }
  .ui-step-num { float: left; width: 34px; height: 34px; font-size: 16px; margin-right: 10px; }
  .ui-step-title { line-height: 34px; }
  .ui-step-help { clear: both; margin-top: 8px; }
  .ui-fields { grid-template-columns: 1fr; }
  .ui-span-2, .ui-span-4 { grid-column: auto; }
  .ui-actionbar { flex-wrap: wrap; }
  .ui-total { justify-content: flex-start; }
  .ui-actionbar-right { width: 100%; }
  .ui-actionbar-right .ui-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .ui-scope * { transition: none !important; }
}

/* Thông báo nhỏ không che thanh "Lưu phiếu" */
body:has(#tab-create.active) #toast-container { bottom: 110px; }

/* ============================================================
   TAB DANH SÁCH PHIẾU & DASHBOARD (cùng phong cách)
   ============================================================ */
.ui-page-head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ui-seg-lg .ui-seg-btn { height: 42px; padding: 0 20px; font-size: 15px; }

/* Thanh lọc */
.ui-filter { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.ui-filter .ui-field { flex: 0 1 180px; }
.ui-filter .ui-filter-search { flex: 1 1 260px; }
.ui-filter .ui-btn { height: 46px; }

.ui-summary { display: flex; gap: 22px; align-items: baseline; flex-wrap: wrap; margin: 0 4px 10px; font-size: 15px; color: var(--ui-muted); }
.ui-summary:empty { display: none; }
.ui-summary strong { font-size: 22px; color: var(--ui-ink); font-weight: 800; margin-right: 4px; }
.ui-summary-muted { font-size: 14px; }

.ui-panel-flush { padding: 0; overflow: hidden; }
.ui-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 16px 18px 12px; }
.ui-panel-head .ui-panel-title { margin: 0; }

/* Bảng dữ liệu chung */
.ui-table-wrap { overflow: auto; max-height: 640px; }
.ui-scope .ui-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.ui-scope .ui-table th {
  position: sticky; top: 0; z-index: 2;
  background: var(--ui-wash); color: var(--ui-ink);
  font-weight: 700; font-size: 14px; text-align: left;
  padding: 12px 12px; border-bottom: 2px solid var(--ui-line-strong); white-space: nowrap;
}
.ui-scope .ui-table td { padding: 13px 12px; border-bottom: 1px solid var(--ui-line); vertical-align: middle; }
.ui-scope .ui-table tbody tr:hover td { background: #f3f9fb; }
.ui-scope .ui-table .c { text-align: center; }
.ui-scope .ui-table .r { text-align: right; }
.ui-scope .ui-table .nowrap { white-space: nowrap; }
.ui-scope .ui-table tfoot td { background: var(--ui-wash); font-weight: 800; font-size: 16px; border-top: 2px solid var(--ui-ink); border-bottom: none; padding: 14px 12px; }
.ui-scope .ui-table-num td { font-variant-numeric: tabular-nums; }
.ui-scope .ui-table tr.is-cancelled td { color: var(--ui-faint); }
.ui-scope .ui-table tr.is-cancelled .ui-slip-no { text-decoration: line-through; }
.ui-scope .ui-table tr.is-warn td { background: #fdf0ea; }
.ui-scope .ui-empty { text-align: center; padding: 36px 16px !important; color: var(--ui-muted); font-size: 15px; }

.ui-muted { color: var(--ui-faint); }
.ui-faint { color: #bfcad4; }
.ui-sub { font-size: 13px; color: var(--ui-muted); margin-top: 2px; }
.ui-slip-no { font-weight: 700; letter-spacing: 0.01em; }
.ui-num-strong { font-weight: 700; }
.ui-grand { color: var(--ui-brand); font-size: 18px !important; }
.ui-warn-text { color: var(--ui-amber); font-weight: 600; }

.ui-tag { display: inline-block; padding: 2px 10px; border-radius: 6px; background: var(--ui-wash); border: 1px solid var(--ui-line); font-size: 13px; font-weight: 700; color: var(--ui-ink); }
.ui-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.ui-badge-ok { background: var(--ui-brand-soft); color: var(--ui-brand); }
.ui-badge-off { background: #f1f1f1; color: #7a7a7a; }
.ui-badge-warn { background: var(--ui-amber-soft); color: var(--ui-amber); margin-left: 6px; }

/* Nút nhỏ trong bảng */
.ui-btn-sm {
  height: 36px; padding: 0 14px; margin-left: 4px;
  border-radius: var(--ui-radius-sm);
  border: 1px solid var(--ui-line-strong); background: var(--ui-paper); color: var(--ui-ink);
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.ui-btn-sm:hover { border-color: var(--ui-brand); color: var(--ui-brand); }
.ui-btn-sm-primary { background: var(--ui-brand); border-color: var(--ui-brand); color: #fff; }
.ui-btn-sm-primary:hover { background: var(--ui-brand-hover); color: #fff; }
.ui-btn-sm-danger { color: var(--ui-danger); border-color: #e3b4ae; }
.ui-btn-sm-danger:hover { background: var(--ui-danger); border-color: var(--ui-danger); color: #fff; }

/* Thẻ số liệu */
.ui-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 14px; }
.ui-stat { background: var(--ui-paper); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 16px 18px; }
.ui-stat-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ui-muted); }
.ui-stat-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.ui-stat-value { white-space: nowrap; font-size: clamp(22px, 2.1vw, 30px); font-weight: 800; color: var(--ui-ink); letter-spacing: -0.01em; margin-top: 4px; line-height: 1.2; }
.ui-stat-sub { font-size: 13.5px; color: var(--ui-muted); margin-top: 2px; }
.ui-stat-total { background: var(--ui-brand); border-color: var(--ui-brand); }
.ui-stat-total .ui-stat-label,
.ui-stat-total .ui-stat-sub { color: rgba(255, 255, 255, 0.82); }
.ui-stat-total .ui-stat-value { color: #fff; }

/* Biểu đồ cột theo ngày */
.ui-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--ui-muted); margin-bottom: 12px; }
.ui-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ui-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.ui-bars { display: flex; gap: 14px; align-items: flex-end; overflow-x: auto; padding: 4px 2px 6px; min-height: 230px; }
.ui-bar { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 auto; min-width: 46px; }
.ui-bar-val { font-size: 13px; font-weight: 700; color: var(--ui-ink); }
.ui-bar-track { width: 30px; height: 170px; display: flex; flex-direction: column-reverse; background: var(--ui-wash); border-radius: 6px 6px 0 0; overflow: hidden; border-bottom: 2px solid var(--ui-line-strong); }
.ui-bar-seg { width: 100%; }
.ui-bar-date { font-size: 13px; color: var(--ui-muted); }

@media (max-width: 680px) {
  .ui-filter .ui-field { flex: 1 1 100%; }
  .ui-filter .ui-btn { flex: 1; }
}

/* Ghi chú khi thêm khách mới từ tab Lập phiếu */
.ui-return-note { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 14px; background: var(--ui-brand-soft); border: 1px solid #a6d9e3; border-radius: var(--ui-radius-sm); font-size: 14.5px; color: var(--ui-ink); }
.ui-return-note[hidden] { display: none; }
.ui-scope .pxk-kh-pill.pxk-kh-none .kh-name { color: var(--ui-brand); }

/* ============================================================
   BẢNG KIỂU EXCEL: VÙNG CHỌN, MENU CHUỘT PHẢI, DÒNG CÔNG CỤ
   ============================================================ */
#tab-create #excel-grid td.row-head { cursor: pointer; user-select: none; }
#tab-create #excel-grid td.row-head:hover { background: var(--ui-brand-soft); color: var(--ui-brand); }
#tab-create #excel-grid td.cell-sel { background: #d2eff4 !important; box-shadow: inset 0 0 0 1px #6dbccb; }
#tab-create #excel-grid td.cell-sel .excel-cell { background: transparent; }
#tab-create #excel-grid tr.row-sel td.row-head { background: var(--ui-brand) !important; color: #fff; }

/* Dòng công cụ / dụng cụ (không theo size) */
#tab-create #excel-grid tr.row-khongsize td { background: #f3f4fb; }
#tab-create #excel-grid tr.row-khongsize td:first-child { border-left: 4px solid #6a72b8; }
#tab-create #excel-grid td.td-ks .excel-cell { font-weight: 700; font-size: 16px; letter-spacing: 0.01em; }
#tab-create #excel-grid td.td-ks .excel-cell::placeholder { font-weight: 400; font-size: 14px; color: #8e94c4; }

.ui-btn-danger { background: var(--ui-paper); border-color: #e3b4ae; color: var(--ui-danger); }
.ui-btn-danger:hover { background: var(--ui-danger); border-color: var(--ui-danger); color: #fff; }
.ui-btn[hidden] { display: none; }

.ui-keyhelp { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; color: var(--ui-muted); }
.ui-keyhelp kbd, .grid-menu kbd {
  display: inline-block; padding: 1px 6px; border: 1px solid var(--ui-line-strong, #b5c4d0); border-bottom-width: 2px;
  border-radius: 5px; background: #fff; font-family: inherit; font-size: 12px; color: #001c44;
}

.grid-menu {
  position: fixed; z-index: 1000; width: 300px; padding: 6px;
  background: #fff; border: 1px solid #d2dde5; border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 28, 68, 0.18);
  font-family: "Be Vietnam Pro", "Segoe UI", Arial, sans-serif;
}
.grid-menu[hidden] { display: none; }
.grid-menu button {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 9px 12px; border: none; background: transparent; border-radius: 7px;
  font-family: inherit; font-size: 14.5px; color: #001c44; text-align: left; cursor: pointer;
}
.grid-menu button:hover { background: #dcf4f7; }
.grid-menu button.danger { color: #b42318; }
.grid-menu button.danger:hover { background: #fde8e6; }
.grid-menu-sep { height: 1px; background: #e0e8ee; margin: 4px 6px; }

/* ============================================================
   LẬP PHIẾU (popick.js): ô PO chọn từ danh sách + cột Còn lại
   ============================================================ */
#tab-create #excel-grid input.po-pick {
  cursor: pointer; padding-right: 22px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath d='M1.5 3.5l3.5 3.5 3.5-3.5' fill='none' stroke='%235a6865' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
#tab-create #excel-grid .size-val-cell::placeholder { color: #b2c0cc; font-style: italic; font-weight: 400; }
#tab-create #excel-grid th.th-conlai-col { min-width: 96px; border-left: 2px solid var(--ui-brand); }
#tab-create #excel-grid td.td-conlai {
  text-align: right; padding: 0 12px; white-space: nowrap; font-weight: 800; font-size: 16px;
  background: #f1f7fa; border-left: 2px solid var(--ui-brand); color: var(--ui-faint);
}
#tab-create #excel-grid td.td-conlai.cl-con { color: var(--ui-amber); }
#tab-create #excel-grid td.td-conlai.cl-du { color: var(--ui-danger); }
#tab-create #excel-grid td.td-conlai.cl-ok { color: #0c5776; }
#tab-create #excel-grid td.td-conlai small { font-size: 12px; font-weight: 600; }
#tab-create #excel-grid tfoot td.foot-conlai { background: #f1f7fa; border-left: 2px solid var(--ui-brand); }

.popick {
  position: absolute; z-index: 1200; background: var(--ui-paper); color: var(--ui-ink);
  border: 1px solid var(--ui-line-strong); border-radius: var(--ui-radius); overflow: hidden;
  box-shadow: 0 14px 34px rgba(0, 28, 68, .24); font-size: 14px;
}
.popick-search { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px solid var(--ui-line); background: #f5f9fb; }
.popick-q { position: relative; flex: 1; min-width: 0; }
.popick-q svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--ui-muted); }
.popick-input {
  width: 100%; height: 36px; border: 1px solid var(--ui-line-strong); border-radius: var(--ui-radius-sm);
  padding: 0 10px 0 30px; background: #fff; font: inherit; font-size: 15px; outline: none;
}
.popick-input:focus { border-color: var(--ui-focus); box-shadow: 0 0 0 2px rgba(45, 153, 174, .18); }
.popick-n { font-size: 12px; color: var(--ui-muted); white-space: nowrap; }
.popick-head, .popick-it {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, .8fr) 58px 88px;
  gap: 8px; padding: 7px 12px; align-items: center;
}
.popick-head { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ui-muted); border-bottom: 1px solid var(--ui-line); }
.popick-head span:last-child, .pp-con { text-align: right; }
.popick-list { max-height: 300px; overflow-y: auto; }
.popick-it { cursor: pointer; border-bottom: 1px solid #ebf1f5; }
.popick-it > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.popick-it:hover { background: #eaf6f9; }
.popick-it.hi { background: var(--ui-brand-soft); box-shadow: inset 3px 0 0 var(--ui-brand); }
.popick-it.done { color: var(--ui-faint); }
.pp-po { font-weight: 700; }
.pp-cur { color: var(--ui-brand); }
.pp-mau { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; padding: 1px 8px; border-radius: 999px; background: #ebf1f5; font-weight: 700; font-size: 12.5px; vertical-align: middle; }
.pp-con { font-weight: 700; font-size: 13px; color: var(--ui-amber); }
.pp-dot { display: inline-block; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--ui-line-strong); font-size: 12px; font-weight: 700; color: var(--ui-muted); white-space: nowrap; }
.pp-dot.on { border-color: var(--ui-brand); background: #bcfefe; color: var(--ui-brand); } /* đợt của phiếu đang lập */
.popick-it.done .pp-con { color: #0c5776; }
.popick-empty { padding: 18px 12px; text-align: center; color: var(--ui-muted); }
.popick-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 7px 12px; border-top: 1px solid var(--ui-line); background: #f5f9fb; font-size: 12px; color: var(--ui-muted); }
.popick-foot kbd { border: 1px solid var(--ui-line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font-family: inherit; font-size: 11px; background: #fff; }
.popick-fill { flex: 1; }
@media print { .popick { display: none !important; } }

#slip-dot-wrap[hidden] { display: none !important; } /* ô "Đơn hàng đợt" (popick.js) */
