:root {
  --bg0: #fff7f2;
  --bg1: #ffffff;
  --card: #ffffff;
  --line: rgba(238, 77, 45, 0.16);
  --text: #222222;
  --muted: #8a8a8a;
  --brand: #ee4d2d;
  --brand2: #ff7337;
  --brand-deep: #d73211;
  --green: #26aa99;
  --red: #ee4d2d;
  --radius: 1rem;
  --shadow: 0 1px 2px rgba(34, 34, 34, 0.04), 0 10px 28px rgba(238, 77, 45, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg0);
  -webkit-font-smoothing: antialiased;
  /* Lịch sử cũ / URL dài dễ đẩy layout lệch ngang trên iOS */
  overflow-x: hidden;
  max-width: 100%;
}

button, input, a { font: inherit; }

.hidden { display: none !important; }

.nb-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(255, 115, 55, 0.22), transparent 58%),
    radial-gradient(640px 320px at 100% 18%, rgba(238, 77, 45, 0.12), transparent 55%),
    linear-gradient(180deg, #fff1ea 0%, var(--bg0) 42%, #fffaf7 100%);
  pointer-events: none;
}

.nb-bg::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 36%;
  background: linear-gradient(180deg, transparent, rgba(238, 77, 45, 0.04));
}

.nb-page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.75rem;
  overflow-x: clip;
  min-width: 0;
}

@media (min-width: 900px) {
  .nb-page {
    max-width: 48rem;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.nb-hero { text-align: center; padding: 0.35rem 0 1.1rem; }

.nb-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 0.5rem 1.05rem;
}

/* [logo] + tên thương hiệu */
.nb-lockup {
  margin: 0;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  line-height: 1;
  max-width: 100%;
}

.nb-lockup-mark {
  /* khung = cỡ vòng ngoài; ảnh logo phóng khớp khung */
  --mark: 3.55rem;
  position: relative;
  width: var(--mark);
  height: var(--mark);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  overflow: visible;
}

/* Vòng SVG khớp khung mark */
.nb-lockup-arc {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: visible;
}

.nb-lockup-logo {
  /* to ra gần sát stroke SVG (r=45, stroke ~5 → nội tiếp ~86%) */
  width: 86%;
  height: 86%;
  border: 0;
  outline: 0;
  border-radius: 999px;
  object-fit: cover;
  background: #fff;
  box-shadow: none;
  clip-path: none;
  position: relative;
  z-index: 1;
}

.nb-lockup-mark-fallback {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 999px;
  background: linear-gradient(145deg, #ff8a55, #ee4d2d);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(238, 77, 45, 0.25);
}

.nb-lockup-text {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.nb-lockup-dark,
.nb-lockup-sale {
  font-size: clamp(1.45rem, 4.6vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #2a2a2a;
  text-transform: uppercase;
}

.nb-sub {
  margin: 0;
  color: var(--brand);
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  /* Xích nhẹ sang phải → nằm gần dưới chữ Sale */
  transform: translateX(1.15rem);
}

.glass {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 0.15rem);
  box-shadow: var(--shadow);
}

.nb-main { display: flex; flex-direction: column; gap: 1rem; }

.nb-convert { padding: 1rem; }

.nb-input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.nb-input {
  flex: 1;
  min-width: 0;
  border: 1px solid #f0d2c8;
  background: #fffaf8;
  color: var(--text);
  border-radius: 0.85rem;
  padding: 0.9rem 1rem;
  outline: none;
}
.nb-input::placeholder { color: #b5b5b5; }
.nb-input:focus {
  border-color: rgba(238, 77, 45, 0.65);
  box-shadow: 0 0 0 3px rgba(238, 77, 45, 0.12);
  background: #fff;
}

.nb-paste {
  width: 3rem;
  border: 1px solid #f0d2c8;
  background: #fffaf8;
  color: var(--brand);
  border-radius: 0.85rem;
  cursor: pointer;
}
.nb-paste:hover { background: rgba(238, 77, 45, 0.08); }

.nb-cta {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 0.9rem;
  padding: 0.95rem 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(90deg, var(--brand2), var(--brand) 55%, var(--brand-deep));
  box-shadow: 0 8px 22px rgba(238, 77, 45, 0.32);
}
.nb-cta:disabled {
  opacity: 1;
  cursor: not-allowed;
  filter: saturate(0.95);
}
.nb-cta:not(:disabled):hover { filter: brightness(1.04); }

.nb-error {
  margin: 0.65rem 0 0;
  color: var(--brand-deep);
  font-size: 0.85rem;
  text-align: center;
}

.nb-history {
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
}
.nb-history-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.nb-history-left {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.92rem;
}
.nb-badge {
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand2), var(--brand));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nb-chevron { color: var(--muted); transition: transform 0.18s ease; }
.nb-history-toggle[aria-expanded="true"] .nb-chevron { transform: rotate(180deg); }
.nb-history:not(.is-open) .nb-history-list,
.nb-history:not(.is-open) .nb-history-actions { display: none !important; }
.nb-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 1rem 1rem;
  border-top: 1px solid rgba(238, 77, 45, 0.1);
}
.nb-history-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 1rem 0.85rem;
}
.nb-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
}
.nb-link:hover { color: var(--brand); }

.nb-vouchers {
  margin-top: 0.85rem;
}

