/* =====================================================================
   LAZICO WORKFLOW — HỆ THỐNG THIẾT KẾ (v8 redesign)
   Tông: xanh THÔNG trầm làm chủ đạo (điềm tĩnh, chuyên nghiệp), nền trắng-ấm ngả xanh
   Typography: Sora cho tiêu đề, Inter cho nội dung/dữ liệu (số dùng tabular-nums)
   File này là bản song song — chỉ trang nào trỏ tới style-v8.css mới đổi giao diện.
   ===================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Bảng màu XANH THÔNG TRẦM (v8) — đổi ở đây là đổi tông toàn hệ thống */
  --brand: #1E7A4D;
  --brand-dark: #196A42;
  --brand-darker: #12502F;
  --brand-light: #E7F3EC;
  --brand-lighter: #F1F8F3;
  --accent-mint: #8FE9BC;

  --ink: #16241D;
  --text-main: #20302A;
  --text-muted: #63756B;
  --text-faint: #7C8A81;   /* đậm hơn mức cũ (#93A29A) cho dễ đọc khi dùng lâu — vẫn nhạt hơn text-muted */

  --border: #E2E9E3;
  --border-strong: #CDD8D0;
  --bg-page: #F6F8F6;
  --bg-card: #FFFFFF;
  --bg-sunken: #EFF3EF;

  --amber: #8A5A00;
  --amber-bg: #FBF0D9;
  --red: #A82B27;
  --red-bg: #FBE9E8;
  --blue: #1D5B86;
  --blue-bg: #E6F0F8;
  --purple: #5A4BB3;
  --purple-bg: #ECE9FA;
  --gray-bg: #EAEEEB;
  --gray-text: #5A6660;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 40, 24, 0.06);
  --shadow-md: 0 4px 16px rgba(16, 40, 24, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 40, 24, 0.12);

  /* ---- THANG ĐO KHOẢNG CÁCH (spacing scale) — DÙNG CHUNG TOÀN BỘ HỆ THỐNG ----
     Trước đây mỗi trang tự viết margin/padding tay (margin-top:14px ở trang này,
     margin-top:12px ở trang khác cho cùng 1 việc) → giao diện lệch nhịp, không thẳng hàng.
     Từ giờ MỌI khoảng cách nên lấy từ đúng 7 bước này, không tự nghĩ ra số mới. */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* ---- THANG ĐO CỠ CHỮ (type scale) — DÙNG CHUNG TOÀN BỘ HỆ THỐNG ----
     Trước đây có tới 13 cỡ chữ lẻ khác nhau (11/12/12.5/13/13.5/14/14.5/15/16/18/22/26/30px)
     dùng rải rác qua style inline cho cùng vai trò "chữ nhỏ/phụ". Gom lại còn đúng 6 bước rõ vai trò. */
  --fs-xs: 11px;    /* nhãn viết hoa, chú thích cực nhỏ */
  --fs-sm: 12.5px;  /* chữ phụ, mô tả, muted */
  --fs-base: 14px;  /* chữ nội dung mặc định */
  --fs-md: 15.5px;  /* nhấn nhẹ, tiêu đề dòng */
  --fs-lg: 19px;    /* h3 */
  --fs-xl: 24px;    /* h2 */
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
/* Lưới an toàn chống kéo ngang cả trang: một phần tử rộng hơn viewport sẽ KHÔNG cho lôi trang
   sang phải vào khoảng trắng. Dùng `clip` (không phải `hidden`) để không biến <html> thành
   scroll-container — giữ nguyên position:sticky của topbar. Vẫn nên để bảng tự cuộn trong khung
   (luật ở @media 700 phía dưới) để nội dung không bị cắt. */
html { overflow-x: clip; scroll-padding-top: 76px; }  /* mục nhảy trong trang (#anchor) không bị topbar dính che */
/* Ảnh/SVG (radar KPI, biểu đồ vẽ tay đặt width cứng) co theo khung, không đẩy tràn. */
img, svg { max-width: 100%; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  font-size: var(--fs-base);
}
a { color: var(--brand-dark); text-decoration: none; font-weight: 500; transition: color .12s; }
a:hover { color: var(--brand-darker); text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px;
}
h1, h2, h3, h4 { font-family: 'Sora', 'Inter', sans-serif; color: var(--ink); letter-spacing: -0.01em; line-height: 1.25; }
/* h1 = h2 = tiêu đề trang (24px). Trước đây h1 KHÔNG có cỡ → rơi về mặc định ~32px, to hơn h2,
   nên trang dùng h1 và trang dùng h2 lệch cỡ tiêu đề. Nay đồng nhất, dùng thẻ nào cũng như nhau. */
h1 { font-size: var(--fs-xl); font-weight: 700; margin: 0 0 var(--sp-1); }
h2 { font-size: var(--fs-xl); font-weight: 700; margin: 0 0 var(--sp-1); }
h3 { font-size: var(--fs-lg); font-weight: 700; margin: 0 0 var(--sp-2); }
h4 { font-size: var(--fs-md); font-weight: 700; margin: 0 0 var(--sp-1); }
.muted { color: var(--text-muted); font-size: var(--fs-sm); margin: 0 0 var(--sp-4); }
::selection { background: var(--brand-light); color: var(--brand-darker); }
/* Chạm trên cảm ứng: thay ô xám mặc định của iOS bằng ánh xanh thương hiệu rất nhạt. */
a, button, [role="button"], summary, label, .act-menu-item, .col-picker-trigger { -webkit-tap-highlight-color: rgba(30,122,77,.12); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; } }

/* ---- Dropdown "Cột hiển thị" — dùng chung cho Khách hàng/Đơn hàng/Sản phẩm/Báo cáo ---- */
.col-picker { position: relative; display: inline-block; }
.col-picker-trigger { cursor: pointer; }
.col-picker-panel {
  position: absolute; top: 100%; right: 0; margin-top: 6px; z-index: 30; display: none;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: var(--sp-3); min-width: 260px; max-width: 340px;
}
.col-picker-panel.is-open { display: block; }
.col-picker-group-title { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); font-weight: 700; margin: var(--sp-2) 0 var(--sp-1); }
.col-picker-group-title:first-child { margin-top: 0; }
.col-picker-item { display: flex; align-items: center; gap: var(--sp-2); padding: 3px 0; font-size: var(--fs-sm); font-weight: 400; text-transform: none; cursor: pointer; }
.col-picker-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-3); padding-top: var(--sp-2); border-top: 1px solid var(--border); }
.col-picker-actions a { font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }

/* ---- MENU THAO TÁC "⋯" — CHUẨN DUY NHẤT cho Sửa / Ẩn / Xóa trên mọi màn hình ----
   Trước đây mỗi trang một kiểu (link chữ phơi ra · gập trong <details> · nút riêng) ⇒ người dùng phải
   học lại ở từng chỗ. Nay gom hết vào một nút ⋯. Khoác lên .col-picker sẵn có nên DÙNG LUÔN JS toàn cục
   ở includes/layout.php (mở/đóng, bấm ra ngoài tự đóng) — không viết JS mới. Dựng menu bằng actionMenu(). */
/* Nút ⋯ = KHUNG VUÔNG NỔI HẲN, luôn thấy được (đổi 17/07/2026).
   Trước đây `border: 1px solid transparent; background: none` ⇒ nút VÔ HÌNH cho tới khi rê chuột vào —
   người dùng không biết là có chỗ bấm. Nay có viền + nền + bóng nhẹ ngay từ đầu.
   Vuông chằn chặn (28×28) để trông như một cái nút thật, không phải ba dấu chấm lạc lõng. */
.act-menu-wrap { display: flex; justify-content: flex-end; align-items: center; }   /* luôn dạt SÁT PHẢI ô chứa nó */
.act-menu .col-picker-trigger {
  width: 28px; height: 28px; padding: 0; flex: 0 0 28px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-main);
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(0,0,0,.06); transition: background .12s, border-color .12s;
}
/* 3 chấm là SVG (xem actionMenu() ở helpers.php) — KHÔNG phải ký tự '⋯'. Ký tự đó phụ thuộc font máy
   người dùng: chỗ mảnh dính nhau, chỗ lệch tâm, phóng to là vỡ. SVG thì đâu cũng sắc nét, luôn đúng tâm. */
.act-menu .col-picker-trigger svg { display: block; }
.act-menu .col-picker-trigger:hover { background: var(--bg-sunken); border-color: var(--text-muted); }
.act-menu .col-picker-trigger:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.act-menu .col-picker-panel { min-width: 180px; max-width: 260px; padding: var(--sp-2); }
.act-menu-item { display: flex; align-items: center; gap: var(--sp-2); width: 100%; padding: 7px 8px;
  border-radius: var(--radius-sm); font-size: var(--fs-sm); font-weight: 500; color: var(--text-main);
  text-align: left; background: none; border: 0; cursor: pointer; font-family: inherit; }
.act-menu-item:hover { background: var(--bg-sunken); text-decoration: none; }
.act-menu-item.is-danger { color: var(--red); }   /* Ẩn/Xóa = màu CÓ NGHĨA, xếp cuối menu */
.act-menu-sep { height: 1px; background: var(--border); margin: var(--sp-1) 0; }
.act-menu-note { font-size: var(--fs-xs); color: var(--text-muted); padding: 4px 8px; }
/* ---- BĂNG CHỮ khẩu hiệu (Lazico Nội Bộ) — to, đậm, nổi bật ---- */
.site-banner {
  position: relative; overflow: hidden; border-radius: var(--radius); margin-bottom: var(--sp-4);
  padding: 16px var(--sp-5); text-align: center; font-weight: 800; font-size: 21px; line-height: 1.3;
  letter-spacing: .004em;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand)); color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.28);
  box-shadow: 0 6px 22px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.14);
}
/* Cỡ chữ do Admin chọn */
.site-banner-lg { font-size: 27px; padding: 20px var(--sp-5); }
.site-banner-xl { font-size: 36px; padding: 26px var(--sp-5); letter-spacing: .012em; }
@media (max-width: 700px) {
  .site-banner    { font-size: 17px; padding: 13px 14px; }
  .site-banner-lg { font-size: 20px; padding: 15px 14px; }
  .site-banner-xl { font-size: 24px; padding: 18px 14px; }
}

/* Chữ chạy ngang — mờ dần 2 mép, di chuột vào thì dừng để đọc */
.site-banner-marquee { white-space: nowrap; text-align: left; padding-left: 0; padding-right: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent); }
.site-banner-marquee span { display: inline-block; padding-left: 100%; animation: siteBannerMarquee 18s linear infinite; }
.site-banner-marquee:hover span { animation-play-state: paused; }
@keyframes siteBannerMarquee { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

.site-banner-pulse { animation: siteBannerPulse 2.4s ease-in-out infinite; }
@keyframes siteBannerPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

.site-banner-gradient {
  background: linear-gradient(270deg, var(--brand-dark), var(--brand), var(--brand-dark));
  background-size: 200% 200%; animation: siteBannerGradient 6s ease infinite;
}
@keyframes siteBannerGradient { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* Ánh sáng quét ngang */
.site-banner-shine::after {
  content: ""; position: absolute; top: 0; left: -40%; width: 34%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-18deg); animation: siteBannerShine 3.4s ease-in-out infinite;
}
@keyframes siteBannerShine { 0% { left: -40%; } 60%, 100% { left: 120%; } }

/* Viền phát sáng (neon) */
.site-banner-neon { animation: siteBannerNeon 1.9s ease-in-out infinite; }
@keyframes siteBannerNeon {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255,255,255,.30), 0 0 12px 1px var(--brand), 0 6px 20px rgba(0,0,0,.16); }
  50%      { box-shadow: 0 0 0 3px rgba(255,255,255,.58), 0 0 30px 7px var(--brand), 0 6px 20px rgba(0,0,0,.16); }
}

