/* Bản web. Trang bán hàng, trang chính sách, và các thành phần bảng dùng chung
   với bảng điều khiển. Hướng sao kê: xem tokens.css. */

.wrap {
  width: min(1200px, 100% - 2 * var(--sp-5));
  margin-inline: auto;
}

/* ---- Thanh điều hướng. Một dòng, cao tối đa 72px. ---- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  height: 72px;
  border-bottom: 1px solid var(--line);
}

/* Logo túi trong ô trắng bo góc, như icon app. Ô trắng để túi xanh không chìm vào dải xanh. */
.wordmark__mark {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 8px;
}

/* Cùng logo với header của app: logo túi cạnh tên. */
.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
  color: var(--brand);
}

.nav__links {
  display: flex;
  gap: var(--sp-4);
  align-items: center;
  font-size: var(--text-base);
}

.nav__links a:not(.btn) {
  color: var(--ink-2);
  text-decoration: none;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) linear, background-color var(--duration-fast) linear;
}

.nav__links a:not(.btn):hover {
  color: var(--ink);
  background: var(--paper-2);
}

.nav__links a:not(.btn):active {
  background: var(--line);
}

.nav__links a:not(.btn):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Bấm link mục trên thanh điều hướng thì cuộn mượt tới mục, chừa khoảng trên cho tiêu đề. */
html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: var(--sp-5);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

@media (max-width: 800px) {
  .nav__links a:not(.btn) {
    display: none;
  }
}

/* Người đã đăng nhập: chữ cái đầu trong vòng tròn cạnh tên, mẫu Wise và Mercury trên Mobbin.
   Luôn hiện, kể cả màn hẹp nơi các link khác ẩn đi. */
.nav__links a.me-link,
.me-link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 600;
  text-decoration: none;
}

.me-link__avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--brand);
  font-size: var(--text-sm);
  font-weight: 700;
}

/* Màn rất hẹp chỉ còn vòng tròn chữ cái, tên vẫn đọc được bằng trình đọc màn hình. */
@media (max-width: 400px) {
  .me-link__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* ---- Hero. Chữ trái, ảnh thật phải. Không dựng giao diện giả bằng div. ---- */
/* Hero phải nằm gọn trong màn hình đầu tiên, kể cả nút. Vì thế ảnh bị cắt đáy
   thay vì đẩy cả khối cao lên. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: var(--sp-6);
  align-items: center;
  padding-block: var(--sp-6) var(--sp-section);
}

.hero > * {
  min-width: 0;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    padding-block: var(--sp-6);
  }
}

.hero h1 {
  font-size: var(--text-display);
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: var(--sp-4);
  max-width: 16ch;
}

.hero__sub {
  font-size: var(--text-lg);
  color: var(--ink-2);
  max-width: 46ch;
  margin-bottom: var(--sp-5);
}

/* ---- Ô dán link, dùng chung với bảng điều khiển ---- */
.hero__form {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  padding: 4px 4px 4px var(--sp-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  max-width: 32rem;
  transition: border-color var(--duration-fast) linear;
}

.hero__form:focus-within {
  border-color: var(--ink);
}

.hero__form .btn {
  min-height: 38px;
  border-radius: var(--radius-inner);
}

.hero__form input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font: inherit;
  color: var(--ink);
}

.hero__form input::placeholder {
  color: var(--ink-3);
}

@media (pointer: coarse) {
  .hero__form .btn {
    min-height: var(--touch);
  }

  .footer a {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch);
  }
}

/* Màn hẹp: ô dán một hàng, dưới là nút Dán link gọn và nút chính chiếm phần còn lại. */
@media (max-width: 560px) {
  .hero__form {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    padding: var(--sp-3);
    max-width: none;
  }

  .hero__form input {
    grid-column: 1 / -1;
    padding: var(--sp-2) var(--sp-3);
  }
}

/* ---- Khung chung cho các mục ---- */
.section {
  padding-block: var(--sp-section);
  border-top: 1px solid var(--line);
}

.section__head {
  max-width: 46ch;
  margin-bottom: var(--sp-6);
}

.section__head h2 {
  font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.4rem);
  font-weight: 700;
}

.section__head p {
  color: var(--ink-2);
  margin-top: var(--sp-3);
}

