/* httl.app – giao diện sau đăng nhập (Tạo, Quản lý, Duyệt). */

/* ---------- Token ---------- */
:root {
  color-scheme: light;
  --bg: #F4F6F9; --surface: #FFFFFF; --surface-2: #F8F9FB; --ink: #14233B; --body: #46566B; --muted: #5B6B7E;
  --line: #E1E6EE; --line-strong: #B9C4D3; --gold: #D9A441; --gold-soft: #FBF1DC; --gold-ink: #7A5410; --link: #1E4F8A;
  --primary-bg: #14233B; --primary-hover: #22385A; --primary-ink: #FFFFFF; --soft: #EEF1F5;
  --ok: #1E6B3A; --ok-bg: #EEF8F1; --err: #B42318; --err-bg: #FEF3F2; --warn: #7A4E00; --warn-bg: #FFF4D6;
  --info: #1E4F8A; --info-bg: #EEF4FB;
  --focus: #D9A441;
  --shadow-1: 0 1px 2px rgba(20, 35, 59, .06);
  --shadow-2: 0 6px 24px rgba(20, 35, 59, .10);
  --shadow-3: 0 18px 48px rgba(20, 35, 59, .18);

  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem;
  --fs-xs: .8125rem; --fs-sm: .9375rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-pill: 999px;
  --tap: 44px;
  --gutter: 1rem;
  --sans: "Be Vietnam Pro", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  box-sizing: border-box;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0E1828; --surface: #16233A; --surface-2: #13203A; --ink: #EEF2F6; --body: #B4C1D2; --muted: #9AAAC0;
    --line: #26375A; --line-strong: #3B5073; --gold: #E8B04A; --gold-soft: #33280F; --gold-ink: #F5D27A; --link: #8DB9E6;
    --primary-bg: #EEF2F6; --primary-hover: #FFFFFF; --primary-ink: #0E1828; --soft: #1C2B45;
    --ok: #7FD39B; --ok-bg: #12301E; --err: #FF9A8F; --err-bg: #3A1512; --warn: #F5D27A; --warn-bg: #3A2C0B;
    --info: #8DB9E6; --info-bg: #15294A;
    --focus: #E8B04A;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 6px 24px rgba(0, 0, 0, .35);
    --shadow-3: 0 18px 48px rgba(0, 0, 0, .5);
  }
}
@media (min-width: 640px) { :root { --gutter: 1.5rem; } }

