/* Giao diện kiểu phần mềm salon EasySalon (menu trái xanh đậm #182C4F, mục chọn #1A9AFF, nút chính #0C66FF,
   nền #F1F2F4, bo góc 4px, phông hệ thống 14px) — chỉ học bố cục và màu, không dùng tên / logo của họ.
   Màu chính đổi được trong Cài đặt → biến --primary. */
:root {
  --primary: #0c66ff;
  --primary-50: #ebf5ff;
  --primary-700: #0048d9;
  --bg: #f1f2f4;
  --card: #ffffff;
  --text: #1f2a3d;
  --muted: #6b7686;
  --line: #e8e8e8;
  --line-strong: #d9d9d9;
  --ok: #0a8f63;
  --ok-bg: #e3f7ef;
  --pay: #0bb07b;
  --pay-700: #089268;
  --side-bg: #182c4f;
  --side-on: #1a9aff;
  --warn: #b45d00;
  --warn-bg: #fff3e0;
  --bad: #e02424;
  --bad-bg: #fdecec;
  --info-bg: #eef4ff;
  --side: #ffffff;
  --side-w: 236px;
  --top-h: 56px;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif; line-height: 1.5; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bold { font-weight: 600; }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); } .warn-t { color: var(--warn); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.mt { margin-top: 12px; } .mt2 { margin-top: 20px; } .mb { margin-bottom: 12px; }

/* ---------- Khung ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side-bg); border-right: 0; color: #fff;
  display: flex; flex-direction: column; z-index: 30;
}
.brand { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand .logo { width: 32px; height: 32px; border-radius: 4px; background: var(--side-on); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; overflow: hidden; }
.brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.brand .name { font-weight: 600; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: #fff; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { flex: 1; overflow-y: auto; padding: 6px 0; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.2) transparent; }
.nav .group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.45); padding: 14px 20px 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px; color: rgba(255,255,255,.85); text-decoration: none !important; font-weight: 400; position: relative;
}
.nav a svg { width: 18px; height: 18px; flex: none; color: rgba(255,255,255,.75); }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--side-on); color: #fff; }
.nav a.active svg { color: #fff; }
.nav .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 6px; font-weight: 600; }
.side-foot { border-top: 1px solid rgba(255,255,255,.08); padding: 12px 20px; font-size: 12.5px; color: rgba(255,255,255,.7) !important; }
.topbar {
  position: fixed; left: var(--side-w); right: 0; top: 0; height: var(--top-h); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 20px; z-index: 20;
}
.topbar .search { flex: 1; max-width: 520px; position: relative; }
.topbar .search input { width: 100%; padding: 6px 12px 6px 34px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; min-height: 34px; }
.topbar .search svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--muted); }
.topbar .search .results { position: absolute; top: 40px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 360px; overflow: auto; }
.topbar .who { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #dfe7f5; color: var(--primary-700); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.main { margin-left: var(--side-w); padding: calc(var(--top-h) + 20px) 24px 40px; max-width: 1480px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin-right: auto; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 6px; white-space: nowrap; }
.back svg { width: 16px; height: 16px; }
/* Cột trong lưới được phép co lại — không thì nội dung dài đẩy tràn ngang trên điện thoại */
.pos > *, .profile > *, .grid > *, .kpis > *, .todo > *, .chat > * { min-width: 0; }
.cart-bar { display: none; }

/* ---------- Thẻ, nút, ô nhập ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin-right: auto; }
.card-b { padding: 16px; }
.card-b.tight { padding: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 15px; border-radius: 4px; border: 1px solid var(--line-strong);
  background: #fff; cursor: pointer; font-weight: 500; white-space: nowrap; min-height: 36px; text-decoration: none !important; color: var(--text);
}
.btn:hover { background: #fff; border-color: #3686ff; color: #3686ff; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #3686ff; border-color: #3686ff; color: #fff; }
.btn-danger { color: var(--bad); border-color: #f0b8b8; }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn-lg { padding: 11px 20px; min-height: 46px; font-size: 15px; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.btn-block { width: 100%; }
label.f { display: block; }
label.f > span { display: block; font-size: 12.5px; color: #4b5563; margin-bottom: 4px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; padding: 6px 11px; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; min-height: 36px;
}
textarea.input { resize: vertical; min-height: 70px; }
.input:focus { outline: 0; box-shadow: 0 0 0 2px rgba(12,102,255,.2); border-color: #3686ff; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { width: 16px; height: 16px; }

/* ---------- Bảng ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 500; font-size: 13px; color: #364866; background: #fafafa; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover { background: #f8fafd; }
table.t tfoot td { font-weight: 600; background: #fafbfc; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #eef0f3; color: #3b4452; white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-info { background: var(--info-bg); color: var(--primary-700); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 4px; background: #f0f1f4; font-size: 12px; margin: 0 4px 4px 0; }

/* ---------- Thanh lọc, tab ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: #4b5563; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--primary-700); border-bottom-color: var(--primary); }
.tabs .n { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: #eef0f3; font-size: 12px; }
.tabs button.on .n { background: var(--primary); color: #fff; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; }
.toolbar .input { width: auto; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 16px; border-top: 1px solid var(--line); }

/* ---------- Ô số ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi .l { color: var(--muted); font-size: 12.5px; }
.kpi .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12px; margin-top: 2px; }
.todo { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.todo a { display: flex; gap: 12px; align-items: center; padding: 14px 16px; text-decoration: none; color: var(--text); }
.todo a:hover { background: #fafbfd; }
.todo .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.todo .ic svg { width: 20px; height: 20px; }
.todo .big { font-size: 20px; font-weight: 700; line-height: 1.1; }
.todo.hot a { border-left: 3px solid var(--bad); }

/* ---------- Hộp thoại, thông báo ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 4px; width: 100%; max-width: 560px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal.wide { max-width: 860px; }
.modal-h { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.modal-h h2 { margin-right: auto; }
.modal-b { padding: 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.x { background: none; border: 0; cursor: pointer; padding: 4px; color: var(--muted); font-size: 20px; line-height: 1; }
.toasts { position: fixed; right: 16px; top: 70px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { background: #1f2937; color: #fff; padding: 10px 14px; border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.bad { background: var(--bad); }
.toast.ok { background: var(--ok); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.loading { padding: 30px; text-align: center; color: var(--muted); }
.alert { padding: 10px 14px; border-radius: 8px; background: var(--info-bg); border: 1px solid #cddcf8; }
.alert.warn { background: var(--warn-bg); border-color: #f5d3a6; }
.alert.bad { background: var(--bad-bg); border-color: #f2c0c0; }

/* ---------- Lịch hẹn ---------- */
.cal { position: relative; overflow: auto; max-height: calc(100vh - 230px); }
.cal-grid { display: grid; min-width: 100%; }
.cal-head { position: sticky; top: 0; z-index: 3; background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; padding: 8px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-time { position: sticky; left: 0; z-index: 2; background: #fff; font-size: 12px; color: var(--muted); text-align: right; padding-right: 6px; border-right: 1px solid var(--line); }
.cal-col { position: relative; border-right: 1px solid var(--line); }
.cal-slot { border-bottom: 1px dashed #edf0f3; cursor: pointer; }
.cal-slot.hour { border-bottom: 1px solid #e6e9ed; }
.cal-slot:hover { background: #f5f9ff; }
.appt { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 4px 6px; font-size: 12px; overflow: hidden; cursor: pointer; border-left: 4px solid; background: #eef4ff; box-shadow: 0 1px 2px rgba(0,0,0,.08); z-index: 1; }
.appt b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt .s { color: #4b5563; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.st-arrived, .appt.st-in_service { background: #fff7e6; }
.appt.st-done { background: #e9f7ef; opacity: .85; }
.appt.st-cancelled, .appt.st-no_show { background: #f3f4f6; opacity: .6; text-decoration: line-through; }
.now-line { position: absolute; left: 0; right: 0; border-top: 2px solid var(--bad); z-index: 2; pointer-events: none; }
.appt-list .it { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.appt-list .it:hover { background: #fafbfd; }
.appt-list .tm { width: 56px; font-weight: 700; flex: none; }

/* ---------- Thu ngân ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.svc { border: 1px solid var(--line); border-radius: 8px; padding: 10px; cursor: pointer; background: #fff; text-align: left; min-height: 70px; }
.svc:hover { border-color: var(--primary); background: var(--primary-50); }
.svc .n { font-weight: 600; font-size: 13.5px; }
.svc .p { color: var(--primary-700); font-weight: 600; margin-top: 4px; }
.cart-line { padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 6px; }
.qty button { border: 0; background: none; width: 28px; height: 28px; cursor: pointer; font-size: 16px; }
.qty span { min-width: 24px; text-align: center; }
.sum-row { display: flex; justify-content: space-between; padding: 4px 0; }
.sum-row.total { font-size: 19px; font-weight: 700; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
.paybox .input { text-align: right; font-variant-numeric: tabular-nums; }
.sticky-pay { position: sticky; top: calc(var(--top-h) + 16px); }

/* ---------- Thu ngân 3 cột (kiểu EasySalon) ---------- */
.pos-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pos-head h1 { font-size: 20px; font-weight: 500; margin-right: 6px; }
.pos-head select.input { width: auto; max-width: 230px; }
.pos-when { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.pos-when svg { width: 16px; height: 16px; }
.pos-when .input { width: 200px; }
.pos3 { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: stretch; }
.pos3 > * { min-width: 0; }
.pos-bill { display: flex; flex-direction: column; min-height: calc(100vh - var(--top-h) - 110px); }
.pos-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; padding: 0 8px; }
.pos-tabs::-webkit-scrollbar { display: none; }
.pos-tab { display: inline-flex; align-items: center; gap: 6px; padding: 12px 10px 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; color: #364866; max-width: 220px; }
.pos-tab .nm { overflow: hidden; text-overflow: ellipsis; }
.pos-tab .n { background: #eef0f3; border-radius: 10px; font-size: 11.5px; padding: 0 6px; }
.pos-tab.on { color: var(--text); font-weight: 600; border-bottom-color: var(--primary); }
.pos-tab.on .n { background: var(--primary); color: #fff; }
.pos-tab .x { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 3px; }
.pos-tab .x:hover { background: #f1f2f4; color: var(--bad); }
.pos-cust { padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.cust-on, .cust-off { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cust-on .cn { font-weight: 600; font-size: 15px; }
.cust-on .cph { display: inline-flex; align-items: center; gap: 4px; color: #364866; }
.cust-on .cph svg { width: 15px; height: 15px; }
.cust-off .ico { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 4px; background: #fff; color: var(--muted); flex: none; }
.cust-off .ico svg { width: 17px; height: 17px; }
.pos-debt { display: flex; align-items: center; gap: 10px; margin: 10px 16px 0; padding: 8px 12px; background: #fff8e6; border: 1px solid #ffd77a; border-radius: 4px; color: #7a4b00; }
.pos-debt svg { width: 17px; height: 17px; flex: none; }
.pos-note { margin: 10px 16px 0; }
.pos-lines { flex: 1 1 auto; padding: 8px 16px; overflow: auto; }
table.pos-t td { vertical-align: middle; }
table.pos-t th { background: #fff; color: var(--muted); font-weight: 400; }
.pos-nm { font-weight: 500; }
.qty-in { width: 72px; text-align: center; }
.price-in { width: 110px; text-align: right; }
.c-qty { width: 90px; } .c-disc { width: 170px; } .c-rm { width: 44px; text-align: right; }
.disc-in { display: inline-flex; }
.disc-in .input { width: 92px; text-align: right; border-radius: 4px 0 0 4px; }
.disc-in select.input { width: 58px; border-left: 0; border-radius: 0 4px 4px 0; padding: 6px 4px; text-align: left; }
.disc-in.sm .input { width: 80px; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid #f5b5b5; border-radius: 4px; background: #fff; color: var(--bad); cursor: pointer; }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--bad-bg); }
.icon-btn[disabled] { opacity: .35; pointer-events: none; }
.pos-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 48px 16px; color: var(--muted); text-align: center; }
.pos-empty svg { width: 40px; height: 40px; color: #c9ced6; }
.pos-foot { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 16px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: end; }
.pos-foot textarea { min-height: 64px; }
.pos-sum .r, .pay-sum .r { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; }
.pos-sum .r > span:first-child, .pay-sum .r > span:first-child { color: #364866; }
.pos-sum .r .num { min-width: 90px; }
.pos-sum .tot { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-size: 18px; font-weight: 700; }
.pos-sum .tot > span:first-child { color: var(--text); }
.pos-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: #fff; border-radius: 0 0 4px 4px; }
.pos-actions .btn { min-height: 40px; }
.btn-danger-o { color: var(--bad); border-color: #f0a3a3; }
.btn-danger-o:hover { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.btn-outline-p { color: var(--primary); border-color: #8fb8ff; }
.btn-outline-p:hover { background: var(--primary-50); }
.btn-outline-o { color: #c76e00; border-color: #ffc46b; }
.btn-outline-o:hover { background: #fff6e6; color: #c76e00; border-color: #ffad0d; }
.btn-pay { background: var(--pay); border-color: var(--pay); color: #fff; font-weight: 600; }
.btn-pay:hover { background: var(--pay-700); border-color: var(--pay-700); color: #fff; }
.btn-pay[disabled] { background: #9fe3c9; border-color: #9fe3c9; opacity: 1; }
.pos-menu { display: flex; flex-direction: column; position: sticky; top: calc(var(--top-h) + 16px); max-height: calc(100vh - var(--top-h) - 32px); }
.pos-find { position: relative; padding: 12px 12px 8px; }
.pos-find svg { position: absolute; right: 22px; top: 21px; width: 16px; height: 16px; color: var(--muted); }
.pos-find .input { padding-right: 34px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; margin: 0 12px 8px; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 7px 6px; cursor: pointer; color: #364866; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: #fff; }
.pos-cats { flex: 1 1 auto; overflow-y: auto; padding: 0 12px 8px; }
.cat-g { border-bottom: 1px dashed var(--line); }
.cat-h { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 12px 2px; border: 0; background: none; cursor: pointer; color: #364866; font-size: 13.5px; letter-spacing: .02em; text-align: left; }
.cat-h .pm { width: 22px; height: 22px; border-radius: 50%; background: #c9ced6; color: #fff; display: grid; place-items: center; font-size: 16px; line-height: 1; flex: none; }
.cat-items { display: grid; gap: 8px; padding-bottom: 12px; }
.svc2 { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 10px 14px; cursor: pointer; box-shadow: 0 1px 3px rgba(10,31,68,.06); }
.svc2 .n { font-size: 14px; color: var(--text); }
.svc2 .p { font-size: 13px; color: #364866; margin-top: 4px; font-variant-numeric: tabular-nums; }
.svc2:hover { border-color: #8fb8ff; }
.svc2.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.pos-menu-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; border-top: 1px solid var(--line); }
/* Hộp thanh toán / thu nợ / xếp nhân viên */
.pay-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.pay-need { text-align: right; }
.pay-need span { display: block; color: var(--muted); font-size: 12.5px; }
.pay-need b { font-size: 24px; font-variant-numeric: tabular-nums; }
.pay-rows { display: grid; gap: 8px; margin-bottom: 8px; }
.pay-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 34px; gap: 8px; align-items: center; }
.pay-row [data-v] { text-align: right; font-size: 15px; }
.pay-hint { margin: -4px 42px 0 178px; text-align: right; }
.pay-sum { margin-top: 12px; padding: 10px 12px; background: #f8f9fb; border-radius: 4px; }
.pay-debt { margin-top: 6px; padding: 8px 10px; background: #fff8e6; border: 1px solid #ffd77a; border-radius: 4px; width: 100%; }
.f-l { font-size: 12.5px; color: #4b5563; font-weight: 500; margin-bottom: 6px; }
.debt-list { display: grid; gap: 4px; max-height: 180px; overflow: auto; }
.debt-it { display: flex; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }
.staff-all { display: flex; gap: 8px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.staff-rows { display: grid; gap: 10px; }
.staff-row { display: flex; align-items: center; gap: 10px; }
.staff-row select.input { width: 210px; flex: none; }

/* ---------- Hồ sơ khách ---------- */
.profile { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.kv { margin: 0; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 6px 10px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.timeline .ev { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.timeline .ev:last-child { border-bottom: 0; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex: none; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photos .ph { position: relative; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 3/4; background: #f3f4f6; }
.photos img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.photos .lb { position: absolute; left: 6px; top: 6px; }
.photos .del { position: absolute; right: 4px; top: 4px; background: rgba(255,255,255,.9); border: 0; border-radius: 6px; cursor: pointer; padding: 2px 6px; }
.stat3 { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; border-top: 1px solid var(--line); }
.stat3 > div { padding: 10px 4px; }
.stat3 > div + div { border-left: 1px solid var(--line); }
.stat3 .v { font-weight: 700; font-size: 15px; }

/* ---------- Hội thoại ---------- */
.chat { display: grid; grid-template-columns: 330px minmax(0, 1fr) 280px; height: calc(100vh - var(--top-h) - 80px); min-height: 480px; }
.chat .list { border-right: 1px solid var(--line); overflow-y: auto; }
.chat .conv { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.chat .conv.on { background: var(--primary-50); }
.chat .conv .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .conv .p { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat .conv.unread .t { color: var(--text); }
.chat .conv.unread .p { color: var(--text); font-weight: 600; }
.chat .pane { display: flex; flex-direction: column; min-width: 0; }
.chat .msgs { flex: 1; overflow-y: auto; padding: 16px; background: #f7f8fa; }
.bubble { max-width: 72%; padding: 8px 12px; border-radius: 14px; margin: 4px 0; white-space: pre-wrap; word-break: break-word; }
.bubble.in { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble.out { background: var(--primary); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.bubble.out.failed { background: var(--bad-bg); color: var(--bad); border: 1px solid #f2c0c0; }
.bubble .meta { font-size: 11px; opacity: .75; margin-top: 2px; }
.bubble img { max-width: 220px; border-radius: 8px; display: block; margin-top: 4px; }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: #fff; }
.composer textarea { flex: 1; min-height: 42px; max-height: 140px; }
.chat .side { border-left: 1px solid var(--line); overflow-y: auto; padding: 14px; }
.ch-ic { width: 16px; height: 16px; border-radius: 4px; display: inline-grid; place-items: center; color: #fff; font-size: 10px; font-weight: 700; flex: none; }
.ch-fb { background: #1877f2; } .ch-zalo { background: #0068ff; }

/* ---------- Đăng nhập ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, #eef3fb, #f6f7f9); }
.auth .card { width: 100%; max-width: 420px; }
.auth .logo-big { width: 52px; height: 52px; border-radius: 14px; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; margin: 0 auto 10px; }

/* ---------- Biểu đồ ---------- */
.chart { width: 100%; height: 220px; }
.bar-list .b { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; align-items: center; padding: 6px 0; }
.bar-list .track { height: 8px; background: #eef0f3; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.bar-list .fill { height: 100%; background: var(--primary); border-radius: 4px; }

/* ---------- Màn «Hôm nay» (thợ · quầy · chăm sóc) ---------- */
.home-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.btn-xl { min-height: 58px; font-size: 16px; font-weight: 600; justify-content: center; gap: 8px; text-decoration: none !important; }
.btn-xl svg { width: 20px; height: 20px; }
.appt-list .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; flex: none; max-width: 46%; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 6px 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); color: var(--text); font-size: 13px; }
.chip:hover { text-decoration: none; border-color: var(--primary); }
.chip-bad { background: var(--bad-bg); border-color: #f2c0c0; color: var(--bad); font-weight: 600; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card:not([open]) > summary { border-bottom: 0; }

/* ---------- Bản 2: quảng cáo · chấm công · marketing · của tôi ---------- */
.hot-card { border-left: 3px solid var(--bad); }
.funnel { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; padding: 16px; }
.funnel-s { background: #f6f8fb; border-radius: 8px; padding: 12px 10px; position: relative; min-width: 0; }
.funnel-s .v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.funnel-s .l { font-size: 12.5px; color: #4b5563; }
.funnel-s:not(:last-child)::after { content: '›'; position: absolute; right: -8px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 16px; }
.att-wrap { max-height: 70vh; }
table.att th, table.att td { padding: 6px 4px; text-align: center; font-size: 12px; min-width: 30px; }
table.att th.sun { color: var(--bad); } table.att th.today { background: var(--primary-50); }
table.att .sticky { position: sticky; left: 0; background: #fff; text-align: left; min-width: 130px; z-index: 1; padding-left: 12px; }
table.att th.sticky { background: #f8f9fa; z-index: 2; }
table.att td.click { cursor: pointer; } table.att td.click:hover { background: #f0f5fd; }
.att-c { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 5px; font-weight: 700; font-size: 11.5px; }
.c-ok { background: var(--ok-bg); color: var(--ok); } .c-warn { background: var(--warn-bg); color: var(--warn); } .c-info { background: var(--info-bg); color: var(--primary-700); }
.c-bad { background: var(--bad-bg); color: var(--bad); } .c-mute { background: #eef0f3; color: #6b7280; }
.kanban { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; align-items: start; }
.kb-col { background: #e9ecf0; border-radius: 10px; padding: 8px; min-width: 0; }
.kb-h { font-weight: 600; font-size: 13px; padding: 4px 6px 8px; display: flex; gap: 6px; align-items: center; }
.kb-h .n { background: #fff; border-radius: 10px; padding: 0 7px; font-size: 12px; }
.kb-card { background: #fff; border-radius: 8px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer; }
.kb-card .t { font-weight: 600; margin: 6px 0 2px; overflow-wrap: anywhere; }
.kb-card.late { border-left: 3px solid var(--bad); }
.checkin { display: flex; gap: 12px; align-items: center; padding: 14px 16px; margin-bottom: 12px; flex-wrap: wrap; }
.checkin .btn-xl { min-width: 160px; }
.me-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; padding: 12px 16px 16px; }
.me-days .d { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; font-size: 13px; }
.me-days .d.late { border-color: #f5d3a6; background: var(--warn-bg); } .me-days .d.absent { border-color: #f2c0c0; background: var(--bad-bg); }
.me-days .d.off_paid, .me-days .d.off_unpaid { background: #f6f7f9; }

/* ---------- Bản 3 ---------- */
.cal-slot.off { background: repeating-linear-gradient(135deg, #f1f2f4, #f1f2f4 6px, #e7e9ec 6px, #e7e9ec 12px); }
.cal-head.off { color: var(--muted); }
.bankqr { display: flex; gap: 12px; align-items: center; border: 1px dashed var(--line-strong); border-radius: 10px; padding: 10px; }
.bankqr img { width: 120px; height: 120px; object-fit: contain; flex: none; }
.rate-ov { position: fixed; inset: 0; z-index: 90; background: rgba(15,23,42,.6); display: grid; place-items: center; padding: 16px; }
.rate-box { background: #fff; border-radius: 16px; padding: 28px 20px; width: min(560px, 100%); text-align: center; position: relative; }
.rate-box h2 { font-size: 22px; } .rate-box .x { position: absolute; right: 10px; top: 8px; border: 0; background: none; font-size: 26px; cursor: pointer; color: var(--muted); }
.rate-faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 20px 0 12px; }
.rate-faces button { font-size: 40px; padding: 12px 0; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.rate-faces button.on { border-color: var(--primary); background: var(--primary-50); }
.rate-faces small { display: block; font-size: 12px; color: var(--muted); }
.qr-big { width: 220px; height: 220px; border: 1px solid var(--line); border-radius: 8px; }

/* ---------- Thanh dưới điện thoại ---------- */
.bottom-nav { display: none; }
.more-sheet { display: none; }

@media (max-width: 1200px) {
  .chat { grid-template-columns: 300px minmax(0, 1fr); }
  .chat .side { display: none; }
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
  .pos3 { grid-template-columns: minmax(0, 1fr) 300px; }
  .pos-foot { grid-template-columns: 1fr; }
  .c-disc { width: 150px; }
  .disc-in .input { width: 74px; }
}
@media (max-width: 900px) {
  :root { --top-h: 52px; }
  .sidebar { display: none; }
  .topbar { left: 0; padding: 0 12px; gap: 8px; }
  .topbar .brand-m { display: flex !important; align-items: center; gap: 8px; font-weight: 700; max-width: 40%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .topbar .who .nm { display: none; }
  .main { margin-left: 0; padding: calc(var(--top-h) + 12px) 12px calc(76px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff;
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 7px; font-size: 11px; color: #5f6b7a; background: none; border: 0; text-decoration: none; position: relative; cursor: pointer; }
  .bottom-nav svg { width: 22px; height: 22px; }
  .bottom-nav .active { color: var(--primary); }
  .bottom-nav .count { position: absolute; top: 3px; left: 54%; background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; }
  .more-sheet.open { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.4); }
  .more-sheet .sheet { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 14px 14px 0 0; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); max-height: 80vh; overflow-y: auto; }
  .more-sheet .sheet a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
  .more-sheet .sheet a svg { width: 20px; height: 20px; color: #5f6b7a; }
  .kpis, .todo { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile { grid-template-columns: 1fr; }
  .pos { grid-template-columns: 1fr; }
  .pos3 { grid-template-columns: 1fr; }
  .pos-bill { min-height: 0; }
  .pos-menu { position: static; max-height: none; }
  .pos-cats { overflow: visible; }
  .cat-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos-head .btn { min-height: 34px; padding: 4px 10px; }
  .pos-when .input { width: 170px; }
  .pos-actions { position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 35; border-radius: 0; padding: 8px 10px; gap: 6px; box-shadow: 0 -4px 14px rgba(10,31,68,.1); }
  .app.kiosk .pos-actions { bottom: calc(70px + env(safe-area-inset-bottom)); }
  .pos-actions .btn { flex-direction: column; gap: 2px; padding: 4px 2px; font-size: 11.5px; min-height: 48px; white-space: normal; line-height: 1.15; }
  .pos-page-pad { height: 70px; }
  .main:has(.pos3) { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  table.pos-t td { align-items: center; }
  table.pos-t td.c-rm { justify-content: flex-end; }
  table.pos-t td.c-rm::before { content: none; }
  .pay-row { grid-template-columns: 130px minmax(0, 1fr) 34px; }
  .pay-hint { margin-left: 138px; }
  .staff-row select.input { width: 160px; }
  .kanban { grid-template-columns: repeat(5, 78vw); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .kb-col { scroll-snap-align: start; }
  .funnel { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sticky-pay { position: static; }
  .cart-bar { display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 35; align-items: center; gap: 10px;
    background: var(--primary); color: #fff; border-radius: 12px; padding: 10px 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); cursor: pointer; border: 0; font-weight: 600; }
  .cart-bar .grow { text-align: left; }
  .chat { grid-template-columns: 1fr; height: calc(100vh - var(--top-h) - 100px); }
  .chat.has-open .list { display: none; }
  .chat:not(.has-open) .pane { display: none; }
  .page-head h1 { font-size: 18px; }
  .hide-m { display: none !important; }
  .toasts { left: 12px; right: 12px; top: auto; bottom: 84px; max-width: none; }
  table.t.resp thead { display: none; }
  table.t.resp tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 12px; }
  table.t.resp td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; text-align: right; }
  table.t.resp td::before { content: attr(data-l); color: var(--muted); text-align: left; font-weight: 500; flex: none; }
  table.t.resp td.first { display: block; text-align: left; font-weight: 600; }
  table.t.resp td.first::before { content: none; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92vh; display: flex; flex-direction: column; }
  .modal-b { overflow-y: auto; }
  .topbar .search { display: none; }
}
@media (max-width: 520px) {
  .g2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .kpi .v { font-size: 18px; }
  .todo a { padding: 12px; gap: 10px; }
  .todo .ic { width: 34px; height: 34px; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .bubble { max-width: 86%; }
  .funnel { grid-template-columns: 1fr 1fr; }
  .funnel-s::after { display: none; }
  .bankqr { flex-direction: column; text-align: center; }
  .rate-faces button { font-size: 30px; }
  .home-actions { grid-template-columns: 1fr 1fr; }
  .home-actions > :first-child { grid-column: 1 / -1; }
  .appt-list .it { flex-wrap: wrap; }
  .appt-list .it > .grow { flex: 1 1 0; }
  .appt-list .acts { max-width: none; width: 100%; justify-content: flex-start; padding-left: 68px; }
}
/* ---------- iPad quầy (/quay): không menu trái, thanh nút dưới đáy ở mọi cỡ màn ---------- */
.app.kiosk .sidebar { display: none; }
.app.kiosk .topbar { left: 0; }
.app.kiosk .topbar .brand-m { display: flex !important; align-items: center; font-weight: 700; margin-right: 8px; white-space: nowrap; }
.app.kiosk .main { margin-left: 0; max-width: none; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.app.kiosk .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.app.kiosk .bottom-nav a, .app.kiosk .bottom-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 2px 9px; font-size: 13px; color: #5f6b7a; background: none; border: 0; text-decoration: none; position: relative; cursor: pointer; }
.app.kiosk .bottom-nav svg { width: 24px; height: 24px; }
.app.kiosk .bottom-nav .active { color: var(--primary); }
.app.kiosk .bottom-nav .count { position: absolute; top: 4px; left: 54%; background: var(--bad); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; }
.app.kiosk .more-sheet.open { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.4); }
.app.kiosk .more-sheet .sheet { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 14px 14px 0 0; padding: 10px 10px calc(14px + env(safe-area-inset-bottom)); max-height: 80vh; overflow-y: auto; }
.app.kiosk .more-sheet .sheet a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; color: var(--text); text-decoration: none; }
.app.kiosk .more-sheet .sheet a svg { width: 20px; height: 20px; color: #5f6b7a; }

@media print {
  .sidebar, .topbar, .bottom-nav, .no-print { display: none !important; }
  .main { margin: 0; padding: 0; }
}
