:root { --brand: #2563eb; --bg: #f6f7f9; --fg: #111827; --muted: #6b7280; --card: #fff; --line: #e5e7eb; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); }
main { max-width: 960px; margin: 0 auto; padding: 16px; }
.guest main { max-width: 560px; }
h1 { font-size: 24px; margin: 8px 0 4px; } h2 { font-size: 18px; margin: 0 0 12px; } h3 { margin: 0 0 4px; font-size: 17px; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; } .center { text-align: center; }
.err { color: #dc2626; min-height: 1em; }
.bar { display: flex; gap: 12px; align-items: center; padding: 12px 16px; background: #111827; color: #fff; }
.bar .muted { color: #9ca3af; } .bar .link { margin-left: auto; color: #fff; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 12px; }
input:not([type=checkbox]):not([type=file]) { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
input[type=color] { height: 42px; padding: 4px !important; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
button, .btn { font: inherit; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--fg); text-decoration: none; display: inline-block; }
button.primary { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
button.primary:disabled { opacity: .45; cursor: not-allowed; }
button.big { width: 100%; padding: 14px; font-size: 17px; }
button.danger { color: #dc2626; } button.link { border: 0; background: none; color: var(--brand); padding: 0; }
.ev-head { display: flex; justify-content: space-between; gap: 12px; }
.qr { width: 96px; height: 96px; border: 1px solid var(--line); border-radius: 8px; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #eef2ff; margin-right: 4px; }
.badge.ready { background: #dcfce7; } .badge.error { background: #fee2e2; } .badge.scanning { background: #fef9c3; }
.progress { height: 6px; background: #eef0f3; border-radius: 99px; overflow: hidden; margin: 12px 0 4px; }
.progress div { height: 100%; background: var(--brand); transition: width .4s; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.stats div { background: var(--bg); border-radius: 10px; padding: 8px; text-align: center; }
.stats b { display: block; font-size: 18px; } .stats span { font-size: 12px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.event a { word-break: break-all; }
.hero { text-align: center; padding: 16px 0; } .logo { max-height: 56px; }
.check { display: flex; gap: 10px; font-weight: 400; align-items: flex-start; } .check input { margin-top: 4px; width: 18px; height: 18px; }
.fallback { margin-top: 14px; font-weight: 400; font-size: 13px; color: var(--muted); }
.note { background: #fffbeb; border: 1px solid #fde68a; border-radius: 12px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.cam { position: relative; border-radius: 12px; overflow: hidden; background: #000; aspect-ratio: 3/4; }
.cam video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.oval { position: absolute; inset: 12% 18%; border: 3px dashed rgba(255,255,255,.7); border-radius: 50%; }
.spinner { width: 36px; height: 36px; border: 4px solid #e5e7eb; border-top-color: var(--brand); border-radius: 50%; margin: 8px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.res-head { display: flex; justify-content: space-between; align-items: center; }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.grid figure { margin: 0; background: #fff; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.grid img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.grid figcaption { display: flex; justify-content: space-between; padding: 6px 8px; font-size: 13px; }
.grid figcaption a { color: var(--brand); text-decoration: none; }
@media (max-width: 600px) { .row, .stats { grid-template-columns: 1fr 1fr; } }

/* Upload logo / nền */
.upload { cursor: pointer; }
.drop { display: flex; align-items: center; justify-content: center; margin-top: 4px; height: 110px; border: 2px dashed var(--line); border-radius: 12px; background: var(--bg); overflow: hidden; text-align: center; color: var(--muted); font-weight: 400; }
.drop:hover { border-color: var(--brand); }
.drop small { font-size: 12px; }
.drop .prev { max-width: 100%; max-height: 100%; object-fit: contain; }
.drop.wide .prev { width: 100%; height: 100%; object-fit: cover; }
.brand-row { display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.brand-item { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.brand-item .link { margin-right: 8px; }
.brand-logo { height: 44px; max-width: 120px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 2px; }
.brand-bg { width: 88px; height: 50px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.brand-empty { display: inline-flex; align-items: center; justify-content: center; height: 44px; width: 60px; font-size: 11px; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.brand-empty.wide { width: 88px; }
.link.danger { color: #dc2626; }

/* Ảnh nền thương hiệu phía khách */
.brand-bg-layer { position: fixed; inset: 0; z-index: -1; background: center / cover no-repeat; }
.brand-bg-layer::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.15) 40%, rgba(246,247,249,.92) 75%); }
body.has-bg { background: transparent; }
body.has-bg .hero h1, body.has-bg .hero .muted { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
body.has-bg .card { background: rgba(255,255,255,.96); backdrop-filter: blur(6px); }
body.has-bg .res-head h2 { background: rgba(255,255,255,.9); padding: 2px 10px; border-radius: 8px; }
.logo { max-height: 64px; max-width: 70%; object-fit: contain; }

/* Lưu tất cả */
.save-box { margin: 8px 0 12px; }
.batches { display: grid; gap: 8px; }
.center-block { display: block; margin: 6px auto 0; }
body.has-bg .res-head .link { background: rgba(255,255,255,.9); padding: 4px 10px; border-radius: 8px; }
#saveMsg:empty { display: none; }
#saveMsg { margin: 10px 0 0; }
/* Quay 4 giây để tìm ảnh */
.cam-hint { position: absolute; left: 0; right: 0; bottom: 22px; text-align: center; color: #fff; font-size: 19px; font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.8); padding: 0 12px; }
.recording .oval { border-color: #ef4444; border-style: solid; }
.cam-msg { min-height: 1.5em; margin: 10px 0; font-size: 14px; color: #dc2626; }
.small { font-size: 13px; margin: 10px 0 0; }
/* Popup */
.modal { position: fixed; inset: 0; background: rgba(17,24,39,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-box { background: var(--card); border-radius: 14px; padding: 20px; max-width: 420px; width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-box p { margin: 8px 0; font-size: 14px; }
.modal-box button { margin-top: 12px; }
/* Quay có hướng dẫn: 3 bước */
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 12px; counter-reset: s; }
.steps li { flex: 1; text-align: center; font-size: 13px; color: var(--muted); padding-top: 8px; border-top: 4px solid var(--line); counter-increment: s; transition: color .2s, border-color .2s; }
.steps li::before { content: counter(s) ". "; }
.steps li.active { color: var(--fg); font-weight: 600; border-color: var(--brand); }
.steps li.done { color: #16a34a; border-color: #16a34a; }
.steps li.done::before { content: "✓ "; }
.cam-arrow { position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%); text-align: center; font-size: 72px; color: rgba(255,255,255,.9); text-shadow: 0 2px 8px rgba(0,0,0,.6); pointer-events: none; }
.recording .cam-arrow:not(:empty) { animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { opacity: .35; } }
/* Cam kết không lưu dữ liệu khuôn mặt */
.privacy { background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; color: #065f46; }
.privacy ul { margin: 6px 0 0; padding-left: 18px; } .privacy li { margin: 2px 0; }
.privacy-done { text-align: center; font-size: 13px; color: #065f46; margin: 0 0 10px; }
/* Đăng nhập / dùng thử */
.auth { max-width: 420px; margin: 32px auto; }
.auth .center { margin: 12px 0 0; }
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.bar .who { margin-left: auto; color: #d1d5db; font-size: 14px; } .bar .who:empty { display: none; }
.bar .who ~ .link { margin-left: 12px; }
.demo-note .link { margin-left: 6px; font-weight: 600; }
/* Bảng giá các gói */
.plans-box { max-width: 860px; position: relative; max-height: calc(100vh - 32px); overflow-y: auto; }
.plans-box h3 { margin: 0 28px 4px 0; }
.modal-x { position: absolute; top: 8px; right: 10px; margin: 0 !important; border: 0; background: none; font-size: 24px; line-height: 1; padding: 4px 8px; color: var(--muted); }
.cycle { display: inline-flex; gap: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 99px; padding: 3px; margin: 8px 0 4px; }
.cycle button { margin: 0 !important; border: 0; border-radius: 99px; padding: 6px 14px; background: none; font-size: 14px; }
.cycle button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }
.save-tag { font-size: 11px; color: #16a34a; font-weight: 600; margin-left: 4px; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.plan { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.plan.best { border: 2px solid var(--brand); }
.plan h4 { margin: 0 0 6px; font-size: 16px; }
.plan .price b { font-size: 24px; } .plan .price span { color: var(--muted); font-size: 14px; }
.plan .sub { color: var(--muted); font-size: 13px !important; margin: 2px 0 10px !important; min-height: 2.6em; }
.plan ul { list-style: none; padding: 0; margin: 0 0 12px; font-size: 14px; flex: 1; }
.plan li { padding: 4px 0 4px 22px; position: relative; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: #16a34a; font-weight: 700; }
.plan li.no { color: var(--muted); } .plan li.no::before { content: "✕"; color: #9ca3af; }
.plan button { width: 100%; margin-top: auto !important; }
.ribbon { position: absolute; top: -11px; right: 12px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 10px; border-radius: 99px; }
@media (max-width: 700px) { .plans { grid-template-columns: 1fr; } .plan .sub { min-height: 0; } }
/* Khoá logo / ảnh nền ở gói dùng thử */
.lock-note { font-size: 13px; color: var(--muted); margin: 8px 0 10px; }
.lock-note .link { margin-left: 4px; font-weight: 600; }
#brandInputs.locked { opacity: .45; pointer-events: none; }
/* Đăng ký gói, popup cảm ơn */
select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--fg); }
.bar .bar-link { color: #fff; font-size: 14px; text-decoration: none; margin-left: 12px; opacity: .85; } .bar .bar-link:hover { opacity: 1; }
.thanks-box { text-align: center; }
.thanks-icon { width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 50%; background: #dcfce7; color: #16a34a; font-size: 30px; line-height: 56px; font-weight: 700; }
.contact { display: grid; gap: 8px; margin: 14px 0 4px; }
.contact a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--fg); text-decoration: none; font-weight: 600; }
.contact a:hover { border-color: var(--brand); color: var(--brand); }
/* Trang quản lý tài khoản */
main.wide { max-width: 1180px; }
.users-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.users-head h2 { margin: 0; margin-right: auto; } .users-head h2 .muted { font-weight: 400; }
.users-head input { width: 260px !important; margin: 0 !important; }
.filters { display: flex; gap: 4px; background: #eef0f3; padding: 3px; border-radius: 10px; }
.filters button { border: 0; background: none; padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.filters button.on { background: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.table-card { padding: 0; overflow-x: auto; }
table.users { width: 100%; border-collapse: collapse; font-size: 14px; }
.users th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.users td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users tr:last-child td { border-bottom: 0; }
.users .c { text-align: center; }
.users a { color: var(--fg); text-decoration: none; } .users a:hover { color: var(--brand); }
.users select.plan { display: inline-block; width: auto; margin: 0 6px 0 0; padding: 5px 8px; font-size: 13px; }
.users .small-txt { font-size: 12px; }
.users tr.busy { opacity: .5; pointer-events: none; }
.tick { display: inline-flex; gap: 6px; align-items: center; margin: 0; font-weight: 400; cursor: pointer; white-space: nowrap; }
.tick input { width: 18px; height: 18px; accent-color: #16a34a; }
.toggle { min-width: 92px; padding: 5px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; background: #f3f4f6; color: var(--muted); border-color: #e5e7eb; }
.toggle.on { background: #dcfce7; color: #15803d; border-color: #86efac; }
#empty { padding: 24px; margin: 0; }
@media (max-width: 760px) {
  .users-head input { width: 100% !important; }
  .users thead { display: none; }
  .users tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .users td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; text-align: right !important; }
  .users td::before { content: attr(data-l); color: var(--muted); font-size: 13px; text-align: left; }
}
/* Mã sự kiện sai */
input.invalid, input.invalid:focus { border-color: #dc2626 !important; outline: 2px solid #dc2626; outline-offset: 0; box-shadow: 0 0 0 4px rgba(220,38,38,.15); }