/* ---------- Nền tảng ---------- */
*, *::before, *::after { box-sizing: inherit; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 400 var(--fs-md)/1.6 var(--sans); overflow-wrap: break-word; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; line-height: 1.25; color: var(--ink); }
h1 { font-size: var(--fs-2xl); font-weight: 800; }
h2 { font-size: var(--fs-xl); font-weight: 800; }
h3 { font-size: var(--fs-lg); font-weight: 700; }
p { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.no-scroll { overflow: hidden; }

/* ---------- Khung trang ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.topbar-in { max-width: 1240px; margin: 0 auto; padding: var(--s3) var(--gutter); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); }
.brand { display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.1875rem; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand .arch { fill: var(--ink); }
.brand small { font-weight: 500; font-size: var(--fs-sm); color: var(--muted); padding-left: var(--s3); margin-left: var(--s1); border-left: 1px solid var(--line-strong); }
.userbox { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s4); font-size: var(--fs-sm); color: var(--muted); min-width: 0; }
.userbox a, .userbox .linkbtn { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--ink); font-weight: 500; text-decoration: none; }
.userbox a:hover, .userbox .linkbtn:hover { text-decoration: underline; }
.userbox a[aria-current="page"] { font-weight: 700; box-shadow: inset 0 -2px 0 var(--gold); }
.userbox-email { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 639px) { .userbox-email { display: none; } }
@media (max-width: 359px) { .brand small { display: none; } }

.page { max-width: 1240px; margin: 0 auto; padding: var(--s5) var(--gutter) var(--s7); padding-bottom: calc(var(--s7) + env(safe-area-inset-bottom, 0px)); }
.page.narrow, .narrow { max-width: 760px; }
@media (min-width: 640px) { .page { padding-top: var(--s6); } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.page-head > div { min-width: 0; flex: 1 1 18rem; }
.lead { color: var(--body); margin-top: var(--s2); font-size: 1.0625rem; max-width: 62ch; }
.eyebrow { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3) var(--s4); }
.meta { font-size: var(--fs-sm); color: var(--muted); overflow-wrap: anywhere; }
.meta a { color: inherit; }
.hint { font-size: .875rem; color: var(--muted); line-height: 1.5; }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; padding: 0 1.25rem; font: inherit; font-weight: 700; font-size: var(--fs-md); line-height: 1.2; text-align: center;
  border-radius: var(--r-md); border: 1.5px solid var(--line-strong); color: var(--ink); background: var(--surface);
  text-decoration: none; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn.primary { background: var(--primary-bg); color: var(--primary-ink); border-color: var(--primary-bg); box-shadow: var(--shadow-1); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--link); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { color: var(--err); border-color: currentColor; background: var(--surface); }
.btn.danger:hover { background: var(--err-bg); }
.btn.danger.solid { background: var(--err); color: #fff; border-color: var(--err); }
@media (prefers-color-scheme: dark) { .btn.danger.solid { color: #2A0D0A; } }
.btn.small { min-height: var(--tap); padding: 0 var(--s4); font-size: var(--fs-sm); border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }

/* ---------- Thẻ, thông báo, nhãn ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5) var(--s4); box-shadow: var(--shadow-1); }
@media (min-width: 640px) { .card { padding: var(--s5); } }
.list { display: flex; flex-direction: column; gap: var(--s4); }

.notice { display: block; border-radius: var(--r-md); padding: var(--s3) var(--s4); font-size: var(--fs-sm); line-height: 1.55; border: 1px solid transparent; border-left-width: 4px; }
.notice strong { font-weight: 700; }
.notice.ok { background: var(--ok-bg); color: var(--ok); border-color: currentColor; }
.notice.err { background: var(--err-bg); color: var(--err); border-color: currentColor; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: currentColor; }
.notice.info { background: var(--info-bg); color: var(--info); border-color: currentColor; }
.notice > * + * { margin-top: var(--s1); }

.badge { display: inline-flex; align-items: center; gap: .4rem; flex: none; font-size: var(--fs-xs); font-weight: 700; line-height: 1; padding: .4rem .7rem; border-radius: var(--r-pill); background: var(--soft); color: var(--body); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.pending, .badge.new { color: var(--warn); background: var(--warn-bg); }
.badge.approved, .badge.done { color: var(--ok); background: var(--ok-bg); }
.badge.suspended, .badge.rejected { color: var(--err); background: var(--err-bg); }

.chip { display: inline-flex; align-items: center; font-size: var(--fs-xs); font-weight: 500; padding: .3rem .65rem; border-radius: var(--r-pill); background: var(--soft); color: var(--body); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); padding: 0; margin: 0; list-style: none; }

/* Trạng thái trống */
.empty { text-align: center; padding: var(--s7) var(--s4); display: flex; flex-direction: column; align-items: center; gap: var(--s3); }
.empty svg { width: 56px; height: 56px; color: var(--line-strong); }
.empty h2 { font-size: var(--fs-lg); }
.empty p { color: var(--body); max-width: 44ch; }
.empty .btn { margin-top: var(--s2); }

/* Khung chờ tải */
.skeleton { display: flex; flex-direction: column; gap: var(--s3); }
.skeleton i { display: block; height: .9rem; border-radius: 6px; background: var(--soft); }
.skeleton i:first-child { height: 1.25rem; width: 45%; }
.skeleton i:nth-child(2) { width: 70%; }
.skeleton i:nth-child(3) { width: 30%; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton i { background: linear-gradient(90deg, var(--soft) 0%, var(--surface-2) 50%, var(--soft) 100%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Toast */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(var(--s4) + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: min(420px, calc(100% - 2 * var(--gutter))); display: flex; flex-direction: column; gap: var(--s2); pointer-events: none; }
.toast { pointer-events: auto; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--ink); color: var(--bg); font-size: var(--fs-sm); font-weight: 500; box-shadow: var(--shadow-3); }
.toast.err { background: var(--err); color: #fff; }
@media (prefers-color-scheme: dark) { .toast.err { color: #2A0D0A; } }
@media (prefers-reduced-motion: no-preference) { .toast { animation: toast-in .2s ease-out; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.has-savebar .toasts { bottom: calc(6.5rem + env(safe-area-inset-bottom, 0px)); }

/* ---------- Đăng nhập ---------- */
.signin { max-width: 920px; margin: 0 auto; display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-2); overflow: hidden; }
@media (min-width: 640px) { .signin { margin-top: var(--s5); } }
@media (min-width: 820px) { .signin { grid-template-columns: 5fr 6fr; min-height: 460px; } }

.signin-aside { --aside-bg: #14233B; position: relative; isolation: isolate; overflow: hidden; background: var(--aside-bg); color: #E6ECF3; padding: var(--s5) var(--s4); display: flex; flex-direction: column; gap: var(--s4); }
@media (prefers-color-scheme: dark) { .signin-aside { --aside-bg: #0A1322; border-right: 1px solid var(--line); } }
/* Khung vòm mờ làm nền, cùng hình với logo */
.signin-aside::after { content: ""; position: absolute; z-index: -1; right: -60px; bottom: -20px; width: 180px; height: 200px; border: 2px solid rgba(217, 164, 65, .2); border-bottom: 0; border-radius: 90px 90px 0 0; }
@media (max-width: 819px) { .signin-aside::after { display: none; } }
@media (min-width: 640px) { .signin-aside { padding: var(--s6); } }
.signin-kicker { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #E8B04A; }
.signin-headline { font-size: var(--fs-xl); font-weight: 800; line-height: 1.3; letter-spacing: -0.015em; color: #FFFFFF; }
@media (min-width: 820px) { .signin-headline { font-size: 1.625rem; } }
.signin-points { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.signin-points li { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--fs-sm); line-height: 1.5; }
.signin-points svg { flex: none; width: 20px; height: 20px; margin-top: 1px; padding: 3px; border-radius: 50%; background: rgba(232, 176, 74, .18); color: #E8B04A; }
.signin-note { margin-top: auto; padding-top: var(--s4); border-top: 1px solid rgba(255, 255, 255, .12); font-size: var(--fs-xs); color: #A9B7C8; }
@media (max-width: 819px) { .signin-points, .signin-note { display: none; } }

.signin-main { padding: var(--s5) var(--s4) var(--s5); display: flex; flex-direction: column; justify-content: center; gap: var(--s4); min-width: 0; }
@media (min-width: 640px) { .signin-main { padding: var(--s7) var(--s6); } }
.signin-main h1 { font-size: var(--fs-2xl); }
.signin-lead { color: var(--body); }
.signin-btn { width: 100%; max-width: 400px; min-height: 44px; display: flex; align-items: center; }
.signin-btn.is-busy { opacity: .5; pointer-events: none; }
.signin-btn-ph { flex: 1; height: 44px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); color: var(--muted); font-size: var(--fs-sm); }
.signin-status:empty { display: none; }
.signin-facts { list-style: none; margin: 0; padding: var(--s4) 0 0; border-top: 1px solid var(--line); display: grid; gap: var(--s2); }
.signin-facts li { display: flex; gap: var(--s2); align-items: flex-start; font-size: var(--fs-sm); color: var(--body); line-height: 1.5; }
.signin-facts svg { flex: none; width: 16px; height: 16px; margin-top: 3px; color: var(--muted); }
.signin-legal { font-size: var(--fs-xs); color: var(--muted); line-height: 1.6; }

.signin-fatal { max-width: 520px; margin: var(--s6) auto 0; display: flex; flex-direction: column; align-items: flex-start; gap: var(--s4); }
.signin-fatal > svg { width: 40px; height: 40px; color: var(--ink); }
.signin-fatal .notice { align-self: stretch; }

/* ---------- Ô nhập ---------- */
fieldset { margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: var(--s4) var(--s4) var(--s5); display: flex; flex-direction: column; gap: var(--s4); box-shadow: var(--shadow-1); }
@media (min-width: 640px) { fieldset { padding: var(--s5); } }
legend { float: left; width: 100%; padding: 0; display: flex; align-items: center; gap: var(--s3); font-weight: 800; font-size: var(--fs-lg); }
legend + * { clear: left; }
.legend-num { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--soft); color: var(--ink); font-size: var(--fs-xs); font-weight: 800; }
.legend-num.done { background: var(--ok-bg); color: var(--ok); }
.legend-opt { margin-left: auto; font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: .4rem; }
.field label { font-weight: 700; font-size: var(--fs-sm); }
.field .req { color: var(--err); font-weight: 700; }
.field .msg { font-size: .875rem; line-height: 1.45; }
.field .msg.err { color: var(--err); font-weight: 500; }
.field .msg.ok { color: var(--ok); }
.field .msg.busy { color: var(--muted); }
input[type="text"], input[type="url"], input[type="email"], input[type="tel"], input[type="search"], textarea {
  width: 100%; min-height: 48px; padding: .7rem .85rem; font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--muted); }
input:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 55%, transparent); }
input:disabled { background: var(--soft); color: var(--body); cursor: not-allowed; }
input[readonly] { background: var(--surface-2); }
textarea { resize: vertical; line-height: 1.5; }
.field.has-err input, .field.has-err textarea, [aria-invalid="true"] { border-color: var(--err); }
.field.has-err input:focus, .field.has-err textarea:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 30%, transparent); }
.prefix { display: flex; align-items: stretch; min-width: 0; }
.prefix span { display: flex; align-items: center; padding: 0 var(--s3); background: var(--soft); border: 1.5px solid var(--line-strong); border-right: 0; border-radius: 10px 0 0 10px; font-weight: 700; font-size: var(--fs-sm); color: var(--body); white-space: nowrap; }
.prefix input { border-radius: 0 10px 10px 0; min-width: 0; }
.field.has-err .prefix span { border-color: var(--err); }

/* Ô link + nút Sao chép */
.copy { display: flex; gap: var(--s2); min-width: 0; }
.copy input { flex: 1 1 auto; min-width: 0; font-weight: 500; }
.copy .btn { flex: none; }

/* ---------- Thanh bước ---------- */
.stepper { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 var(--s5); padding: 0; list-style: none; counter-reset: none; }
.stepper li { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--s1); text-align: center; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); }
.stepper li::before { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li[aria-current="step"]::before { background: var(--ink); }
.stepper-num { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); font-size: var(--fs-sm); color: var(--muted); }
.stepper li[aria-current="step"] { color: var(--ink); }
.stepper li[aria-current="step"] .stepper-num { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-ink); box-shadow: 0 0 0 4px var(--gold-soft); }
.stepper li.done { color: var(--ink); }
.stepper li.done .stepper-num { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
@media (min-width: 640px) {
  .stepper { max-width: 560px; }
  .stepper li { font-size: var(--fs-sm); }
}

/* ---------- Chọn mẫu ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: var(--s4); margin-top: var(--s5); }
.tpl { position: relative; display: flex; flex-direction: column; gap: var(--s1); padding: var(--s2) var(--s2) var(--s4); text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: var(--r-lg); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tpl:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.tpl[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--gold), var(--shadow-2); }
.tpl-name { font-weight: 700; font-size: 1.0625rem; padding: var(--s2) var(--s2) 0; }
.tpl-desc { font-size: .875rem; color: var(--body); padding: 0 var(--s2); line-height: 1.45; }
.tpl-check { position: absolute; top: var(--s3); right: var(--s3); z-index: 2; display: none; align-items: center; gap: .3rem; padding: .3rem .6rem; border-radius: var(--r-pill); background: var(--primary-bg); color: var(--primary-ink); font-size: var(--fs-xs); font-weight: 700; box-shadow: var(--shadow-2); }
.tpl[aria-pressed="true"] .tpl-check { display: inline-flex; }
.thumb { position: relative; display: block; height: 230px; overflow: hidden; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.thumb iframe { position: absolute; top: 0; left: 50%; width: 390px; height: 900px; border: 0; transform: translateX(-50%) scale(.52); transform-origin: top center; pointer-events: none; }
@media (prefers-reduced-motion: no-preference) { .tpl:hover { transform: translateY(-2px); } }

/* ---------- Trình tạo trang ---------- */
.builder { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s6); align-items: start; margin-top: var(--s5); }
.builder form { min-width: 0; display: flex; flex-direction: column; gap: var(--s4); }
.form-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s4); padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); font-size: var(--fs-sm); }
.form-head strong { font-weight: 700; }

/* Thanh lưu dính đáy */
.savebar { position: sticky; bottom: 0; z-index: 20; margin: 0 calc(-1 * var(--gutter)); padding: var(--s3) var(--gutter); padding-bottom: calc(var(--s3) + env(safe-area-inset-bottom, 0px)); background: var(--surface); background: color-mix(in srgb, var(--surface) 94%, transparent); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(20, 35, 59, .08); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
@supports (backdrop-filter: blur(8px)) { .savebar { backdrop-filter: blur(8px); } }
.savebar .grow { flex: 1 1 10rem; min-width: 0; }
.savebar .btn.primary { flex: 1 1 auto; }
@media (min-width: 640px) {
  .savebar { margin: 0; border: 1px solid var(--line); border-radius: var(--r-lg); bottom: var(--s3); padding: var(--s3) var(--s4); }
  .savebar .btn.primary { flex: 0 0 auto; }
}
.progress-text { font-size: var(--fs-xs); font-weight: 700; color: var(--body); }
.progress-bar { height: 6px; margin-top: .35rem; border-radius: var(--r-pill); background: var(--soft); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--gold); }
.progress-bar.full span { background: var(--ok); }
@media (prefers-reduced-motion: no-preference) { .progress-bar span { transition: width .3s ease; } }

/* Xem trước: dính bên phải trên máy tính, lớp phủ toàn màn hình trên điện thoại */
.preview { display: none; flex-direction: column; align-items: center; gap: var(--s3); }
.preview-head { width: 100%; max-width: 390px; display: flex; justify-content: space-between; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--muted); }
.preview-head strong { color: var(--ink); }
.preview-state { font-size: var(--fs-xs); }
.phone { width: 100%; max-width: 390px; background: #14233B; border-radius: 40px; padding: 12px; box-shadow: var(--shadow-3); }
.phone iframe { display: block; width: 100%; height: 720px; border: 0; border-radius: 30px; background: #fff; }
.preview.is-open { display: flex; position: fixed; inset: 0; z-index: 60; overflow-y: auto; padding: var(--s3) var(--gutter) calc(var(--s4) + env(safe-area-inset-bottom, 0px)); padding-top: calc(var(--s3) + env(safe-area-inset-top, 0px)); background: var(--bg); }
.preview.is-open .phone { border-radius: 28px; padding: 8px; }
.preview.is-open .phone iframe { height: calc(100vh - 7rem); height: calc(100dvh - 7rem); border-radius: 22px; }
@media (min-width: 960px) {
  .builder { grid-template-columns: minmax(0, 1fr) 400px; }
  .preview, .preview.is-open { display: flex; position: sticky; inset: auto; top: var(--s4); z-index: auto; padding: 0; background: none; overflow: visible; }
  .preview.is-open .phone { border-radius: 40px; padding: 12px; }
  .phone iframe, .preview.is-open .phone iframe { height: min(720px, calc(100vh - 6rem)); border-radius: 30px; }
  .only-mobile { display: none !important; }
}

/* Bước hoàn tất */
.done-card { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s4); }
.done-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); }
.done-icon svg { width: 28px; height: 28px; }
.next-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--s3); counter-reset: step; }
.next-steps li { position: relative; padding-left: 2.5rem; color: var(--body); counter-increment: step; }
.next-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); color: var(--ink); font-weight: 800; font-size: var(--fs-xs); }

