/* ============================================================
   SPA.VN — Giao diện chuẩn v3 (gói 03)
   Theo SPA-GOV-STD-002-UI v1.1:
   - Shell sidebar + master–detail kiểu adida.vn
   - Nền giấy ấm, nhấn terracotta, phẳng, radius 10/14
   - Vùng đọc 19px/1.75 + A−/A+ · thumb zone · breakpoint 860px
   ============================================================ */

:root {
  --paper:     #FAF4EF;
  --ink:       #3B2E2B;
  --ink-soft:  #6B5A52;
  --ink-mute:  #95857D;
  --brand:     #8A4B3C;
  --brand-dark:#6E3A2E;
  --accent:    #A63D33;
  --soft-bg:   #F6E9E0;
  --soft-line: #C77B54;
  --box-bg:    #FBF5F0;
  --line:      #E9D9CF;
  --white:     #FFFFFF;
  --gem:       #2E7D6E;
  --gem-bg:    #E7F2EE;
  --warn-bg:   #FCF3DA;
  --warn-ink:  #8A5E00;
  --warn-line: #EFD489;
  --login-bg:  #FFF3E4;
  --login-ink: #B4571E;
  --login-line:#E8A05C;

  /* Nút chính — nền ấm nhạt, KHÔNG tô đặc (quy chuẩn UI 1.1.1) */
  --btn-bg:    #F2DCCE;
  --btn-line:  #DCAB8F;
  --btn-ink:   #6E3A2E;

  --r-sm: 10px;
  --r-md: 14px;

  --read-size: 19px;        /* A−/A+ chỉnh 17 / 19 / 22 */

  --side-w: 260px;
  --rail-w: 64px;
  --nav-h: 60px;

  --font: 'Be Vietnam Pro', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; font-size: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ============================================================
   SHELL: sidebar + main (kiểu adida)
   ============================================================ */
.shell { display: flex; min-height: 100vh; }

.side {
  width: var(--side-w);
  flex: none;
  background: var(--white);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 80;
}

.side-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.side-brand img { width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover; flex: none; }
.side-brand .bt { line-height: 1.15; min-width: 0; }
.side-brand .bw { font-weight: 700; font-size: 17px; letter-spacing: .8px; color: var(--brand); display: block; }
.side-brand .bd { font-size: 11.5px; color: var(--accent); font-weight: 500; }
.side-toggle {
  margin-left: auto; flex: none;
  width: 34px; height: 34px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-mute);
}
.side-toggle:hover { background: var(--box-bg); }
.side-toggle svg { width: 17px; height: 17px; transition: transform .25s; }

.side-menu { padding: 8px 0; }
.side-item {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 16px;
  font-size: 14.5px; font-weight: 500;
  color: var(--ink-soft);
  border-left: 3px solid transparent;
  min-height: 46px;
  width: 100%; text-align: left;
}
.side-item:hover { background: var(--box-bg); text-decoration: none; }
.side-item.on {
  color: var(--brand); font-weight: 600;
  background: var(--soft-bg);
  border-left-color: var(--brand);
}
.side-item svg { width: 20px; height: 20px; flex: none; }

.side-acc { padding: 12px 12px 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-login {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--login-line);
  background: var(--login-bg);
  color: var(--login-ink);
  border-radius: var(--r-sm);
  padding: 7px 8px;
  font-size: 12.5px; font-weight: 600;
  min-height: 36px;
}
.btn-login:hover { filter: brightness(.97); text-decoration: none; }
.btn-login svg { width: 15px; height: 15px; flex: none; }

.side-nap { padding: 8px 12px; }
.btn-nap {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: var(--gem-bg);
  border: 1px solid #BCDCD2;
  color: var(--gem);
  border-radius: var(--r-sm);
  padding: 10px;
  font-weight: 700; font-size: 14px;
  min-height: 46px;
}
.btn-nap .bal { display: inline-flex; align-items: center; gap: 5px; padding-right: 9px; border-right: 1px solid #BCDCD2; }
.btn-nap svg { width: 17px; height: 17px; }

.side-links {
  margin-top: auto;
  padding: 10px 14px 0;
  font-size: 12px; color: var(--ink-mute);
}
.side-links a { color: var(--ink-mute); }
.side-links a:hover { color: var(--brand); }
body.side-collapsed .side-links { display: none; }

.side-foot {
  border-top: 1px solid var(--line);
  padding: 10px 14px 14px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink-mute);
}
.fs-group { display: inline-flex; gap: 5px; margin-left: auto; }
.fs-group button {
  min-width: 32px; min-height: 30px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--white); color: var(--ink-soft);
  font-size: 12.5px; font-weight: 700;
}
.fs-group button:hover { background: var(--box-bg); }