.nb-section-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  margin-bottom: 0.35rem;
  padding: 0 3.5rem;
}
.nb-section-head h2 {
  margin: 0;
  flex: 0 1 auto;
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}
.nb-section-head .nb-count,
.nb-section-head .nb-icon-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
}
.nb-section-head .nb-count {
  right: 2.15rem;
}
.nb-section-head .nb-icon-btn {
  right: 0;
}
.nb-count {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.nb-icon-btn {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.nb-icon-btn:hover { color: var(--brand); background: rgba(238, 77, 45, 0.08); }

.nb-voucher-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0;
}
.nb-voucher-list.collapsed { display: none; }

.nb-empty {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(238, 77, 45, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
}

/* Voucher card — gọn chiều cao */
.vcard {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(238, 77, 45, 0.14);
  border-radius: 0.75rem;
  background: #fff;
  box-shadow: var(--shadow);
}
.vcard.is-out { opacity: 0.85; }

.vcard-note {
  margin: 0;
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.3;
}

.vcard-body {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.65rem;
  align-items: center;
}

.vcard-badge {
  border-radius: 0.65rem;
  background: var(--brand);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.4rem 0.25rem;
  min-height: 62px;
}
.vcard.is-out .vcard-badge { background: #9ca3af; }

.vcard-badge-pct {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
}
.vcard-badge-go {
  margin-top: 0.28rem;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.15rem 0.3rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vcard-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.vcard-top {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
}
.vcard-code {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--text);
}
.vcard-status {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  white-space: nowrap;
}
.vcard-status.ok {
  color: #15803d;
  background: rgba(34, 197, 94, 0.12);
}
.vcard-status.out {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
}
.vcard-desc {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.3;
}

.vcard-progress {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.1rem;
  border-top: 1px solid rgba(34, 34, 34, 0.08);
}
.vcard-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.vcard-progress-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.55rem;
  align-items: center;
}
.vcard-spark {
  width: 100%;
  height: 28px;
  display: block;
}
.vcard-bar-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  min-width: 0;
}
.vcard-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(238, 77, 45, 0.12);
  overflow: hidden;
}
.vcard-bar.is-out { background: rgba(156, 163, 175, 0.22); }
.vcard-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}
.vcard-bar.is-out > span { background: #9ca3af; }
.vcard-pct {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
  min-width: 3.2rem;
}
.vcard-pct strong {
  font-size: 0.85rem;
  font-weight: 800;
}
.vcard-pct span {
  font-size: 0.6rem;
  color: var(--muted);
}

@media (max-width: 420px) {
  .vcard-progress-row {
    gap: 0.65rem;
  }
}

/* Convert result cards */
.nb-result { display: flex; flex-direction: column; gap: 0.75rem; }
.nb-card {
  border-radius: 1rem;
  border: 1px solid rgba(238, 77, 45, 0.14);
  background: #fff;
  padding: 0.9rem;
  box-shadow: var(--shadow);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}
.nb-product-top {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  min-width: 0;
}
.nb-thumb {
  width: 56px;
  height: 56px;
  border-radius: 0.65rem;
  object-fit: cover;
  background: #fff1ea;
}
.nb-product-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.nb-price-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  margin-top: 0.3rem;
}
.nb-ticket-time {
  font-size: 0.72rem;
  color: var(--muted);
}
.nb-price { color: var(--brand); font-weight: 800; }
.nb-price-old {
  color: var(--muted);
  text-decoration: line-through;
  font-size: 0.78rem;
}
.nb-disc {
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
}
.nb-aff-row {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.65rem;
  border-top: 1px solid rgba(34, 34, 34, 0.06);
}
@media (min-width: 420px) {
  .nb-aff-row {
    flex-direction: row;
    align-items: center;
  }
}
.nb-aff-name {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.nb-actions {
  display: flex;
  gap: 0.45rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.nb-btn-outline,
.nb-btn-buy {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: 0.55rem;
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.nb-btn-outline {
  border: 1px solid rgba(238, 77, 45, 0.35);
  background: #fff;
  color: var(--brand);
}
.nb-btn-buy {
  border: 0;
  background: linear-gradient(90deg, var(--brand2), var(--brand));
  color: #fff;
}
.remove-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  margin-left: auto;
}
.product-title-row { display: flex; gap: 0.5rem; align-items: flex-start; }

.nb-note {
  padding: 1rem;
  text-align: center;
}
.nb-note h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}
.nb-note ol {
  margin: 0;
  padding: 0;
  list-style-position: inside;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.65;
}

.nb-footer {
  text-align: center;
  padding-top: 0.5rem;
}
.nb-secure {
  margin: 0 0 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}
.nb-social {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}
.nb-social-btn {
  flex: 1 1 0;
  min-width: 9.5rem;
  min-height: 3.1rem;
  padding: 0.95rem 1.35rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(238, 77, 45, 0.4);
  color: var(--brand);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  background: rgba(238, 77, 45, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nb-social-btn:hover {
  background: rgba(238, 77, 45, 0.16);
}

/* Bảo trì tạm */
.nb-maintenance {
  padding: 1.5rem 1.15rem 1.35rem;
  text-align: center;
}
.nb-maintenance-badge {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(238, 77, 45, 0.12);
  color: var(--brand-deep);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nb-maintenance-title {
  margin: 0 0 0.65rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: #111;
  line-height: 1.35;
}
.nb-maintenance-msg {
  margin: 0;
  color: #222;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.65;
  white-space: pre-line;
}