/* ---- Họ bố cục 1: ba bước dạng hàng, không phải ba thẻ bằng nhau ---- */
.steps {
  display: grid;
}

.step {
  display: grid;
  grid-template-columns: 6rem minmax(0, 22ch) minmax(0, 1fr);
  gap: var(--sp-5);
  align-items: center;
  padding-block: var(--sp-5);
  border-top: 1px solid var(--line);
}

.step:last-child {
  border-bottom: 1px solid var(--line);
}

/* Ảnh nền trắng, multiply để nền trắng hoà vào nền trang. */
.step__img,
.tier-badge {
  mix-blend-mode: multiply;
}

.step__img {
  width: 6rem;
  height: 6rem;
}

.step h3 {
  font-size: var(--text-xl);
  font-weight: 600;
}

.step p {
  color: var(--ink-2);
}

/* Màn hẹp: ảnh bên trái, tên bước và lời giải thích xếp chồng bên phải. */
@media (max-width: 760px) {
  .step {
    grid-template-columns: 4rem minmax(0, 1fr);
    gap: var(--sp-1) var(--sp-4);
    align-items: start;
  }

  .step__img {
    grid-row: span 2;
    width: 4rem;
    height: 4rem;
  }
}

/* ---- Mục nhắn bot (#120): tấm nền xanh nhạt nối sau ba bước, cô gái đang nhắn bot ---- */
.bots {
  padding-bottom: var(--sp-section);
}

.bots[hidden] {
  display: none;
}

.bots__panel {
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 30rem) auto 13rem;
  justify-content: space-between;
  gap: var(--sp-6);
  align-items: center;
  padding: var(--sp-6) var(--sp-6) var(--sp-6) clamp(var(--sp-5), 4vw, var(--sp-8));
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
}

.bots__copy h2 {
  font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.4rem);
  font-weight: 700;
  max-width: 14ch;
}

.bots__copy p {
  max-width: 40ch;
  margin-top: var(--sp-3);
  color: var(--ink-2);
}

.bots__open {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
}

.bots__tile {
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
  margin: 0;
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
}

.bots__tabs[hidden] {
  display: none;
}

.bots__qr {
  width: 184px;
  height: 184px;
}

.bots__tile figcaption {
  font-size: var(--text-sm);
  color: var(--ink-2);
}

/* Ảnh nền trắng: multiply cho hoà vào nền xanh nhạt. Ngồi ở cột phải, đầu nhô qua mép trên tấm nền. */
.bots__mascot {
  position: absolute;
  right: var(--sp-6);
  bottom: 0;
  width: 15.5rem;
  height: auto;
  mix-blend-mode: multiply;
}

/* Máy tính: chỉ hiện nút của bot đang chọn ở tab. */
.bots__open .btn:not(.is-active) {
  display: none;
}

/* Điện thoại: quét mã của chính máy mình không được, nên bỏ ô QR, hiện nút cho từng bot. */
@media (max-width: 760px), (hover: none) {
  .bots__panel {
    grid-template-columns: minmax(0, 1fr) 6.5rem;
    padding: var(--sp-5);
  }

  .bots__copy {
    display: contents;
  }

  .bots__copy h2 {
    grid-column: 1;
    grid-row: 1;
  }

  .bots__mascot {
    position: static;
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    margin-top: calc(var(--sp-8) * -1.5);
  }

  .bots__copy p,
  .bots__open {
    grid-column: 1 / -1;
    margin-top: 0;
  }

  .bots__open {
    display: grid;
  }

  .bots__open .btn:not(.is-active) {
    display: inline-flex;
  }

  .bots__open .btn + .btn {
    background: var(--surface);
    color: var(--brand);
  }

  .bots__tile {
    display: none;
  }
}

/* ---- Họ bố cục 2: lời khẳng định rộng kèm ảnh thật ---- */
.proof__shot {
  display: block;
  width: 100%;
  height: auto;
  margin-top: var(--sp-6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
}

/* Tổng tiền đã chi, cùng mặt giấy với bảng sao kê bên dưới (#187). */
.proof__totals {
  margin-top: var(--sp-6);
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
}

.proof__totals[hidden] {
  display: none;
}

.proof__totals .kv {
  grid-template-columns: 1fr auto;
  align-items: baseline;
}

/* Màn hẹp: số lớn xuống dòng dưới nhãn, để số chục triệu không tràn khung. */
@media (max-width: 640px) {
  .proof__totals .kv {
    grid-template-columns: 1fr;
    row-gap: 0;
  }

  .proof__totals .kv dd {
    text-align: left;
  }

  .proof__totals .kv dd + dt {
    margin-top: var(--sp-3);
  }
}

.proof__totals .money {
  font-size: var(--text-money-hero);
  line-height: 1.1;
}

.proof__totals .proof__sub {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line);
}