/* ---------- Trang quản lý ---------- */
.site { display: flex; flex-direction: column; gap: var(--s4); }
.site-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.site-head h2 { font-size: var(--fs-lg); overflow-wrap: anywhere; }
.site-status { font-size: var(--fs-sm); color: var(--body); }
.site-section { display: flex; flex-direction: column; gap: var(--s2); padding-top: var(--s4); border-top: 1px solid var(--line); }
.site-section h3 { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); }
.site-grid { display: grid; gap: var(--s4); }
@media (min-width: 640px) { .site-grid { grid-template-columns: minmax(0, 1fr) auto; } }
.shortlinks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.shortlinks li { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--tap); border-bottom: 1px dashed var(--line); }
.shortlinks li:last-child { border-bottom: 0; }
.shortlinks .sl-label { font-size: var(--fs-xs); color: var(--muted); display: block; }
.shortlinks a { font-weight: 500; overflow-wrap: anywhere; }
.qr { display: flex; flex-direction: column; align-items: center; gap: var(--s2); }
.qr img { width: 136px; height: 136px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); }
.stat { display: flex; align-items: baseline; gap: var(--s2); }
.stat b { font-size: var(--fs-xl); font-weight: 800; color: var(--ink); line-height: 1; }
.stat span { font-size: var(--fs-sm); color: var(--muted); }
.upsell { margin-top: var(--s5); display: flex; flex-direction: column; gap: var(--s2); background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.upsell .eyebrow { color: var(--gold-ink); }
.upsell p { color: var(--body); font-size: var(--fs-sm); }
.upsell .btn { align-self: flex-start; margin-top: var(--s2); }

/* ---------- Trang duyệt ---------- */
.toolbar { display: flex; flex-direction: column; gap: var(--s3); margin: var(--s5) 0 var(--s4); }
.tabs { display: flex; gap: var(--s2); overflow-x: auto; padding: 2px 2px var(--s1); margin: 0 -2px; scrollbar-width: thin; }
.tab { flex: none; display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--tap); padding: 0 var(--s4); border-radius: var(--r-pill); border: 1.5px solid var(--line); background: var(--surface); color: var(--body); font: inherit; font-size: var(--fs-sm); font-weight: 700; cursor: pointer; white-space: nowrap; }
.tab:hover { border-color: var(--line-strong); color: var(--ink); }
.tab[aria-pressed="true"] { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-ink); }
.tab .count { min-width: 1.5rem; padding: .1rem .45rem; border-radius: var(--r-pill); background: var(--soft); color: var(--ink); font-size: var(--fs-xs); text-align: center; }
.tab[aria-pressed="true"] .count { background: color-mix(in srgb, var(--primary-ink) 18%, transparent); color: var(--primary-ink); }
.tab .count.hot { background: var(--gold); color: #14233B; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.filters .search { flex: 1 1 16rem; min-width: 0; }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--r-md); background: var(--soft); gap: 2px; }
.segmented button { min-height: 40px; padding: 0 var(--s3); border: 0; border-radius: 9px; background: transparent; font: inherit; font-size: var(--fs-sm); font-weight: 700; color: var(--body); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
@media (pointer: coarse) { .segmented button { min-height: var(--tap); } }
.result-count { font-size: var(--fs-xs); color: var(--muted); }
.item { display: flex; flex-direction: column; gap: var(--s3); }
.item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.item-head h2 { font-size: var(--fs-lg); overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s1) var(--s4); margin: 0; font-size: var(--fs-sm); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.item .note { font-size: var(--fs-sm); color: var(--body); padding: var(--s2) var(--s3); border-left: 3px solid var(--line-strong); background: var(--surface-2); border-radius: 0 var(--r-sm) var(--r-sm) 0; }

/* Hộp thoại ghi chú */
dialog { width: min(520px, calc(100% - 2 * var(--gutter))); max-height: calc(100% - 2rem); padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3); }
dialog::backdrop { background: rgba(14, 24, 40, .55); }
.dialog-body { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5); }
.dialog-body .actions { justify-content: flex-end; }
@media (prefers-reduced-motion: no-preference) { dialog[open] { animation: toast-in .18s ease-out; } }

/* ---------- Giảm chuyển động ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