/* Rail thu gọn (desktop) */
@media (min-width: 861px) {
  body.side-collapsed .side { width: var(--rail-w); }
  body.side-collapsed .side-brand { flex-direction: column; gap: 8px; padding: 12px 0; }
  body.side-collapsed .side-brand .bt { display: none; }
  body.side-collapsed .side-toggle { margin: 0 auto; }
  body.side-collapsed .side-toggle svg { transform: rotate(180deg); }
  body.side-collapsed .side-item { justify-content: center; padding: 13px 0; font-size: 0; border-left: 0; }
  body.side-collapsed .side-item svg { width: 21px; height: 21px; }
  body.side-collapsed .side-acc,
  body.side-collapsed .side-nap .bal,
  body.side-collapsed .side-nap .nap-txt,
  body.side-collapsed .side-foot .foot-txt,
  body.side-collapsed .fs-group { display: none; }
  body.side-collapsed .btn-nap { padding: 10px 0; }
  body.side-collapsed .side-foot { justify-content: center; }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Topbar mobile */
.topbar {
  display: none;
  position: sticky; top: 0; z-index: 70;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  align-items: center; gap: 10px;
  padding: 10px 14px;
}
.topbar .burger {
  width: 42px; height: 42px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft);
}
.topbar .burger svg { width: 22px; height: 22px; }
.topbar img { width: 34px; height: 34px; border-radius: 8px; }
.topbar .bw { font-weight: 700; font-size: 15px; letter-spacing: .6px; color: var(--brand); }
.topbar .bd { font-size: 10.5px; color: var(--accent); }
.top-wallet {
  margin-left: auto;
  display: flex; align-items: center; gap: 5px;
  background: var(--gem-bg); border: 1px solid #BCDCD2;
  border-radius: 999px; padding: 7px 12px;
  font-weight: 700; font-size: 14px; color: var(--gem);
  min-height: 40px;
}
.top-wallet svg { width: 16px; height: 16px; }

.scrim {
  display: none;
  position: fixed; inset: 0; z-index: 79;
  background: rgba(59, 46, 43, .45);
}

/* Bottom nav mobile */
.botnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 75;
  background: var(--white);
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(5, 1fr);
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom);
}
.bn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10.5px; color: var(--ink-mute); font-weight: 500;
  min-height: 44px;
}
.bn svg { width: 22px; height: 22px; }
.bn.on { color: var(--brand); font-weight: 700; }

@media (max-width: 860px) {
  .side {
    position: fixed; left: 0; top: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(59,46,43,.18);
    height: 100dvh;
  }
  body.side-open .side { transform: none; }
  body.side-open .scrim { display: block; }
  .topbar { display: flex; }
  .botnav { display: grid; }
  .main { padding-bottom: calc(var(--nav-h) + 16px); }
  .side-toggle { display: none; }
}

/* ============================================================
   Màn hình & layout chung
   ============================================================ */
.screen { display: none; }
.screen.on { display: block; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 18px; width: 100%; }
.wrap-read { max-width: 720px; }

.crumb {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 13px; color: var(--ink-mute);
  padding: 14px 0 2px;
}
.crumb a { color: var(--brand); }
.crumb .sep { color: var(--line); }

h1.page { font-size: 28px; font-weight: 600; color: var(--brand); line-height: 1.3; margin: 8px 0 14px; }
h2.sec { font-size: 20px; font-weight: 600; color: var(--accent); margin: 26px 0 10px; }

/* Nút */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border-radius: var(--r-sm);
  font-size: 16px; font-weight: 600;
  transition: filter .15s;
}
.btn:hover { text-decoration: none; filter: brightness(1.06); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 19px; height: 19px; }
.btn-brand { background: var(--btn-bg); border: 1.5px solid var(--btn-line); color: var(--btn-ink); }
.btn-line { background: var(--white); border: 1.5px solid var(--line); color: var(--ink); }
.btn-soft { background: var(--soft-bg); color: var(--brand); font-size: 14px; min-height: 42px; padding: 0 16px; }
.btn-block { width: 100%; }

