:root {
  --bg: #f6f5f1;
  --panel: #ffffff;
  --ink: #1d1f1c;
  --muted: #6b6f68;
  --line: #e4e2db;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --brand-soft: #e3f2ef;
  --warn: #b45309;
  --warn-soft: #fdf1e1;
  --bad: #b91c1c;
  --bad-soft: #fde8e8;
  --good: #15803d;
  --good-soft: #e6f4ea;
  --radius: 10px;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.5; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
a { color: var(--brand); }
.muted { color: var(--muted); font-size: 13px; }

button, .btn {
  font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
button:hover { border-color: #c9c6bc; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); }
button.small { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }

input, textarea, select {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ---------- Trang đăng nhập ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth-card .logo { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-card .logo img { width: 56px; height: 56px; }
.auth-card .logo .kc-word { font-size: 30px; color: var(--ink); }
.auth-card .logo .tag { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; font-weight: 500; letter-spacing: 0; }
.tabs { display: flex; gap: 4px; margin: 18px 0 6px; background: var(--bg); padding: 4px; border-radius: 9px; }
.tabs button { flex: 1; border: 0; background: transparent; }
.tabs button.on { background: var(--panel); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.err { color: var(--bad); font-size: 13px; min-height: 20px; margin-top: 8px; }

/* ---------- Bố cục trang quản lý ---------- */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #12302c; color: #d6e6e2; padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; }
.side .logo { font-weight: 800; color: #fff; font-size: 17px; padding: 4px 10px 16px; }
.side a { color: inherit; text-decoration: none; padding: 9px 10px; border-radius: 8px; display: flex; justify-content: space-between; }
.side a:hover { background: rgba(255,255,255,.06); }
.side a.on { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }
.side .spacer { flex: 1; }
.side .who { font-size: 12px; padding: 10px; color: #9fbab4; border-top: 1px solid rgba(255,255,255,.1); }
.side .who button { margin-top: 6px; background: transparent; color: #d6e6e2; border-color: rgba(255,255,255,.2); }
.badge { background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; line-height: 18px; }

main { padding: 24px 28px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat .num { font-size: 26px; font-weight: 700; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.scroll { overflow-x: auto; }

.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.brand { background: var(--brand-soft); color: var(--brand); }

.notice { padding: 12px 14px; border-radius: 8px; background: var(--warn-soft); color: #7c3f06; font-size: 14px; margin-bottom: 16px; }
.notice.info { background: var(--brand-soft); color: #0b4f4a; }
/* Web vừa cập nhật bản mới (trang mở từ trước) → nút nổi "bấm để tải lại" */
#newBuild { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 10000; max-width: calc(100% - 32px);
  background: var(--brand); color: #fff; border: 0; border-radius: 8px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.2); }
code, .code { font-family: ui-monospace, Consolas, monospace; background: var(--bg); padding: 2px 6px; border-radius: 5px; font-size: 13px; word-break: break-all; }

/* ---------- Hội thoại ---------- */
.inbox { display: grid; grid-template-columns: 300px 1fr; gap: 0; height: calc(100vh - 110px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.inbox .list { border-right: 1px solid var(--line); overflow-y: auto; }
.inbox .item { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.inbox .item:hover { background: var(--bg); }
.inbox .item.on { background: var(--brand-soft); }
.inbox .item .name { font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.inbox .item .last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread { display: flex; flex-direction: column; min-width: 0; }
.thread .top { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #fbfaf7; }
.bubble { max-width: 75%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.customer { align-self: flex-start; background: #fff; border: 1px solid var(--line); }
.bubble.ai { align-self: flex-end; background: var(--brand); color: #fff; }
.bubble.staff { align-self: flex-end; background: #334155; color: #fff; }
.bubble .who { font-size: 11px; opacity: .7; margin-bottom: 2px; }
.compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.compose input { flex: 1; }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; }

/* ---------- Hộp thoại ---------- */
dialog { border: 0; border-radius: 14px; padding: 22px; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0,0,0,.35); }


/* ---------- Hướng dẫn AI ---------- */
.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; }
.seg button.on { background: var(--panel); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); color: var(--brand); }
.ggroup { font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--brand); margin-bottom: 4px; }
.gsec { padding: 14px 0; border-bottom: 1px solid var(--line); }
.gsec:last-child { border-bottom: 0; padding-bottom: 0; }
.gsec textarea { margin-top: 8px; min-height: 80px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.chip { font-size: 13px; padding: 4px 11px; border-radius: 99px; background: var(--bg); }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.bar { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > div { height: 100%; background: var(--brand); transition: width .2s; }
.sim { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 32px); }
.sim .msgs { min-height: 260px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.sim .bubble { max-width: 88%; font-size: 14px; }
.tracker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.slot { border: 1px dashed var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.slot.ok { border-style: solid; border-color: var(--good); background: var(--good-soft); }
.slot > div:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
pre.prompt { white-space: pre-wrap; word-break: break-word; background: var(--bg); padding: 14px; border-radius: 8px; max-height: 65vh; overflow: auto; font-size: 13px; font-family: ui-monospace, Consolas, monospace; }


/* ---------- Kho sản phẩm ---------- */
a.btn { text-decoration: none; display: inline-block; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.tabline { flex-wrap: wrap; margin-bottom: 12px; }
.chip.mini { font-size: 12px; padding: 2px 9px; }
.ptable input { padding: 6px 8px; }
.ptable td { vertical-align: middle; }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 12px; margin-right: 6px; vertical-align: 2px; }
.sharedbox { white-space: pre-wrap; background: var(--bg); border: 1px dashed var(--line); border-radius: 8px; padding: 10px 12px; margin: 6px 0 12px; font-size: 14px; }
.faq { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-top: 10px; }
.calc { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; min-height: 40px; }
.calc:empty { display: none; }
.calc .total { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
.switch-label { font-weight: 600; }


/* ---------- Cài đặt chung ---------- */
.settings-wrap { max-width: 860px; }
.setrow { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setrow:last-child { border-bottom: 0; }
.setrow.soon { opacity: .6; }
.settitle { font-weight: 600; font-size: 14px; }
.sw { position: relative; display: inline-block; width: 44px; height: 24px; margin: 0; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw span { position: absolute; inset: 0; background: #cfd3cc; border-radius: 99px; cursor: pointer; transition: background .15s; }
.sw span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw input:checked + span { background: var(--brand); }
.sw input:checked + span::before { transform: translateX(20px); }
.sw input:disabled + span { cursor: not-allowed; }
.sw input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.stylecard { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; cursor: pointer; font-weight: 400; }
.stylecard.on { border-color: var(--brand); background: var(--brand-soft); }
.evtable td { vertical-align: middle; }


/* ---------- Hội thoại ---------- */
main.fullbleed { padding: 0; }
.ib { display: grid; grid-template-columns: 340px minmax(0, 1fr) 370px; height: 100vh; position: relative; background: var(--panel); }
.ib-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ib-search { display: flex; gap: 6px; padding: 10px 10px 6px; }
.ib-search input { padding: 7px 10px; }
.ib-search button { white-space: nowrap; }
.ib-quick { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px 6px; }
.ib-tools { padding: 0 10px 6px; flex-wrap: nowrap; }
.ib-tools select { padding: 5px 8px; font-size: 13px; }
.ib-active { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 10px; align-items: center; }
.ib-active:not(:empty) { padding-bottom: 6px; }
.ib-items { overflow-y: auto; flex: 1; border-top: 1px solid var(--line); }
.ib-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.ib-item:hover { background: var(--bg); }
.ib-item.on { background: #dbeafe; }
.ib-item.unread .nm, .ib-item.unread .ib-r2 { font-weight: 700; color: var(--ink); }
.av { width: 40px; height: 40px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; position: relative; overflow: hidden; }
.av > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; } /* ảnh đại diện phủ lên chữ viết tắt */
.ib-body { min-width: 0; flex: 1; }
.ib-r1 { display: flex; justify-content: space-between; gap: 6px; }
.ib-r1 .nm { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-r1 .tm { font-size: 12px; color: var(--muted); flex: none; }
.ib-r2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-r3 { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 3px; min-height: 18px; }
.ib-r3 .tags { display: flex; gap: 3px; flex-wrap: wrap; min-width: 0; }
.ib-r3 .icons { display: flex; gap: 4px; align-items: center; font-size: 13px; flex: none; }
.ib-page { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #2563eb; display: inline-block; }
.tagchip { display: inline-block; border-radius: 99px; padding: 1px 9px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.tagchip.xs { font-size: 10.5px; padding: 0 7px; line-height: 16px; }
.tagchip.outline { background: #fff; border: 1px solid; font-size: 10.5px; padding: 0 7px; line-height: 15px; }
.tagchip.ghost { border: 1px dashed var(--line); color: var(--muted); font-weight: 400; }
.tagchip.more { background: var(--bg); color: var(--muted); }
.ib-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #EAF2FC; } /* nền khung chat: tông xanh nhạt Kính Coong */
.ib-empty { margin: auto; color: var(--muted); font-size: 18px; }
.ib-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ib-head .nm { font-weight: 700; }
.ib-msgs { flex: 1; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.ib-msgs .bubble { max-width: 70%; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.ib-msgs .bubble.ai { background: #d9fdd3; color: var(--ink); }
.ib-msgs .bubble.staff { background: #cfe3ff; color: var(--ink); }
.ib-day { align-self: center; background: rgba(255,255,255,.85); border-radius: 8px; padding: 2px 12px; font-size: 12px; color: var(--muted); }
.ib-tagbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; background: var(--panel); border-top: 1px solid var(--line); }
.tagbtn { flex: 1 1 auto; min-width: 88px; border: 0; border-radius: 3px; padding: 3px 6px; font-size: 11.5px; font-weight: 600; background: var(--c); color: var(--t); opacity: .58; }
.tagbtn:hover { opacity: .85; }
.tagbtn.on { background: var(--c); opacity: 1; box-shadow: inset 0 0 0 2px rgba(0,0,0,.18); }
.ib-compose { position: relative; background: var(--panel); padding: 8px 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.ib-compose textarea { min-height: 54px; }
.ib-qrpop { position: absolute; bottom: 100%; left: 10px; right: 10px; max-height: 340px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); z-index: 5; }
.ib-qrpop table td { padding: 6px 8px; font-size: 13px; cursor: pointer; }
.ib-qrpop tr.on td, .ib-qrpop tbody tr:hover td { background: var(--brand-soft); }
.ib-qrpop .qrtext { max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-side { border-left: 1px solid var(--line); overflow-y: auto; background: var(--bg); padding: 8px; min-height: 0; }
.ib-tabs { display: flex; width: 100%; margin-bottom: 8px; }
.ib-tabs button { flex: 1; }
.ib-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; font-size: 14px; }
.ib-card .nm { font-weight: 700; }
.ib-sec { font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.note { border-top: 1px dashed var(--line); padding: 6px 0 2px; margin-top: 6px; font-size: 13px; }
.ocard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 8px; font-size: 13.5px; }
.ocard-h { color: #fff; padding: 6px 10px; display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
button.light { background: rgba(255,255,255,.2); color: #fff; border-color: rgba(255,255,255,.4); }
.ocard-steps { padding: 6px 10px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); font-size: 12px; }
.step-i { color: var(--muted); }
.step-i.done { color: var(--good); }
.step-i.cur { color: #fff; background: var(--warn); border-radius: 99px; padding: 0 8px; font-weight: 600; }
.ocard-b { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.pick { position: relative; }
.pick-res { position: absolute; top: 100%; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 20px rgba(0,0,0,.12); max-height: 280px; overflow: auto; z-index: 4; }
.pick-it { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: 13px; }
.pick-it:hover { background: var(--brand-soft); }
.ofline { border-bottom: 1px dashed var(--line); padding: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.ofline .nm { font-weight: 600; }
.ofline select, .ofline input { padding: 5px 8px; }
.ib-pop { position: absolute; top: 46px; left: 10px; z-index: 20; display: flex; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); width: 560px; max-height: 70vh; }
.fp-menu { width: 220px; padding: 8px; border-right: 1px solid var(--line); background: #f8f9fb; border-radius: 12px 0 0 12px; overflow: auto; }
.fp-title { font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 8px 4px; }
.fp-item { display: flex; justify-content: space-between; align-items: center; width: 100%; border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.fp-item.on, .fp-item:hover { background: #e5e7eb; }
.fp-list { flex: 1; padding: 8px; overflow: auto; }
.fp-list input#fpSearch { margin-bottom: 6px; }
.fp-opt { display: flex; align-items: center; gap: 10px; padding: 6px 4px; font-weight: 400; margin: 0; cursor: pointer; }
.mgrow { padding: 6px 0; border-bottom: 1px solid var(--line); flex-wrap: nowrap; }
.mgqr { padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 1180px) {
  .ib { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: 100vh auto; height: auto; }
  .ib-side { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 760px) {
  .ib { grid-template-columns: 1fr; grid-template-rows: 45vh 75vh auto; }
  .ib-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .ib-pop { width: calc(100vw - 20px); flex-direction: column; }
  .fp-menu { width: auto; border-right: 0; }
}


/* ---------- Kết nối Facebook ---------- */
.fbsteps { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.fbstep { display: flex; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.fbstep .n { width: 26px; height: 26px; border-radius: 50%; background: var(--warn-soft); color: var(--warn); display: grid; place-items: center; font-weight: 700; flex: none; }
.fbstep.ok { border-color: var(--good); background: var(--good-soft); }
.fbstep.ok .n { background: var(--good); color: #fff; }
.bad-t { color: var(--bad); }
a.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.bubble img.att { display: block; max-width: 220px; max-height: 260px; border-radius: 8px; margin-top: 6px; }
.pkrow { border-bottom: 1px solid var(--line); }

@media (max-width: 860px) {
  .guide-layout { grid-template-columns: 1fr; }
  .sim { position: static; max-height: none; }
  .layout { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow-x: auto; padding: 8px; }
  .side .logo, .side .spacer, .side .who { display: none; }
  main { padding: 16px; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .two { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox .list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--line); }
  .msgs { min-height: 50vh; }
}
/* Nút dạng chữ nhỏ trong bong bóng chat (VD: "Tin bot tự động?") */
.linkbtn { background: none; border: none; padding: 0 0 0 6px; margin: 0; color: var(--brand); text-decoration: underline; font-size: 11px; cursor: pointer; }
.linkbtn:hover { opacity: .8; }

/* =====================================================================
   BỘ NHẬN DIỆN KÍNH COONG (15/10 – file "Kinhcoong – Logo & Icon.pdf"):
   Xanh dương AI #3D8BF2 (chủ đạo, logo, điểm nhấn) · Xanh trời #9BD4FF (sóng âm, nhấn nhẹ) · Xanh đêm #0F2A44 (chữ, thanh menu)
   Băng tuyết #F2F8FE (nền trang) · Đỏ san hô #FF6B6B (chỉ cho số tin / đơn mới) · phông Be Vietnam Pro
   Nút / chữ link dùng #2470DB (cùng tông, đậm hơn để chữ trắng trên nền xanh đủ dễ đọc)
   ===================================================================== */
:root {
  --brand: #2470DB; --brand-ink: #fff; --brand-soft: #E6F1FE; --brand-ai: #3D8BF2; --brand-sky: #9BD4FF;
  --ink: #0F2A44; --muted: #5B6B7F; --line: #E1E8F0; --bg: #F2F8FE; --coral: #FF6B6B;
  --nav: #0F2A44; --nav-on: #1D4170; --pk-bg: #EAF2FC; --pk-active: #2470DB;
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}
body.pk { font-size: 14px; background: #fff; }
body.pk h1 { font-size: 20px; font-weight: 500; } body.pk h2 { font-size: 16px; font-weight: 500; } body.pk h3 { font-weight: 500; }
body.pk button.primary, body.pk a.btn.primary { background: var(--brand); border-color: var(--brand); }
body.pk input:focus, body.pk textarea:focus, body.pk select:focus { outline: 2px solid rgba(61, 139, 242, .28); border-color: var(--brand); }

/* ---- Thanh menu trên ---- */
.topbar { position: fixed; inset: 0 0 auto 0; height: 56px; background: var(--nav); color: #fff; display: flex; align-items: center; gap: 12px; padding: 0 16px; z-index: 50; }
.tb-brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; min-width: 220px; }
.tb-logo { width: 34px; height: 34px; display: block; flex: none; }
/* Chữ "Kính Coong": Be Vietnam Pro ExtraBold, giãn chữ -4%, "oo" màu xanh (trên nền tối là xanh trời) */
.kc-word { font-weight: 800; letter-spacing: -0.04em; line-height: 1; white-space: nowrap; }
.kc-word .oo { color: var(--brand-ai); }
.topbar .kc-word { font-size: 20px; color: #fff; }
.topbar .kc-word .oo { color: var(--brand-sky); }
.tb-nav a svg { width: 18px; height: 18px; flex: none; }
.tb-nav { flex: 1; display: flex; justify-content: center; gap: 6px; }
.tb-nav a { color: #fff; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 500; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tb-nav a:hover { background: rgba(255, 255, 255, .12); }
.tb-nav a.on { background: var(--nav-on); }
.tb-right { min-width: 220px; display: flex; justify-content: flex-end; position: relative; }
.tb-user { display: flex; align-items: center; gap: 8px; background: transparent; border: 0; color: #fff; padding: 4px 8px; border-radius: 8px; font-weight: 500; }
.tb-user:hover { background: rgba(255, 255, 255, .12); border: 0; }
.av.sm { width: 32px; height: 32px; font-size: 12px; }
.tb-menu { position: absolute; right: 0; top: 48px; background: #fff; color: var(--ink); border-radius: 10px; box-shadow: 0 10px 28px rgba(16, 24, 40, .18); padding: 6px; min-width: 240px; z-index: 60; }
.tb-menu-h { padding: 8px 10px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.tb-menu a, .tb-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--ink); text-decoration: none; background: transparent; border: 0; font-size: 14px; }
.tb-menu a:hover, .tb-menu button:hover { background: var(--bg); }
.tb-nav .badge { background: var(--coral); font-weight: 700; }

/* ---- Khung trang ---- */
body.pk main#view { padding: 76px 24px 24px; min-height: 100vh; }
body.pk main#view.fullbleed { padding: 56px 0 0; }
body.pk main#view.settings { padding: 56px 0 0; background: var(--pk-bg); }
body.pk .ib { height: calc(100vh - 56px); }
@media (max-width: 1180px) { body.pk .ib { grid-template-rows: calc(100vh - 56px) auto; height: auto; } }

/* ---- Cài đặt: menu trái + nội dung ---- */
.st-wrap { display: grid; grid-template-columns: 296px minmax(0, 1fr); min-height: calc(100vh - 56px); background: var(--bg); }
/* Menu Cài đặt (bộ icon Kính Coong): khung trắng bo góc, mục đang chọn nền xanh nhạt + chữ / nét icon xanh, rê chuột nền xám xanh */
.st-menu { background: #fff; padding: 22px 14px; margin: 16px 0 16px 16px; border-radius: 22px; box-shadow: 0 1px 3px rgba(15, 42, 68, .06), 0 8px 24px rgba(15, 42, 68, .05);
  position: sticky; top: 72px; height: calc(100vh - 88px); overflow: auto; }
.st-menu h2 { font-size: 22px !important; font-weight: 800 !important; letter-spacing: -0.02em; margin: 0 0 14px 10px; color: var(--ink); }
.st-menu a { display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: 12px; color: var(--ink); text-decoration: none; margin-bottom: 3px; font-weight: 500; }
.st-menu a:hover { background: #F1F5F9; }
.st-menu a.on { background: #E3F0FD; color: var(--brand); font-weight: 600; }
.st-menu a svg, .pk-gi svg { width: 21px; height: 21px; flex: none; }
.st-menu .beta { background: #DCEBFD; color: var(--brand); font-size: 12px; font-weight: 700; padding: 1px 10px; border-radius: 99px; line-height: 20px; }
/* Chi tiết xanh của icon Kính Coong: giữ nguyên xanh dương khi đổi trạng thái; trên nền tối đổi sang xanh trời */
.kc-ic .acs { stroke: var(--brand-ai); }
.kc-ic .acf { fill: var(--brand-ai); stroke: none; }
.kc-ic .acf2 { fill: var(--brand-sky); stroke: none; }
.topbar .kc-ic .acs { stroke: var(--brand-sky); }
.topbar .kc-ic .acf { fill: var(--brand-sky); }
.st-content { padding: 24px 32px 40px; min-width: 0; }
.st-col { max-width: 940px; margin: 0 auto; }
.st-title { font-size: 20px !important; font-weight: 500 !important; margin: 4px 0 20px; display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.st-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .st-grid2 { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .st-wrap { grid-template-columns: 1fr; } .st-menu { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; } .st-menu h2 { width: 100%; } .st-content { padding: 16px; } }

.pk-card { background: #fff; border-radius: 8px; padding: 20px 24px; margin-bottom: 16px; }
.pk-card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.pk-card-h h3 { font-size: 16px; font-weight: 500; margin: 0; display: flex; align-items: center; gap: 8px; }
.pk-count { background: var(--brand-soft); color: var(--pk-active); font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 6px; }
.pk-sub { color: var(--muted); font-size: 13px; margin: -4px 0 12px; }
.pk-group { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; padding: 16px 0; border-bottom: 1px solid #eaecf0; }
.pk-group:last-child { border-bottom: 0; padding-bottom: 4px; }
.pk-gi { color: #344054; padding-top: 1px; }
.pk-gt { font-weight: 500; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.pk-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 8px 0; color: #344054; }
.pk-row + .pk-row { border-top: 1px solid #f2f4f7; }
.pk-row-t { min-width: 0; }
.pk-desc { color: var(--muted); font-size: 13px; margin-top: 2px; }
.pk-row-c { flex: none; display: flex; align-items: center; gap: 8px; }
.pk-soon { background: #f2f4f7; color: #667085; font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.pk-row.soon { opacity: .55; }
.pk-sel { width: auto; min-width: 110px; padding: 6px 10px; border: 1px solid #d0d5dd; border-radius: 6px; background: #fff; }
.pk-sw { position: relative; display: inline-block; width: 40px; height: 22px; margin: 0; flex: none; }
.pk-sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.pk-sw span { position: absolute; inset: 0; background: #d0d5dd; border-radius: 99px; cursor: pointer; transition: background .15s; }
.pk-sw span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(16, 24, 40, .2); }
.pk-sw input:checked + span { background: var(--brand-ai); }
.pk-sw input:checked + span::before { transform: translateX(18px); }
.pk-sw input:disabled + span { cursor: not-allowed; opacity: .5; }
.pk-btn { border: 1px solid #d0d5dd; background: #fff; border-radius: 6px; padding: 6px 12px; font-size: 13px; }
.pk-btn.blue { background: var(--brand); color: #fff; border-color: var(--brand); }
.pk-btn.icon { padding: 5px 8px; line-height: 1; }
.pk-tabs { display: flex; gap: 20px; border-bottom: 1px solid #eaecf0; margin-bottom: 12px; }
.pk-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: 8px 0; color: #475467; }
.pk-tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.pk-tools { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.pk-search { position: relative; }
.pk-search input { padding: 6px 10px 6px 30px; background: #f2f4f7; border-color: #f2f4f7; width: 220px; }
.pk-search::before { content: '⌕'; position: absolute; left: 10px; top: 4px; color: #98a2b3; font-size: 16px; }
.pk-table { border: 1px solid #eaecf0; border-radius: 8px; overflow: hidden; }
.pk-table table th { background: #fff; color: #344054; font-weight: 500; font-size: 13px; padding: 10px 12px; border-bottom: 1px solid #eaecf0; }
.pk-table table td { padding: 10px 12px; vertical-align: middle; border-bottom: 1px solid #f2f4f7; }
.pk-table tr[draggable] { cursor: grab; }
.pk-table tr.dragging { opacity: .4; }
.pk-table tr.dropbefore td { box-shadow: inset 0 2px 0 var(--brand); }
.pk-table .acts { text-align: right; white-space: nowrap; visibility: hidden; }
.pk-table tr:hover .acts { visibility: visible; }
.pk-table .acts button { border: 0; background: transparent; padding: 2px 6px; color: #667085; }
.pk-table .acts button:hover { color: var(--brand); }
.pk-table .acts button.del:hover { color: #d92d20; }
.pk-table .stt { color: #667085; width: 44px; }
.pk-table tbody tr:hover td { background: #f9fafb; }
.tagname { display: flex; align-items: center; gap: 8px; }
.tagname svg { width: 16px; height: 16px; flex: none; }
.colorpill { display: inline-block; width: 56px; height: 12px; border-radius: 99px; }
.pk-empty { color: var(--muted); text-align: center; padding: 28px; }
.pk-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #101828; color: #fff; padding: 8px 16px; border-radius: 8px; font-size: 13px; z-index: 100; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.qrthumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; vertical-align: middle; margin-right: 6px; }
.qrmsg { max-width: 560px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topicchip { display: inline-block; border-radius: 99px; padding: 1px 10px; font-size: 12px; font-weight: 500; line-height: 18px; white-space: nowrap; margin: 1px 2px 1px 0; }
.qr-dlg { width: min(560px, calc(100vw - 32px)); padding: 20px 24px; }
.qr-block { background: #f2f4f7; border-radius: 8px; padding: 10px; margin-top: 12px; }
.qr-block-h { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: #344054; margin-bottom: 6px; }
.qr-block textarea { background: #fff; min-height: 90px; }
.qr-imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.qr-imgs .im { position: relative; }
.qr-imgs img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.qr-imgs .im button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; padding: 0; font-size: 11px; line-height: 18px; background: #101828; color: #fff; border: 0; }
.qr-tool { display: flex; gap: 6px; margin-top: 6px; position: relative; }
.qr-vars { position: absolute; left: 0; bottom: 36px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .16); padding: 6px; z-index: 5; min-width: 300px; max-height: 320px; overflow: auto; }
.qr-vars .hd { color: var(--muted); font-size: 12px; padding: 4px 8px; }
.qr-vars button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 6px 8px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; border-radius: 6px; }
.qr-vars button:hover { background: var(--bg); }
.topic-pick { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid #d0d5dd; border-radius: 6px; min-height: 36px; align-items: center; cursor: pointer; background: #fff; }
.topic-pick .ph { color: #98a2b3; padding: 0 6px; }
.topic-menu { border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; max-height: 200px; overflow: auto; background: #fff; }
.topic-menu label { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin: 0; font-weight: 400; cursor: pointer; }
.topic-menu label:hover { background: var(--bg); }
.sc-input { display: flex; align-items: center; border: 1px solid #d0d5dd; border-radius: 6px; overflow: hidden; }
.sc-input span { padding: 0 10px; color: #667085; background: #f2f4f7; align-self: stretch; display: grid; place-items: center; }
.sc-input input { border: 0; border-radius: 0; }
.tagmini { display: inline-block; width: 14px; height: 6px; border-radius: 99px; margin-right: 2px; vertical-align: middle; }
.ib-pending { display: flex; gap: 6px; flex-wrap: wrap; }
.ib-pending .im { position: relative; }
.ib-pending img { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.ib-pending .im button { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; padding: 0; font-size: 10px; background: #101828; color: #fff; border: 0; }
.ib-qrpop .qrtopics { white-space: nowrap; }
.page-color { width: 4px; border-radius: 4px; align-self: stretch; flex: none; }
.soon-page { text-align: center; padding: 48px 24px; color: #475467; }
.soon-page h3 { margin-bottom: 6px; }
.soon-page ul { text-align: left; display: inline-block; margin: 12px auto 0; color: #475467; }

/* ---- Cài đặt: bổ sung (giờ làm việc, hộp màu, tab) ---- */
.st-wide { max-width: 1320px; margin: 0 auto; }
.st-col.wide { max-width: 1240px; }
.st-tabs { margin-bottom: 16px; }
.pk-tabs a { padding: 8px 0; color: #475467; text-decoration: none; border-bottom: 2px solid transparent; font-weight: 500; }
.pk-tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.pk-inp { width: 260px; max-width: 100%; padding: 6px 10px; border: 1px solid #d0d5dd; border-radius: 6px; }
.pk-tz { background: #f2f4f7; border-radius: 6px; padding: 4px 10px; font-size: 13px; color: #344054; white-space: nowrap; }
.pk-row-c select:disabled { background: #f9fafb; color: #98a2b3; }
.st-menu a > span:first-of-type { flex: 1; }
.tb-caret { font-size: 11px; opacity: .8; }
a.btn.small { padding: 4px 10px; font-size: 13px; display: inline-flex; align-items: center; text-decoration: none; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.palette button { width: 24px; height: 24px; border-radius: 50%; padding: 0; border: 2px solid #fff; box-shadow: 0 0 0 1px #d0d5dd; }
.palette button.on { box-shadow: 0 0 0 2px var(--brand); }
.palette input[type=color] { width: 34px; height: 28px; padding: 1px; }
.cd-prev { margin-top: 12px; display: flex; align-items: center; gap: 12px; }
.pg-row { display: flex; gap: 12px; align-items: center; background: #f9fafb; border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.qr-vars button span { display: block; color: var(--muted); font-family: inherit; font-size: 11.5px; }
.ib-qrpop .qrtext img.qrthumb { width: 22px; height: 22px; }
.tagbars { display: inline-flex; gap: 2px; align-items: center; }
.pk-btn svg, .pk-table .acts svg { width: 16px; height: 16px; vertical-align: middle; }
.pk-btn.icon { display: inline-flex; align-items: center; gap: 4px; }
/* ---- Phân quyền / Lịch sử / người đang xem ---- */
.dot-on { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #12b76a; margin-right: 6px; vertical-align: middle; }
.perm-chip { display: inline-block; background: #f2f4f7; color: #344054; border-radius: 99px; padding: 1px 9px; font-size: 12px; margin: 1px 4px 1px 0; }
.perm-chip.all { background: var(--brand-soft); color: var(--pk-active); }
.perm-list { border: 1px solid #eaecf0; border-radius: 8px; padding: 4px 10px; }
.perm-row { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 0; padding: 8px 0; }
.perm-row + .perm-row { border-top: 1px solid #f2f4f7; }
.role-help > div { padding: 6px 0; color: #344054; }
.login-card { background: #f2f4f7; border-radius: 8px; padding: 12px 14px; font-size: 14px; white-space: pre-wrap; }
.hist-tools { justify-content: flex-start; }
.hist-date { gap: 6px; margin: 0; font-weight: 400; color: #475467; font-size: 13px; flex-wrap: nowrap; }
.hist-date input { padding: 5px 8px; width: 150px; }
.av.xs { width: 18px; height: 18px; font-size: 8px; border: 1.5px solid #fff; margin-left: -4px; }
.viewers { display: inline-flex; align-items: center; gap: 4px; margin-right: 4px; }
#ibViewers .viewers { margin-top: 2px; font-size: 12px; }
/* Điện thoại / máy tính bảng không có chuột: luôn hiện nút sửa / xoá trong bảng */
@media (hover: none) { .pk-table .acts { visibility: visible; } }
/* Điện thoại: thanh menu trên gọn lại (ẩn chữ logo + tên shop, menu kéo ngang được), bảng kéo ngang được */
@media (max-width: 860px) {
  .topbar { gap: 6px; padding: 0 8px; }
  .tb-brand, .tb-right { min-width: 0; }
  .tb-brand > span:last-child, #tbName, .tb-caret { display: none; }
  .tb-nav { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .tb-nav::-webkit-scrollbar { display: none; }
  .tb-nav a { padding: 8px; }
  .pk-table { overflow-x: auto; }
  .pk-table table { min-width: 620px; }
}
.staff-link { background: #f5f8ff; border: 1px solid #dbe6fd; border-radius: 8px; padding: 8px 12px; margin: 8px 0 12px; }
.staff-link strong { user-select: all; }

/* ---------- Bảng điều khiển chọn Page ---------- */
body.pk main#view.pd { background: var(--pk-bg); }
.pd-wrap { max-width: 1240px; margin: 0 auto; }
.pd-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pd-head h1 { width: 100%; margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.pd-search { position: relative; flex: 1 1 280px; max-width: 380px; display: block; }
.pd-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.pd-search input { width: 100%; padding: 9px 12px 9px 36px; background: #f2f4f7; border: 1px solid transparent; border-radius: 6px; }
.pd-tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.pd-tools button, .pd-tools .btn { display: inline-flex; align-items: center; gap: 6px; }
.pd-tabs { display: flex; gap: 8px; padding: 10px 12px; flex-wrap: wrap; }
.pd-tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 0; background: transparent; border-radius: 8px; font-weight: 500; }
.pd-tab.on { background: #e3ecfb; color: #1d3b72; }
.pd-tab .cnt { background: #e4e7ec; color: #344054; border-radius: 99px; padding: 0 8px; font-size: 12px; line-height: 20px; }
.pd-tab.on .cnt { background: var(--brand); color: #fff; }
.pd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.pd-card { position: relative; display: flex; gap: 14px; align-items: center; padding: 10px 40px 10px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; text-align: left; min-width: 0; width: 100%; color: var(--ink); }
.pd-card:hover { border-color: #b2c7f0; box-shadow: 0 2px 10px rgba(16, 24, 40, .08); }
.pd-card.sel { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(61, 139, 242, .3); }
.pd-card.all .pd-pic { background: #e3ecfb !important; color: var(--brand); }
.pd-pic { position: relative; width: 70px; height: 70px; flex: none; border-radius: 6px; overflow: hidden; display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 24px; }
.pd-pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; } /* đang tải / lỗi ảnh → thấy chữ cái đầu bên dưới */
.pd-info { min-width: 0; flex: 1; }
.pd-name { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-id { display: flex; align-items: center; gap: 8px; color: var(--muted); margin-top: 8px; font-size: 13px; }
.pd-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.fbi { width: 16px; height: 16px; border-radius: 3px; background: #1877f2; color: #fff; display: inline-grid; place-items: center; font: 700 12px/1 Arial, sans-serif; flex: none; }
.pd-flags { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 4px; }
.pd-star { width: 24px; height: 24px; border-radius: 50%; border: 0; padding: 0; display: grid; place-items: center; background: #f2f4f7; color: #98a2b3; font-size: 13px; line-height: 1; }
.pd-star:hover { border: 0; color: #f79009; }
.pd-star.on { background: #f79009; color: #fff; }
.pd-warn { width: 24px; height: 24px; border-radius: 50%; background: #f79009; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.pd-unread { position: absolute; top: 4px; left: 68px; background: var(--coral); color: #fff; border-radius: 99px; font-size: 11px; line-height: 18px; min-width: 18px; padding: 0 5px; text-align: center; border: 2px solid #fff; }
.pd-check { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; border-radius: 4px; border: 2px solid #fff; background: rgba(16, 24, 40, .35); display: grid; place-items: center; color: #fff; font-size: 13px; z-index: 1; }
.pd-card.sel .pd-check { background: var(--brand); }
.pd-empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.pd-bar { position: sticky; bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border-radius: 8px; padding: 10px 16px; box-shadow: 0 8px 24px rgba(16, 24, 40, .16); }
.pd-bar .grow { flex: 1; }
@media (max-width: 640px) { .pd-grid { grid-template-columns: 1fr; } .pd-search { max-width: none; } .pd-tools { margin-left: 0; } }
/* Menu Page ở góc phải (giống danh sách Page trên thanh Pancake) */
.tb-menu.pages { width: 290px; }
.tb-pages { max-height: min(420px, 60vh); overflow-y: auto; }
.tb-menu .tb-page { display: flex; align-items: center; gap: 12px; padding: 8px 10px; }
.tb-menu .tb-page.on { background: var(--brand-soft); }
.tb-page .pd-pic { width: 40px; height: 40px; border-radius: 50%; font-size: 15px; overflow: visible; }
.tb-page .pd-pic img { border-radius: 50%; }
.tb-page .pd-pic .fbi { position: absolute; right: -3px; bottom: -3px; border: 2px solid #fff; border-radius: 50%; width: 18px; height: 18px; font-size: 11px; }
.tb-page .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-page .badge { flex: none; }
.tb-menu .tb-merge { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; margin: 4px 0; display: flex; align-items: center; gap: 10px; }
/* Hội thoại: Page đang xem */
.ib-pagebar { display: flex; gap: 6px; align-items: center; padding: 8px 10px 0; }
.ib-pagebtn { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 4px 10px 4px 4px; font-size: 13px; font-weight: 500; text-align: left; background: #f2f4f7; border-color: transparent; border-radius: 99px; }
.ib-pagebtn:hover { background: #e3ecfb; border-color: transparent; }
.ib-pagebtn .pd-pic { width: 26px; height: 26px; border-radius: 50%; font-size: 11px; }
.ib-pagebtn .pd-pic img { border-radius: 50%; }
.ib-pagebtn .pd-pic + .pd-pic { margin-left: -14px; border: 2px solid #fff; }
.ib-pagebtn .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Đơn hàng (giống danh sách đơn của Pancake POS) ---------- */
body.pk main#view.ord-page { background: var(--pk-bg); }
.ord-tools { gap: 8px; flex-wrap: wrap; }
.ord-search { flex: 1 1 260px; max-width: 320px; }
.ord-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px; margin-bottom: 12px; background: #fff; border-radius: 8px; scrollbar-width: none; }
.ord-tabs::-webkit-scrollbar { display: none; }
.ord-tab { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-weight: 500; color: #344054; flex: none; }
.ord-tab:hover { background: #f2f4f7; border: 0; }
.ord-tab .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.ord-tab .cnt { background: #f2f4f7; border-radius: 99px; padding: 0 8px; font-size: 12px; line-height: 20px; color: #475467; }
.ord-tab.on { background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); box-shadow: inset 0 -2px 0 var(--c); }
.ord-tab.on .cnt { background: var(--c); color: #fff; }
.ord-card { background: #fff; border-radius: 8px; overflow: clip; } /* clip (không phải hidden) để dòng tiêu đề cột vẫn dính khi cuộn trang */
.ord-row { display: grid; grid-template-columns: 34px 112px minmax(130px, 1.05fr) minmax(180px, 1.6fr) 124px 190px 90px; gap: 12px; padding: 12px 12px; border-bottom: 1px solid var(--line); border-left: 3px solid var(--st, transparent); align-items: start; }
.ord-row:hover:not(.ord-head) { background: #fafbfc; }
.ord-head { border-left-color: transparent; background: #f9fafb; font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 9px; padding-bottom: 9px; position: sticky; top: 56px; z-index: 2; }
.ord-c { min-width: 0; }
/* Ô tích + STT đầu dòng (chọn nhiều đơn) */
.ord-sel { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.ord-sel input { width: 16px; height: 16px; margin: 2px 0 0; cursor: pointer; accent-color: var(--brand); }
.ord-stt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ord-head .ord-sel { flex-direction: row; gap: 6px; }
.ord-head .ord-sel span { font-size: 11px; }
.ord-row.on, .ord-row.on:hover:not(.ord-head) { background: #eef4ff !important; }
.ord-bulk { grid-column: 2 / -1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13px; font-weight: 500; color: var(--ink); }
.ord-bulk .of-link { font-size: 13px; max-width: none; white-space: normal; text-align: left; }
.ord-bulk-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.ord-head.bulk { background: #eef4ff; }
.ord-newbar { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 7px 12px; background: #fffaeb; border-bottom: 1px solid #fedf89; color: #93370d; font-size: 13px; }
.ord-newbar[hidden] { display: none; }
/* Menu "⚡ Cập nhật nhanh" */
.ord-qmenu { position: fixed; z-index: 70; overscroll-behavior: contain; width: 280px; max-width: calc(100vw - 16px); overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .18); padding: 6px; text-align: left; }
.ord-qmenu .qm-h { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; padding: 8px 10px 4px; }
.ord-qmenu button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 7px 10px; border-radius: 6px; text-align: left; font-size: 13.5px; font-weight: 500; color: #344054; }
.ord-qmenu button:hover:not(:disabled) { background: #f2f4f7; }
.ord-qmenu button:disabled { opacity: .45; cursor: default; }
.ord-qmenu .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.ord-qmenu .qm-n { margin-left: auto; background: #f2f4f7; border-radius: 99px; padding: 0 8px; font-size: 12px; line-height: 20px; }
/* Chân bảng: tổng bên trái, chia trang bên phải */
.ord-pager { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ord-pager button { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid transparent; background: transparent; border-radius: 6px; color: #344054; font-variant-numeric: tabular-nums; }
.ord-pager button:hover:not(:disabled) { background: #f2f4f7; }
.ord-pager button.on { border-color: var(--brand); color: var(--brand); background: #fff; font-weight: 600; }
.ord-pager button:disabled { opacity: .4; cursor: default; }
.ord-pager .pg-gap { color: #98a2b3; padding: 0 4px; letter-spacing: 1px; }
.ord-pager select { width: auto; height: 30px; padding: 0 6px; margin-left: 6px; font-size: 13px; }
.ord-no { font-weight: 700; font-size: 15px; }
.ord-id .tagchip { margin-top: 4px; display: inline-block; }
.ord-by { font-size: 12px; margin-top: 2px; }
.ord-cus .nm { font-weight: 600; }
.ord-phone { display: inline-block; margin: 2px 0; color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; }
.ord-phone:hover { color: var(--brand); }
.ord-addr { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ord-item { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.ord-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex: none; border: 1px solid var(--line); background: #fff; }
.ord-thumb.none { display: grid; place-items: center; background: #f2f4f7; font-size: 18px; }
.ord-item-t { min-width: 0; }
.ord-item-t .nm { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ord-item-t .muted { font-size: 13px; }
.ord-note { font-size: 13px; color: #475467; margin-top: 4px; }
.ord-notice { margin: 6px 0 0; padding: 6px 8px; font-size: 13px; }
.ord-total { font-weight: 700; font-size: 15px; color: var(--good); font-variant-numeric: tabular-nums; }
.ord-money .muted { font-size: 12.5px; }
.st-pill { display: inline-block; color: #fff; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; margin: 0 4px 4px 0; }
.st-pill.sm { font-size: 11px; padding: 1px 8px; }
.ord-ship { font-size: 13px; margin-top: 2px; }
.ord-err { font-size: 12.5px; color: var(--bad); margin-top: 4px; }
.ord-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.ord-local { width: auto; padding: 4px 6px; font-size: 13px; }
.ord-time { font-size: 13px; }
@media (max-width: 1021px) { /* hẹp hơn thì bảng 7 cột không đủ chỗ → mỗi đơn 1 thẻ 2 cột */
  .ord-head { display: none; }
  .ord-head.bulk { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; } /* điện thoại: chỉ hiện khi đang chọn đơn */
  .ord-row { grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .ord-row > .ord-sel { grid-column: 1 / -1; flex-direction: row; gap: 8px; }
  .ord-bulk { flex: 1 1 100%; }
  .ord-bulk-acts { margin-left: 0; }
  .ord-items, .ord-st { grid-column: 1 / -1; }
  .ord-money { text-align: right; }
  .ord-time { grid-column: 1 / -1; }
}
.ord-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 8px 14px; font-size: 13px; color: #475467; border-top: 1px solid var(--line); background: #f9fafb; }
/* Đơn hàng: nút ⟳ 📅 ↓↑ ⏷ + ô nổi lịch / sắp xếp / bộ lọc */
.ord-tb { position: relative; display: flex; gap: 6px; margin-left: auto; }
.ord-ib { width: 34px; height: 34px; padding: 0; display: inline-grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; color: #344054; position: relative; }
.ord-ib:hover { border-color: var(--brand); color: var(--brand); }
.ord-ib.on { border-color: var(--brand); color: var(--brand); background: #eff4ff; }
.ord-ib.spin svg { animation: ord-spin .8s linear infinite; }
@keyframes ord-spin { to { transform: rotate(360deg); } }
.ord-ib-n { position: absolute; top: -7px; right: -7px; min-width: 17px; height: 17px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 10.5px; line-height: 17px; padding: 0 4px; font-weight: 600; }
.ord-pop { position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); text-align: left; }
.ord-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 10px; align-items: center; }
.ord-chip { display: inline-flex; align-items: center; gap: 2px; background: #fff; border: 1px solid #b2ccff; color: #1d4ed8; border-radius: 6px; padding: 3px 3px 3px 10px; font-size: 13px; max-width: 100%; }
.ord-chip button { border: 0; background: transparent; padding: 0 5px; font-size: 16px; line-height: 1; color: #667085; }
.ord-chip button:hover { color: var(--bad); background: transparent; }
.ord-chip-clear { border: 0; background: transparent; color: var(--muted); font-size: 13px; padding: 3px 6px; text-decoration: underline; }
/* lịch */
.ord-datepop { width: 720px; max-width: calc(100vw - 32px); }
.dp-main { display: flex; }
.dp-presets { display: flex; flex-direction: column; padding: 8px 0; border-right: 1px solid var(--line); flex: none; width: 150px; }
.dp-presets button { border: 0; background: transparent; text-align: left; padding: 8px 14px; border-radius: 0; color: #344054; font-size: 14px; }
.dp-presets button:hover, .dp-presets button.on { background: #eff4ff; color: var(--brand); }
.dp-right { flex: 1; min-width: 0; padding: 10px 12px 6px; }
.dp-inputs { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; color: var(--muted); }
.dp-inputs input { border: 0; padding: 7px 0; background: transparent; min-width: 0; flex: 1; box-shadow: none; }
.dp-cals { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 6px; }
.dp-cal-h { display: grid; grid-template-columns: 60px 1fr 60px; align-items: center; text-align: center; height: 34px; }
.dp-cal-h > span:last-child { text-align: right; }
.dp-cal-h > span:first-child { text-align: left; }
.dp-cal-h button { border: 0; background: transparent; padding: 2px 6px; color: var(--muted); font-size: 15px; }
.dp-cal-h button:hover { color: var(--brand); background: transparent; }
.dp-cal-h strong { font-size: 14px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; row-gap: 2px; }
.dp-grid .wd { font-size: 12px; color: var(--muted); padding: 5px 0; }
.dp-grid button { border: 0; background: transparent; padding: 0; height: 31px; border-radius: 0; font-size: 13px; color: #101828; }
.dp-grid button:hover { background: #e0eaff; }
.dp-grid button.out { color: #c0c5cf; }
.dp-grid button.today { box-shadow: inset 0 0 0 1px var(--brand); border-radius: 6px; }
.dp-grid button.in { background: #eff4ff; }
.dp-grid button.lo, .dp-grid button.hi { background: var(--brand); color: #fff; border-radius: 6px; }
.dp-cal .mob { display: none; }
.dp-row, .dp-foot, .fm-foot { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line); font-size: 13px; }
.dp-row select { width: auto; padding: 5px 8px; font-size: 13px; }
.dp-foot button, .fm-foot button, .sp-foot button { padding: 5px 12px; font-size: 13px; }
.dp-remember { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: #475467; white-space: nowrap; }
.dp-remember input { width: auto; margin: 0; }
@media (max-width: 760px) {
  .dp-main { flex-direction: column; }
  .dp-presets { flex-direction: row; flex-wrap: wrap; width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; gap: 5px; }
  .dp-presets button { padding: 4px 10px; border-radius: 99px; background: #f2f4f7; font-size: 13px; }
  .dp-cals { grid-template-columns: 1fr; }
  .dp-cal.second { display: none; }
  .dp-cal .mob { display: inline; }
  .dp-foot { flex-wrap: wrap; }
}
/* sắp xếp */
.ord-sortpop { width: 280px; max-width: calc(100vw - 32px); padding: 6px 0 0; }
.sp-h { font-size: 12.5px; color: var(--muted); padding: 6px 14px 4px; }
.sp-sep { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 8px; }
.sp-opt { display: flex; align-items: center; gap: 9px; padding: 6px 14px; cursor: pointer; font-size: 14px; }
.sp-opt:hover { background: #f9fafb; }
.sp-opt input { width: auto; margin: 0; }
.sp-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line); margin-top: 6px; }
/* bộ lọc */
.ord-fpop { display: grid; grid-template-columns: 220px 1fr; grid-template-rows: minmax(0, 1fr) auto; width: 540px; max-width: calc(100vw - 32px); height: min(470px, 72vh); }
.fm-cats { overflow-y: auto; padding: 6px 0; border-right: 1px solid var(--line); }
.fm-cat { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: transparent; text-align: left; padding: 8px 12px; border-radius: 0; color: #344054; font-size: 14px; }
.fm-cat .t { flex: 1; min-width: 0; }
.fm-cat:hover, .fm-cat.on { background: #eff4ff; color: var(--brand); }
.fm-n { background: var(--brand); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; line-height: 17px; font-weight: 600; }
.fm-arrow { color: var(--muted); font-size: 16px; line-height: 1; }
.fm-opts { overflow-y: auto; padding: 6px 0; min-width: 0; }
.fm-modes { border-bottom: 1px solid var(--line); padding-bottom: 4px; margin-bottom: 4px; }
.fm-o { display: flex; align-items: center; gap: 9px; padding: 7px 12px; cursor: pointer; font-size: 14px; }
.fm-o:hover { background: #f9fafb; }
.fm-o input { width: auto; margin: 0; flex: none; }
.fm-o .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-o .n { font-size: 12px; color: var(--muted); }
.fm-o .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.fm-mode { color: #475467; font-size: 13px; padding-top: 5px; padding-bottom: 5px; }
.fm-search { margin: 4px 12px 6px; width: calc(100% - 24px); padding: 6px 10px; font-size: 13px; }
.fm-empty { padding: 10px 12px; font-size: 13px; }
.fm-foot { grid-column: 1 / -1; }
@media (max-width: 560px) {
  .ord-fpop { grid-template-columns: 1fr; grid-template-rows: 170px minmax(0, 1fr) auto; height: min(560px, 78vh); }
  .fm-cats { border-right: 0; border-bottom: 1px solid var(--line); }
}
.fm-o, .sp-opt, .dp-remember { margin: 0; font-weight: 400; } /* bỏ kiểu label chung (đậm + cách trên) */

/* Form Tạo đơn trong Hội thoại */
.of { display: flex; flex-direction: column; gap: 8px; }
.of-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; }
.of-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; }
.of-h > span { display: inline-flex; align-items: center; gap: 7px; }
.of-link { border: 0; background: transparent; color: var(--brand); padding: 0; font-size: 13px; font-weight: 600; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.of-two { gap: 6px; }
.of-sec input, .of-sec select, .of-sec textarea { padding: 7px 10px; background: #f9fafb; }
.of-sec textarea { min-height: 54px; }
.of-notice { margin: 0; }
.of-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.of-row > span { color: #344054; }
.of-row select { max-width: 62%; }
.of-money { width: 130px; text-align: right; }
.of-checks { display: flex; gap: 14px; flex-wrap: wrap; }
.of-checks label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 400; font-size: 14px; cursor: pointer; }
.of-checks input { width: auto; margin: 0; }
.of-table { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.of-tr { display: grid; grid-template-columns: minmax(0, 1fr) 38px 60px 66px; gap: 4px; align-items: center; padding: 7px 6px; border-top: 1px solid var(--line); font-size: 13px; }
.of-unit, .of-sum { font-size: 12px; }
.of-th { border-top: 0; background: #f2f4f7; font-weight: 600; color: #344054; }
.of-th span:nth-child(n+2), .of-unit, .of-sum { text-align: right; }
.of-name { display: flex; gap: 6px; align-items: flex-start; min-width: 0; }
.of-name img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.of-name > div { min-width: 0; }
.of-name .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.of-name select { margin-top: 4px; padding: 3px 6px; font-size: 12px; max-width: 100%; }
.of-x { border: 0; background: transparent; color: var(--bad); padding: 0; font-size: 12px; margin-top: 2px; }
.of-qty { padding: 4px 4px !important; text-align: center; }
.of-sum { font-weight: 600; }
.of-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 8px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.of-search { display: flex; align-items: center; gap: 6px; background: #f9fafb; border: 1px solid var(--line); border-radius: 8px; padding: 0 4px 0 8px; }
.of-search .of-sic { color: var(--muted); display: inline-flex; }
.of-search input { border: 0; background: transparent !important; padding: 8px 4px; flex: 1; min-width: 0; box-shadow: none; }
.of-combo { border: 1px solid var(--line); background: #fff; padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.of-combo.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.of-plus { border: 0; background: var(--brand); color: #fff; width: 30px; height: 30px; border-radius: 7px; font-size: 18px; line-height: 1; padding: 0; }
.of-pimg { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex: none; }
.of-search .pick-it { align-items: center; }
.of-qline { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.of-ntabs { width: 100%; }
.of-ntabs button { flex: 1; }
.of-foot { position: sticky; bottom: -8px; background: var(--bg); padding: 8px 0 10px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }
.of-total { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px; }
.of-total strong { color: var(--bad); font-size: 20px; }
.of-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.of-btns button { padding: 10px; }
/* Ô "Chọn địa chỉ" (Địa chỉ cũ / Địa chỉ mới, Tỉnh → Quận huyện → Phường xã) */
.ap { position: relative; }
.ap-field { display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #f9fafb; cursor: pointer; font-size: 14px; }
.ap-field.empty { color: var(--muted); }
.ap-field:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.ap-field > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-caret { color: var(--muted); font-size: 12px; }
.ap-ref { font-size: 12px; margin-top: 3px; }
.ap-ref:empty { display: none; }
.ap-warn { color: #b54708; font-size: 12.5px; }
.ap-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 28px rgba(16, 24, 40, .16); min-width: 280px; }
.ap-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 10px 6px; }
.ap-mode button { padding: 4px 10px; font-size: 13px; }
.ap-tabs { display: flex; border-bottom: 1px solid var(--line); }
.ap-tabs button { flex: 1; border: 0; background: transparent; border-radius: 0; padding: 8px 4px; font-size: 13px; color: var(--muted); border-bottom: 2px solid transparent; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-tabs button.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.ap-q { margin: 8px 8px 4px; width: calc(100% - 16px); padding: 6px 10px; font-size: 13px; }
.ap-list { max-height: 240px; overflow-y: auto; padding: 2px 4px 6px; }
.ap-it { padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.ap-it:hover { background: #f2f4f7; }
.ap-it.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.ap-empty { padding: 10px 8px; font-size: 13px; }
dialog .ap-pop { position: relative; top: 4px; }

/* Sửa đơn tay: khung đầu form khi đang sửa */
.of-edit { background: #fffaeb; border: 1px solid #fedf89; border-radius: 10px; padding: 8px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.of-edit .muted { font-size: 12.5px; }
.of-edit button { align-self: flex-start; }