/* Ba dòng chữ thật thay ảnh bảng, chỉ ở màn hẹp. */
.proof__rows {
  display: none;
  margin: var(--sp-6) 0 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lift);
}

.proof__rows li {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
}

.proof__rows li + li {
  border-top: 1px solid var(--line);
}

.proof__rows li > :last-child {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: var(--sp-1);
}

.proof__sub {
  font-size: var(--text-sm);
  color: var(--ink-2);
}

@media (max-width: 640px) {
  .proof__shot {
    display: none;
  }

  .proof__rows {
    display: block;
  }
}

.proof__points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--sp-4) var(--sp-6);
  margin-top: var(--sp-6);
}

.proof__points div {
  border-top: 1px solid var(--line);
  padding-top: var(--sp-3);
}

.proof__points h3 {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.proof__points p {
  font-size: var(--text-sm);
  color: var(--ink-2);
}

/* ---- Họ bố cục 3: bảng hạng. Bảng thật, không phải ba thẻ. ---- */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

thead th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  font-size: var(--text-micro);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--line);
  vertical-align: baseline;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background-color var(--duration-fast) linear;
}

tbody tr:hover {
  background: var(--paper);
}

td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

td.code {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}

.cell-name {
  font-weight: 500;
}

/* Bảng hạng ở màn hẹp: mỗi hạng một khối, nhãn cột hiện trước giá trị. */
@media (max-width: 640px) {
  #hang thead {
    display: none;
  }

  #hang tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--sp-1) var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--line);
  }

  #hang tbody tr:last-child {
    border-bottom: none;
  }

  #hang tbody td {
    padding: 0;
    border: 0;
  }

  #hang td[data-label] {
    grid-column: 1 / -1;
    font-size: var(--text-sm);
  }

  #hang td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--ink-3);
  }

  #hang td.num {
    grid-row: 1;
    grid-column: 2;
  }

  /* Tiêu đề cột "Ví dụ, cùng một đơn" ẩn khi bảng thành thẻ, nên số tiền cần nhãn riêng. */
  #hang td.num::before {
    content: "Ví dụ hoàn ";
    color: var(--ink-3);
    font-size: var(--text-sm);
  }
}

.cell-sub {
  display: block;
  font-size: var(--text-sm);
  color: var(--ink-3);
}

.rate {
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---- Họ bố cục 4: câu hỏi dạng gập mở ---- */
.qa {
  border-top: 1px solid var(--line);
}

.qa details {
  border-bottom: 1px solid var(--line);
}

.qa summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) 0;
  font-size: var(--text-lg);
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  transition: color var(--duration-fast) linear;
}

.qa summary::-webkit-details-marker {
  display: none;
}

.qa summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  color: var(--ink-3);
  flex-shrink: 0;
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

.qa details[open] summary::after {
  transform: rotate(45deg);
}

.qa summary:hover {
  color: var(--ink);
}

.qa p {
  padding-bottom: var(--sp-4);
  color: var(--ink-2);
  max-width: 62ch;
}

/* ---- Họ bố cục 5: dải kêu gọi cuối. Thẻ nền xanh như hero, đè nửa lên footer. ---- */
.closer {
  position: relative;
  z-index: 1;
  padding-top: var(--sp-6);
  margin-bottom: calc(var(--sp-8) * -1.5);
}

.closer__card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(40rem 20rem at 0% 100%, var(--brand-glow), transparent 70%),
    var(--brand-band);
  color: var(--surface);
  box-shadow: var(--shadow-brand);
}

.closer__body {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--sp-3);
  padding: clamp(var(--sp-5), 4vw, var(--sp-8));
}

.closer h2 {
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem);
  max-width: 16ch;
}

.closer p {
  margin-bottom: var(--sp-3);
  color: var(--on-brand-2);
}