/* ============================================================
   TRANG CHỦ
   ============================================================ */
.home-hero { padding: 26px 0 8px; }
.home-hero h1 {
  font-size: clamp(24px, 5vw, 30px); font-weight: 600;
  color: var(--brand); line-height: 1.35;
}
.home-hero h1 em { font-style: normal; color: var(--accent); }
.home-hero .sub { color: var(--ink-soft); margin-top: 6px; font-size: 15.5px; max-width: 560px; }

.searchbox {
  margin-top: 16px;
  display: flex; align-items: center; gap: 10px;
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 4px 6px 4px 14px;
  max-width: 560px;
}
.searchbox:focus-within { border-color: var(--brand); }
.searchbox svg { width: 19px; height: 19px; color: var(--ink-mute); flex: none; }
.searchbox input {
  flex: 1; border: none; outline: none;
  font: inherit; font-size: 16px;
  background: transparent; min-width: 0; padding: 10px 0;
  color: var(--ink);
}
.searchbox .ctx {
  flex: none; background: var(--soft-bg); color: var(--brand);
  font-size: 13px; font-weight: 600;
  border-radius: 8px; padding: 8px 12px;
}

.gates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; max-width: 560px; }
.gate {
  border-radius: var(--r-md);
  padding: 16px;
  min-height: 104px;
  display: block;
}
.gate:hover { text-decoration: none; }
.gate h3 { font-size: 17.5px; font-weight: 600; margin-top: 6px; }
.gate p { font-size: 13px; margin-top: 3px; line-height: 1.5; }
.gate svg { width: 24px; height: 24px; }
.gate-a { background: var(--white); border: 1px solid var(--line); color: var(--ink); }
.gate-a svg { color: var(--brand); }
.gate-a p { color: var(--ink-soft); }
.gate-b { background: var(--btn-bg); border: 1.5px solid var(--btn-line); color: var(--brand); }
.gate-b svg { color: var(--brand); }
.gate-b p { color: var(--ink-soft); }

.tool-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 640px; }
.tool {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 8px; text-align: center;
  position: relative;
  display: block;
}
.tool:hover { text-decoration: none; background: var(--box-bg); }
.tool svg { width: 24px; height: 24px; color: var(--brand); margin: 0 auto 6px; display: block; }
.tool b { font-size: 13.5px; font-weight: 600; color: var(--ink); display: block; }
.tool span { font-size: 11.5px; color: var(--ink-mute); }
.tool.soon { opacity: .5; pointer-events: none; }
.tool .tag {
  position: absolute; top: 6px; right: 6px;
  font-size: 9.5px; font-weight: 700;
  background: var(--warn-bg); color: var(--warn-ink);
  padding: 2px 6px; border-radius: 6px;
}

.med-note {
  margin: 26px 0;
  background: var(--box-bg); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  font-size: 13px; color: var(--ink-soft); line-height: 1.6;
  display: flex; gap: 10px;
  max-width: 640px;
}
.med-note svg { width: 18px; height: 18px; color: var(--brand); flex: none; margin-top: 2px; }

/* ============================================================
   TRA CỨU — master–detail
   ============================================================ */
.split { display: grid; grid-template-columns: 330px 1fr; gap: 0; flex: 1; min-height: 0; }

.list-col {
  border-right: 1px solid var(--line);
  padding: 14px;
  background: var(--white);
  overflow-y: auto;
  max-height: calc(100vh - 0px);
  position: sticky; top: 0;
}
.list-col .searchbox { max-width: none; margin-top: 0; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; padding: 12px 0 4px; }
.chip {
  padding: 7px 13px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  min-height: 36px;
}
.chip.on { background: var(--soft-bg); border-color: var(--soft-line); color: var(--brand); font-weight: 700; }