/* Nảy nhẹ */
.site-banner-bounce { animation: siteBannerBounce 1.7s ease-in-out infinite; }
@keyframes siteBannerBounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* Nhấp nháy sáng chữ */
.site-banner-blink { animation: siteBannerBlink 1.2s ease-in-out infinite; }
@keyframes siteBannerBlink { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.55); } }

/* Nền cầu vồng chạy */
.site-banner-rainbow {
  background: linear-gradient(90deg, #E11D48, #F59E0B, #22C55E, #0EA5E9, #8B5CF6, #E11D48);
  background-size: 300% 100%; animation: siteBannerRainbow 7s linear infinite;
}
@keyframes siteBannerRainbow { 0% { background-position: 0 0; } 100% { background-position: 300% 0; } }

/* Phóng to nhẹ theo nhịp */
.site-banner-zoom { animation: siteBannerZoom 2.6s ease-in-out infinite; }
@keyframes siteBannerZoom { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.022); } }

@media (prefers-reduced-motion: reduce) {
  .site-banner-marquee span, .site-banner-pulse, .site-banner-gradient, .site-banner-shine::after,
  .site-banner-neon, .site-banner-bounce, .site-banner-blink, .site-banner-rainbow, .site-banner-zoom { animation: none !important; }
}

/* ---- LỚP TIỆN ÍCH DÙNG CHUNG (utility classes) ----
   Thay cho việc mỗi trang tự viết style="font-size:...; margin-top:..." với số tự chọn.
   Dùng các lớp này trong HTML để toàn hệ thống luôn thẳng hàng, cùng nhịp khoảng cách. */
.text-xs   { font-size: var(--fs-xs) !important; }
.text-sm   { font-size: var(--fs-sm) !important; }
.text-base { font-size: var(--fs-base) !important; }
.text-md   { font-size: var(--fs-md) !important; }
.text-center { text-align: center !important; }
.text-right   { text-align: right !important; }
.text-uppercase { text-transform: uppercase !important; letter-spacing: .04em; }
.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }

.mt-0 { margin-top: 0 !important; } .mb-0 { margin-bottom: 0 !important; }
.mt-1 { margin-top: var(--sp-1) !important; } .mb-1 { margin-bottom: var(--sp-1) !important; }
.mt-2 { margin-top: var(--sp-2) !important; } .mb-2 { margin-bottom: var(--sp-2) !important; }
.mt-3 { margin-top: var(--sp-3) !important; } .mb-3 { margin-bottom: var(--sp-3) !important; }
.mt-4 { margin-top: var(--sp-4) !important; } .mb-4 { margin-bottom: var(--sp-4) !important; }
.mt-6 { margin-top: var(--sp-6) !important; } .mb-6 { margin-bottom: var(--sp-6) !important; }

.stack-1 > * + * { margin-top: var(--sp-1); }
.stack-2 > * + * { margin-top: var(--sp-2); }
.stack-3 > * + * { margin-top: var(--sp-3); }
.stack-4 > * + * { margin-top: var(--sp-4); }

.row { display: flex; align-items: center; flex-wrap: wrap; }
.row-1 { gap: var(--sp-1); } .row-2 { gap: var(--sp-2); } .row-3 { gap: var(--sp-3); } .row-4 { gap: var(--sp-4); }

/* Thêm — các mẫu lặp lại nhiều nhất trong style inline trên toàn hệ thống, gom về đây dùng chung */
.m-0 { margin: 0 !important; }
.p-0 { padding: 0 !important; }
.p-4 { padding: var(--sp-4) !important; }
.w-auto { width: auto !important; }
.d-inline { display: inline !important; }
.is-hidden { display: none; }   /* xem thêm luật lặp lại ở CUỐI file — bắt buộc, đọc chú thích ở đó */
.is-relative { position: relative; }
.nowrap { white-space: nowrap; }
.overflow-x-auto { overflow-x: auto; }
.flex-1 { flex: 1; }
.min-w-200 { min-width: 200px; }
.gap-fw400 { gap: var(--sp-1); font-weight: 400; }
.link-danger { color: var(--red); }
.link-danger:hover { color: #7A1F1E; }
/* Lưới 2 cột cho form (dùng .grid-2 sẵn có) — 1 ô chiếm cả 2 cột */
.col-span-2 { grid-column: span 2; }
/* Danh sách chú thích/gợi ý nhỏ trong form */
.hint-list { padding-left: 18px; font-size: var(--fs-base); color: var(--text-muted); }
/* Độ rộng khung nội dung theo trang — thay cho mỗi trang tự chọn 1000/1100/1200/1300px */
/* Nới rộng để nội dung tận dụng bề ngang màn hình khi đã bỏ menu chiếm chỗ (chốt 25/07/2026).
   Màn dưới ngưỡng cap vốn đã full-width; cap chỉ chặn màn RẤT rộng để chữ khỏi dài quá đọc mệt. */
/* ĐỒNG BỘ KHỔ NỘI DUNG (chốt 25/07/2026): mọi trang cùng max-width ⇒ LỀ 2 BÊN GIỐNG NHAU khi chuyển trang
   (trước đây md/lg/xl khác nhau nên lề nhảy mỗi trang một kiểu). Lấy đúng khổ trang Công việc (1400) anh ưng.
   Selector GHÉP để thắng luật `.container` bất kể thứ tự file. Trang bảng nào cần rộng hơn sẽ nới RIÊNG khi cần. */
.container.container-md,
.container.container-lg,
.container.container-xl { max-width: 1400px; }

/* ---- Thêm — các mẫu UI lặp lại ở nhiều trang khác (hồ sơ, quản trị, báo cáo...) ---- */
.card-compact { padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3); }
.card-flush { padding: 0; margin-bottom: var(--sp-5); }
.card-flush.p-0-nomargin { margin-bottom: 0; }
.filter-caption { margin: calc(var(--sp-2) * -1) 0 var(--sp-4); }
.detail-block { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.check-label { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); cursor: pointer; }
.check-label-col { display: flex; text-transform: none; font-weight: 600; color: var(--text-main); margin: 0 0 var(--sp-2); }
.stat-red { color: var(--red); font-weight: 600; }
.stat-green { color: var(--brand-dark); font-weight: 600; }
.stat-amber { color: var(--amber); font-weight: 600; }
.stat-blue { color: var(--blue); font-weight: 600; }
/* Ô "đã hoàn thành" trong bảng — thay style inline lẻ, dùng chung. */
.cell-done { color: var(--brand-dark); font-size: 16px; }
.gap-4 { gap: var(--sp-4) !important; }
.gap-1 { gap: var(--sp-1) !important; }
.gap-2 { gap: var(--sp-2) !important; }
.items-start { align-items: flex-start !important; }
.gap-3 { gap: var(--sp-3) !important; }
.w-160 { width: 160px !important; }
.max-w-200 { max-width: 200px !important; }
.btn-sm { padding: 4px 11px !important; font-size: var(--fs-sm) !important; }
.order-total-line { text-align: right; margin-top: var(--sp-2); font-weight: 600; }
.step-track { display: flex; gap: var(--sp-1); margin-top: var(--sp-3); }
.step-segment { flex: 1; height: 4px; border-radius: 4px; }
.scroll-table-wrap-md { max-height: 280px; }
.min-w-140 { min-width: 140px; }
.status-col { width: auto; text-align: center; padding-left: 2px !important; padding-right: 2px !important; }
/* Badge trạng thái trong bảng đơn hàng — hình CHỮ NHẬT gọn (không phải hình bầu pill như .badge mặc
   định dùng ở nơi khác), không có dấu chấm phía trước, để nhiều cột trạng thái đứng sát nhau vẫn gọn.
   Chỉ áp dụng RIÊNG cho .badge nằm trong .status-col — không ảnh hưởng .badge ở các trang khác. */
.status-col .badge { border-radius: 4px; padding: 3px 6px; font-size: 11px; white-space: nowrap; }
.status-col .badge::before { display: none; }
/* Địa chỉ trong bảng đơn hàng CHÍNH — thu nhỏ hơn hẳn mức chung của .truncate-cell, vì chỉ thật sự
   cần thiết lúc TẠO đơn (đã có trang riêng lo phần đó), lúc XEM chỉ cần lướt qua là đủ. */
.address-col-compact { max-width: 110px !important; }
/* ---- Xem nhanh trong dòng (bảng Đơn hàng) — bấm mở rộng xem sản phẩm + ghi chú, không cần rời trang ---- */
.qv-toggle {
  background: none; border: 1px solid var(--border-strong); border-radius: 6px; width: 26px; height: 26px;
  cursor: pointer; color: var(--text-muted); font-size: 13px; line-height: 1; transition: transform .15s;
}
.qv-toggle:hover { background: var(--brand-lighter); color: var(--brand-dark); }
.qv-toggle.is-open { transform: rotate(90deg); }
.qv-row td.qv-cell { background: var(--bg-sunken); padding: var(--sp-4) var(--sp-5) !important; }
.qv-items-table { width: auto; max-width: 100%; margin-bottom: var(--sp-3); border-collapse: collapse; }
.qv-items-table th, .qv-items-table td { padding: 4px 14px 4px 4px; font-size: var(--fs-sm); border-bottom: 1px solid var(--border); }
.num { white-space: nowrap; text-align: right; }
/* Căn tiêu đề cột số nằm ở luật `table th.num` phía dưới (gần các luật bảng) — KHÔNG đặt ở đây,
   vì `table th.num` có độ ưu tiên cao hơn và sẽ đè mất. */
/* Tô nền so le theo TỪNG ĐƠN (không phải từng dòng) — vì 1 đơn có thể chiếm nhiều dòng theo sản
   phẩm (rowspan), tô so le kiểu Excel giúp phân biệt nhanh đơn này với đơn kia khi lướt mắt. */
