:root {
  --bg: #f6f7f9; --card: #fff; --text: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --accent: #fe2c55; --accent-2: #25c2c6; --ok: #1a9e5a;
  --s-cho: #8a8f9c; --s-pt: #2f6fdb; --s-quay: #d98a00; --s-video: #1a9e5a;
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111318; --card: #1b1e26; --text: #e8eaf0; --muted: #9aa1b2; --line: #2c303b; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.logo { font-weight: 700; text-decoration: none; font-size: 17px; }
main { max-width: 920px; margin: 0 auto; padding: 14px 12px 60px; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .end { justify-content: flex-end; }
.btn { border: 0; border-radius: 10px; padding: 9px 14px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; }
textarea { min-height: 110px; resize: vertical; }
label { display: block; margin: 10px 0; font-size: 14px; } label input { margin-top: 4px; }

.add { display: flex; gap: 8px; margin-bottom: 12px; }
.add input { flex: 1; }
.add-msg { margin: -4px 0 10px; font-size: 14px; min-height: 0; }
.add-msg.ok { color: var(--ok); font-weight: 600; } .add-msg.loi { color: var(--accent); font-weight: 600; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chip { white-space: nowrap; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; color: var(--text); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.search { margin-bottom: 12px; }

.list { display: grid; gap: 10px; }
.card { display: flex; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; align-items: center; }
.card .thumb { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }
.card .body { flex: 1; min-width: 0; text-decoration: none; }
.card .ten { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.stt { color: #888; font-weight: 700; margin-right: 2px; }
.uid-copy { cursor: pointer; border-bottom: 1px dashed currentColor; padding: 2px 0; }
.uid-copy:hover { color: var(--accent, #2563eb); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; color: #fff; border-radius: 6px; padding: 1px 8px; }
.b-cho { background: var(--s-cho); } .b-da_phan_tich { background: var(--s-pt); } .b-da_quay { background: var(--s-quay); } .b-da_lam_video { background: var(--s-video); }

.switch { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); flex: none; cursor: pointer; }
.switch input { display: none; }
.switch .tr { width: 44px; height: 26px; border-radius: 99px; background: var(--line); position: relative; transition: .2s; }
.switch .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px #0003; }
.switch input:checked + .tr { background: var(--ok); }
.switch input:checked + .tr::after { left: 21px; }
.switch.busy { opacity: .5; pointer-events: none; }

.detail .head { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.detail .head img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; background: var(--line); flex: none; }
.detail h1 { font-size: 18px; margin: 0 0 6px; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.detail h1.full { -webkit-line-clamp: unset; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 14px; margin-top: 6px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.quaybox { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; margin: 10px 0; }
.quaybox .switch { flex-direction: row; font-size: 14px; color: var(--text); font-weight: 600; gap: 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 10px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted); font: inherit; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.on { color: var(--text); border-color: var(--accent); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.md { overflow-x: auto; } .md table { border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 8px; vertical-align: top; }
.md h1 { font-size: 19px; } .md h2 { font-size: 17px; margin-top: 22px; } .md h3 { font-size: 15px; }
.caps { list-style: none; padding: 0; margin: 0; }
.caps li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.caps li span { flex: 1; word-break: break-word; } .caps .n { color: var(--muted); font-size: 12px; min-width: 26px; flex: none; }
pre.cmd { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; word-break: break-all; font-size: 13px; }
.err { color: var(--accent); min-height: 1em; font-size: 14px; }
dialog { border: 0; border-radius: 16px; padding: 18px; width: min(420px, 92vw); background: var(--card); color: var(--text); }
dialog::backdrop { background: #0007; }
dialog h2 { margin: 0 0 6px; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: .25s; pointer-events: none; max-width: 90vw; z-index: 20; }
#toast.on { opacity: .95; }
@media (max-width: 520px) { .detail .head img { width: 84px; height: 84px; } }
.card .switches { display: flex; flex-direction: column; gap: 6px; flex: none; }
.quaybox + .quaybox { margin-top: -4px; }

.vtk-add { display: grid; gap: 8px; margin-bottom: 6px; }
.vtk-list { display: grid; gap: 10px; margin-top: 10px; }
.vtk { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.vtk-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.vtk-link { display: block; font-weight: 600; word-break: break-all; font-size: 14px; }
.vtk-canh:not(:empty) { margin-top: 10px; display: grid; gap: 8px; }
.canh { display: flex; gap: 10px; align-items: flex-start; border-top: 1px solid var(--line); padding-top: 8px; }
.canh img, .canh .img { width: 72px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 6px; background: var(--line); flex: none; }
.canh-body { min-width: 0; display: grid; gap: 3px; font-size: 14px; word-break: break-word; }

/* QR link sản phẩm trên thẻ: nhỏ, rê chuột / chạm mới phóng to để điện thoại quét */
.qr { position: relative; flex: none; cursor: zoom-in; outline: none; }
.qr svg { display: block; width: 100%; height: auto; }
.qr-mini { width: 44px; padding: 2px; background: #fff; border-radius: 6px; border: 1px solid var(--line); }
.qr-pop { display: none; position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%); z-index: 10;
  width: 240px; padding: 10px; background: #fff; color: #333; border-radius: 12px; box-shadow: 0 8px 28px #0005; text-align: center; }
.qr:hover .qr-pop, .qr:focus .qr-pop { display: block; }