.rec-list { margin-top: 8px; display: grid; gap: 8px; }
.rec-item {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  background: var(--paper);
}
.rec-item:hover { text-decoration: none; background: var(--box-bg); }
.rec-item.on { border-color: var(--brand); background: var(--soft-bg); }
.rec-item .ri-top { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; flex-wrap: wrap; }
.rec-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11.5px; color: var(--brand);
  background: var(--soft-bg);
  padding: 2px 7px; border-radius: 5px;
}
.rec-item.on .rec-code { background: var(--white); }
.rec-badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.rec-badge.c { background: var(--gem-bg); color: var(--gem); }
.rec-badge.p { background: var(--warn-bg); color: var(--warn-ink); }
.rec-item b { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.4; display: block; }
.rec-item .ri-meta { font-size: 11.5px; color: var(--ink-mute); margin-top: 4px; }

.empty-note { text-align: center; color: var(--ink-mute); font-size: 14px; padding: 30px 10px; }

.detail-col { min-width: 0; padding: 0 26px 48px; }
.detail-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 50vh; color: var(--ink-mute); text-align: center; gap: 10px; font-size: 14.5px;
}
.detail-empty svg { width: 44px; height: 44px; color: var(--line); }

/* ============================================================
   TRANG THẺ — khuôn 11 khối kiểu adida
   ============================================================ */
.record { max-width: 720px; }
.rec-kicker {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px; font-weight: 600; color: var(--accent);
  margin-top: 14px;
}
.record h1 {
  font-size: 28px; line-height: 1.3; color: var(--brand);
  font-weight: 600; margin: 6px 0 4px;
}
.rec-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.rec-meta { font-size: 13px; color: var(--ink-mute); margin-bottom: 14px; display: flex; gap: 10px; flex-wrap: wrap; }

.rec-body { font-size: var(--read-size); line-height: 1.75; color: var(--ink); }
.rec-body p { margin: 0 0 12px; }

.sum-box {
  font-size: calc(var(--read-size) + 1px); line-height: 1.7;
  color: var(--ink-soft);
  background: var(--soft-bg);
  border-left: 4px solid var(--soft-line);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 20px;
}

.rec-body h2 {
  font-size: 23px; color: var(--accent); font-weight: 600;
  margin: 28px 0 10px;
}

.wrong-box {
  background: rgba(199, 123, 84, .07);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 16px 12px;
  margin: 16px 0;
}
.wrong-box h2 { font-size: 19px; color: var(--brand); margin-top: 10px; }
.wrong-item { margin: 10px 0; }
.wrong-item b { color: var(--accent); font-weight: 600; display: block; font-size: calc(var(--read-size) - 3px); }
.wrong-item span { font-size: calc(var(--read-size) - 3px); color: var(--ink-soft); }

.safe-box {
  background: var(--warn-bg);
  border: 1.5px solid var(--warn-line);
  border-radius: 8px;
  padding: 6px 16px 12px;
  margin: 16px 0;
}
.safe-box h2 { font-size: 19px; color: var(--warn-ink); margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.safe-box h2 svg { width: 19px; height: 19px; }
.safe-box ul { padding-left: 20px; list-style: disc; }
.safe-box li { margin: 7px 0; font-size: calc(var(--read-size) - 2px); color: var(--ink-soft); }

details.deep {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--box-bg);
  margin: 16px 0;
}
details.deep summary {
  cursor: pointer;
  padding: 13px 16px;
  font-weight: 600; color: var(--brand);
  font-size: calc(var(--read-size) - 2px);
  list-style: none;
}
details.deep summary::-webkit-details-marker { display: none; }
details.deep summary::before { content: '▸ '; }
details.deep[open] summary::before { content: '▾ '; }
details.deep > div { padding: 0 16px 14px; font-size: calc(var(--read-size) - 1px); }

.src-sec { margin: 24px 0 0; }
.src-item {
  display: flex; gap: 11px;
  padding: 11px 13px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-top: 8px;
  font-size: 13.5px; color: var(--ink-soft);
}
.src-rank {
  flex: none; width: 26px; height: 26px; border-radius: 7px;
  background: var(--soft-bg); color: var(--brand);
  font-weight: 800; font-size: 12.5px;
  display: flex; align-items: center; justify-content: center;
}
.src-item b { color: var(--ink); font-size: 14px; display: block; font-weight: 600; }
.src-tags { margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; }
.src-tag {
  font-size: 10.5px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 8px; color: var(--ink-mute);
}