.order-row-alt td { background: #EAF0EB; }
.qv-total-row td { font-weight: 500; border-bottom: none !important; padding-top: 6px !important; }
.qv-total-row-first td { border-top: 1.5px solid var(--ink); padding-top: 8px !important; }
.qv-cod-row td { color: var(--brand-dark); font-weight: 700; font-size: var(--fs-md); }
.qv-note { margin-bottom: var(--sp-2); font-size: var(--fs-sm); }
.qv-note strong { color: var(--brand-dark); }
.status-dot {
  display: inline-block; width: 15px; height: 15px; border-radius: 50%;
  vertical-align: middle; border: 2px solid rgba(0,0,0,0.06); cursor: default;
}
.status-dot-empty {
  display: inline-block; width: 15px; height: 15px; border-radius: 50%;
  vertical-align: middle; border: 2px dashed var(--border-strong); cursor: default;
}
/* ---- Badge BẤM ĐƯỢC để đổi trạng thái (thay cho <select> hay bị che chữ/cắt ngắn) — hình CHỮ NHẬT
   có tên trạng thái bên trong, ĐỒNG BỘ HOÀN TOÀN với badge chỉ đọc (catalogColorBadge()) — trước đây
   là chấm tròn 20px riêng biệt, to hơn hẳn badge chỉ đọc (15px), gây cảm giác lệch cỡ khi 2 loại
   đứng cạnh nhau trong cùng 1 bảng — đã bỏ hẳn sự khác biệt đó. ---- */
.status-picker-trigger {
  display: inline-flex; align-items: center; border-radius: 4px; padding: 3px 6px; font-size: 11px;
  font-weight: 700; letter-spacing: .01em; cursor: pointer; border: 1px dashed var(--border-strong);
  background: var(--gray-bg); color: var(--gray-text); white-space: nowrap; line-height: 1.3;
}
.status-picker-trigger:hover { border-color: var(--brand); }
/* Ô "Chưa chọn" (chỉ đọc, không bấm được) — CÙNG kích thước với badge có màu, viền chấm chấm để
   phân biệt đây là ô đặc biệt/trống, không dùng màu (đồng bộ với trạng thái mặc định của nút bấm được). */
.status-empty-badge {
  display: inline-flex; align-items: center; border-radius: 4px; padding: 3px 6px; font-size: 11px;
  font-weight: 700; border: 1px dashed var(--border-strong); background: var(--gray-bg);
  color: var(--gray-text); white-space: nowrap;
}
/* ---- Bảng chọn 10 màu cố định (trang Cấu hình — danh mục vị trí cố định) ---- */
.palette-picker { display: grid; grid-template-columns: repeat(auto-fill, 24px); gap: 6px; align-items: center; justify-content: start; }
.palette-swatch-label { cursor: pointer; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; }
.palette-swatch {
  width: 22px; height: 22px; border-radius: 50%; display: block; box-sizing: border-box;
  border: 2px solid transparent; position: relative;
}
.palette-swatch-label input:checked + .palette-swatch { border-color: var(--ink); }
.palette-swatch-label input:checked + .palette-swatch::after {
  content: "✓"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 0 2px rgba(0,0,0,.6);
}
.catalog-role-row { background: var(--amber-bg); }
.catalog-role-row td:first-child { font-weight: 700; color: var(--amber); }
.role-col-header { max-width: 160px; white-space: normal; cursor: help; }
.status-picker .col-picker-panel { min-width: 170px; right: auto; left: 50%; transform: translateX(-50%); }
.status-option { cursor: pointer; }
.status-option:hover { background: var(--brand-lighter); border-radius: 6px; }
.status-option .status-dot, .status-option .status-dot-empty { margin-right: 6px; }
.select-sm { font-size: var(--fs-sm); padding: 3px 4px; width: 100%; max-width: 100px; }
/* Cắt ngắn chữ dài trong ô bảng (địa chỉ, ghi chú...) — tránh mỗi từ 1 dòng làm bảng cao ngất.
   Di chuột vào (title=...) để xem đầy đủ, không cần mở rộng cột hay bấm gì thêm. */
.truncate-cell { display: block; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Hiện ĐẦY ĐỦ chữ, tự xuống dòng — dùng cho Ghi chú đơn hàng, nơi Kho/Kỹ thuật cần đọc rõ ngay để
   chuẩn bị vật tư, không tiện phải hover chuột vào mới thấy (đặc biệt bất tiện trên máy tính bảng). */
.wrap-cell { display: block; max-width: 380px; white-space: normal; word-wrap: break-word; line-height: 1.5; }

/* 🐞 VÁ LỆCH DÒNG (17/07/2026) — ĐỌC TRƯỚC KHI SỬA HAI LỚP TRÊN.
   Hai lớp trên có `display: block` vì chúng vốn được thiết kế để BỌC BÊN TRONG ô:
        <td><span class="wrap-cell">…</span></td>          ← ĐÚNG (inline cần block thì max-width mới ăn)
   Nhưng đặt THẲNG lên ô thì `display:block` khiến ô đó RỚT KHỎI HÀNG của bảng ⇒ chữ tụt xuống, sinh
   gạch ngang lạ, cả bảng lệch:
        <td class="wrap-cell">…</td>                       ← SAI, nhưng rất dễ viết nhầm
   Thực tế đã dính ở 8 chỗ (đối soát COD, thùng rác, danh sách ca bảo hành…).
   ⇒ Thay vì bắt mọi người nhớ luật, TRẢ ô về đúng kiểu hiển thị của nó. Nay VIẾT KIỂU NÀO CŨNG ĐÚNG. */
td.truncate-cell, th.truncate-cell,
td.wrap-cell,     th.wrap-cell     { display: table-cell; }
.section-title-gap { margin: var(--sp-6) 0 var(--sp-2); }
.max-w-280 { max-width: 280px; }
.max-w-320 { max-width: 320px; }
.card-amber { background: var(--amber-bg); }
.pre-line { white-space: pre-line; }
.my-2-tight { margin: var(--sp-1) 0; }
.task-color-dot-lg { width: 16px; height: 16px; }
.swatch-flat { border-width: 0; }
.swatch-none { background: #fff; border: 1px solid var(--border-strong); }
.progress-meta { display: flex; justify-content: space-between; font-size: var(--fs-sm); color: var(--text-muted); }
.progress-range { flex: 1; }
.progress-output { width: 40px; text-align: right; }
.progress-track-task { background: var(--bg-sunken); height: 6px; border-radius: 4px; }
.progress-fill-task { background: var(--blue); height: 6px; border-radius: 4px; }
.ml-auto { margin-left: auto; }
.mr-2 { margin-right: var(--sp-2); }
.check-label-inline { display: inline-flex; align-items: center; gap: var(--sp-2); margin: 0; text-transform: none; font-weight: 500; }
.color-input { width: 44px; height: 34px; padding: 2px; border-radius: 6px; cursor: pointer; }
.color-input-sm { width: 40px; height: 32px; padding: 2px; border-radius: 6px; cursor: pointer; }
.btn-xs { padding: 4px 10px; font-size: var(--fs-sm); }
.avatar-lg-56 { width: 56px; height: 56px; }
.avatar-lg-56.avatar-circle { font-size: var(--fs-lg); }
.avatar-lg-56.user-avatar-img { border-radius: 50%; object-fit: cover; }
.max-w-240 { max-width: 240px; }
.link-danger-ml { color: var(--red); margin-left: var(--sp-1); }
.link-danger-ml-lg { color: var(--red); margin-left: var(--sp-3); }
.logo-preview { max-height: 60px; max-width: 240px; object-fit: contain; }
.favicon-preview { width: 40px; height: 40px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.slide-thumb { width: 140px; height: 90px; object-fit: cover; border-radius: 8px; }
.slide-remove-btn {
  position: absolute; top: 4px; right: 4px; background: #fff; border-radius: 50%;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  color: var(--red); font-weight: 700;
}
.badge-btn { border: none; cursor: pointer; }
.quote-total-block { text-align: right; margin-top: var(--sp-3); font-size: var(--fs-base); }
.quote-grand-total { font-weight: 600; font-size: 16px; margin-top: var(--sp-1); }
.logo-preview-sm { max-height: 48px; max-width: 220px; object-fit: contain; margin-bottom: var(--sp-2); }
.check-label-plain { display: flex; text-transform: none; font-weight: 500; margin-top: var(--sp-4); }
.row-item-line { display: flex; justify-content: space-between; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-md); }
.topbar-avatar-link { display: flex; align-items: center; gap: var(--sp-2); }
.avatar-sm-28 { width: 28px; height: 28px; font-size: var(--fs-sm); }
.w-90 { width: 90px; }
.comment-block { border-top: 1px solid var(--border); padding: var(--sp-3) 0; }
.comment-author { font-size: var(--fs-base); }
.comment-content { margin: var(--sp-2) 0; font-size: var(--fs-base); }
.badge-block { display: block; text-align: center; margin-bottom: var(--sp-1); }
.badge-inline-block { display: inline-block; margin-bottom: 2px; }
.progress-track-sm { flex: 1; min-width: 60px; height: 7px; background: var(--bg-sunken); border-radius: 99px; overflow: hidden; }
.progress-fill-sm { height: 100%; background: var(--brand); }
/* Trang Hồ sơ cá nhân */
.profile-card { text-align: center; }
.profile-avatar-xl { width: 80px; height: 80px; margin-bottom: var(--sp-2); }
.profile-avatar-xl.avatar-circle { font-size: 30px; }
.profile-avatar-xl.user-avatar-img { border-radius: 50%; object-fit: cover; }
.profile-name { margin: var(--sp-2) 0 var(--sp-1); font-size: var(--fs-md); }
.profile-fields { text-align: left; margin-top: var(--sp-3); }
.profile-fields label { margin-bottom: var(--sp-2); }
.profile-avatar-input { font-size: var(--fs-xs); }
.profile-avatar-btn { width: 100%; justify-content: center; margin-top: var(--sp-2); font-size: var(--fs-sm); padding: 7px; }
/* Trang Quản trị nhân sự — lưới chọn phòng ban khi tạo tài khoản */
.dept-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-2); }
.dept-picker-card { padding: var(--sp-2) var(--sp-3); margin-bottom: 0; }
.dept-role-select { height: 32px; font-size: var(--fs-sm); }
.avatar-sm-32 { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.summary-toggle { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--brand-dark); }

/* ---- Trang Thông báo — panel 3 cột, dùng đúng token màu chung thay vì hex rời rạc ---- */
.notif-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.notif-panel-header { padding: var(--sp-3) var(--sp-4); display: flex; align-items: center; justify-content: space-between; }
.notif-panel-header-left { display: flex; align-items: center; gap: var(--sp-2); }
.notif-panel-icon { font-size: var(--fs-md); }
.notif-panel-title { color: #fff; font-size: var(--fs-md); letter-spacing: .01em; }
.notif-panel-count { background: rgba(255,255,255,0.28); color: #fff; font-size: var(--fs-xs); font-weight: 700; padding: 2px 9px; border-radius: 99px; min-width: 22px; text-align: center; }
.notif-panel-body { padding: var(--sp-2); max-height: 600px; overflow-y: auto; }
.notif-empty { text-align: center; padding: var(--sp-8) var(--sp-4); color: var(--text-faint); }
.notif-empty-icon { font-size: 26px; margin-bottom: var(--sp-2); opacity: .5; }
.notif-row-link { display: block; padding: var(--sp-2) var(--sp-2); border-radius: 9px; margin-bottom: 2px; }
.notif-row-inner { display: flex; align-items: flex-start; gap: var(--sp-2); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.notif-row-content { min-width: 0; flex: 1; }
.notif-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); }
.notif-row-title { font-size: var(--fs-sm); color: var(--text-main); line-height: 1.3; }
.notif-row-time { font-size: var(--fs-xs); color: var(--text-faint); white-space: nowrap; flex-shrink: 0; }
.notif-row-body { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 2px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-row-link.is-unread { background: #BFE8CE; }
.notif-row-link.is-unread .notif-row-title { font-weight: 700; color: var(--ink); }
.notif-unread-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: middle; }

/* Badge ICON LOẠI thông báo — nhìn phát biết loại + độ quan trọng. act=đỏ (cần xử lý) · ops=xanh (vận hành) · info=xám (tham khảo). */
.nicon { display: inline-flex; align-items: center; justify-content: center; width: 23px; height: 23px; min-width: 23px; border-radius: 7px; font-size: 12.5px; line-height: 1; margin-right: 6px; vertical-align: middle; border: 1px solid transparent; }
.nicon-act  { background: #FDECEC; border-color: #F1B4B4; }
.nicon-ops  { background: #E9F1FD; border-color: #BAD3F3; }
.nicon-info { background: #EFF1F3; border-color: #DCDFE3; }

/* Cặp nhãn+giá trị thẳng hàng theo lưới cố định — thay cho các khối flex tự chế mỗi trang 1 kiểu */
.kv-grid { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-4); align-items: baseline; }
.kv-grid dt { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; }
.kv-grid dd { margin: 0; }

/* Section: khối tiêu đề + nội dung có nhịp khoảng cách cố định, thay cho margin tay */
.section { margin: var(--sp-6) 0 var(--sp-3); }
.section:first-child { margin-top: 0; }

/* ---- Form controls ---- */
input, select, textarea {
  height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--border-strong);
  font-size: 14px; width: 100%; font-family: inherit; background: #fff; color: var(--text-main);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3.5px var(--brand-light);
}
textarea { height: auto; padding: 10px 12px; min-height: 84px; resize: vertical; }
input[type="range"] { height: auto; padding: 0; accent-color: var(--brand); }
input[type="checkbox"], input[type="radio"] { width: auto; height: auto; accent-color: var(--brand); }
input[type="file"] { padding: 7px; height: auto; font-size: 13px; }
select[multiple] { height: auto; padding: 6px; }
/* Nhãn form: sentence-case, KHÔNG in hoa (chuẩn Linear/Notion/Stripe — nhẹ mắt, đọc nhanh, bớt "admin cũ").
   Tiêu đề cột bảng vẫn in hoa riêng ở `table th`; các nhãn-nhóm in hoa có class riêng, không đụng. */
label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-text); margin: 8px 0 5px; text-transform: none; letter-spacing: normal; }
label:first-child { margin-top: 0; }

/* ---- Buttons ----
   text-transform: none — nút "Thêm ảnh" ở trang chủ dùng <label class="btn"> để bọc input file ẩn
   (kỹ thuật làm nút chọn file đẹp hơn mặc định), nên vô tình dính rule chung "label { text-transform:
   uppercase }" ở trên (dành cho nhãn form như "Họ tên") → bị viết hoa toàn bộ, lệch tông với nút
   "Đăng bài" bên cạnh (button thường, không bị dính rule label). Chặn hẳn ở đây cho MỌI nút, để sau
   này lỡ có label nào khác được biến thành nút cũng không bị lặp lại lỗi tương tự. */
.btn-primary, .btn, .btn-danger {
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600; padding: 9px 18px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all .14s; display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid transparent; line-height: 1.2; text-transform: none; letter-spacing: normal;
}
.btn-primary {
  background: var(--brand); color: #fff; box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-dark); box-shadow: var(--shadow-md); }
.btn-primary:active { background: var(--brand-darker); box-shadow: var(--shadow-sm); }
.btn {
  background: #fff; color: var(--text-main); border-color: var(--border-strong);
}
.btn:hover { background: var(--brand-lighter); border-color: var(--brand); color: var(--brand-darker); text-decoration: none; }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: #F0C9C8; }
.btn-danger:hover { background: #F8D6D5; }

.alert-error { background: var(--red-bg); color: var(--red); padding: 11px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; border: 1px solid #F0C9C8; font-weight: 500; }
.alert-success { background: var(--brand-light); color: var(--brand-darker); padding: 11px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; border: 1px solid #BFE3CC; font-weight: 500; }
.alert-info { background: #EAF3FB; color: #1B4F72; padding: 11px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; border: 1px solid #C5DEF2; font-weight: 500; }

/* ---- Panel CÔNG NỢ (chi tiết đơn): gom thành các mục rõ ràng, ngăn nắp ---- */
.cn-tiles { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.cn-tile { flex: 1; min-width: 120px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 10px; padding: 9px 13px; }
.cn-tile .cn-lbl { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.cn-tile .cn-val { font-size: 17px; font-weight: 700; margin-top: 2px; }
.cn-subline { font-size: 12.5px; color: var(--text-muted); margin: 0 0 4px; }
.cn-sec { margin-top: 20px; }
.cn-sec-h { font-size: 12.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; margin: 0 0 9px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.cn-pay-table { width: 100%; font-size: 13.5px; border-collapse: collapse; }
.cn-pay-table th { text-align: left; padding: 6px 8px; color: var(--text-muted); font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--border); }
.cn-pay-table td { padding: 8px; border-bottom: 1px solid var(--border); }
.cn-pay-table tr:last-child td { border-bottom: 0; }
.cn-box { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--bg-sunken); }
.cn-box-warn { border-color: #FFE0A3; background: #FFFBF0; }   /* riêng khung DUYỆT miễn — vàng để nổi bật */
.cn-box-dashed { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; }
/* Hàng form gọn: mỗi ô là 1 cột nhãn-trên-input, nhãn 1 dòng nên input CANH ĐỀU đáy, nút khỏi lệch */
.cn-form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.cn-field { display: flex; flex-direction: column; gap: 3px; }
.cn-field > label { font-size: 11.5px; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.cn-field > input { width: 100%; }
.cn-field-money { width: 150px; }
.cn-field-date  { width: 200px; }   /* đủ rộng cho "CN, 19/7/2026" trên MỘT dòng, không xuống dòng */
.cn-field-date > input { min-width: 0; }
.cn-field-grow  { flex: 1; min-width: 150px; }
.cn-form-row > .btn, .cn-form-row > .btn-primary { white-space: nowrap; }
@keyframes cnFlash { 0% { box-shadow: 0 0 0 0 rgba(240,160,0,.55); } 100% { box-shadow: 0 0 0 10px rgba(240,160,0,0); } }
.cn-flash { animation: cnFlash 1.1s ease-out 2; }

/* ---- Popup XÁC NHẬN MẬT KHẨU cho thao tác nguy hiểm (dùng chung, dựng bằng JS ở head.php) ---- */
.pwm-overlay { position: fixed; inset: 0; background: rgba(15,23,32,.55); z-index: 9998; display: none; align-items: center; justify-content: center; padding: 16px; }
.pwm-overlay.is-open { display: flex; }
.pwm-box { background: #fff; border-radius: 14px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.28); overflow: hidden; }
.pwm-head { display: flex; align-items: center; gap: 8px; padding: 15px 18px 0; font-size: 16px; font-weight: 700; color: var(--red); }
.pwm-body { padding: 10px 18px 4px; font-size: 14px; color: var(--text-main); line-height: 1.5; }
.pwm-body .pwm-msg { margin-bottom: 12px; white-space: pre-line; }
.pwm-body label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.pwm-body input[type=password] { width: 100%; }
.pwm-err { color: var(--red); font-size: 12.5px; margin-top: 6px; min-height: 16px; }
.pwm-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }

/* =====================================================================
   ĐĂNG NHẬP
   ===================================================================== */
.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background:
    radial-gradient(circle at 15% 15%, rgba(21,128,61,0.10), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(52,211,153,0.12), transparent 45%),
    var(--bg-page);
}
.login-box {
  background: var(--bg-card); padding: 2.4rem 2.2rem; border-radius: var(--radius-lg);
  border: 1px solid var(--border); width: 380px; box-shadow: var(--shadow-lg);
}
.login-box h1 { font-size: 25px; margin: 0 0 6px; color: var(--brand-darker); font-weight: 800; }
.login-box form { display: flex; flex-direction: column; gap: 2px; }
.login-box .btn-primary { width: 100%; justify-content: center; height: 44px; margin-top: 16px; font-size: 15px; }
.password-field-wrap { position: relative; }
.password-field-wrap input { padding-right: 60px; }
.password-toggle-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--brand-dark); font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; padding: 6px 8px;
}
.password-toggle-btn:hover { text-decoration: underline; }

/* =====================================================================
   BỐ CỤC: SIDEBAR + TOPBAR
   ===================================================================== */
/* MENU TRÁI ẨN/HIỆN Ở MỌI KÍCH THƯỚC (kiểu điện thoại, chốt 25/07/2026):
   Mặc định ẩn (trượt off-canvas) → nội dung dùng TRỌN bề ngang. Bấm ☰ trượt ra đè lên + làm mờ nền.
   Trước đây chỉ ẩn ở ≤900px; nay mở cho cả desktop để nội dung không bị menu chiếm 232px. */
body.has-sidebar { padding-left: 0; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 264px;
  background: linear-gradient(185deg, #16241D, #0F1C15);
  display: flex; flex-direction: column; padding: 18px 12px; z-index: 20;
  transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.45);
}
body.nav-open .sidebar { transform: translateX(0); }
body.nav-open .nav-overlay { display: block; }

/* GHIM menu — CHỈ CÒN CHO TRANG ADMIN (admin_layout.php). Menu chính đã chuyển sang RAIL luôn hiện
   (html.nav-rail) nên không dùng ghim; main không bao giờ được gắn nav-pinned (head.php không áp) → các
   rule html.nav-pinned bên dưới chỉ tác động admin. */
.nav-pin { margin-left: auto; flex-shrink: 0; width: 30px; height: 30px; display: inline-flex; align-items: center;
  justify-content: center; background: transparent; border: none; border-radius: 8px; color: #8FB39D;
  font-size: 15px; cursor: pointer; opacity: .72; transition: all .12s; }
.nav-pin:hover { background: rgba(255,255,255,.09); opacity: 1; }
html.nav-pinned .nav-pin { color: var(--accent-mint); opacity: 1; background: rgba(255,255,255,.12); }
@media (min-width: 901px) {
  html.nav-pinned .sidebar { transform: translateX(0); box-shadow: none; }
  html.nav-pinned body.has-sidebar { padding-left: 264px; }
  html.nav-pinned .nav-overlay { display: none !important; }
  html.nav-pinned .nav-hamburger { display: none; }
}
@media (max-width: 900px) { .nav-pin { display: none; } }
.sidebar-logo {
  color: #fff; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 16.5px;
  padding: 4px 10px 22px; display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.sidebar-logo span { font-weight: 400; opacity: .55; margin-left: 4px; }
/* Nhãn nhóm menu trong sidebar (VD "Kinh doanh" / "Khác") — dùng khi gom nhóm ở layout.php */
.side-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #5E7468; font-weight: 700; padding: 14px 12px 6px; }
.site-logo-img { max-height: 34px; max-width: 180px; object-fit: contain; }

.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
/* Thanh cuộn mảnh cho menu dài (sidebar tối) */
.sidebar nav::-webkit-scrollbar { width: 7px; }
.sidebar nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 4px; }
.sidebar nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  color: #B9D9C4; font-weight: 600; font-size: 13.5px; text-decoration: none;
  border-radius: var(--radius-sm); transition: all .12s;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar nav a.active { background: var(--accent-mint); color: var(--brand-darker); box-shadow: var(--shadow-sm); }
.nav-icon { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
/* Badge số việc cần làm trên item menu (Công việc/KPI/Đề xuất) — gom về 1 class thay 3 chỗ inline. */
.nav-badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px;
  margin-left: auto; border-radius: 9px; background: #E5484D; color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.sidebar nav a.active .nav-badge { background: var(--red); }

/* ===================================================================
   RAIL kiểu Getfly: desktop = thanh icon dọc LUÔN hiện + flyout bay ra;
   mobile ≤900px = accordion trong ngăn kéo (CÙNG 1 DOM). Đã bỏ nút ghim 📌.
   =================================================================== */
.rail-item { position: relative; }
.rail-btn { display: flex; align-items: center; gap: 11px; width: 100%; box-sizing: border-box;
  padding: 10px 12px; border: none; background: transparent; cursor: pointer; text-align: left; font-family: inherit;
  color: #B9D9C4; font-weight: 600; font-size: 13.5px; border-radius: var(--radius-sm); text-decoration: none; transition: all .12s; }
.rail-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.rail-item.is-active > .rail-btn, .rail-btn.active { background: var(--accent-mint); color: var(--brand-darker); box-shadow: var(--shadow-sm); }
.rail-txt { flex: 1 1 auto; min-width: 0; }
.rail-badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; padding: 0 5px; border-radius: 9px;
  background: #E5484D; color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.rail-sep { padding: 12px 12px 5px; }
.rail-sep span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: #5E7468; font-weight: 800; }
.flyout-head { display: none; }
.rail-search-input { width: 100%; box-sizing: border-box; margin: 2px 0 8px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #EAF3EE; font-size: 13px; }
.rail-search-input::placeholder { color: #6E8579; }
.rail-search-results:empty { display: none; }
.rail-search-results a mark { background: #E0B84C; color: #2a2100; border-radius: 2px; }

/* ---------- DESKTOP ≥901px: rail + flyout ----------
   ⚠️ CHỈ áp cho MENU CHÍNH: layout.php gắn class `html.nav-rail`. Trang ADMIN dùng admin_layout.php
   KHÔNG có nav-rail → giữ sidebar 264px off-canvas + nút ghim như cũ (đừng bỏ tiền tố html.nav-rail!). */
@media (min-width: 901px) {
  html.nav-rail body.has-sidebar { padding-left: var(--rail-w, 74px); }
  html.nav-rail .sidebar { transform: none; width: var(--rail-w, 74px); padding: 12px 7px; box-shadow: 2px 0 18px rgba(0,0,0,.28); }
  html.nav-rail .sidebar-logo { justify-content: center; padding: 2px 0 12px; font-size: 0; gap: 0; }
  html.nav-rail .sidebar-logo .site-logo-img { max-width: 54px; }
  html.nav-rail .nav-hamburger { display: none; }   /* rail luôn hiện → ẩn ☰ (chỉ menu chính) */
  html.nav-rail .nav-overlay { display: none !important; }
  html.nav-rail .sidebar nav { overflow: visible; gap: 4px; }
  html.nav-rail .sidebar.rail-scroll nav { overflow-y: auto; overflow-x: visible; }
  .rail-btn { flex-direction: column; align-items: center; gap: 5px; padding: 11px 4px; text-align: center; }
  .rail-btn .nav-icon { font-size: 27px; width: auto; line-height: 1; }
  .rail-txt { font-size: 10.5px; line-height: 1.15; max-height: 2.4em; overflow: hidden; word-break: break-word; }
  .rail-btn .gcaret { display: none; }
  .rail-badge { position: absolute; top: 3px; right: 9px; min-width: 15px; height: 15px; line-height: 15px; padding: 0 4px; font-size: 9.5px; }
  .rail-sep { padding: 9px 2px 3px; text-align: center; }
  .rail-sep span { font-size: 8px; letter-spacing: .05em; }
  .rail-item.is-cat > .flyout {
    position: absolute; left: 100%; top: -2px; width: var(--flyout-w, 236px);
    background: #1A2C23; border: 1px solid rgba(255,255,255,.08); border-radius: 12px;
    box-shadow: 0 14px 44px rgba(0,0,0,.5); padding: 8px; margin-left: 4px;
    display: flex; flex-direction: column; gap: 2px; z-index: 30;
    opacity: 0; visibility: hidden; transform: translateX(-6px); transition: opacity .13s, transform .13s; }
  .rail-item.is-cat.is-open > .flyout { opacity: 1; visibility: visible; transform: none; }
  .rail-item.is-cat.fly-fixed > .flyout { position: fixed; left: auto; top: auto; margin-left: 0; }
  .flyout-head { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6E8579; font-weight: 800; padding: 4px 8px 6px; }
  .flyout a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #C7E3D1; font-size: 13.5px; }
  .flyout a .nav-icon { font-size: 16px; width: 18px; }
  .flyout a:hover { background: rgba(255,255,255,.08); color: #fff; }
  .flyout a.active { background: var(--accent-mint); color: var(--brand-darker); box-shadow: var(--shadow-sm); }
  .flyout .nav-badge { margin-left: auto; }
  .flyout .nav-fav-star { margin-left: auto; }
  .flyout .nav-badge + .nav-fav-star { margin-left: 6px; }
  .rail-search .flyout { width: 280px; }
}
@media (min-width: 901px) and (hover: hover) {
  .rail-item.is-cat:hover > .flyout { opacity: 1; visibility: visible; transform: none; }
}

/* ---------- MOBILE ≤900px: cùng DOM → accordion trong ngăn kéo ---------- */
@media (max-width: 900px) {
  .rail-item { display: block; }
  .rail-btn { flex-direction: row; justify-content: flex-start; gap: 11px; padding: 12px 14px; font-size: 15px; }
  .rail-btn .nav-icon { font-size: 16px; width: 18px; }
  .rail-txt { flex: 1 1 auto; font-size: 15px; }
  .rail-badge { margin-left: auto; }
  .rail-btn .gcaret { display: inline-block; font-size: 9px; color: #7C8B9C; width: 12px; text-align: center; transition: transform .15s; transform: rotate(90deg); }
  .rail-btn .gcaret.gcol { transform: none; }
  .rail-item.is-cat > .flyout { margin-left: 11px; border-left: 1px solid rgba(255,255,255,.09); padding-left: 3px; }
  .rail-item.is-cat > .flyout.gcol { display: none; }
  .flyout a { padding-left: 22px; }
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-card); padding: 12px 28px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 18;   /* dính trên cùng để nút ☰ luôn với tới khi cuộn */
}
.topbar select { height: 36px; font-size: 13px; }
.topbar .user-info { display: flex; align-items: center; gap: 18px; font-size: 14px; }
.topbar .user-info a { color: var(--gray-text); font-weight: 600; position: relative; }
.topbar .user-info a:hover { color: var(--brand-dark); text-decoration: none; }
.user-name { font-weight: 700; color: var(--text-main); }
.notif-badge {
  position: absolute; top: -8px; right: -10px; background: var(--red); color: #fff;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; border: 1.5px solid #fff;
}

.admin-topbar { background: linear-gradient(135deg, var(--brand-darker), var(--brand-dark)); padding: 14px 28px; }
.admin-topbar .brand { color: #fff; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 17px; }
.admin-topbar .user-info { color: #BFE3CC; }
.admin-topbar .user-info a { color: #fff; }
.admin-topbar .user-info a:hover { color: #BFE3CC; }

.container { max-width: 1400px; margin: var(--sp-5) auto; padding: 0 var(--sp-8); }  /* khổ ĐỒNG BỘ mọi trang + lề 2 bên 32px */

/* =====================================================================
   THẺ (CARD) / BẢNG / HUY HIỆU
   ===================================================================== */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5); margin-bottom: var(--sp-3); box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-3); padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border);
}
.card-header h3, .card-header h4 { margin: 0; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  padding: 4px 11px 4px 9px; border-radius: 99px; letter-spacing: .01em;
  /* Cột hẹp làm "Trong kho" gãy làm hai dòng, viên thuốc phình méo. Huy hiệu luôn nằm một dòng. */
  white-space: nowrap;
}
/* flex-shrink:0 — không có nó, chấm tròn bị bóp thành hình bầu dục khi ô chật. */
.badge::before { content: ''; width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-gray { background: var(--gray-bg); color: var(--gray-text); }
.badge-green { background: var(--brand-light); color: var(--brand-darker); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }

table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: var(--sp-3) var(--sp-3); border-bottom: 1px solid var(--border); font-size: var(--fs-sm); vertical-align: middle; font-variant-numeric: tabular-nums; }
table th { color: var(--text-faint); font-weight: 700; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .05em; background: var(--bg-sunken); white-space: nowrap; }
table th:first-child { border-top-left-radius: var(--radius); }
table th:last-child { border-top-right-radius: var(--radius); }
table tr:last-child td { border-bottom: none; }
table tr:hover td { background: var(--brand-lighter); }
/* (Đã BỎ tiêu đề bảng dính — 25/07: gây header nổi lơ lửng đè dòng đầu trên trang báo cáo nhiều bảng.
   Nếu muốn dính lại cho 1 bảng cụ thể, làm OPT-IN bằng class riêng + kiểm từng trang, không áp global.) */
/* Tô màu hover CẢ NHÓM dòng thuộc cùng 1 đơn (JS thêm/xóa class này) — dùng riêng cho bảng đơn hàng
   có rowspan nhiều sản phẩm, không thay thế tr:hover thông thường ở các bảng khác. */
.order-row-hover td { background: var(--brand-lighter) !important; }
table td a { font-weight: 600; }
/* Cột số (giá tiền, số lượng...) — thêm class "num" vào <th>/<td> để canh phải + chữ số đều nhau, dễ so sánh theo hàng dọc */
/* Cột SỐ: DỮ LIỆU căn phải (để hàng đơn vị / hàng nghìn gióng thẳng nhau — liếc một cái là so được
   số nào lớn hơn), còn TIÊU ĐỀ căn GIỮA cột.
   Trước đây gộp `table th.num, table td.num` cùng căn phải; tách ra làm hai. */
table td.num { text-align: right;  font-variant-numeric: tabular-nums; }
table th.num { text-align: center; font-variant-numeric: tabular-nums; }
/* Vằn xen kẽ nhẹ cho bảng dài nhiều dòng — thêm class "table-zebra" khi cần dễ dò theo hàng */
.table-zebra tr:nth-child(even) td { background: var(--bg-sunken); }
.table-zebra tr:hover td { background: var(--brand-lighter); }

.flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.w-100 { width: 100% !important; }
.col-span-3 { grid-column: span 3; }
/* .grid-3 xuống 2 cột ở tablet rồi 1 cột ở điện thoại — 3 cột trên màn hẹp thì ô nào cũng bé tí */
@media (max-width: 980px) { .grid-3 { grid-template-columns: 1fr 1fr; } .col-span-3 { grid-column: span 2; } }
@media (max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .col-span-2, .col-span-3 { grid-column: span 1; } }

/* KHỐI "THÊM KHÁCH HÀNG MỚI" ngay trong form lên đơn — khoanh vùng để không lẫn với các trường của đơn */
.ncust-box {
  border: 1px dashed var(--brand); border-radius: 10px; padding: 12px 14px;
  background: var(--bg-sunken);                                 /* đường lùi cho trình duyệt cũ */
  background: color-mix(in srgb, var(--brand) 5%, transparent); /* nền xanh rất nhạt cho dễ nhận khối */
}
.ncust-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ncust-title { font-weight: 700; color: var(--brand); }

/* Form nhập liệu: nhãn sát ô của nó, các ô không giãn cách thừa (form lên đơn trước đây thưa,
   phải cuộn nhiều màn mới tới nút Lưu). */
#orderForm label { margin-bottom: 4px; }
#orderForm .grid-2, #orderForm .grid-3 { gap: 12px; }
#orderForm h4 { margin: 16px 0 6px; }
#orderForm .filter-caption { margin: 0 0 8px; }

.stats-line {
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-main); font-size: 14px; font-weight: 600;
  padding: 14px 18px; border-radius: var(--radius); margin-bottom: 14px; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 6px;
}
.stats-line::before { content: '📊'; font-size: 16px; }
.stats-line strong { color: var(--brand-dark); font-family: 'Sora', sans-serif; }

/* ---- Tab cụm dạng GẠCH CHÂN (v8) — gọn, hiện đại; thay cho ô chữ nhật viền đầy trước đây ---- */
.tab-bar { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.tab-bar a {
  padding: 9px 15px; color: var(--text-muted); font-weight: 600; font-size: 13.5px;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px; transition: color .12s, border-color .12s;
}
.tab-bar a:hover { color: var(--brand-darker); text-decoration: none; }
.tab-bar a.active { color: var(--brand-darker); border-bottom-color: var(--brand); background: none; }
/* Badge số đỏ trên tab (VD "Duyệt việc 5") — 1 class chung, thay badge inline-style/.kpi-badge rải rác. */
.tab-badge { display: inline-block; min-width: 17px; padding: 0 5px; border-radius: 9px; background: #C4433F; color: #fff; font-size: 11px; font-weight: 800; text-align: center; vertical-align: 1px; margin-left: 4px; }

/* ---- Thanh bộ lọc ---- */
/* Thanh lọc MỎNG (21/07): ít thao tác nên bớt đệm + ô/nút thấp lại, đỡ tốn diện tích — cả hệ dùng chung. */
.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 7px 9px; margin-bottom: 10px; box-shadow: var(--shadow-sm);
}
.filter-bar input[type="text"] { max-width: 220px; }
.filter-bar select { width: auto; max-width: 180px; }
/* Ô nhập / dropdown / nút trong thanh lọc: thấp + chữ nhỏ hơn để thanh lọc mảnh lại. */
.filter-bar input, .filter-bar select, .filter-bar button,
.filter-bar .btn, .filter-bar .btn-primary, .filter-bar .btn-sm {
  padding: 5px 9px; font-size: 13px; line-height: 1.35;
}

/* ---- Avatar / Logo / Slider ---- */
.avatar-circle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent-mint));
  color: #fff; font-weight: 700; font-size: 13.5px; text-transform: uppercase; flex-shrink: 0;
  font-family: 'Sora', sans-serif;
}
.user-avatar-img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; vertical-align: middle; border: 2px solid var(--brand-light); }

.slider-wrap { display: flex; gap: 12px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 4px; }
.slider-wrap img { height: 170px; border-radius: var(--radius-lg); object-fit: cover; flex-shrink: 0; box-shadow: var(--shadow-md); }

/* ---- Màu sắc gắn cho công việc ---- */
.task-color-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex-shrink: 0; box-shadow: 0 0 0 2px #fff, 0 0 0 3px rgba(0,0,0,0.06); }
.task-color-strip { border-left-width: 4px; border-left-style: solid; }

/* ---- Thẻ công việc GỌN (tasks.php) — chỉ hiện Tên + Hạn + Trạng thái là chính, không chiếm nhiều
   diện tích như bản cũ (từng có padding lớn kiểu .card + nhiều dòng riêng biệt). ---- */
.task-card-compact {
  display: block; background: var(--surface-1, #fff); border: 0.5px solid var(--border);
  border-left-width: 4px; border-left-style: solid; border-radius: 8px;
  padding: 8px 12px; margin-bottom: 6px; text-decoration: none; color: inherit;
  transition: box-shadow .12s, border-color .12s;
}
.task-card-compact:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08); text-decoration: none; color: inherit; }
.task-card-compact-title { font-weight: 600; font-size: var(--fs-sm); line-height: 1.35; margin-bottom: 3px; }
.task-card-compact-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: var(--fs-xs); color: var(--text-muted); }
.task-card-compact-meta .badge { margin-left: auto; }
/* Việc quá hạn — tô nền đỏ nhạt để nổi bật ngay khi lướt mắt, không cần đọc badge mới biết */
.task-card-compact-overdue { background: #FDECEC; border-color: #F5C6C6; }

.badge-sm { padding: 1px 8px; font-size: 10.5px; }

/* ---- Khối "Tổng hợp việc gấp" — gom quá hạn + sắp tới hạn từ cả 3 cột, đặt lên đầu để không phải
   lướt hết cả 3 cột mới biết hôm nay cần chú ý gì. ---- */
.task-urgent-banner { background: #FFF6F6; border: 1px solid #F5C6C6; border-radius: 10px; padding: 14px 16px; margin-bottom: 18px; }
.task-urgent-banner-head { margin-bottom: 10px; }
.task-urgent-banner-list .task-card-compact { background: #fff; }

/* ---- Ảnh đóng gói đơn hàng (trang Tạo đơn hàng) ---- */
.pkg-photo-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.pkg-photo-link { font-size: var(--fs-xs); color: var(--brand-dark); }
.pkg-attach-label { cursor: pointer; display: inline-flex; align-items: center; }
.pkg-batch-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pkg-batch-item { position: relative; width: 90px; height: 90px; }
.pkg-batch-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.pkg-batch-remove { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--red); color: #fff; border: 2px solid #fff; cursor: pointer; line-height: 1; }
.color-swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.color-swatch {
  -webkit-appearance: none; appearance: none; box-sizing: border-box;
  width: 22px; height: 22px; min-width: 22px; min-height: 22px;
  border-radius: 6px; cursor: pointer; border: 2px solid transparent;
  display: inline-block; padding: 0; margin: 0; outline: none; transition: transform .1s;
}
.color-swatch:hover { transform: scale(1.12); }
.color-swatch.selected { border-color: var(--text-main); box-shadow: 0 0 0 2px #fff inset; }

/* ---- Biểu đồ đơn giản (thanh ngang + cột xu hướng theo tháng) ---- */
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bar-label { width: 150px; flex-shrink: 0; font-size: 13.5px; font-weight: 500; }
.bar-track { flex: 1; background: var(--gray-bg); height: 10px; border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; background: var(--brand); transition: width .3s; }
.bar-value { width: 90px; flex-shrink: 0; text-align: right; font-size: 13px; font-weight: 600; color: var(--text-main); }

.trend-chart { display: flex; align-items: flex-end; gap: 10px; height: 160px; padding: 10px 4px 0; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.trend-bar { width: 100%; max-width: 36px; background: linear-gradient(180deg, var(--accent-mint), var(--brand)); border-radius: 6px 6px 0 0; min-height: 3px; }
.trend-num { font-size: 11px; font-weight: 700; color: var(--brand-dark); margin-bottom: 4px; }
.trend-label { font-size: 10.5px; color: var(--text-muted); margin-top: 6px; white-space: nowrap; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.kpi-box .kpi-num { font-family: 'Sora', sans-serif; font-size: 26px; font-weight: 700; color: var(--brand-dark); line-height: 1.1; }
.kpi-box .kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ============ DI ĐỘNG (Đợt 1): menu ngăn kéo + thanh đáy + chạm dễ ============ */
.nav-hamburger { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; margin-right: 6px;
  border: none; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-main); border-radius: 8px; }
.nav-hamburger:hover { background: var(--bg-sunken); }
.nav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 19; }
.bottom-nav { display: none; }
.quick-fab { display: none; }   /* FAB hành động nhanh: chỉ hiện trên điện thoại (desktop đã có rail) */

@media (max-width: 900px) {
  /* Menu trái thành NGĂN KÉO trượt ra — giữ đủ icon + chữ + nhóm như PC.
     padding-bottom = chiều cao thanh đáy + vùng an toàn iPhone (home indicator) để nội dung không bị che. */
  body.has-sidebar { padding-left: 0; padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; width: 264px; box-shadow: 0 0 40px rgba(0,0,0,.45); }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-overlay { display: block; }
  .sidebar-logo { display: flex; }
  .nav-label { display: inline; }
  .nav-hamburger { display: inline-flex; }
  /* Topbar dính trên cùng để luôn với tới nút menu */
  .topbar { position: sticky; top: 0; z-index: 18; padding: 10px 14px; }
  .topbar .user-name { display: none; }
  .container { padding: 0 14px; }
  /* Chạm dễ: ô nhập 16px (chặn iPhone tự phóng to), menu/nút cao hơn */
  input, select, textarea { font-size: 16px; }
  .sidebar nav a { padding: 12px 14px; font-size: 15px; }
  .btn, .btn-primary, .btn-danger { padding-top: 10px; padding-bottom: 10px; }
  /* Thanh điều hướng dưới đáy (kiểu app) — tôn trọng vùng an toàn iPhone. */
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 18;
    background: var(--bg-card); border-top: 1px solid var(--border); box-shadow: 0 -2px 12px rgba(0,0,0,.06);
    padding-bottom: env(safe-area-inset-bottom, 0px); }
  .bottom-nav a, .bottom-nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 2px 8px; font-size: 10.5px; font-weight: 600; color: var(--text-muted);
    background: none; border: none; cursor: pointer; text-decoration: none; min-height: 48px; justify-content: center; }
  .bottom-nav .bn-ic { font-size: 19px; line-height: 1; }
  .bottom-nav a.active { color: var(--brand-dark); }

  /* ---- FAB hành động nhanh (chỉ điện thoại): nổi TRÊN thanh nav đáy, chạm bung 2 nút ---- */
  .quick-fab { display: block; position: fixed; right: 16px; z-index: 20;
    bottom: calc(62px + 14px + env(safe-area-inset-bottom, 0px)); }
  body.nav-open .quick-fab { display: none; }   /* mở ngăn kéo menu → ẩn FAB (khỏi đè overlay) */
  .quick-fab .qfab-btn { width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--brand, #1B7F4B); color: #fff; font-size: 30px; line-height: 1; font-weight: 400;
    display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0,0,0,.28);
    transition: transform .18s ease; }
  .quick-fab .qfab-plus { display: block; transition: transform .18s ease; }
  .quick-fab.open .qfab-plus { transform: rotate(45deg); }   /* ＋ → × khi mở */
  .quick-fab .qfab-menu { position: absolute; right: 2px; bottom: 66px; display: flex; flex-direction: column;
    gap: 10px; align-items: flex-end; opacity: 0; transform: translateY(8px); pointer-events: none;
    transition: opacity .16s ease, transform .16s ease; }
  .quick-fab.open .qfab-menu { opacity: 1; transform: none; pointer-events: auto; }
  .quick-fab .qfab-item { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
    background: var(--bg-card); color: var(--text-main); text-decoration: none; font-weight: 700;
    padding: 11px 15px; border-radius: 999px; font-size: 14.5px; border: 1px solid var(--border);
    box-shadow: 0 3px 10px rgba(0,0,0,.16); min-height: 44px; }
  .quick-fab .qfab-ic { font-size: 18px; line-height: 1; }

  /* VÙNG CHẠM ≥40px cho nút icon nhỏ (Apple/WCAG ~44px) — tránh bấm nhầm khi thao tác tại kho/hiện trường.
     Trên desktop giữ gọn 26–28px; chỉ nới trên cảm ứng. */
  .act-menu .col-picker-trigger { width: 40px; height: 40px; }
  .qv-toggle { width: 38px; height: 38px; font-size: 16px; }
  .btn-sm { min-height: 38px; padding: 6px 12px !important; }
  .status-picker-trigger, .status-dot, .status-dot-empty { min-height: 30px; }
  .topbar { padding-top: max(10px, env(safe-area-inset-top, 0px)); }   /* né tai thỏ khi xoay ngang */
}
/* Phản hồi CHẠM tức thì (thiết bị cảm ứng, không có hover): nút/hàng bảng nhấn xuống là thấy phản hồi. */
@media (hover: none) {
  .btn:active, .btn-primary:active, .btn-danger:active { filter: brightness(.96); }
  table tr:active td { background: var(--brand-lighter); }
}

/* ============ DI ĐỘNG: BẢNG VUỐT NGANG (một kiểu DUY NHẤT, đồng bộ toàn hệ thống) ============
   Dưới 700px MỌI bảng trong .container giữ nguyên dạng bảng và CUỘN NGANG để xem thêm cột.
   KHÔNG ghim cột đầu — đã thử và bỏ: cột định danh (tên/mã) dài chiếm gần nửa màn hình khi ghim.
   Đây là "kiểu 1" đơn giản, quen mắt, giống trang Đơn hàng đang dùng. */
@media (max-width: 700px) {
  /* Bỏ hộp cuộn dọc giới hạn chiều cao (scroll-table-wrap): để CẢ TRANG cuộn dọc tự nhiên,
     bảng chỉ cuộn NGANG — tránh cuộn-trong-cuộn. */
  .scroll-table-wrap { max-height: none; overflow: visible; }

  .container table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Ô KHÔNG xuống dòng → bảng đủ rộng để VUỐT (nếu không, cột co vừa màn hình, mất ý nghĩa vuốt).
     Cột text dài đã có .truncate-cell (240px) / .wrap-cell (380px) bọc riêng nên không dài vô tận. */
  .container table td { white-space: nowrap; }

  /* NGOẠI LỆ: ô CHỦ ĐỘNG cho xuống dòng (thông số kỹ thuật, ghi chú, địa chỉ…) thì nowrap ở trên
     KHÔNG được đè — nếu đè, nội dung nhiều dòng bị duỗi thành một dòng dài tràn màn hình.
     Bắt cả khi class đặt thẳng trên <td> lẫn khi bọc trong khối con. */
  .container table td.pre-line,  .container table td .pre-line  { white-space: pre-line; }
  .container table td.wrap-cell, .container table td .wrap-cell { white-space: normal; }

  /* Trên điện thoại 380px/240px vẫn quá rộng → co theo bề ngang màn hình. */
  .wrap-cell     { max-width: 70vw; }
  .truncate-cell { max-width: 55vw; }
}

/* ---- Bộ lọc thời gian dùng chung (week/month/quarter/year/custom) ---- */
.date-filter-bar .range-extra { display: inline-flex; align-items: center; gap: 6px; }
.date-filter-bar input[type="date"],
.date-filter-bar input[type="month"] { width: auto; }
.date-filter-bar input[type="number"] { width: 90px; }

/* ---- Bảng cuộn — giới hạn chiều cao ~10 dòng, lăn chuột xem thêm, header dính ---- */
.scroll-table-wrap { max-height: 460px; overflow-y: auto; border-radius: var(--radius); }
.scroll-table-wrap-sm { max-height: 240px; }
.scroll-table-wrap table th { position: sticky; top: 0; z-index: 1; }

/* ---- Phân biệt Cấp 1 (nhóm) / Cấp 2 (danh mục con) trong trang Danh mục ---- */
.catalog-level-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); margin: 14px 0 6px; }
.tab-bar-l2 { gap: 6px; }
.tab-bar-l2 a {
  padding: 6px 14px; font-size: 12.5px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--blue); background: #fff; color: var(--blue); font-weight: 600;
}
.tab-bar-l2 a:hover { background: var(--blue-bg); text-decoration: none; }
.tab-bar-l2 a.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---- Ô tìm-kiếm-thêm dạng thẻ (Người liên quan trong Giao việc) ---- */
.tag-select { position: relative; }
.tag-select input[type="text"] { width: 100%; }
.tag-chip-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.tag-chip-list:empty { margin-bottom: 0; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-lighter); color: var(--brand-darker);
  border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 13px; font-weight: 600;
}
.tag-chip-remove { cursor: pointer; font-weight: 700; padding: 0 4px; border-radius: 50%; }
.tag-chip-remove:hover { background: rgba(0,0,0,0.08); }
.tag-suggestions {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px;
  background: #fff; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  max-height: 200px; overflow-y: auto; z-index: 10; box-shadow: var(--shadow-md);
}
.tag-suggestion-item { padding: 8px 12px; cursor: pointer; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.tag-suggestion-item:last-child { border-bottom: none; }
.tag-suggestion-item:hover { background: var(--brand-lighter); }

/* ---- Dấu * cho trường bắt buộc ---- */
.required-mark { color: var(--red); font-weight: 700; }

/* ---- Ảnh trong bài đăng Lazico Nội Bộ — hiện trực tiếp, không phải file tải về ---- */
.feed-post-image { display: block; max-width: 100%; max-height: 480px; width: auto; height: auto; object-fit: contain; border-radius: var(--radius); margin: var(--sp-2) auto; border: 1px solid var(--border); }
.feed-toggle-comments { display: inline-block; font-size: var(--fs-sm); font-weight: 600; color: var(--brand-dark); }

/* ---- Trang chủ / Lazico Nội Bộ — feed dạng cột hẹp, căn giữa, dễ đọc ---- */
.feed-container { max-width: 640px; }
.feed-row { display: flex; gap: var(--sp-3); align-items: flex-start; }
/* Avatar bài đăng — to hơn (48px), ảnh thật nếu có, kích vào xem lớn */
/* Trang nội bộ: NỘI DUNG là chính. Avatar chỉ để nhận mặt người đăng — 48px là quá to, nó đẩy chữ
   và ảnh sang phải, ăn mất bề ngang vốn đã hẹp. Thu còn 38px (điện thoại 32px, xem @media bên dưới). */
.feed-avatar-lg { width: 38px; height: 38px; min-width: 38px; font-size: var(--fs-base); }
img.feed-avatar-lg { border-radius: 50%; object-fit: cover; border: 2px solid var(--brand-light); }
.feed-avatar-clickable { cursor: zoom-in; transition: transform .15s ease, box-shadow .15s ease; }
.feed-avatar-clickable:hover { transform: scale(1.06); box-shadow: 0 3px 12px rgba(0,0,0,.18); }

/* ---- Lưới ảnh bài đăng (1 / 2 / 3 ảnh) kiểu Facebook ---- */
.fpi-grid { display: grid; gap: 4px; margin: var(--sp-2) 0; border-radius: var(--radius); overflow: hidden; }
.fpi-grid img.fpi { width: 100%; height: 100%; display: block; cursor: zoom-in; background: var(--bg-sunken); }
.fpi-grid.n1 { grid-template-columns: 1fr; }
.fpi-grid.n1 img.fpi { max-height: 480px; object-fit: contain; }
.fpi-grid.n2 { grid-template-columns: 1fr 1fr; }
.fpi-grid.n2 img.fpi { aspect-ratio: 1/1; object-fit: cover; }
.fpi-grid.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; max-height: 420px; }
.fpi-grid.n3 img.fpi:first-child { grid-row: span 2; object-fit: cover; }
.fpi-grid.n3 img.fpi { object-fit: cover; }
@media (max-width: 560px) { .fpi-grid.n3 { max-height: 320px; } }

/* ---- Xem trước ảnh trong ô soạn bài ---- */
.feed-preview { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--sp-2); }
.feed-preview:empty { margin-bottom: 0; }
.feed-preview img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
/* Ảnh HEIC (camera Samsung/iPhone) trình duyệt không vẽ được → ô chữ thay cho ô trống khó hiểu. */
.feed-preview-na { width: 84px; height: 84px; border-radius: 8px; border: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 11.5px; font-weight: 600; color: var(--muted); background: #F4F7F3; }

/* ---- Khung xem ảnh lớn (lightbox) ---- */
.lb { display: none; position: fixed; inset: 0; z-index: 10000; background: rgba(8,14,10,.94);
  align-items: center; justify-content: center; }
.lb.is-open { display: flex; }
.lb .lb-img { max-width: 92vw; max-height: 88vh; object-fit: contain; border-radius: 6px; cursor: zoom-in;
  transition: transform .2s ease; }
.lb .lb-img.is-zoom { transform: scale(2); cursor: zoom-out; }
.lb button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: none; cursor: pointer;
  border-radius: 50%; display: grid; place-items: center; transition: background .15s ease; }
.lb button:hover { background: rgba(255,255,255,.26); }
.lb .lb-close { top: 16px; right: 16px; width: 44px; height: 44px; font-size: 20px; }
.lb .lb-prev, .lb .lb-next { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; font-size: 32px; line-height: 1; }
.lb .lb-prev { left: 14px; } .lb .lb-next { right: 14px; }
.lb .lb-counter { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); color: #fff;
  font-size: 13px; font-weight: 700; background: rgba(0,0,0,.45); padding: 4px 12px; border-radius: 99px; }
@media (max-width: 560px) {
  .lb .lb-prev, .lb .lb-next { width: 42px; height: 42px; font-size: 26px; }
  .lb .lb-img { max-width: 96vw; }
}
@media (prefers-reduced-motion: reduce) { .lb .lb-img, .feed-avatar-clickable { transition: none; } }
/* flex:1 + min-width:0 — trước đây thiếu 2 dòng này nên khung composer tự co về kích thước mặc định
   của trình duyệt (~300px) thay vì lấp đầy phần còn lại của hàng, để trống 1 dải lớn bên phải trong
   thẻ và làm 2 nút "Thêm ảnh"/"Đăng bài" (vốn canh space-between) bị dồn cụm sát nhau. Áp đúng cách
   .feed-post-body bên dưới đã làm (khung hiển thị bài đăng không bị lỗi này). */
.feed-composer { flex: 1; min-width: 0; }
.feed-composer form { flex: 1; }
.feed-composer textarea { margin-bottom: var(--sp-2); }
.feed-composer-actions { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.feed-composer-actions label.btn { cursor: pointer; margin: 0; }
.feed-composer-actions input[type="file"] { display: none; }

/* ============ TRANG NỘI BỘ TRÊN ĐIỆN THOẠI — nhường tối đa diện tích cho NỘI DUNG ============
   Đây là nơi gần như chỉ thao tác bằng điện thoại, mà bề ngang lại quý nhất. Cắt mọi thứ không
   mang thông tin. */
@media (max-width: 700px) {
  /* Thẻ bài đăng: bớt lề trong → chữ và ảnh rộng thêm ~20px mỗi bên. */
  .home-feed > .card { padding: 12px 14px; }

  /* Avatar nhỏ nữa. Vẫn đủ nhận ra mặt người, mà trả lại 6px + khoảng cách cho nội dung. */
  .feed-avatar-lg { width: 32px; height: 32px; min-width: 32px; font-size: 13px; }
  .feed-row { gap: 10px; }

  /* Ô SOẠN BÀI: bỏ hẳn avatar của chính mình — không mang thông tin gì (ai chẳng biết mình là ai),
     mà ăn mất ~45px bề ngang của ô gõ chữ. Bài của NGƯỜI KHÁC thì vẫn giữ avatar (cần biết ai đăng). */
  .feed-composer-row > .feed-avatar-lg { display: none; }

  /* Nút "Thêm ảnh": chỉ còn ICON. Chữ "Thêm ảnh (tối đa 3)" chiếm gần nửa hàng mà chẳng nói thêm gì —
     cái icon 🖼️ đã đủ hiểu. Chỗ trống dồn hết cho nút Đăng bài. */
  .feed-composer-actions label.btn .lbl { display: none; }
  .feed-composer-actions label.btn { padding: 8px 13px; font-size: 16px; line-height: 1; }
  .feed-composer-actions { gap: 8px; }

  /* Ảnh xem trước nhỏ lại — 3 tấm vẫn nằm gọn một hàng, không đẩy nút Đăng xuống dòng. */
  .feed-preview img, .feed-preview-na { width: 64px; height: 64px; }
}
.feed-post-body { flex: 1; min-width: 0; }
.feed-post-content { margin: var(--sp-2) 0; white-space: pre-wrap; }
.feed-delete-link { font-size: var(--fs-sm); color: var(--red); }
.feed-comments-section { margin-top: var(--sp-3); border-top: 1px solid var(--border); padding-top: var(--sp-2); }
.feed-comments-box { display: none; margin-top: var(--sp-2); }
.feed-comments-box.is-open { display: block; }
.feed-comment-form { margin-top: var(--sp-2); }
.feed-comment-form input[type="text"] { flex: 1; }
.feed-comment-form button { padding: var(--sp-2) var(--sp-3); }
.feed-comment-row { display: flex; align-items: flex-start; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.feed-comment-avatar { width: 30px; height: 30px; min-width: 30px; font-size: var(--fs-xs); }
img.feed-comment-avatar { border-radius: 50%; object-fit: cover; border: 1.5px solid var(--brand-light); }
.feed-comment-bubble { background: var(--gray-bg); border-radius: 12px; padding: var(--sp-2) var(--sp-3); flex: 1; }
.feed-comment-bubble strong { font-size: var(--fs-sm); }
.feed-comment-bubble div { font-size: var(--fs-sm); }

/* ---- Trang chủ — bố cục 2 CỘT: feed chính (trái) + cột phụ Thông báo/Việc của tôi (phải) ----
   Trước đây feed-container (640px) đứng 1 mình trong .container (max-width 1280px, margin:auto)
   → bị căn giữa giữa phần trống sau sidebar, để lại 2 dải trắng gần bằng nhau, rất to trên màn hình
   rộng (đo thực tế ~430px mỗi bên trên màn 1920px). Thêm cột phụ 300px bên phải để tận dụng đúng
   khoảng trống đó bằng nội dung thật sự hữu ích, thay vì chừa trắng vô nghĩa.
   Dưới 1040px (tablet/màn nhỏ) chuyển về xếp chồng dọc, cột phụ xuống dưới feed cho dễ dùng. */
/* KHÔNG đặt max-width ở đây: `.home-layout` DÙNG CHUNG div với `.container` → để kế thừa đúng khổ 1400
   (đặt max-width:none từng làm mất cap → trang chủ full-width, lệch lề so với trang khác). */
.home-layout { display: flex; align-items: flex-start; gap: var(--sp-6); flex-wrap: wrap; }
.home-feed { flex: 1 1 520px; min-width: 0; }
/* top = chiều cao topbar dính + khoảng đệm, để cột phụ không nằm KHUẤT dưới topbar khi cuộn. */
.home-sidebar { flex: 0 0 340px; width: 340px; display: flex; flex-direction: column; gap: var(--sp-4); position: sticky; top: 72px; }
/* Ngưỡng 1240px = 232px sidebar cố định + 40px padding .container + 964px nội dung 2 cột — dưới mức
   này KHÔNG đủ chỗ để 2 cột đứng cạnh nhau mà không bị chật, nên chuyển hẳn về xếp chồng dọc cho gọn
   (flex-wrap ở trên chỉ là lưới an toàn dự phòng, không thay cho việc tính đúng ngưỡng này). */
@media (max-width: 1240px) {
  .home-layout { flex-direction: column; max-width: 640px; }
  .home-feed { width: 100%; max-width: 100%; }
  .home-sidebar { width: 100%; flex: 1 1 auto; position: static; }
}
/* ĐIỆN THOẠI: đưa khối VIỆC CẦN LÀM / cảnh báo LÊN TRƯỚC feed (mở app là thấy ngay việc cần xử lý —
   đúng brief "mobile ưu tiên cảnh báo & việc cần làm"). Chỉ đổi thứ tự hiển thị, không đụng dữ liệu. */
@media (max-width: 900px) {
  .home-sidebar { order: -1; }
}

.home-widget-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--sp-2); }
.home-widget-header h3 { margin: 0; }
.home-widget-more { font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.home-widget-empty { color: var(--text-muted); font-size: var(--fs-sm); margin: 0; padding: var(--sp-2) 0; }

.home-notif-item { display: block; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.home-notif-item:last-child { border-bottom: none; }
.home-notif-item:hover { color: inherit; text-decoration: none; background: var(--brand-lighter); margin: 0 calc(-1 * var(--sp-2)); padding-left: var(--sp-2); padding-right: var(--sp-2); border-radius: var(--radius-sm); }
.home-notif-title { font-size: var(--fs-sm); font-weight: 500; display: flex; align-items: baseline; gap: 6px; }
.home-notif-item.is-unread { background: #BFE8CE; margin: 0 calc(-1 * var(--sp-2)); padding-left: var(--sp-2); padding-right: var(--sp-2); border-radius: var(--radius-sm); }
.home-notif-item.is-unread .home-notif-title { font-weight: 700; color: var(--ink); }
.home-notif-dot { width: 6px; height: 6px; min-width: 6px; border-radius: 50%; background: var(--brand); }
.home-notif-time { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 2px; }

.home-stat-row { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); color: inherit; text-decoration: none; }
.home-stat-row:last-child { border-bottom: none; }
.home-stat-row:hover { color: inherit; text-decoration: none; background: var(--brand-lighter); margin: 0 calc(-1 * var(--sp-2)); padding-left: var(--sp-2); padding-right: var(--sp-2); border-radius: var(--radius-sm); }
.home-stat-num { font-family: 'Sora', sans-serif; font-weight: 700; font-size: var(--fs-lg); color: var(--brand-darker); min-width: 24px; text-align: right; }
.home-stat-num.is-zero { color: var(--text-faint); }
.home-stat-num.is-overdue { color: var(--red); }

/* ---- Trang Thông báo — chia 3 cột, khung thông báo thu nhỏ hơn card thường ---- */
/* auto-fit: có card thứ 4 (KT/KD) → 4 cột; không có → tự về 3 cột; hẹp → tự xuống dòng. */
.notif-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; align-items: start; margin-top: 14px; }
@media (max-width: 900px) { .notif-columns { grid-template-columns: 1fr; } }
/* ⭐ Card "Việc quan trọng" — dùng chung notifications (panel) + trang chủ (home). Style tự chứa. */
.imp-body { padding: 2px 0; }
.imp-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.imp-row:last-child { border-bottom: 0; }
.imp-row:hover { background: var(--brand-lighter); }
.imp-row.imp-overdue { background: #FDECEA; }
.imp-row.imp-overdue:hover { background: #FADBD8; }
.imp-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.imp-row-title { font-weight: 600; font-size: 13px; }
.imp-row-sub { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imp-due { flex-shrink: 0; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.imp-due.is-overdue { color: #C0392B; font-weight: 700; }
.imp-home-card .home-widget-header h3 { color: #C0392B; }
.notif-card-link { display: block; text-decoration: none; color: inherit; }
.notif-card {
  background: var(--bg-card); border: 1px solid var(--border); border-left-width: 4px; border-left-style: solid;
  border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 6px; box-shadow: var(--shadow-sm);
}
.notif-card:hover { background: var(--brand-lighter); }
.notif-title { font-size: 12.5px; }
.notif-time { font-size: 10.5px; white-space: nowrap; }
.notif-body { font-size: 12px; margin-top: 2px; line-height: 1.4; }

/* ---- Khi in (bấm "In trực tiếp") — chỉ in đúng bảng nội dung, ẩn menu/topbar/bộ lọc/nút bấm ---- */
@media print {
  .sidebar, .topbar, .no-print, .date-filter-bar, .filter-caption, .col-picker { display: none !important; }
  .container, .container-lg { margin: 0 !important; padding: 0 !important; max-width: 100% !important; }
  body.has-sidebar { padding-left: 0 !important; }
  .card { border: 1px solid #000 !important; box-shadow: none !important; }
  table { width: 100% !important; }
}

/* =====================================================================
   V8 — THÀNH PHẦN MỚI
   ===================================================================== */

/* ---- Dải KPI tổng quan (4 nhóm trạng thái đơn hàng) — MỎNG & BO MỀM, không chiếm nhiều chỗ
   vì trọng tâm trang vẫn là bảng đơn hàng bên dưới. Bấm 1 ô để lọc nhanh theo nhóm. ---- */
/* Ô tổng quan gọn (đã thu nhỏ 21/07: bớt cao ~40% cho đỡ tốn diện tích — dùng chung Đơn hàng/COD/…) */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.kpi {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px 11px; position: relative; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; gap: 0;
  transition: box-shadow .14s, border-color .14s, transform .12s;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi.is-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.kpi::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 3px; background: var(--k, var(--brand)); }
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kpi .k-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.kpi .k-num { font-family: 'Sora', sans-serif; font-size: 18px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 10.5px; color: var(--text-faint); line-height: 1.3; }
.kpi .k-chip { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--gray-bg); color: var(--gray-text); white-space: nowrap; }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .kpis { grid-template-columns: 1fr; } }

/* ---- Dòng nhập sản phẩm khi lên đơn (trước đây là <style> inline trong orders.php) ---- */
.item-row { display: grid; grid-template-columns: 2fr 0.7fr 1fr 0.7fr 1.1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }

/* ---- Ô tìm kiếm toàn cục trên topbar (v8) ---- */
.topbar-search { display: flex; align-items: center; gap: 8px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: 99px; padding: 6px 14px; width: 260px; color: var(--text-faint); }
.topbar-search input { border: 0; background: transparent; outline: 0; height: auto; padding: 0; font-size: 13px; color: var(--text-main); width: 100%; }
@media (max-width: 768px) { .topbar-search { display: none; } }

/* =====================================================================
   .is-hidden — NHẮC LẠI Ở CUỐI FILE, CỐ Ý.
   Luật gốc nằm ở đầu file (~dòng 221) nên bị mọi lớp đặt display khai báo sau nó ghi đè
   (cùng độ ưu tiên → luật sau thắng). Ví dụ `class="is-hidden grid-2"`: .grid-2 đặt
   display:grid ở ~dòng 609 ⇒ phần tử KHÔNG BAO GIỜ ẩn. Đó chính là lý do khối "nhập tay
   công ty" trong orders.php / order_detail.php luôn hiện dù JS đã gắn .is-hidden.

   KHÔNG dùng !important ở đây: nhiều hộp gợi ý (.tag-suggestions) mang sẵn .is-hidden rồi
   được bật bằng element.style.display='block' — !important sẽ chặn luôn, làm hỏng autocomplete.
   Đặt cuối file là đủ: thắng các lớp trước, vẫn thua style viết thẳng trên thẻ.
   ===================================================================== */
.is-hidden { display: none; }

/* ---------------------------------------------------------------------
   MÃ ĐƠN CÓ MÀU THEO LOẠI (helpers.php → orderCodeHtml())
     DH…  = đơn bán hàng            → màu chữ mặc định
     BH…  = đơn trả máy bảo hành    → cam  (không tính doanh số)
     MDM… = đơn 1 đổi 1             → tím  (không tính doanh số)
   Nhìn danh sách đơn là phân biệt ngay, không phải đọc từng chữ.
--------------------------------------------------------------------- */
.ocode { font-weight: 700; }
/* Mã đơn đã TỰ MANG tiền tố loại (BH… / MDM…) + màu riêng + tooltip, nên KHÔNG gắn thêm chữ " BH" /
   " ĐỔI" phía sau nữa (22/07: bỏ vì lặp thông tin — "BH02170726 BH" đọc rối). Giữ màu để phân biệt. */
.ocode-bh  { color: #B45309; }                 /* cam đậm */
.ocode-mdm { color: #6D28D9; }                 /* tím */

/* ATP giữ-số — badge 3 số Tồn·hứa·Khả dụng (dùng chung: picker sản phẩm, kho, đơn) */
.atp{font-size:12px;font-weight:700;white-space:nowrap;border-radius:6px;padding:1px 6px}
.atp .muted{font-weight:500}
.atp-good{background:rgba(34,153,84,.12);color:#1e8449}
.atp-warn{background:rgba(214,158,46,.15);color:#b7791f}
.atp-bad{background:rgba(197,48,48,.12);color:#c53030}

/* Thumbnail ảnh sản phẩm trên bảng đơn (Danh sách + Giám sát) — nhận diện đơn bằng mắt */
.oimg{width:38px;height:38px;object-fit:cover;border-radius:7px;border:1px solid var(--border,#e5e7eb);background:#f8fafc;display:inline-block;vertical-align:middle}
.oimg-none{width:38px;height:38px;display:inline-flex;align-items:center;justify-content:center;font-size:17px;color:#cbd5e1}
