:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #222922;
  background: #f6f3ec;
  --accent: #254b3d;
  --accent-hover: #183529;
  --muted: #626760;
  --border: #e4ded1;
  --well: #f8f6f0;
  --surface: #fffdf8;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-space: 0px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding: calc(var(--safe-top) + 4.5rem) 0 calc(var(--tab-space) + 1rem); }
body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 50% 0, #fcfaf4, #f6f3ec 43rem);
}

.shell {
  width: min(100%, 57rem);
  margin-inline: auto;
  padding: max(0.7rem, var(--safe-top)) 1.5rem max(2rem, var(--safe-bottom));
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
  padding-block: 0.42rem;
  border-bottom: 1px solid var(--border);
}
.brand-identity {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.75rem;
  color: inherit;
  font-size: 0.97rem;
  font-weight: 700;
  text-decoration: none;
}
.brand-identity img { display: block; width: 2rem; height: 2rem; border-radius: 0.63rem; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.site-nav:has(#withdrawal-link[hidden]) { display: none; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.74rem;
  border-radius: 0.72rem;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.25;
  text-decoration: none;
}
.site-nav a[aria-current="page"] {
  color: var(--accent-hover);
  background: #e5ece3;
  font-weight: 700;
}
.tab-icon { position: relative; display: inline-block; width: 1.05rem; height: 0.85rem; border: 1.5px solid currentColor; }
.tab-receipt { width: 0.85rem; height: 1rem; border-radius: 0.17rem; }
.tab-receipt::after {
  content: "";
  position: absolute;
  inset: 0.2rem 0.12rem auto;
  height: 1px;
  background: currentColor;
  box-shadow: 0 0.23rem currentColor;
}
.tab-wallet { border-radius: 0.2rem; }
.tab-wallet::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -1px;
  width: 0.3rem;
  height: 0.26rem;
  border: 1px solid currentColor;
  border-right: 0;
  border-radius: 0.12rem 0 0 0.12rem;
  background: inherit;
  transform: translateY(-50%);
}

.screen, .member-sections { display: grid; min-width: 0; gap: 0.9rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 5vw, 2.15rem); line-height: 1.22; }
h2 { font-size: 1.06rem; line-height: 1.4; }
.intro { margin-top: 0.45rem; color: var(--muted); line-height: 1.55; font-size: 0.9rem; }

.checkout-hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 11rem;
  overflow: hidden;
  border: 1px solid #e8ddcb;
  border-radius: 1.25rem;
  background: #eee5d6;
}
.checkout-hero::after {
  content: "";
  position: absolute;
  inset: 0 0 0 43%;
  background: url("../assets/checkout-agarwood.webp") center 65% / cover no-repeat;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 35%);
  mask-image: linear-gradient(to right, transparent, #000 35%);
}
.hero-copy {
  position: relative;
  z-index: 1;
  width: 55%;
  padding: 1.1rem 0 1.1rem 1.25rem;
}
.hero-copy h1 {
  color: #252f25;
  font-family: "Songti SC", "Noto Serif CJK SC", Georgia, serif;
  font-size: clamp(1.78rem, 7.1vw, 2.5rem);
  font-weight: 700;
}
.hero-copy .intro { max-width: 11rem; margin-top: 0.62rem; color: #4e5448; }

.panel {
  min-width: 0;
  padding: clamp(1rem, 3.6vw, 1.4rem);
  border: 1px solid var(--border);
  border-radius: 1.15rem;
  background: var(--surface);
  box-shadow: 0 0.35rem 1.25rem #40332109;
}
#lookup { display: flex; flex-direction: column; justify-content: center; }
label { display: block; margin-bottom: 0.54rem; font-size: 0.92rem; line-height: 1.35; font-weight: 680; }
.lookup-label { font-size: 1.03rem; }
.input-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.input-row input { flex-basis: 7.35rem; }
input, button { font: inherit; min-height: 3rem; border-radius: 0.7rem; }
input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--border);
  padding: 0.65rem 0.8rem;
  color: inherit;
  background: var(--well);
}
input::placeholder { color: #686862; }
button { cursor: pointer; padding: 0.6rem 0.8rem; }
button:disabled { cursor: default; opacity: 0.65; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.primary {
  width: 100%;
  margin-top: 0.75rem;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: white;
  font-weight: 700;
}
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.search-button {
  position: relative;
  min-height: 3.12rem;
  padding-inline: 2.4rem;
}
.action-arrow {
  position: absolute;
  inset: 50% 0.95rem auto auto;
  width: 0.98rem;
  height: 1px;
  background: currentColor;
}
.action-arrow::after {
  position: absolute;
  inset: 50% 0 auto auto;
  width: 0.43rem;
  height: 0.43rem;
  border: solid currentColor;
  border-width: 1.5px 1.5px 0 0;
  transform: translateY(-50%) rotate(45deg);
  content: "";
}
.secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent-hover);
  font-size: 0.9rem;
}
.secondary:hover:not(:disabled) { background: var(--well); }
#paste { min-width: 4.2rem; }

.order-help {
  border-block: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.87rem;
}
.order-help summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.2rem;
  cursor: pointer;
  list-style: none;
}
.order-help summary::-webkit-details-marker { display: none; }
.order-help summary::after {
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.15rem;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  content: "";
}
.order-help[open] summary::after { transform: rotate(225deg); }
.order-help p { padding: 0 0.2rem 0.8rem; line-height: 1.6; }