.try-cta {
  margin: 22px 0;
  background: var(--soft-bg);
  border: 1.5px solid var(--soft-line);
  border-radius: var(--r-md);
  padding: 16px;
  color: var(--ink);
  display: flex; align-items: center; gap: 14px;
}
.try-cta .t { flex: 1; }
.try-cta b { font-size: 16.5px; display: block; color: var(--brand); }
.try-cta span { font-size: 12.5px; color: var(--ink-soft); }
.try-cta .btn { background: var(--white); border: 1.5px solid var(--btn-line); color: var(--btn-ink); min-height: 44px; font-size: 14.5px; flex: none; }

.rec-foot {
  border-top: 1px solid var(--line);
  margin-top: 26px; padding: 14px 0 30px;
  font-size: 13px; color: var(--ink-mute); line-height: 1.6;
}

/* Thanh công cụ đọc (mobile): quay lại + A−/A+ */
.read-tools {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 0 0;
}
.read-tools .back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--brand);
  min-height: 40px;
}
.read-tools .back svg { width: 16px; height: 16px; }
.read-tools .fs-group { margin-left: auto; }
@media (min-width: 861px) { .read-tools .fs-group { display: none; } }

/* ============================================================
   THỬ MÀU TÓC
   ============================================================ */
.try-box {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  margin-top: 14px;
}
.stage {
  background: var(--soft-bg);
  display: flex; align-items: flex-end; justify-content: center;
  padding-top: 24px;
}
.stage svg { width: min(56vw, 270px); height: auto; }
#hairBack, #hairFront { transition: fill .35s ease; }

.sw-area { padding: 14px 16px 18px; }
.sw-label { font-size: 13.5px; color: var(--ink-soft); display: flex; justify-content: space-between; margin-bottom: 10px; }
.sw-label b { color: var(--brand); }
.swatches { display: flex; gap: 10px; overflow-x: auto; padding: 3px 2px 8px; scrollbar-width: none; }
.swatches::-webkit-scrollbar { display: none; }
.swatch {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 3px solid transparent;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.5);
  transition: transform .15s, border-color .15s;
}
.swatch.on { border-color: var(--brand); transform: scale(1.08); }

.hint {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 15px; margin-top: 12px;
  font-size: 13.5px; color: var(--ink-soft);
}
.hint b { color: var(--ink); font-size: 14px; }
.hint ul { margin-top: 6px; padding-left: 20px; list-style: disc; }
.hint li { margin: 4px 0; }

.price-note { font-size: 12.5px; color: var(--ink-mute); text-align: center; margin-top: 8px; }

/* Flow */
.upload-zone {
  width: 100%;
  margin-top: 14px;
  border: 2px dashed var(--soft-line);
  background: var(--soft-bg);
  border-radius: var(--r-md);
  padding: 32px 20px;
  text-align: center; color: var(--ink-soft);
}
.upload-zone svg { width: 36px; height: 36px; color: var(--brand); margin: 0 auto 10px; display: block; }
.upload-zone b { color: var(--brand); display: block; font-size: 16px; }
.upload-zone span { font-size: 13px; }

.processing { text-align: center; padding: 56px 20px; }
.spinner {
  width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: 50%;
  border: 4px solid var(--soft-bg);
  border-top-color: var(--brand);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing b { font-size: 18px; color: var(--brand); display: block; }
.processing p { color: var(--ink-soft); font-size: 14px; margin-top: 6px; }

.ba-wrap {
  margin-top: 14px; position: relative;
  border-radius: var(--r-md); overflow: hidden;
  background: #000;
  aspect-ratio: 3 / 4;
  max-height: 64vh;
  border: 1px solid var(--line);
}
.ba-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba-after { position: absolute; inset: 0; }
.ba-after .tint { position: absolute; inset: 0; mix-blend-mode: color; opacity: .85; }
.ba-after .tint2 { position: absolute; inset: 0; mix-blend-mode: soft-light; opacity: .5; }
.ba-divider {
  position: absolute; top: 0; bottom: 0; width: 3px;
  background: #fff; transform: translateX(-1.5px);
  pointer-events: none;
}
.ba-handle {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.3);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); pointer-events: none;
}
.ba-handle svg { width: 19px; height: 19px; }
.ba-label {
  position: absolute; top: 10px; font-size: 11px; font-weight: 700;
  color: #fff; background: rgba(0,0,0,.45);
  padding: 4px 10px; border-radius: 999px;
}
.ba-label.l { left: 10px; } .ba-label.r { right: 10px; }
.ba-range {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: ew-resize; margin: 0;
  -webkit-appearance: none; appearance: none;
}

