/* Trang quản trị shop — giao diện sáng, màu nhấn cam. */
:root {
  --accent: #ff5f0a;
  --accent-dark: #e04f00;
  --accent-soft: #fff1e8;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #6b7280;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --info: #2563eb;
  --info-soft: #e8f0fe;
  --violet: #7c3aed;
  --violet-soft: #f1eafe;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --sidebar-w: 232px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
p { margin: 0 0 8px; }
code, pre, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
pre { white-space: pre-wrap; word-break: break-word; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pre-line { white-space: pre-line; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.break { word-break: break-word; overflow-wrap: anywhere; }

/* ---------- Nút & ô nhập ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 7px 14px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-danger { background: var(--surface); border-color: #f3b4b4; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { background: #12843c; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font-size: 18px; cursor: pointer;
}
.icon-btn:hover { background: #f1f2f4; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

input[type=text], input[type=password], input[type=number], input[type=search], input[type=email], input[type=tel], input[type=date], input[type=month], select, textarea {
  width: 100%; padding: 8px 10px; min-height: 38px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: #fff; color: var(--text); font: inherit;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .icon-btn:focus-visible, .nav-item:focus-visible {
  outline: 2px solid rgba(255, 95, 10, .35); outline-offset: 1px; border-color: var(--accent);
}
.field { display: block; margin-bottom: 14px; }
.field > span:first-child { display: block; font-weight: 600; margin-bottom: 5px; }
.field .hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; font-weight: 400; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; margin-bottom: 12px; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pill span {
  display: inline-block; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  cursor: pointer; background: #fff;
}
.radio-pill input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.radio-pill input:focus-visible + span { outline: 2px solid rgba(255, 95, 10, .35); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 10px; border-radius: 8px; }

/* ---------- Đăng nhập ---------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #fff4ec 0%, var(--bg) 60%); }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border-radius: 14px; padding: 28px 24px; box-shadow: var(--shadow-lg); }
.login-card .brand { margin-bottom: 8px; }
.login-card p.muted { margin-bottom: 18px; }

/* ---------- Khung trang ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; min-width: 0; }
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-lg { font-size: 20px; }
.brand-logo {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border-radius: 9px; background: var(--accent); color: #fff; font-size: 17px;
}
.layout { min-height: 100vh; }
.topbar { display: none; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px;
  overflow-y: auto;
}
.sidebar-brand { padding: 4px 8px 16px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--text); font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.nav-item:hover { background: #f4f5f7; text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.nav-ico { width: 22px; text-align: center; font-size: 16px; flex: none; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center;
}
.logout { color: var(--muted); margin-top: 8px; border-top: 1px solid var(--border); border-radius: 0; padding-top: 12px; }
.backdrop { display: none; }
.main { margin-left: var(--sidebar-w); padding: 24px 28px 48px; min-width: 0; }
.page { max-width: 1200px; margin: 0 auto; }
.loading, .empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 2px 0 0; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.grid { display: grid; gap: 16px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section { margin-top: 16px; }

/* ---------- Thanh lọc ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 240px; max-width: 360px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: #fff;
  font: inherit; font-size: 13px; cursor: pointer; color: var(--text); white-space: nowrap;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

/* ---------- Bảng ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { background: #fafafa; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.clickable:hover { background: #fffaf6; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl td.actions { text-align: right; white-space: nowrap; }
.tbl td.actions .btn + .btn { margin-left: 4px; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12px; }
.card .table-wrap { box-shadow: none; }

/* ---------- Nhãn trạng thái ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #f1f2f4; color: var(--muted); }
.st-pending { background: var(--warn-soft); color: var(--warn); }
.st-paid { background: var(--info-soft); color: var(--info); }
.st-delivered { background: var(--ok-soft); color: var(--ok); }
.st-cancelled, .st-expired { background: #f1f2f4; color: var(--muted); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }
.b-accent { background: var(--accent-soft); color: var(--accent-dark); }
.b-violet { background: var(--violet-soft); color: var(--violet); }

/* ---------- Tổng quan ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; display: block; color: inherit; }
a.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.stat-sub { color: var(--muted); font-size: 12px; }
.stat.hl { background: linear-gradient(135deg, var(--accent) 0%, #ff8a3d 100%); border-color: transparent; color: #fff; }
.stat.hl .stat-label, .stat.hl .stat-sub { color: rgba(255, 255, 255, .88); }
.stat.alert .stat-value { color: var(--accent-dark); }
.conn { display: flex; flex-wrap: wrap; gap: 8px; }
.conn-item { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: #f4f5f7; font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #c4c8cf; flex: none; display: inline-block; }
.dot.on { background: var(--ok); }
.dot.off { background: #c4c8cf; }
.chart { display: flex; align-items: flex-end; gap: 10px; height: 210px; padding-top: 22px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bar-val { font-size: 11px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; }
.bar { width: 100%; max-width: 46px; border-radius: 6px 6px 2px 2px; background: #ffd2b8; min-height: 3px; transition: height .3s; }
.bar.today { background: var(--accent); }
.bar-label { font-size: 12px; color: var(--muted); margin-top: 6px; white-space: nowrap; text-align: center; line-height: 1.3; }
.bar-label b { color: var(--accent-dark); font-weight: 600; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rank { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; font-size: 12px; display: inline-grid; place-items: center; flex: none; }

/* ---------- Hộp thoại ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(17, 24, 39, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); }
.modal-wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; overflow-wrap: anywhere; }
.modal-body { padding: 18px; overflow-y: auto; overflow-x: hidden; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 8px 14px; margin: 0 0 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.box { background: #f8f9fb; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; max-height: 220px; overflow: auto; }

/* ---------- Thông báo ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 380px; border-left: 4px solid var(--ok); animation: toast-in .2s ease-out; overflow-wrap: anywhere; }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--info); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Gửi tin hàng loạt ---------- */
.progress { height: 8px; border-radius: 999px; background: #eef0f3; overflow: hidden; display: flex; min-width: 120px; }
.progress .p-sent { background: var(--ok); }
.progress .p-failed { background: var(--danger); }
.progress-text { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.clip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; overflow-wrap: anywhere; max-width: 420px; }

/* ---------- Chat ---------- */
.chat { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100vh - 150px); min-height: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; min-width: 0; }
.chat-item { display: flex; gap: 10px; align-items: flex-start; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--border); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.chat-item:hover { background: #fafafa; }
.chat-item.active { background: var(--accent-soft); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #ffe2d1; color: var(--accent-dark); font-weight: 700; display: grid; place-items: center; flex: none; text-transform: uppercase; }
.chat-item-body { flex: 1; min-width: 0; }
.chat-item-top { display: flex; justify-content: space-between; gap: 8px; }
.chat-item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-time { color: var(--muted); font-size: 11px; white-space: nowrap; flex: none; }
.chat-item-last { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.chat-item-last span { overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .chat-item-name, .chat-item.unread .chat-item-last { color: var(--text); font-weight: 700; }
.unread-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); min-height: 56px; }
.chat-head .grow { flex: 1; min-width: 0; }
.chat-head .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-back { display: none; }
.messages { flex: 1; overflow-y: auto; padding: 16px; background: #f7f8fa; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 72%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0, 0, 0, .04); }
.msg-meta { display: block; font-size: 11px; margin-top: 3px; opacity: .75; }
.msg-in { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-out { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg-ai { align-self: flex-end; background: var(--violet-soft); color: #3b1d78; border: 1px solid #ddd0fb; border-bottom-right-radius: 4px; }
.msg-day { align-self: center; font-size: 12px; color: var(--muted); background: #eceef1; padding: 2px 10px; border-radius: 999px; margin: 6px 0; }
.reply { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); align-items: flex-end; }
.reply textarea { min-height: 42px; max-height: 140px; resize: none; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--muted); padding: 24px; text-align: center; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }

/* ---------- Cài đặt ---------- */
.qr-preview { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.qr-preview img { width: 180px; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.sticky-save { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 16px 0 4px; display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- Điện thoại ---------- */
/* Hàng tiền: doanh thu, lãi, chi phí (5 ô). */
.stats.money { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1024px) {
  .stats, .stats.money { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .topbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20;
    height: 54px; padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .topbar .brand { font-size: 15px; }
  .topbar .brand-logo { width: 28px; height: 28px; font-size: 15px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; width: min(280px, 84vw); }
  .menu-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-open .backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(17, 24, 39, .4); }
  .main { margin-left: 0; padding: 16px 16px 40px; }
  .page-head h1 { font-size: 19px; }
  .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { gap: 10px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 18px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
  .chart { gap: 5px; height: 170px; }
  .bar-val { font-size: 10px; }
  .bar-label { font-size: 11px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal, .modal-wide { max-width: none; max-height: 92vh; border-radius: 14px 14px 0 0; }
  .modal-foot .btn { flex: 1 1 auto; }

  /* Bảng thành thẻ */
  .table-wrap.cards, .table-wrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 12px; margin-bottom: 10px; }
  .tbl td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 0; padding: 5px 0; text-align: right; min-width: 0; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex: none; max-width: 45%; }
  .tbl td > * { min-width: 0; overflow-wrap: anywhere; }
  .tbl td.num { white-space: normal; }
  .tbl td.actions { justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
  .tbl td.actions::before { content: none; }
  .tbl td.hide-mobile { display: none; }
  .tbl td.primary { font-size: 15px; justify-content: flex-start; text-align: left; }
  .tbl td.primary::before { content: none; }
  .clip { max-width: none; text-align: right; }

  /* Chat: một cột, chuyển qua lại danh sách / hội thoại */
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 54px - 110px); min-height: 380px; }
  .chat.has-active .chat-list { display: none; }
  .chat:not(.has-active) .chat-pane { display: none; }
  .chat-list { border-right: 0; }
  .chat-back { display: inline-flex; }
  .msg { max-width: 86%; }
}

/* Số liệu nhanh trong form sửa sản phẩm */
.product-numbers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.pn { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.pn-label { display: block; color: var(--muted); font-size: 12px; }
.pn-value { display: block; font-size: 18px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
@media (max-width: 768px) {
  .product-numbers { gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pn { padding: 8px 10px; }
  .pn-value { font-size: 15px; white-space: nowrap; overflow-wrap: normal; }
}

/* Số dư khách */
.wallet-box { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 18px; display: grid; gap: 12px; }
.wallet-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.wallet-balance { font-size: 24px; font-weight: 700; color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.wallet-form { display: grid; grid-template-columns: auto minmax(0, 160px) minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.wallet-form input[type=number], .wallet-form input[type=text] { min-width: 0; }
.wallet-logs summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.wallet-logs[open] summary { margin-bottom: 8px; }
.text-ok { color: #16a34a; }
.text-danger { color: #dc2626; }
@media (max-width: 768px) {
  .wallet-form { grid-template-columns: minmax(0, 1fr); }
}
.text-accent { color: var(--accent-dark); }
/* Tài khoản & nhân viên */
.nav-item.account { margin-top: 6px; }
.account-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.account-text > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.login-help { margin: 12px 0 0; text-align: center; }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; margin-top: 6px; }
.perm-grid .check { margin-bottom: 8px; font-weight: 400; }
.perm-list { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px;
  border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; }
@media (max-width: 768px) { .perm-grid { grid-template-columns: minmax(0, 1fr); } }
.dot-alert { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #dc2626; margin-right: 6px; vertical-align: middle; box-shadow: 0 0 0 3px rgba(220, 38, 38, .15); }
.dot-alert.warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }
.tier-list { display: grid; gap: 6px; margin: 4px 0 8px; }
.tier-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tier-row input { width: 80px; }
.tier-row select { flex: 1 1 260px; width: auto; min-width: 0; }
input[readonly] { font-weight: 700; cursor: default; }
.sold-content { display: flex; gap: 8px; align-items: flex-start; min-width: 220px; }
.sold-content .box { margin: 0; flex: 1; min-width: 0; max-height: 120px; overflow: auto; white-space: pre-wrap; word-break: break-all; font-size: 12px; }
.toolbar .search.search-wide { max-width: none; flex: 1 1 320px; }
.toolbar select[data-product] { width: auto; flex: 0 1 260px; min-width: 0; }
@media (max-width: 768px) { .toolbar select[data-product] { flex-basis: 100%; } }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.inline-field input { width: auto; }