.money-card {
  padding: 1.15rem 1.25rem;
  border: 1px solid #3d5b46;
  border-radius: 1.02rem;
  background: radial-gradient(ellipse at top right, #456750, transparent 75%), #244536;
  color: #f8fbf8;
}
.money-card h2 { color: #eaf0e8; }
.money-card .secondary { border-color: #6c8878; background: #294e3e; color: #fff; }
.money-card .secondary:hover:not(:disabled) { background: #1e3d34; }
.money-card button:focus-visible { outline-color: #f9e0b7; }
.amount {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.55rem;
  align-items: baseline;
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}
.amount strong { min-width: 0; font-size: clamp(1.9rem, 6.7vw, 2.5rem); overflow-wrap: anywhere; line-height: 1.12; }
.amount span { color: #ead7ad; font-size: 0.9rem; font-weight: 700; }
.quote-summary { margin: -0.12rem -0.12rem 0; }
dl { display: grid; gap: 0.58rem; margin: 0.95rem 0; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
dl div { display: flex; justify-content: space-between; gap: 0.55rem 0.85rem; }
dt { flex-shrink: 0; }
dd { min-width: 0; margin: 0; color: #2c352e; text-align: right; overflow-wrap: anywhere; }
#notice {
  padding: 0.75rem 0.85rem;
  border: 1px solid #d7e2d6;
  border-radius: 0.75rem;
  background: #eaf0e7;
  font-size: 0.91rem;
  line-height: 1.5;
}
.status-button { width: 100%; }
#change-quote, #retry-application { margin-top: 0.65rem; }
.transaction { padding: 0.9rem; border: 1px solid var(--border); border-radius: 0.85rem; background: var(--surface); }
.transaction code { display: block; margin-top: 0.4rem; overflow-wrap: anywhere; line-height: 1.5; }
#copy-status { color: var(--muted); font-size: 0.87rem; }

.withdrawal-heading { padding: 0.55rem 0.1rem 0; }
.login-panel, .withdrawal-section { padding: clamp(1.05rem, 4.25vw, 1.5rem); }
.field + .field { margin-top: 0.9rem; }
#login .intro, #apply-form .intro, #retry-application-note { margin-bottom: 0.85rem; }
.wide-input { width: 100%; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; }
.quiet-action { min-height: 2.75rem; margin: 0; }
.withdrawal-quote { padding: 0.8rem; border: 1px solid var(--border); border-radius: 0.82rem; background: var(--well); }
.withdrawal-quote .quote-total {
  padding: 0.5rem 0;
  border-block: 1px solid var(--border);
  color: var(--accent);
  font-weight: 700;
}
.withdrawal-quote .quote-total dd { font-size: 1.11rem; }
.record-detail dl { margin-bottom: 0; }
.withdrawal-records { list-style: none; padding: 0; margin: 0.35rem 0 0; }
.withdrawal-records li + li { border-top: 1px solid var(--border); }
.record-button {
  width: 100%;
  border: 0;
  padding: 0.75rem 0.2rem;
  text-align: left;
  background: transparent;
  color: inherit;
}
.record-button:hover:not(:disabled) { background: var(--well); }
.record-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.3rem 0.6rem; }
.record-status { border-radius: 0.43rem; padding: 0.16rem 0.48rem; background: #f3ead9; color: #654d2b; font-size: 0.82rem; }
.record-status[data-status="11"] { background: #e4efe5; color: #26503c; }
.record-status[data-status="20"], .record-status[data-status="21"] { background: #f6e9e4; color: #813c34; }
.record-subtitle { display: block; margin-top: 0.3rem; color: var(--muted); font-size: 0.84rem; overflow-wrap: anywhere; }
#no-records { padding-top: 0.4rem; }
.page-actions { display: flex; gap: 0.5rem; margin-top: 0.7rem; }
.address-confirm { max-width: 70%; }

@media (min-width: 47rem) {
  .checkout-screen { grid-template-columns: minmax(0, 0.93fr) minmax(0, 1.07fr); align-items: start; gap: 1rem; }
  .checkout-hero { min-height: 13rem; grid-row: 1 / span 2; }
  .checkout-screen > :not(.checkout-hero) { grid-column: 2; }
  .withdrawal-screen { width: min(100%, 38rem); margin-inline: auto; }
}

@media (max-width: 46.99rem) {
  :root { --tab-space: calc(3.95rem + var(--safe-bottom)); }
  .shell {
    width: min(100%, 36rem);
    padding: 0 max(1rem, env(safe-area-inset-right)) calc(var(--tab-space) + 1.1rem)
      max(1rem, env(safe-area-inset-left));
  }
  .brand {
    position: sticky;
    z-index: 2;
    top: 0;
    margin: 0 -1rem 0.9rem;
    padding: calc(0.28rem + var(--safe-top)) max(1rem, env(safe-area-inset-right)) 0.28rem
      max(1rem, env(safe-area-inset-left));
    background: #fbf9f2;
  }
  .site-nav {
    position: fixed;
    z-index: 3;
    inset: auto 0 0;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.32rem max(1rem, env(safe-area-inset-right))
      calc(0.32rem + var(--safe-bottom)) max(1rem, env(safe-area-inset-left));
    border-top: 1px solid var(--border);
    background: #fbf9f3;
    box-shadow: 0 -0.15rem 1rem #362b1d0c;
  }
  .site-nav a {
    flex: 1;
    flex-direction: column;
    max-width: 13rem;
    min-width: 0;
    min-height: 3.25rem;
    gap: 0.26rem;
    padding: 0.24rem 0.4rem;
    font-size: 0.8rem;
  }
  input, #close-detail { scroll-margin-bottom: calc(var(--tab-space) + 0.8rem); }
}

@media (max-width: 22rem) {
  .checkout-hero { min-height: 9.6rem; }
  .hero-copy { padding-left: 0.9rem; }
  .hero-copy .intro { font-size: 0.84rem; }
}