.disclaimer {
  margin-top: 12px;
  background: var(--box-bg); border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: var(--r-sm); padding: 11px 14px;
  font-size: 12.5px; line-height: 1.55;
  display: flex; gap: 9px;
}
.disclaimer svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--brand); }

.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.privacy-row {
  margin-top: 10px; display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12.5px; color: var(--ink-mute); flex-wrap: wrap;
}
.privacy-row svg { width: 14px; height: 14px; }
.privacy-row button { color: var(--accent); font-weight: 600; font-size: 12.5px; text-decoration: underline; min-height: 40px; }

/* ============================================================
   VÍ NGỌC LIÊN
   ============================================================ */
.vi-card {
  margin-top: 14px;
  background: var(--white);
  border: 1.5px solid var(--gem);
  border-radius: var(--r-md);
  padding: 18px;
}
.vi-card .lb { font-size: 12px; color: var(--ink-mute); letter-spacing: .5px; }
.vi-bal { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.vi-bal svg { width: 30px; height: 30px; color: var(--gem); }
.vi-bal b { font-size: 36px; font-weight: 700; color: var(--gem); line-height: 1; }
.vi-bal span { font-size: 14px; color: var(--ink-soft); }
.vi-sub { margin-top: 8px; font-size: 12.5px; color: var(--ink-mute); display: flex; gap: 14px; flex-wrap: wrap; }

.price-menu { display: grid; gap: 9px; max-width: 560px; }
.price-row {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 14px;
  display: flex; align-items: center; gap: 12px;
  text-align: left; width: 100%;
}
.price-row:hover { background: var(--box-bg); }
.price-row svg { width: 22px; height: 22px; color: var(--gem); flex: none; }
.price-row .t { flex: 1; min-width: 0; }
.price-row b { font-size: 15px; display: block; color: var(--ink); }
.price-row span { font-size: 12.5px; color: var(--ink-mute); }
.price-row .p { font-weight: 700; font-size: 15.5px; color: var(--brand); white-space: nowrap; }
.price-row .p small { display: block; font-weight: 600; font-size: 11px; color: var(--gem); text-align: right; }

.streak-card {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px; max-width: 560px;
}
.streak-days { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 13px 0; }
.sday {
  aspect-ratio: 1; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  background: var(--paper); border: 1.5px dashed var(--line); color: var(--ink-mute);
}
.sday.done { background: var(--soft-bg); border: none; color: var(--brand); }
.sday.done svg { width: 17px; height: 17px; }
.sday.today { border: 2px solid var(--brand); color: var(--brand); }
.sday.gift { background: var(--gem-bg); border: none; color: var(--gem); }
.sday.gift svg { width: 18px; height: 18px; }
.streak-note { font-size: 13px; color: var(--ink-soft); line-height: 1.6; }
.action-status { display: flex; gap: 8px; align-items: center; margin-top: 11px; font-size: 13px; font-weight: 600; }
.action-status.ok { color: var(--gem); }
.action-status.no { color: var(--ink-mute); }
.action-status svg { width: 16px; height: 16px; }

.history-list { display: grid; gap: 7px; max-width: 560px; }
.h-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 13px; font-size: 13.5px;
}
.h-row .w { flex: 1; color: var(--ink); }
.h-row .d { font-size: 11.5px; color: var(--ink-mute); }
.h-row .a { font-weight: 700; }
.h-row .a.plus { color: var(--gem); }
.h-row .a.minus { color: var(--accent); }

/* ============================================================
   CÁ NHÂN
   ============================================================ */