.closer .btn {
  background: var(--surface);
  color: var(--brand);
}

.closer .btn:hover {
  background: var(--brand-soft);
}

.closer .btn:active {
  transform: scale(0.985);
}

.closer .btn:focus-visible {
  outline-color: var(--surface);
}

/* Ảnh nền trắng là một tấm riêng, mép thẳng, không tan vào nền xanh. */
.closer__img {
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

@media (max-width: 768px) {
  .closer__card {
    grid-template-columns: 1fr;
  }

  .closer__img {
    order: -1;
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 3;
  }
}

/* ---- Chân trang. Nền xanh đậm cùng họ màu với dải thương hiệu. ---- */
.footer {
  --footer-ink: oklch(100% 0 0 / 0.72);
  overflow: hidden;
  background: oklch(25% 0.1 262);
  color: var(--footer-ink);
  font-size: var(--text-sm);
  padding-top: var(--sp-8);
}

main:has(> .closer:last-child) + .footer {
  padding-top: calc(var(--sp-8) * 1.5 + var(--sp-8));
}

.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: var(--sp-6) var(--sp-5);
}

.footer__brand {
  margin-bottom: var(--sp-3);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--surface);
}

.footer__about p:last-child {
  max-width: 36ch;
  line-height: 1.6;
}

.footer__col {
  display: grid;
  align-content: start;
  gap: var(--sp-3);
}

.footer__col h2 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--surface);
  margin-bottom: var(--sp-1);
}

.footer a {
  justify-self: start;
  color: var(--footer-ink);
  text-decoration: none;
  transition: color var(--duration-fast) linear;
}

.footer a:hover {
  color: var(--surface);
}

.footer a:focus-visible {
  outline-color: var(--surface);
}

/* Chữ thương hiệu cỡ lớn, bị cắt ở đáy trang. Chỉ để trang trí, có aria-hidden. */
.footer__mark {
  margin: var(--sp-8) 0 -0.12em;
  /* "Đầy Túi" rộng khoảng 3,9 lần cỡ chữ: chia bề ngang để luôn nằm trên một dòng. */
  font-size: min(17rem, (100vw - 3rem) / 3.9);
  font-weight: 800;
  line-height: 0.8;
  white-space: nowrap;
  letter-spacing: -0.05em;
  color: oklch(100% 0 0 / 0.07);
  user-select: none;
}

@media (max-width: 768px) {
  .footer__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer__about {
    grid-column: 1 / -1;
  }
}

.hero__form {
  margin-top: var(--sp-5);
  max-width: 36rem;
}

.hero__form .btn--ghost {
  border-color: transparent;
  background: var(--brand-soft);
  color: var(--brand);
}

/* Khung chờ lúc tải: đúng hình khối sẽ hiện, để bố cục không nhảy khi dữ liệu về. */
.skeleton {
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  animation: skeleton-pulse 1.2s ease-in-out infinite alternate;
}

.skeleton--line {
  display: block;
  height: 0.9em;
  margin-block: 0.25em;
}

.skeleton--short {
  width: 45%;
}

@keyframes skeleton-pulse {
  from { opacity: 1; }
  to { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* Khung chờ dạng thẻ cho danh sách và form, cùng viền và bo góc với thẻ thật. */
.skeleton-card {
  display: grid;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

/* Link bỏ qua điều hướng cho người dùng bàn phím. Ẩn tới khi được focus. */
.skip-link {
  position: absolute;
  top: var(--sp-2);
  left: var(--sp-2);
  z-index: 20;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
}

/* Màn trống có minh hoạ, theo prototype/illustrations.html. Đổi màu nét bằng color. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
}

.empty-state h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
}

.empty-state p {
  max-width: 34ch;
  font-size: var(--text-sm);
  color: var(--ink-2);
}

.empty-state .btn {
  margin-top: var(--sp-2);
}

.illo {
  width: 160px;
  height: 140px;
  color: var(--ink);
}

.illo .s { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.illo .d { stroke-dasharray: 3 3; }
.illo .f { fill: currentColor; }
.illo .w { fill: var(--surface); }
.illo .a { fill: none; stroke: var(--brand); stroke-width: 1.6; stroke-linecap: round; }


.tier-badge {
  width: 2rem;
  height: 2rem;
  margin-right: var(--sp-3);
  vertical-align: middle;
}
