/* =====================================================================
 *  STYLE.CSS – Hệ thống đặt hàng Ô Mai Hà Nội (dùng chung toàn site)
 *  1. Biến màu & nền   2. Thành phần dùng chung (nút, ô nhập, badge, card, bảng, tab…)
 *  3. Khung quản lý (sidebar, topbar)   4. Trang quản lý (tổng quan, đơn hàng…)
 *  5. Đăng nhập   6. Khách đặt hàng (điện thoại)   7. Responsive
 *  Trang mới: dùng lại class có sẵn; CSS riêng (nếu cần) thêm ở CUỐI file theo khối có tiêu đề.
 * ===================================================================== */

/* ---------- 1. BIẾN MÀU & NỀN ---------- */
:root {
  --primary: #9b1c31;
  --primary-dark: #7c1426;
  --primary-soft: #fbe9ec;
  --primary-faint: #fdf3f4;
  --bg: #faf6f0;
  --surface: #ffffff;
  --surface-2: #fbf8f4;
  --border: #eee5da;
  --border-strong: #e2d6c8;
  --text: #2a1d18;
  --muted: #7d6f66;
  --amber: #b86e00;   --amber-bg: #fdf0d9;
  --blue: #2259c9;    --blue-bg: #e7eefc;
  --green: #23784a;   --green-bg: #e3f3e9;
  --red: #b42335;     --red-bg: #fde7ea;
  --gray: #6b625c;    --gray-bg: #f1ece6;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(60, 30, 20, .04), 0 4px 16px rgba(60, 30, 20, .04);
  --shadow-lg: 0 10px 40px rgba(60, 30, 20, .18);
  --sidebar-w: 260px;
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
small { font-size: 13px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.d-block { display: block; }
.ta-r { text-align: right; }
.text-primary { color: var(--primary); }
.text-amber { color: var(--amber); }
.pad { padding: 20px; }
.no-scroll { overflow: hidden; }

/* ---------- 2. THÀNH PHẦN DÙNG CHUNG ---------- */
.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-xs { width: 14px; height: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; text-decoration: none !important; }
.btn .icon { width: 18px; height: 18px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline { background: var(--surface); color: var(--primary); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-faint); }
.btn-outline-danger { background: var(--surface); color: var(--red); border-color: #f1c2c9; }
.btn-outline-danger:hover { background: var(--red-bg); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 14px; }
.btn-lg { height: 52px; padding: 0 22px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 10px; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--gray-bg); }
.link-muted { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; font-weight: 500; }
.link-danger { background: none; border: 0; padding: 0; font: inherit; font-size: 13px; color: var(--red); cursor: pointer; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; font-weight: 500; margin-bottom: 6px; }
.back-link .icon { width: 16px; height: 16px; }

.input { width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface);
  font: inherit; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input:disabled { background: var(--surface-2); color: var(--muted); }
textarea.input { height: auto; padding: 10px 14px; resize: vertical; }
select.input { padding-right: 32px; }
.input-lg { height: 54px; font-size: 18px; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 44px; }
.field-label { display: block; margin: 14px 0 6px; font-size: 14px; font-weight: 500; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { margin-top: 10px; color: var(--red); font-size: 14px; }

.badge { display: inline-flex; align-items: center; height: 26px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; vertical-align: middle; }
.badge-amber { color: var(--amber); background: var(--amber-bg); }
.badge-blue  { color: var(--blue);  background: var(--blue-bg); }
.badge-green { color: var(--green); background: var(--green-bg); }
.badge-red   { color: var(--red);   background: var(--red-bg); }
.badge-gray  { color: var(--gray);  background: var(--gray-bg); }
.chip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #7a5a3c; background: #f4ebdf; }
.chip-primary { color: #fff; background: var(--primary); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.card-head a { font-size: 14px; font-weight: 500; }
.card-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-toolbar .field-label { margin-top: 0; }
.card-toolbar .input { width: 220px; }
.stack > .card { margin-bottom: 20px; }
.stack h2 { margin-bottom: 12px; }

.alert { border-radius: var(--radius); padding: 16px 20px; margin-bottom: 20px; border: 1px solid; }
.alert strong { display: block; margin-bottom: 4px; }
.alert-warning { background: #fff4e3; border-color: #f7dcb0; color: #5a3d14; }
.alert-warning strong { color: var(--amber); }
.alert-danger { background: var(--red-bg); border-color: #f4c3ca; color: #6b1622; }
.note { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 10px; }
.note-info { background: var(--blue-bg); color: var(--blue); }
.note-danger { background: var(--red-bg); color: var(--red); }

.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 16px 14px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none !important; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--primary-soft); color: var(--primary); }

.filter-bar { display: flex; flex-wrap: wrap; gap: 12px; padding: 16px 20px; }
.filter-bar .grow { flex: 1 1 280px; }
.filter-bar select.input, .filter-bar input[type="month"] { width: auto; min-width: 170px; flex: 0 0 auto; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 12px 20px; text-align: left; font-size: 12.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th.ta-r { text-align: right; }
.table td { padding: 14px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { padding: 10px 20px; border-top: 1px solid var(--border); }
.row-link { cursor: pointer; transition: background .1s; }
.row-link:hover { background: var(--primary-faint); }
.row-link.unread strong { color: var(--text); }
.cell-main { display: flex; align-items: center; gap: 8px; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex-shrink: 0; }
.empty-row { text-align: center; padding: 40px 20px !important; color: var(--muted); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--border); }
.pager { display: flex; align-items: center; gap: 10px; }
.td-check { width: 44px; }
.td-thumb { width: 64px; }
.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; display: inline-grid; place-items: center; }
.thumb-empty { background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--border-strong); }
.ck { font-size: 12px; color: var(--muted); }
.ck-uudai { color: var(--primary); font-weight: 600; }

.empty-state { padding: 48px 24px; text-align: center; }
.empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 14px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); }
.empty-icon .icon { width: 30px; height: 30px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state .btn { margin-top: 16px; }
.feature-list { list-style: none; padding: 0; margin: 20px auto 0; max-width: 560px; text-align: left; display: grid; gap: 10px; }
.feature-list li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.feature-list .icon { color: var(--green); width: 18px; height: 18px; margin-top: 2px; }

.info-list { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.info-list dt { color: var(--muted); }
.info-list dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--border); font-size: 14px; }
.timeline li { position: relative; padding: 0 0 14px 8px; }
.timeline li::before { content: ''; position: absolute; left: -22px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--surface); }

.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 1000; display: grid; gap: 10px; max-width: calc(100vw - 36px); }
.toast { padding: 12px 18px; border-radius: 12px; background: var(--text); color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500;
  transform: translateY(-10px); opacity: 0; transition: all .25s; max-width: 380px; }
.toast.show { transform: none; opacity: 1; }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }

.modal { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; background: rgba(30, 15, 10, .45); }
.modal-box { width: 100%; max-width: 420px; padding: 24px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-lg); }
.modal-box h3 { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- 3. KHUNG QUẢN LÝ ---------- */
.admin-body { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; width: var(--sidebar-w); height: 100vh; flex-shrink: 0; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--border); z-index: 50; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; text-decoration: none !important; }
.brand-logo { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--primary); color: #fff; flex-shrink: 0; }
.brand-logo .icon { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { color: var(--primary); font-size: 16px; letter-spacing: .02em; }
.brand-text small { color: var(--muted); }
.nav { flex: 1; overflow-y: auto; padding: 4px 14px; }
.nav-section { padding: 20px 12px 8px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav-item { display: flex; align-items: center; gap: 12px; height: 48px; padding: 0 14px; margin-bottom: 4px; border-radius: 12px; color: #4a3a32; font-weight: 500; text-decoration: none !important; transition: background .15s; }
.nav-item .icon { color: var(--muted); }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(155, 28, 49, .25); }
.nav-item.active .icon { color: #fff; }
.nav-badge { margin-left: auto; display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; background: #e3a11c; color: #fff; font-size: 12px; font-weight: 700; }
.sidebar-user { margin: 0 14px; padding: 16px 6px 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; }
.sidebar-user small { color: var(--muted); margin-bottom: 10px; }
.logout { display: inline-flex; align-items: center; gap: 10px; color: #4a3a32; font-weight: 500; }
.logout .icon { width: 18px; height: 18px; color: var(--muted); }
.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px; height: 76px; padding: 0 32px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar-title { display: flex; flex-direction: column; line-height: 1.3; }
.topbar-title strong { font-size: 18px; }
.topbar-title small { color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.menu-toggle { display: none; }
.bell .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px #fff; }
.bell .bell-off, .bell.muted .bell-on { display: none; }
.bell.muted .bell-off { display: inline-flex; color: var(--muted); }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--primary); color: #fff; font-weight: 700; font-size: 14px; }
.content { padding: 32px; max-width: 1480px; width: 100%; }

/* ---------- 4. TRANG QUẢN LÝ ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 20px; }
.stat-cards .card { margin-bottom: 0; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 20px 24px; }
.stat-label { font-size: 12.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat-row .stat + .stat { border-left: 1px solid var(--border); }
.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }

.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 260px; padding: 16px 20px 20px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.bar { --h: 2%; width: 100%; max-width: 48px; height: var(--h); min-height: 4px; border-radius: 8px 8px 4px 4px; background: var(--primary-soft); transition: height .4s; }
.bar-col.current .bar { background: var(--primary); }
.bar-col:hover .bar { background: #f1c4cc; }
.bar-col.current:hover .bar { background: var(--primary-dark); }
.bar-val { font-size: 11px; color: var(--muted); min-height: 14px; }
.bar-label { font-size: 12px; color: var(--muted); }

.rank-list { padding: 0 20px 12px; }
.rank-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.rank-item:last-child { border-bottom: 0; }
.rank-row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.progress { height: 6px; border-radius: 999px; background: var(--primary-soft); overflow: hidden; }
.progress span { --w: 0%; display: block; height: 100%; width: var(--w); background: var(--primary); border-radius: inherit; }

/* ---------- 5. ĐĂNG NHẬP ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 24px; margin-top: 24px; }
.login-card .btn { margin-top: 24px; }
.welcome-brand { display: flex; align-items: center; gap: 12px; }
.welcome-brand strong { color: var(--primary); font-size: 17px; letter-spacing: .02em; display: block; }
.welcome-brand small { color: var(--muted); }

/* ---------- 6. KHÁCH ĐẶT HÀNG (điện thoại) ---------- */
.shop-body { background: #f4ece1; }
.shop-app { max-width: 520px; min-height: 100vh; margin: 0 auto; background: var(--surface); position: relative; }

.welcome { padding: 32px 22px; display: flex; flex-direction: column; gap: 14px; min-height: 100vh; }
.welcome h1 { margin-top: 28px; font-size: 26px; }
.welcome-form { margin-top: 10px; }
.welcome-form .btn { margin-top: 20px; }
.greet-card { margin: 28px 0 10px; padding: 22px; border-radius: 18px; background: var(--primary-faint); border: 1px solid #f3d6db; }
.greet-card h2 { font-size: 22px; margin: 4px 0 12px; }
.greet-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; }
.greet-phone { display: flex; align-items: center; gap: 6px; margin-top: 16px; font-size: 14px; color: var(--muted); }
.greet-phone .icon { width: 16px; height: 16px; }

.shop-sticky { position: sticky; top: 0; z-index: 20; background: var(--surface); }
.shop-header { padding: 18px 18px 14px; background: var(--surface); }
.shop-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.shop-who { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.shop-who strong { font-size: 20px; }
.shop-header-actions { display: flex; align-items: center; gap: 14px; }
.shop-header-actions .btn .icon { width: 16px; height: 16px; }
.shop-page-title { font-size: 22px; }
.search-box .input { background: var(--surface-2); border-color: var(--border); height: 48px; }

.cat-tabs { display: flex; gap: 4px; padding: 0 12px; background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { flex-shrink: 0; padding: 14px 12px 12px; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; font-weight: 500; color: #4a3a32; cursor: pointer; white-space: nowrap; }
.cat-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.price-note { padding: 14px 18px 4px; font-size: 14px; color: var(--muted); }

.product-list { padding: 8px 18px 120px; display: grid; gap: 14px; }
.product-card { padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); transition: border-color .15s; }
.product-card.selected { border-color: var(--primary); }
.product-head { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.product-thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; cursor: zoom-in; flex-shrink: 0; }
.product-info { flex: 1; min-width: 0; }
.product-info h3 { font-size: 17px; }
.product-info small { color: var(--muted); }
.product-price { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.product-price strong { color: var(--primary); font-size: 15px; white-space: nowrap; }
.tag-uudai { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 600; }
.product-qty { display: flex; gap: 16px; padding-top: 14px; }
.qty-group label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; height: 46px; border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; }
.stepper input { width: 52px; height: 100%; border: 0; text-align: center; font: inherit; font-size: 17px; font-weight: 600; outline: none; -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.step-btn { width: 44px; height: 100%; border: 0; background: none; color: var(--primary); cursor: pointer; display: grid; place-items: center; }
.step-btn:disabled { color: var(--border-strong); cursor: default; }
.step-btn:active:not(:disabled) { background: var(--primary-faint); }
.product-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 14px; }
.product-foot strong { color: var(--primary); font-size: 18px; }
.product-card:not(.selected) .product-foot strong { color: var(--muted); }
.empty-search { text-align: center; color: var(--muted); padding: 30px 0; }

.cart-bar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 30; width: 100%; max-width: 520px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -6px 20px rgba(60, 30, 20, .06); }
.cart-bar small { display: block; color: var(--muted); }
.cart-bar strong { color: var(--primary); font-size: 22px; }
.cart-bar .btn .icon { width: 18px; height: 18px; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(30, 15, 10, .45); }
.sheet { position: fixed; left: 50%; bottom: 0; z-index: 61; width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px 22px 0 0; transform: translate(-50%, 100%); transition: transform .25s ease; }
.sheet.open { transform: translate(-50%, 0); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 22px 16px; border-bottom: 1px solid var(--border); }
.sheet-head h2 { font-size: 20px; }
.sheet-body { overflow-y: auto; padding: 0 22px 10px; }
.sheet-foot { padding: 16px 22px calc(16px + env(safe-area-inset-bottom)); background: var(--surface-2); border-top: 1px solid var(--border); }
.sheet-total { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet-total strong { color: var(--primary); font-size: 24px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.line small { display: block; color: var(--muted); }
.line > strong, .line-right strong { color: var(--primary); white-space: nowrap; }
.line-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.delivery-form { padding: 10px 0 6px; }
.delivery-form h3 { margin-top: 14px; }

.success-view { padding: 48px 22px; text-align: center; display: flex; flex-direction: column; gap: 12px; }
.success-icon { margin: 0 auto 8px; display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--green-bg); color: var(--green); }
.success-icon .icon { width: 38px; height: 38px; }
.success-total { font-size: 28px; font-weight: 700; color: var(--primary); }

.my-orders { padding: 0 18px 40px; }
.order-card { border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px; background: var(--surface); }
.order-card summary { list-style: none; display: flex; justify-content: space-between; gap: 10px; padding: 16px; cursor: pointer; }
.order-card summary::-webkit-details-marker { display: none; }
.order-card summary small { display: block; color: var(--muted); }
.order-card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.order-card-body { padding: 0 16px 14px; border-top: 1px solid var(--border); }
.order-card-body .note { margin-top: 12px; }
.order-card-body .muted { margin-top: 10px; }

.lightbox { position: fixed; inset: 0; z-index: 1100; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .85); }
.lightbox img { max-width: 100%; max-height: 85vh; border-radius: 12px; }
.lightbox-close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .15); color: #fff; font-size: 28px; cursor: pointer; }

/* ---------- 7. RESPONSIVE ---------- */
@media (max-width: 1200px) {
  .stat-cards, .stat-row { grid-template-columns: repeat(2, 1fr); }
  .stat-row .stat:nth-child(3) { border-left: 0; }
  .stat-row .stat:nth-child(n+3) { border-top: 1px solid var(--border); }
  .grid-2-1 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(30, 15, 10, .4); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
  .menu-toggle { display: inline-grid; }
  .topbar { height: 64px; padding: 0 16px; }
  .topbar-title small { display: none; }
  .content { padding: 20px 16px; }
  h1 { font-size: 24px; }
}
/* Bảng thành thẻ trên điện thoại – Sale xác nhận đơn được trên điện thoại (module 11) */
@media (max-width: 700px) {
  .stat-cards { gap: 12px; }
  .stat { padding: 16px; }
  .stat-value { font-size: 22px; }
  .card-toolbar { flex-wrap: wrap; }
  .card-toolbar .input { width: 100%; }
  .filter-bar select.input, .filter-bar input[type="month"] { flex: 1 1 140px; min-width: 0; }
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td, .table-cards tfoot { display: block; width: 100%; }
  .table-cards tbody tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 13px; text-align: left; flex-shrink: 0; }
  .table-cards td:not([data-label])::before { content: none; }
  .table-cards td { flex-wrap: wrap; }
  .table-cards td > div { margin-left: auto; text-align: right; }
  .table-cards td > small { flex-basis: 100%; text-align: right; margin-top: -2px; }
  .table-cards tfoot tr { display: flex; justify-content: space-between; padding: 0 16px; }
  .table-cards tfoot td { width: auto; }
  .table-cards .td-thumb, .table-cards .td-check { width: auto; }
  .bar-chart { gap: 4px; height: 200px; padding: 12px; }
  .bar-val { display: none; }
  .info-list { grid-template-columns: 110px 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
}
@media (max-width: 400px) {
  .product-qty { gap: 10px; }
  .stepper input { width: 42px; }
  .step-btn { width: 38px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
}

/* =====================================================================
 *  CSS RIÊNG CỦA TỪNG TRANG – thêm bên dưới, mỗi trang 1 khối có tiêu đề
 * ===================================================================== */


/* ---------- BỘ LỌC THỜI GIAN DÙNG CHUNG (render_time_filter) ---------- */
.time-filter { position: relative; flex: 0 0 auto; }
.time-filter-btn { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; width: auto; min-width: 230px; cursor: pointer; text-align: left; white-space: nowrap; }
.time-filter.open .time-filter-btn { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.time-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 80; width: max-content; max-width: calc(100vw - 32px); padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.time-presets { display: grid; grid-template-columns: repeat(5, minmax(110px, auto)); gap: 18px; }
.time-col { display: flex; flex-direction: column; gap: 8px; }
.time-col strong { font-size: 14px; margin-bottom: 2px; }
.time-preset { height: 36px; padding: 0 12px; border: 0; border-radius: 8px; background: var(--surface-2); font: inherit; font-size: 14px; color: var(--text); cursor: pointer; white-space: nowrap; }
.time-preset:hover { background: var(--primary-soft); color: var(--primary); }
.time-preset.active { background: var(--primary); color: #fff; font-weight: 600; }
.time-custom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.time-custom strong { font-size: 14px; margin-right: 4px; }
.time-custom .input { width: 160px; height: 38px; }
.time-custom.active strong { color: var(--primary); }

/* ---------- TẠO ĐƠN MỚI (quan-ly/tao-don.php) ---------- */
.create-order h2 { margin-bottom: 12px; }
.create-order .card-head h2 { margin-bottom: 0; }
.sticky-col { position: sticky; top: 96px; }
.cust-search { position: relative; }
.cust-search .hint { margin-top: 8px; }
.suggest { position: absolute; left: 0; right: 0; top: 50px; z-index: 30; max-height: 340px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.suggest-item { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--border); background: none; font: inherit; text-align: left; cursor: pointer; }
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover { background: var(--primary-faint); }
.suggest-item small { display: block; color: var(--muted); }
.suggest-new strong { color: var(--primary); }
.suggest-empty { padding: 14px; color: var(--muted); font-size: 14px; }
.cust-box { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--primary-faint); border: 1px solid #f3d6db; }
.cust-box-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.cust-box-main strong { font-size: 17px; }
.cust-box-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 10px; font-size: 14px; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.pick-list { max-height: 640px; overflow-y: auto; border-top: 1px solid var(--border); }
.pick-row { display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.pick-row .thumb-empty { display: none; }
.pick-info { flex: 1; min-width: 0; }
.pick-row.selected { background: var(--primary-faint); }
.pick-info strong { display: block; }
.pick-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pick-price strong { color: var(--primary); white-space: nowrap; }
.pick-qty { display: flex; gap: 10px; }
.pick-qty label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.pick-total { display: flex; flex-direction: column; align-items: flex-end; text-align: right; width: 104px; flex-shrink: 0; }
.pick-row:not(.selected) .pick-total strong { color: var(--muted); }
.stepper-sm { height: 38px; border-radius: 10px; }
.stepper-sm input { width: 44px; font-size: 15px; }
.stepper-sm .step-btn { width: 34px; font-size: 20px; line-height: 1; }
.sum-lines { max-height: 320px; overflow-y: auto; }
.sum-lines .line:first-child { padding-top: 0; }
.sum-total { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 14px 0; font-size: 14px; color: var(--muted); }
.sum-total strong { color: var(--primary); font-size: 24px; }

@media (max-width: 1200px) {
  .sticky-col { position: static; }
}
@media (max-width: 700px) {
  .time-filter { flex: 1 1 100%; }
  .time-filter-btn { width: 100%; }
  .time-panel { left: 0; right: 0; width: auto; max-width: none; padding: 14px; }
  .time-presets { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .time-custom .input { flex: 1 1 120px; width: auto; }
  .pick-list { max-height: none; overflow: visible; }
  .pick-row { flex-wrap: wrap; gap: 8px 12px; padding: 12px 16px; }
  .pick-row .thumb { display: none; }
  .pick-info { flex: 1 1 55%; }
  .pick-qty { flex: 1 1 auto; }
  .pick-total { align-self: flex-end; }
  .create-order { padding-bottom: 130px; }
  .order-summary { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; margin: 0 !important; border-radius: 16px 16px 0 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(60, 30, 20, .1); }
  .order-summary .sum-lines, .order-summary h2 { display: none; }
  .order-summary .sum-total { margin-top: 0; }
}


/* ---------- KHÁCH HÀNG (quan-ly/khach-hang.php) + hộp thoại dùng chung cỡ lớn ---------- */
.row-edit { cursor: pointer; transition: background .1s; }
.chip { white-space: nowrap; }
.nowrap { white-space: nowrap; }
.table-compact th, .table-compact td { padding-left: 12px; padding-right: 12px; }
.table-compact th:first-child, .table-compact td:first-child { padding-left: 20px; }
.table-compact th:last-child, .table-compact td:last-child { padding-right: 20px; }
.row-edit:hover { background: var(--primary-faint); }
.td-actions { white-space: nowrap; }
.td-actions .btn + .btn { margin-left: 6px; }
.td-actions .btn .icon { width: 16px; height: 16px; }
.modal-lg { max-width: 620px; padding: 0; display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 4px 22px 18px; overflow-y: auto; }
.modal-lg .modal-actions { margin: 0; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
.input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.switch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 16px; cursor: pointer; font-weight: 500; }
.switch-row input { width: 18px; height: 18px; accent-color: var(--primary); }
.switch-row small { flex-basis: 100%; padding-left: 28px; }
@media (max-width: 700px) {
  .modal { padding: 0; align-items: end; }
  .modal-lg { max-width: none; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .td-actions { justify-content: flex-end; }
}


/* ---------- NHÓM CHIẾT KHẤU (quan-ly/nhom-chiet-khau.php) ---------- */
.alert-info { background: var(--blue-bg); border-color: #cddbf7; color: #1d3c7a; }
.alert-info strong { color: var(--blue); }
.ck-summary { margin-bottom: 12px; }
.ck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.ck-card { margin: 0; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.ck-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.ck-card-head h2 { margin-bottom: 4px; }
.ck-pct { flex-shrink: 0; padding: 6px 14px; border-radius: 12px; background: var(--primary); color: #fff; font-size: 22px; font-weight: 700; }
.ck-items summary { cursor: pointer; color: var(--primary); font-size: 14px; font-weight: 500; }
.ck-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; max-height: 180px; overflow-y: auto; }
.ck-chips .chip { height: 26px; font-weight: 500; font-size: 12.5px; }
.ck-card-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.ck-card-foot .btn .icon { width: 16px; height: 16px; }
.modal-xl { max-width: 760px; }
.form-row-2-1 { grid-template-columns: 2fr 1fr; }
.ck-pick-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.ck-count { font-size: 13px; font-weight: 600; color: var(--primary); margin-bottom: 6px; }
.ck-pick-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 10px; }
.ck-pick-tools .grow { flex: 1 1 260px; }
.ck-pick { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ck-cat + .ck-cat { border-top: 1px solid var(--border); }
.ck-cat-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); cursor: pointer; }
.ck-cat-head span { margin-left: auto; }
.ck-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 38px; cursor: pointer; border-bottom: 1px solid var(--border); }
.ck-item:last-child { border-bottom: 0; }
.ck-item:hover { background: var(--primary-faint); }
.ck-item.checked { background: var(--primary-faint); }
.ck-pick input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); flex-shrink: 0; }
.ck-item-name { flex: 1; min-width: 0; }
.ck-item-name small { display: block; }
.tag-dang-o { flex-shrink: 0; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--amber-bg); color: var(--amber); white-space: nowrap; }
.tag-dang-o.moving { background: var(--primary-soft); color: var(--primary); }
.move-list { margin: 12px 0 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
@media (max-width: 700px) {
  .ck-grid { grid-template-columns: 1fr; gap: 14px; }
  .form-row-2-1 { grid-template-columns: 1fr; gap: 0; }
  .ck-item { padding-left: 14px; flex-wrap: wrap; }
  .tag-dang-o { margin-left: 27px; }
  .ck-pick { max-height: 50vh; }
}


/* ---------- NHÓM CHIẾT KHẤU – chọn phạm vi áp dụng (Toàn bộ / Theo nhóm SP / Tùy chọn) ---------- */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.seg-item { position: relative; display: flex; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .15s, background .15s; }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item span { display: flex; flex-direction: column; gap: 2px; }
.seg-item strong { font-size: 14px; }
.seg-item small { color: var(--muted); }
.seg-item:hover { border-color: var(--primary); }
.seg-item.active { border-color: var(--primary); background: var(--primary-faint); box-shadow: 0 0 0 2px var(--primary-soft); }
.seg-item.active strong { color: var(--primary); }
.ck-cat-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; max-height: 46vh; overflow-y: auto; }
.ck-cat-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; flex-wrap: wrap; }
.ck-cat-opt:hover { border-color: var(--primary); }
.ck-cat-opt.checked { border-color: var(--primary); background: var(--primary-faint); }
.ck-cat-opt input { width: 17px; height: 17px; accent-color: var(--primary); }
.ck-cat-opt-name { flex: 1 1 150px; min-width: 0; display: flex; flex-direction: column; }
.ck-cat-opt .tag-dang-o { margin-left: auto; }
.ck-total { margin-top: 14px; font-size: 14px; }
@media (max-width: 700px) {
  .seg { grid-template-columns: 1fr; gap: 8px; }
  .ck-cat-list { grid-template-columns: 1fr; }
  .ck-cat-opt .tag-dang-o { margin-left: 27px; }
}


/* ---------- NHÓM KHÁCH HÀNG + GÁN NHÓM CHIẾT KHẤU CHO KHÁCH ---------- */
.kh-ck-list { display: grid; gap: 6px; }
.kh-ck-opt { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.kh-ck-opt input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.kh-ck-opt span { display: flex; flex-direction: column; }
.kh-ck-opt span strong { font-size: 14px; }
.kh-ck-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-faint); }
.kh-ck-opt.is-all { cursor: default; }
.kh-ck-opt.is-off { opacity: .5; }
.ck-scope { align-self: flex-start; }
.seg-2 { grid-template-columns: repeat(2, 1fr); }
.nk-note { margin: 12px 0; }
.nk-table { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.nk-table tr.editing { background: var(--primary-faint); }
.nk-table .btn.confirm { background: var(--red); border-color: var(--red); color: #fff; }
.nk-form { margin-top: 16px; padding: 14px 16px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.nk-form h4 { margin: 0; font-size: 15px; }
.nk-form-row { display: flex; flex-wrap: wrap; gap: 12px; }
.nk-form-row .grow { flex: 1 1 220px; }
.nk-form-row > div:not(.grow) { flex: 0 1 130px; }
.nk-form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
@media (max-width: 700px) {
  .seg-2 { grid-template-columns: 1fr; }
  .nk-form-row > div:not(.grow) { flex: 1 1 120px; }
}
/* ---------- NHÓM KHÁCH – 2 ô "Được đặt theo thùng" / "Được đặt lẻ" ---------- */
.nk-checks { display: flex; flex-wrap: wrap; gap: 4px 28px; }
.nk-checks .switch-row { margin-top: 14px; }
.nk-checks + small { margin-top: 6px; }


/* ---------- NHÂN VIÊN (quan-ly/nhan-vien.php) ---------- */
.nv-name { display: flex; align-items: center; gap: 10px; }
.avatar-sm { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; flex-shrink: 0; }
.chip-xs { height: 20px; padding: 0 8px; font-size: 11px; vertical-align: middle; }
.row-locked td { opacity: .6; }
.row-locked td.td-actions { opacity: 1; }
.menu-wrap { position: relative; display: inline-block; margin-left: 6px; }
.row-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 200px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); text-align: left; }
.row-menu button { display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14px; text-align: left; color: var(--text); cursor: pointer; white-space: nowrap; }
.row-menu button:hover { background: var(--primary-faint); color: var(--primary); }
.row-menu button.danger { color: var(--red); }
.row-menu button.danger:hover { background: var(--red-bg); }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-3 .seg-item small { font-size: 12px; line-height: 1.4; }
.seg-item:has(input:disabled) { cursor: not-allowed; opacity: .75; }
.pw-row { display: flex; gap: 8px; }
.pw-row .input { flex: 1; min-width: 0; }
.js-hh-box small, .js-mk-hint { display: block; margin-top: 6px; }
@media (max-width: 700px) {
  .seg-3 { grid-template-columns: 1fr; }
  .pw-row { flex-wrap: wrap; }
  .pw-row .input { flex-basis: 100%; }
  .pw-row .btn { flex: 1; }
  .table-cards td.td-actions { justify-content: flex-end; gap: 6px; }
  .table-cards td.td-actions .menu-wrap { margin-left: 0; }
}

/* =====================================================================
 *  PHÂN QUYỀN (Nhân viên → tab Phân quyền) + chọn vai trò trong hộp thoại nhân viên
 * ===================================================================== */
.badge-purple { color: #6d3fc0; background: #efe8fb; }
.tab-end { margin-left: auto; }
.tab .icon { width: 16px; height: 16px; }
.seg-roles { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.seg-item.is-off { opacity: .45; cursor: not-allowed; }
.seg-item.is-off:hover { border-color: var(--border-strong); }
.form-row-tight { gap: 10px; }

.vt-intro { padding: 14px 16px 0; }
.vt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; padding: 16px; }
.vt-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; text-align: left; font: inherit; color: inherit; }
.vt-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vt-code { margin-left: auto; font-family: ui-monospace, Menlo, Consolas, monospace; }
.vt-desc { margin: 0; color: var(--muted); font-size: 13px; min-height: 2.6em; }
.vt-stats { display: flex; gap: 16px; font-size: 13px; }
.vt-groups { display: flex; flex-wrap: wrap; gap: 6px; }
.vt-groups .chip { font-size: 12px; }
.vt-actions { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); }
.vt-actions .btn-outline-danger { margin-left: auto; }
.vt-card-add { align-items: center; justify-content: center; min-height: 180px; border-style: dashed; color: var(--muted); cursor: pointer; background: transparent; }
.vt-card-add:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-faint); }
.vt-card-add .icon { width: 26px; height: 26px; }

.vt-perm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.vt-perm-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vt-perm-tools .input { width: auto; min-width: 180px; height: 32px; padding: 4px 10px; font-size: 13px; }
.vt-perms { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 8px; }
.vt-perm-group { margin: 0; padding: 10px 12px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.vt-perm-group legend { padding: 0 6px; font-weight: 600; font-size: 14px; }
.vt-perm-group legend label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.vt-perm { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.vt-perm + .vt-perm { border-top: 1px solid var(--border); }
.vt-perm input, .vt-perm-group legend input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.vt-perm small { font-size: 12px; }
.vt-perm.is-off { opacity: .45; cursor: not-allowed; }

@media (max-width: 640px) {
  .vt-grid { grid-template-columns: 1fr; padding: 12px; }
  .vt-perm-tools { width: 100%; }
  .vt-perm-tools .input { min-width: 0; flex: 1 1 100%; }
  .tab-end { margin-left: 0; }
}

/* =====================================================================
 *  XÁC NHẬN ĐƠN – ghi chú khi không được xác nhận + tùy chọn "Xác nhận toàn bộ đơn" ở hộp thoại nhân viên
 * ===================================================================== */
.xn-note { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.xn-note .icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--amber); }
.btn[disabled][title] { cursor: not-allowed; }
.xn-box { margin-top: 16px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--primary-faint); }
.xn-box .switch-row { margin-top: 0; }
.chip-xn { margin-top: 4px; }


/* =====================================================================
 *  SẢN PHẨM & DANH MỤC – ô chọn nhiều, thanh xóa, xem chi tiết, ảnh, import
 * ===================================================================== */
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.bulk-bar { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bulk-bar[hidden] { display: none; }
.td-check input, .vt-perm input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.table tr.row-selected td { background: var(--primary-faint); }

/* Xem chi tiết */
.sp-view { display: grid; grid-template-columns: 200px 1fr; gap: 20px; align-items: start; }
.sp-view-img img, .sp-view-noimg { width: 200px; height: 200px; border-radius: var(--radius-sm); object-fit: cover; display: grid; place-items: center; }
.sp-view-noimg .icon { width: 40px; height: 40px; }
.sp-view-info { grid-template-columns: 130px 1fr; }

/* Chọn ảnh trong form */
.sp-img-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.sp-img-pick { position: relative; width: 104px; height: 104px; flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; cursor: pointer;
  border: 1px dashed var(--border-strong); background: var(--surface-2); display: grid; place-items: center; }
.sp-img-pick:hover { border-color: var(--primary); }
.sp-img-pick img { width: 100%; height: 100%; object-fit: cover; }
.sp-img-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); }
.sp-img-empty .icon { width: 28px; height: 28px; }
.sp-img-help { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }

/* Import */
.import-steps { margin: 0 0 14px; padding-left: 20px; font-size: 14px; line-height: 1.6; }
.file-drop { display: grid; place-items: center; min-height: 86px; padding: 14px; border: 2px dashed var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--muted); cursor: pointer; text-align: center; font-weight: 500; }
.file-drop:hover { border-color: var(--primary); color: var(--primary); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.file-drop span { display: inline-flex; align-items: center; gap: 8px; }
.import-result { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--blue-bg); }
.import-result.is-done { background: var(--green-bg); }
.import-result p { margin: 0 0 8px; font-weight: 500; }
.import-result .table-wrap { max-height: 240px; overflow: auto; background: #fff; border-radius: 8px; }
.imp-loi td:last-child { color: var(--red); }
.imp-canh-bao td:last-child { color: var(--amber); }

.td-sp-name { min-width: 170px; }

@media (max-width: 640px) {
  #spTable tr[data-sp] { position: relative; }
  #spTable tr[data-sp] .td-check { position: absolute; top: 14px; right: 14px; padding: 0; border: 0; }
  #spTable .td-sp-name { min-width: 0; }
  .sp-view { grid-template-columns: 1fr; }
  .sp-view-img img, .sp-view-noimg { width: 100%; height: 220px; }
  .page-actions .bulk-bar { width: 100%; }
}

/* =====================================================================
 *  HOA HỒNG – biểu đồ 12 tháng (bấm cột để lọc tháng), tỷ trọng theo sale, cấu hình tỷ lệ
 * ===================================================================== */
.bar-chart-sm { height: 200px; }
a.bar-col { color: inherit; text-decoration: none; }
a.bar-col:hover .bar-label { color: var(--primary); }
.td-share { min-width: 140px; }
.td-share .progress { margin-bottom: 4px; }
.table tfoot th { padding: 12px 16px; border-top: 2px solid var(--border); font-weight: 600; text-transform: none; font-size: 14px; color: var(--text); background: var(--surface-2); }
.text-strike { text-decoration: line-through; color: var(--muted); }
.hh-note { display: flex; gap: 8px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--amber-bg); align-self: end; }
.hh-note .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--amber); }
.hh-cfg-table .input-pct { width: 120px; height: 36px; text-align: right; margin-left: auto; }
.hh-cfg-table td { vertical-align: middle; }
.modal .table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }

@media (max-width: 640px) {
  .bar-chart-sm { gap: 4px; padding: 12px 10px 14px; }
  .bar-chart-sm .bar-val { font-size: 9px; }
  .bar-chart-sm .bar-label { font-size: 10px; }
  .table tfoot { display: none; }
}

/* =====================================================================
 *  BÁO CÁO – thanh lọc trên cùng, nút Ngày / Tháng / Năm, biểu đồ nhiều cột
 * ===================================================================== */
.bc-filter { padding: 14px 16px; margin-bottom: 20px; flex-wrap: wrap; }
.seg-inline { display: inline-flex; grid-template-columns: none; gap: 0; padding: 3px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.seg-inline .seg-item { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border: 0; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 14px; text-decoration: none; white-space: nowrap; }
.seg-inline .seg-item:hover { color: var(--primary); }
.seg-inline .seg-item.active { background: var(--surface); color: var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.bc-chart { height: 240px; }
.bc-chart.is-dense { gap: 3px; }
.bc-chart .bar-col { min-width: 0; }
.bc-chart .bar-label { max-width: 100%; overflow: hidden; text-overflow: clip; white-space: nowrap; }
.bc-chart.is-dense .bar-val { display: none; }
.bc-chart.is-dense .bar-label { font-size: 10px; white-space: nowrap; min-height: 14px; }

@media (max-width: 640px) {
  .bc-filter > * { flex: 1 1 100%; }
  .seg-inline { display: flex; }
  .seg-inline .seg-item { flex: 1; justify-content: center; padding: 0 8px; }
  .bc-chart { gap: 2px; padding: 12px 8px 14px; }
  .bc-chart .bar-val { display: none; }
  .bc-chart .bar-label { font-size: 9px; }
}

/* =====================================================================
 *  CÀI ĐẶT – bố cục 2 cột theo từng mục, xem trước phiếu xuất, logo thương hiệu
 * ===================================================================== */
.cd-form { padding: 4px 24px 24px; }
.cd-section { display: grid; grid-template-columns: 260px 1fr; gap: 28px; padding: 22px 0; border-bottom: 1px solid var(--border); }
.cd-side h3 { margin: 0 0 6px; font-size: 16px; }
.cd-side p { margin: 0; line-height: 1.55; }
.cd-main { max-width: 720px; }
.cd-main > .field-label:first-child { margin-top: 0; }
.cd-table { border: 1px solid var(--border); border-radius: var(--radius-sm); }
.cd-table .input-pct, .hh-cfg-table .input-pct { width: 110px; height: 36px; text-align: right; margin-left: auto; }
.cd-secure { margin-bottom: 4px; }
.cd-secure .seg-item { cursor: pointer; }
.cd-test { display: flex; gap: 10px; margin-top: 18px; }
.cd-test .input { flex: 1; }
.cd-mailerr { display: flex; gap: 8px; align-items: flex-start; margin: 14px 0 0; padding: 10px 14px; font-size: 13px; }
.cd-mailerr .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.cd-actions { display: flex; justify-content: flex-end; padding-top: 20px; }
.cd-logo-pick img { object-fit: contain; background: #fff; }

/* Xem trước đầu phiếu xuất kho */
.pxk-preview { padding: 18px 20px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; font-family: 'Times New Roman', Times, serif; font-size: 14px; line-height: 1.5; color: #000; }
.pxk-top { display: flex; justify-content: space-between; gap: 20px; }
.pxk-top > div:last-child { max-width: 260px; }
.pxk-tt { font-size: 12px; font-style: italic; }
.pxk-title { margin: 16px 0 2px; text-align: center; font-size: 18px; letter-spacing: .5px; }
.pxk-noco { margin: 6px 0 8px auto; width: max-content; }
.ta-c { text-align: center; }

/* Logo thương hiệu (khi đã tải logo ở Cài đặt) */
.brand-logo.has-img { background: #fff; border: 1px solid var(--border); overflow: hidden; }
.brand-logo.has-img img { width: 100%; height: 100%; object-fit: contain; }

@media (max-width: 900px) {
  .cd-section { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 640px) {
  .cd-form { padding: 0 14px 16px; }
  .cd-test { flex-direction: column; }
  .pxk-top { flex-direction: column; gap: 10px; }
}

/* =====================================================================
 *  KHO – Đơn cần xuất, Tổng hợp soạn hàng, trang in Phiếu xuất kho 02-VT
 * ===================================================================== */
.table tr.row-late td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.badge + .badge, td .badge { margin-left: 4px; }
.kho-info { grid-template-columns: 110px 1fr; margin-bottom: 14px; }
.modal-actions .js-kv-tong { margin-right: auto; font-weight: 600; color: var(--text); }
.tabs-pill { display: flex; gap: 8px; margin-bottom: 16px; border: 0; padding: 0; }
.tabs-pill .tab { border: 1px solid var(--border-strong); border-radius: 999px; padding: 8px 16px; background: var(--surface); }
.tabs-pill .tab.active { border-color: var(--primary); background: var(--primary-faint); }
.th-qd { font-size: 15px; }
.th-qd b { color: var(--primary); font-size: 16px; }
.th-don { display: flex; flex-wrap: wrap; gap: 4px; }
.th-table tr.row-done td { opacity: .45; }
.th-table tr.row-done td strong { text-decoration: line-through; }
.print-only { display: none; }

/* Trang in phiếu (quan-ly/phieu-xuat.php) */
.print-body { background: #e9e4df; padding: 76px 16px 40px; font-family: 'Times New Roman', Times, serif; }
.print-toolbar { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 12px 20px;
  background: var(--surface); border-bottom: 1px solid var(--border); font-family: var(--font, system-ui, sans-serif); }
.print-toolbar span { margin-right: auto; }
.print-empty { max-width: 600px; margin: 40px auto; padding: 24px; background: #fff; border-radius: 12px; text-align: center; font-family: system-ui, sans-serif; }
.phieu { width: 210mm; min-height: 297mm; margin: 0 auto 16px; padding: 14mm 14mm 12mm; background: #fff; color: #000; font-size: 13.5px; line-height: 1.45; box-shadow: 0 2px 12px rgba(0, 0, 0, .12); }
.phieu-head { display: flex; justify-content: space-between; gap: 24px; }
.phieu-head > div:last-child { max-width: 72mm; }
.phieu-tt { font-size: 11.5px; font-style: italic; }
.phieu-title-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; margin: 14px 0 10px; }
.phieu-title { margin: 0; font-size: 20px; letter-spacing: .5px; }
.phieu-copy { font-style: italic; font-size: 12px; }
.phieu-noco { justify-self: end; }
.phieu-info { margin: 6px 0; }
.phieu-info > div { margin: 2px 0; }
.phieu-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.phieu-table th, .phieu-table td { border: 1px solid #000; padding: 4px 6px; vertical-align: middle; }
.phieu-table th { font-weight: 700; text-align: center; font-size: 12.5px; }
.phieu-table .phieu-abc td { text-align: center; font-size: 12px; }
.phieu-table .phieu-blank td { height: 24px; }
.phieu-table small { font-size: 11.5px; }
.phieu-date { text-align: right; margin: 10px 0 4px; }
.phieu-sign { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; text-align: center; }
.phieu-sign strong, .phieu-sign em { display: block; }
.phieu-sign em { font-size: 11.5px; }
.phieu-sign span { display: block; margin-top: 64px; font-weight: 700; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  .print-body { background: #fff; padding: 0; }
  .print-toolbar, .print-empty { display: none !important; }
  .phieu { margin: 0; box-shadow: none; page-break-after: always; break-after: page; }
  .phieu:last-of-type { page-break-after: auto; break-after: auto; }
  /* Trang quản lý (VD: Tổng hợp soạn hàng): ẩn menu, thanh trên, nút */
  .admin-body .sidebar, .admin-body .topbar, .admin-body .no-print, .toast-wrap, .js-soan { display: none !important; }
  .admin-body { background: #fff; }
  .admin-body .main, .admin-body .content { margin: 0 !important; padding: 10mm !important; }
  .admin-body .card { box-shadow: none; border: 1px solid #999; }
  .print-only { display: block; }
  .th-print-head { text-align: center; margin-bottom: 12px; }
  .th-print-head h1 { margin: 6px 0; font-size: 20px; }
  .th-table tr.row-done td { opacity: 1; }
  .th-table tr.row-done td strong { text-decoration: none; }
}
@media (max-width: 640px) {
  #khoTable tr[data-kho] { position: relative; }
  #khoTable tr[data-kho] .td-check { position: absolute; top: 14px; left: 14px; padding: 0; border: 0; }
  #khoTable tr[data-kho] td[data-label="Mã đơn"] { padding-left: 40px; }
}
@media screen and (max-width: 860px) {
  .phieu { width: 100%; min-height: 0; padding: 16px; font-size: 12px; overflow-x: auto; }
  .phieu-sign { grid-template-columns: repeat(3, 1fr); }
}

/* =====================================================================
 *  MẪU IN – thẻ mẫu ở Cài đặt, logo / khổ A5 trên phiếu, bản in Tổng hợp soạn hàng dạng danh sách
 * ===================================================================== */
.mau-add-btn { margin-top: 14px; }
.mau-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; max-width: none; }
.mau-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.mau-card.is-default { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.mau-card-head { display: flex; align-items: center; gap: 8px; }
.mau-card-head .badge { margin-left: auto; }
.mau-card-body { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.mau-logo { width: 44px; height: 44px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; background: #fff; flex-shrink: 0; }
.mau-card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--border); }
.mau-card-actions .btn-outline-danger { margin-left: auto; }
.mau-sec { margin: 22px 0 4px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 15px; }
.mau-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.mau-checks .switch-row { margin-top: 12px; }
.mau-checks input:disabled + span { opacity: .45; }
.mau-rows .input-pct { width: 70px; height: 34px; }
.js-mau-kho .seg-item { cursor: pointer; }
.js-mau-kho .seg-item input { position: absolute; opacity: 0; }

/* Trang in: chọn mẫu, logo, ghi chú cuối, khổ A5 ngang */
.print-mau { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.print-mau .input { height: 38px; min-width: 200px; }
.phieu-donvi { display: flex; gap: 10px; align-items: flex-start; }
.phieu-logo { width: 54px; height: 54px; object-fit: contain; }
.phieu-foot { margin: 16px 0 0; text-align: center; font-style: italic; font-size: 12.5px; }
.phieu.phieu-a5 { width: 210mm; min-height: 148mm; padding: 6mm 9mm; font-size: 11px; line-height: 1.3; }
.phieu-a5 .phieu-tt, .phieu-a5 .phieu-sign em, .phieu-a5 .phieu-table th, .phieu-a5 .phieu-table small { font-size: 10px; }
.phieu-a5 .phieu-logo { width: 40px; height: 40px; }
.phieu-a5 .phieu-title-row { margin: 4px 0; }
.phieu-a5 .phieu-title { font-size: 15px; }
.phieu-a5 .phieu-info { margin: 3px 0; }
.phieu-a5 .phieu-info > div { margin: 0; }
.phieu-a5 .phieu-table { margin: 4px 0; }
.phieu-a5 .phieu-table th, .phieu-a5 .phieu-table td { padding: 1px 4px; }
.phieu-a5 .phieu-table .phieu-blank td { height: 16px; }
.phieu-a5 .phieu-date { margin: 4px 0 2px; }
.phieu-a5 .phieu-sign span { margin-top: 26px; }
.phieu-a5 .phieu-foot { margin-top: 6px; font-size: 10px; }
@page phieu-a5 { size: A5 landscape; margin: 0; }

/* Bản in Tổng hợp soạn hàng: danh sách gọn 1 dòng / sản phẩm */
.soan-print { font-family: 'Times New Roman', Times, serif; color: #000; font-size: 13px; }
.soan-head { display: flex; justify-content: space-between; gap: 20px; }
.soan-title { margin: 10px 0 2px; text-align: center; font-size: 19px; }
.soan-sub { margin-bottom: 10px; }
.soan-list { width: 100%; border-collapse: collapse; }
.soan-list th, .soan-list td { border: 1px solid #000; padding: 4px 6px; vertical-align: top; }
.soan-list th { font-size: 12px; text-align: center; white-space: nowrap; }
.soan-list tr { break-inside: avoid; page-break-inside: avoid; }
.soan-list thead { display: table-header-group; }
.soan-don { font-size: 11px; }
.soan-box { width: 52px; }
.soan-orders { margin-top: 10px; font-size: 12px; line-height: 1.5; }
.soan-orders span { display: inline-block; margin-right: 14px; }
.soan-sign { display: grid; grid-template-columns: 1fr 1fr; text-align: center; margin-top: 16px; break-inside: avoid; }
.soan-sign strong, .soan-sign em, .soan-sign span { display: block; }
.soan-sign em { font-size: 11.5px; }
.soan-sign span { margin-top: 50px; font-weight: 700; }

@media print {
  .phieu.phieu-a5 { page: phieu-a5; min-height: 0; }
  .admin-body .content { padding: 8mm 10mm !important; }
}
@media (max-width: 640px) {
  .mau-checks { grid-template-columns: 1fr; }
  .print-toolbar { flex-wrap: wrap; }
  .print-mau .input { min-width: 0; }
}

/* =====================================================================
 *  SỬA ĐƠN & HỦY ĐƠN
 * ===================================================================== */
.text-green { color: var(--green); }
.sum-old { margin: -4px 0 12px; text-align: right; }
.sum-old + .btn-block, .order-summary .btn-block + .btn-block { margin-top: 8px; }
.huy-warn { padding: 10px 14px; font-size: 13.5px; margin-bottom: 12px; }
.huy-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip-btn { border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font: inherit; font-size: 13px; padding: 5px 10px; }
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.chip-btn.active { border-color: var(--primary); background: var(--primary-faint); color: var(--primary); }
.page-actions .btn[disabled][title] { opacity: .5; }

/* =====================================================================
 *  THỊ TRƯỜNG – Đi thị trường (sale) & Giám sát sale (bản đồ Leaflet)
 * ===================================================================== */
.tt-gps { display: flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 14px; border-radius: var(--radius-sm); font-size: 13.5px; background: var(--surface-2); border: 1px solid var(--border); }
.tt-gps .icon { width: 16px; height: 16px; flex-shrink: 0; }
.tt-gps[data-state="ok"] { background: var(--green-bg); border-color: transparent; color: var(--green); }
.tt-gps[data-state="kem"] { background: var(--amber-bg); border-color: transparent; color: #7a5310; }
.tt-gps[data-state="loi"] { background: #fdecec; border-color: transparent; color: var(--red); }
.tt-now { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 16px; border: 1px solid var(--green); background: var(--green-bg); }
.tt-now-main { display: flex; align-items: center; gap: 12px; }
.tt-now-main strong { display: block; font-size: 17px; }
.tt-now-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 6px rgba(35, 120, 74, .18); animation: tt-pulse 1.6s infinite; }
@keyframes tt-pulse { 50% { box-shadow: 0 0 0 10px rgba(35, 120, 74, 0); } }
.tt-now-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tt-map { height: 380px; border-radius: var(--radius); overflow: hidden; position: relative; z-index: 0; }
.tt-map-note { display: grid; place-items: center; height: 100%; padding: 20px; text-align: center; background: var(--surface-2); }
.tt-list { display: flex; flex-direction: column; }
.tt-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 18px; border-top: 1px solid var(--border); }
.tt-row.is-here { background: var(--green-bg); }
.tt-row-main { min-width: 0; }
.tt-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; }
.tt-row-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex-shrink: 0; }
.tt-photo { display: grid; place-items: center; min-height: 110px; margin-bottom: 8px; border: 2px dashed var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; color: var(--muted); overflow: hidden; }
.tt-photo span { display: inline-flex; align-items: center; gap: 8px; padding: 16px; }
.tt-photo img { width: 100%; max-height: 220px; object-fit: cover; }
.tt-kq { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tt-kq .seg-item { cursor: pointer; justify-content: center; text-align: center; font-weight: 500; }
.tt-kq .seg-item.active { border-color: var(--primary); background: var(--primary-faint); color: var(--primary); }
.tt-pop-btn { margin-top: 8px; }
/* Điểm "Bạn đang ở đây" */
.tt-me { width: 18px; height: 18px; border-radius: 50%; background: #1f6fb2; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(31, 111, 178, .25); }

/* Giám sát */
.gs-map-wrap { padding: 0 16px 16px; }
.gs-map { height: 480px; border: 1px solid var(--border); }
.gs-route { padding: 10px 2px 0; }
.gs-sale-icon { background: none; border: 0; }
.gs-sale-dot { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); opacity: .65; }
.gs-sale-dot.is-on { opacity: 1; box-shadow: 0 0 0 5px rgba(35, 120, 74, .35), 0 2px 8px rgba(0, 0, 0, .3); }
.gs-c0 { background: #9b1c31; } .gs-c1 { background: #1f6fb2; } .gs-c2 { background: #23784a; } .gs-c3 { background: #c27c0e; }
.gs-c4 { background: #6d3fc0; } .gs-c5 { background: #0e8a8a; } .gs-c6 { background: #b4462d; } .gs-c7 { background: #4a5a6a; }
.gs-sale-name { position: absolute; top: 38px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 1px 6px; border-radius: 6px; background: #fff; font-size: 11px; font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.gs-num { background: none; border: 0; }
.gs-num span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #c27c0e; color: #fff; font-weight: 700; font-size: 12px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }

@media (max-width: 640px) {
  .tt-map { height: 300px; border-radius: 0; }
  .gs-map { height: 360px; }
  .gs-map-wrap { padding: 0 0 12px; }
  .tt-row { flex-direction: column; align-items: stretch; padding: 12px 14px; }
  .tt-row-actions { justify-content: flex-start; }
  .tt-row-actions .btn { flex: 1 1 auto; }
  .tt-now-actions { width: 100%; }
  .tt-now-actions .btn { flex: 1; }
}

/* =====================================================================
 *  CÀI ĐẶT → EMAIL: xem trước người nhận mail báo đơn
 * ===================================================================== */
.mail-to { margin-top: 14px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13.5px; }
.mail-to-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.mail-to-row > .muted:first-child { min-width: 120px; }
.mail-to .chip { font-size: 12.5px; }
.mail-to a { display: inline-block; margin-top: 10px; }

/* =====================================================================
   CHI TIẾT ĐƠN → Lịch sử thao tác + nút "Gửi lại mail báo đơn"
   ===================================================================== */
.card-head.log-head { padding: 0 0 12px; flex-wrap: wrap; }
.card-head.log-head h2 { margin: 0; }


/* =====================================================================
   TRANG ĐẶT HÀNG → Nhãn ưu đãi + giá niêm yết gạch ngang + tiết kiệm + báo giá thay đổi
   ===================================================================== */
.gia-niem-yet { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tag-giam { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--primary-faint); color: var(--primary); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tag-uudai { white-space: nowrap; }
.tiet-kiem { display: block; margin-top: 2px; color: var(--green); font-size: 12.5px; font-weight: 600; }
.cart-bar .tiet-kiem { color: var(--green); }
.gia-doi { display: inline-block; margin-top: 6px; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; line-height: 1.35; }
.gia-doi.gia-giam { color: var(--green); background: var(--green-bg); }
.gia-doi.gia-tang { color: var(--amber); background: var(--amber-bg); }

/* =====================================================================
   CHI TIẾT ĐƠN → Dòng hàng gọn trên điện thoại (bảng .don-items)
   Dòng 1: Tên SP ........ Thành tiền   ·   Dòng 2: mã · quy cách
   Dòng 3: 2 thùng · 5 lẻ · = 65 hộp × 22.680đ  CK 30%
   ===================================================================== */
@media (max-width: 700px) {
  .table-cards.don-items tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 2px; padding: 10px 16px; }
  .table-cards.don-items tbody tr::after { content: ''; order: 2; flex-basis: 100%; height: 0; }       /* xuống dòng sau Thành tiền */
  .table-cards.don-items tbody td { display: inline; width: auto; padding: 0; text-align: left; font-size: 13.5px; color: var(--muted); }
  .table-cards.don-items tbody td::before { content: none; }
  .table-cards.don-items td[data-label="Sản phẩm"] { order: 0; flex: 1 1 0; min-width: 0; color: var(--text); font-size: 15px; }
  .table-cards.don-items td[data-label="Sản phẩm"] small { font-size: 12.5px; text-align: left; margin-top: 1px; }
  .table-cards.don-items .td-tien { order: 1; margin-left: auto; color: var(--text); font-size: 15px; white-space: nowrap; }
  .table-cards.don-items .td-thung, .table-cards.don-items .td-le, .table-cards.don-items .td-sl, .table-cards.don-items .td-gia { order: 3; white-space: nowrap; }
  .table-cards.don-items .td-thung::after { content: ' thùng ·'; }
  .table-cards.don-items .td-le::after { content: ' lẻ ·'; }
  .table-cards.don-items .is-zero, .table-cards.don-items .td-thung.is-zero + .td-le { display: none; }   /* không thùng thì chỉ hiện tổng SL */
  .table-cards.don-items .td-thung:not(.is-zero) ~ .td-sl::before { content: '= '; }
  .table-cards.don-items .td-sl { color: var(--text); font-weight: 500; }
  .table-cards.don-items .td-gia::before { content: '× '; }
  .table-cards.don-items .td-gia small { display: inline; margin-left: 4px; }
  /* Tổng chưa VAT / Tổng cộng: hiện lại (khối Hoa hồng ẩn mọi tfoot trên điện thoại) */
  .table-cards.don-items tfoot { display: block; background: var(--surface-2); }
  .table-cards.don-items tfoot tr { padding: 8px 16px; }
  .table-cards.don-items tfoot td { padding: 0; border: 0; }
}

/* =====================================================================
   THỊ TRƯỜNG → GPS chính xác, khóa vị trí cửa hàng, yêu cầu sửa vị trí
   ===================================================================== */
.tt-gps .js-gps-me { margin-left: auto; flex-shrink: 0; }
.vt-hien { margin: 0 0 6px; font-size: 14px; word-break: break-word; }
.vt-gps { margin: 0 0 12px; }
.vt-note { margin: 0 0 12px; font-size: 13.5px; }
.vt-note[hidden], .js-vt-yc[hidden] { display: none; }
.tab-count-hot { background: var(--amber); color: #fff; }

/* =====================================================================
   THỊ TRƯỜNG ĐỢT 1 → Ca làm việc · Tuyến hôm nay · Điểm bán mới · Trang Tuyến bán hàng
   ===================================================================== */
.tt-ca { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 18px; margin-bottom: 14px; }
.tt-ca-main { display: flex; align-items: center; gap: 12px; flex: 1 1 260px; min-width: 0; }
.tt-ca-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.tt-ca.is-dang .tt-ca-dot { background: var(--green); box-shadow: 0 0 0 5px var(--green-bg); }
.tt-ca.is-chua { border-color: #f7dcb0; background: #fffaf2; }
.tt-ca.is-chua .tt-ca-dot { background: var(--amber); }
.tt-tuyen { flex-basis: 100%; display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 13.5px; }
.tt-tuyen > span { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tt-tuyen .icon { width: 15px; height: 15px; }
.dm-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.tuyen-thu { margin: 0 4px 4px 0; }
.tuyen-thu.is-today { background: var(--primary); color: #fff; }
.tuyen-progress { width: 90px; margin-bottom: 2px; }
.text-red { color: var(--red); }
.tuyen-thu-chon { display: flex; flex-wrap: wrap; gap: 6px; }
.tuyen-thu-chon .seg-item { padding: 8px 12px; min-width: 48px; justify-content: center; }
.tuyen-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tuyen-pick-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tuyen-list, .tuyen-chon { height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tuyen-kh { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13.5px; }
.tuyen-kh input { margin-top: 3px; accent-color: var(--primary); flex-shrink: 0; }
.tuyen-chon { margin: 0; padding: 0 0 0 30px; }
.tuyen-chon li { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.tuyen-chon-btn { display: flex; gap: 2px; flex-shrink: 0; }
.tuyen-chon-btn .icon-btn { width: 28px; height: 28px; font-size: 13px; }
@media (max-width: 700px) {
  .tuyen-pick { grid-template-columns: 1fr; }
  .tuyen-list, .tuyen-chon { height: 200px; }
  .tt-ca .btn { flex: 1 1 100%; }
}
/* ===== NHÓM CHIẾT KHẤU: trạng thái, thời gian, nút Lưu/Hủy luôn hiện ===== */
.ck-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.ck-time { display: flex; align-items: center; gap: 6px; margin: -4px 0 0; }
.ck-time .icon { width: 15px; height: 15px; flex-shrink: 0; }
.ck-card.is-paused .ck-pct { background: var(--gray); }
.ck-card.is-paused .ck-card-head h2 { color: var(--gray); }
.ck-time-hint { margin: 6px 0 14px; }
/* Hộp thoại dài: phần thân cuộn, đầu + nút Lưu/Hủy cố định */
.modal-xl { padding: 0; display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.modal-xl .modal-body { flex: 1 1 auto; min-height: 0; }
.modal-xl .modal-actions { flex-shrink: 0; margin: 0; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 18px 18px; }
@supports (height: 100dvh) { .modal-xl { max-height: calc(100dvh - 40px); } }

/* =====================================================================
 *  SaaS: TRANG THÔNG BÁO (không tìm thấy / khóa / hết hạn) – includes/thong_bao.php
 * ===================================================================== */
.saas-msg-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.saas-msg { width: 100%; max-width: 460px; margin: 0; }
.saas-msg p { margin-top: 6px; }
.text-danger { color: var(--red); }

/* =====================================================================
 *  SaaS: ADMIN NHÀ CUNG CẤP (sale.hanixa.vn/admin) – dùng lại khung quản lý, chỉ thêm phần riêng
 * ===================================================================== */
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.pf-form .pad + .card-head { border-top: 1px solid var(--border); }
.pf-form .modal-actions { margin-top: 0; border-top: 1px solid var(--border); }
.pf-check { margin: 14px 0 4px; white-space: normal; }
.pf-chips { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 10px 0 4px; }
.pf-slug { display: flex; align-items: stretch; }
.pf-slug .input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.pf-slug-duoi { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); color: var(--muted); font-size: 14px; white-space: nowrap; }
.pf-dns { margin-top: 4px; }
.pf-info { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 12px 0 16px; }
.pf-info dt { color: var(--muted); font-size: 14px; }
.pf-info dd { margin: 0; font-weight: 600; word-break: break-all; }
.pf-list { display: flex; flex-direction: column; padding: 0 12px 12px; }
.pf-list-item { display: flex; flex-direction: column; padding: 10px 8px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none !important; }
.pf-list-item:hover { background: var(--primary-faint); }
.pf-log { list-style: none; margin: 0; padding: 0; }
.pf-log li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pf-log li:last-child { border-bottom: 0; }
.pf-goi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.pf-goi { margin: 0; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.pf-goi.is-paused { opacity: .7; }
.pf-goi-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.pf-goi-gia { font-size: 20px; color: var(--primary); }
.pf-post-row { display: flex; align-items: center; gap: 12px; }
.pf-post-thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }

/* =====================================================================
 *  SaaS: TRANG GIỚI THIỆU (sale.hanixa.vn) – gioi-thieu/index.php
 * ===================================================================== */
.lp-body { background: var(--surface); }
.lp-wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.lp-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.lp-header-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }
.lp-logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 18px; text-decoration: none !important; }
.lp-logo .brand-logo { width: 38px; height: 38px; border-radius: 10px; }
.lp-nav { display: flex; align-items: center; gap: 22px; }
.lp-nav a:not(.btn) { color: var(--text); font-weight: 500; }
.lp-hero { padding: 72px 0 64px; background: linear-gradient(180deg, var(--primary-faint), var(--surface)); }
.lp-hero-in { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.lp-hero h1 { font-size: 40px; line-height: 1.2; margin: 12px 0 16px; }
.lp-eyebrow { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600; }
.lp-lead { font-size: 17px; color: var(--muted); }
.lp-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.lp-tim { display: flex; flex-direction: column; gap: 10px; padding: 22px; margin: 0; }
.lp-tim-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lp-section { padding: 64px 0; }
.lp-alt { background: var(--bg); }
.lp-h2 { font-size: 28px; font-weight: 700; margin-bottom: 28px; }
.lp-head-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.lp-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.lp-feature { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.lp-feature h3 { margin: 14px 0 6px; }
.lp-feature-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); }
.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 0; padding: 0; list-style: none; counter-reset: buoc; }
.lp-steps li { display: flex; flex-direction: column; gap: 6px; padding: 24px; border-radius: var(--radius); background: var(--surface); counter-increment: buoc; }
.lp-steps li::before { content: counter(buoc); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; }
.lp-prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; align-items: stretch; }
.lp-price { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 28px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.lp-price.is-hot { border: 2px solid var(--primary); box-shadow: var(--shadow-lg); }
.lp-price-tag { position: absolute; top: -12px; right: 20px; padding: 3px 12px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; }
.lp-price-num { font-size: 30px; margin-top: 10px; }
.lp-price-list { list-style: none; margin: 14px 0 20px; padding: 0; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.lp-price-list li { display: flex; gap: 8px; align-items: flex-start; }
.lp-price-list .icon { width: 18px; height: 18px; color: var(--green); flex-shrink: 0; margin-top: 2px; }
.lp-posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.lp-post { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); color: var(--text); text-decoration: none !important; }
.lp-post:hover { box-shadow: var(--shadow); }
.lp-post img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.lp-post-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 20px; }
.lp-dk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 40px; align-items: start; }
.lp-dk p { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.lp-form { margin: 0; }
.lp-form .btn-block { margin-top: 16px; }
.lp-bay { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.lp-ok { padding: 16px; border-radius: var(--radius-sm); background: var(--green-bg); color: var(--green); }
.lp-ok p { margin-top: 8px; color: var(--text); line-height: 1.8; }
.lp-footer { padding: 32px 0; border-top: 1px solid var(--border); background: var(--bg); }
.lp-footer-in { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.lp-article { max-width: 760px; padding-top: 40px; padding-bottom: 64px; }
.lp-article h1 { font-size: 34px; margin: 16px 0 8px; }
.lp-back { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.lp-article-img { width: 100%; border-radius: var(--radius); margin: 20px 0; }
.lp-content { font-size: 16.5px; line-height: 1.75; }
.lp-content p, .lp-content ul { margin: 0 0 16px; }
.lp-content h2 { font-size: 22px; margin: 28px 0 12px; }
.lp-cta-box { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding: 20px 24px; border-radius: var(--radius); background: var(--primary-faint); }

@media (max-width: 900px) {
  .lp-hero-in, .lp-dk { grid-template-columns: 1fr; gap: 28px; }
  .lp-features, .lp-posts, .lp-steps { grid-template-columns: 1fr; }
  .lp-hero { padding: 40px 0; }
  .lp-hero h1 { font-size: 30px; }
  .lp-nav a:not(.btn) { display: none; }
  .lp-section { padding: 44px 0; }
  .form-row-3 { grid-template-columns: 1fr; gap: 0; }
}