.login-card {
  margin-top: 14px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 22px 18px; text-align: center;
  max-width: 480px;
}
.login-card h2 { font-size: 19px; color: var(--brand); font-weight: 600; }
.login-card p { font-size: 13.5px; color: var(--ink-soft); margin: 6px 0 14px; }
.login-card .btn + .btn { margin-top: 8px; }
.btn-zalo { background: #0068FF; color: #fff; }
.btn-google { background: var(--white); border: 1.5px solid var(--line); color: var(--ink); }

.set-group {
  margin-top: 14px;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden; max-width: 480px;
}
.set-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 15px; min-height: 52px;
  border-bottom: 1px solid var(--paper);
  font-size: 14.5px;
}
.set-row:last-child { border-bottom: none; }
.set-row svg { width: 19px; height: 19px; color: var(--ink-mute); flex: none; }
.set-row .t { flex: 1; }
.set-row .t small { display: block; font-size: 11.5px; color: var(--ink-mute); line-height: 1.45; }
.toggle { position: relative; width: 44px; height: 26px; flex: none; }
.toggle input { opacity: 0; position: absolute; inset: 0; z-index: 2; cursor: pointer; margin: 0; width: 100%; height: 100%; }
.toggle .tk { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; }
.toggle .tk::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s;
}
.toggle input:checked + .tk { background: var(--gem); }
.toggle input:checked + .tk::after { transform: translateX(18px); }

/* ============================================================
   Sheet / Toast
   ============================================================ */
.overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(59,46,43,.5);
  display: none; align-items: flex-end; justify-content: center;
}
.overlay.open { display: flex; }
.sheet {
  background: var(--white);
  border-radius: var(--r-md) var(--r-md) 0 0;
  width: 100%; max-width: 540px;
  max-height: 88dvh; overflow-y: auto;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 861px) {
  .overlay { align-items: center; }
  .sheet { border-radius: var(--r-md); }
}
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 4px auto 12px; }
.sheet h2 { font-size: 19px; color: var(--brand); font-weight: 600; margin-bottom: 4px; }
.sheet .s-sub { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 13px; }
.sheet .btn + .btn { margin-top: 8px; }

.consent-list { display: grid; gap: 9px; margin-bottom: 14px; }
.consent-list li {
  display: flex; gap: 10px; font-size: 13.5px; color: var(--ink-soft);
  background: var(--box-bg); border-radius: 8px; padding: 10px 12px;
  line-height: 1.55;
}
.consent-list svg { width: 16px; height: 16px; color: var(--brand); flex: none; margin-top: 2px; }
.consent-list b { color: var(--ink); }

.check-row {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px; border: 1.5px solid var(--line); border-radius: var(--r-sm);
  margin-bottom: 12px; cursor: pointer; user-select: none;
}
.check-row input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; margin-top: 2px; cursor: pointer; }
.check-row span { font-size: 13.5px; color: var(--ink-soft); line-height: 1.5; }

.qr-box {
  background: var(--box-bg); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 18px;
  text-align: center; margin-bottom: 13px;
}
.qr-box svg.qr { width: 160px; height: 160px; margin: 0 auto 10px; display: block; background: #fff; padding: 10px; border-radius: 8px; }
.qr-box .amt { font-size: 24px; font-weight: 700; color: var(--brand); }
.qr-box .qn { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
.qr-box .qc {
  font-family: ui-monospace, Consolas, monospace;
  background: var(--white); border-radius: 7px; padding: 6px 12px;
  display: inline-block; margin-top: 8px;
  font-size: 13px; color: var(--brand); letter-spacing: 1px;
  border: 1px solid var(--line);
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 12px);
  transform: translateX(-50%) translateY(16px);
  background: var(--ink); color: var(--paper);
  border-radius: 999px; padding: 10px 18px;
  font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  opacity: 0; pointer-events: none;
  transition: all .28s ease;
  z-index: 99; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 17px; height: 17px; color: var(--gem); flex: none; }
@media (min-width: 861px) { .toast { bottom: 26px; } }

/* Banner bản mẫu */
.demo-banner {
  background: var(--warn-bg); color: var(--warn-ink);
  font-size: 12.5px; text-align: center;
  padding: 6px 40px 6px 14px;
  position: relative; z-index: 60;
}
.demo-banner button {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%; font-size: 14px;
}

/* ============================================================
   Mobile: master–detail tách màn
   ============================================================ */
@media (max-width: 860px) {
  .split { display: block; }
  .list-col {
    border-right: none; position: static; max-height: none;
    background: transparent; padding: 12px 16px;
  }
  .detail-col { display: none; padding: 0 18px 40px; }
  body.show-detail .list-col { display: none; }
  body.show-detail .detail-col { display: block; }
  h1.page { font-size: 24px; }
  .record h1 { font-size: 25px; }
}
@media (min-width: 861px) {
  .read-tools .back { display: none; }
}
