/* Buyer-facing site: /, /shop, /me, /me/log, /pay/return, /c/<token>. Builds on ui.css tokens and components. */

/* ===== Navy header on every page ===== */
.sitebar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50; }
.sitebar-in { display: flex; align-items: center; gap: 24px; max-width: 1120px; height: 60px; margin: 0 auto; padding: 0 24px; }
.sitebar-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: var(--fs-md); line-height: var(--lh-md); white-space: nowrap; flex: none; }
.sitebar-brand:hover, .sitebar-brand:not(.btn):hover { color: #fff; text-decoration: none; }
.sitenav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.sitenav::-webkit-scrollbar { display: none; }
.sitenav a { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: var(--radius-btn); color: var(--navy-text); font-size: var(--fs-body); white-space: nowrap; transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out); }
.sitenav a:hover, .sitenav a:not(.btn):hover { color: #fff; text-decoration: none; background: rgba(255, 255, 255, .06); }
.sitenav a.active { color: #fff; background: var(--navy-raised); font-weight: 500; }
.sitebar :focus-visible { outline-color: var(--navy-ring); }
.sitebar-user { display: flex; align-items: center; gap: 4px; min-width: 0; margin-left: auto; }
.sitebar .user-chip { color: var(--navy-text); }
.sitebar-user .user-chip { max-width: 220px; }
/* SQ.mountHeader: email + 退出, or 登录 */
.session-box { gap: 12px; flex: none; max-width: 50%; }
.session-box .session-email { min-width: 0; }
.session-box .session-email .icon { flex: none; }
.session-box .user-chip.num { height: 28px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--navy-raised); color: #fff; }
.session-box .user-chip.num .icon { color: var(--navy-text); }
.session-box .btn { flex: none; }
.sitebar .btn-text { color: #fff; }
.sitebar .btn-text:hover { background: var(--navy-raised); color: #fff; }
.sitebar .btn-secondary { background: transparent; border-color: var(--navy-text); color: #fff; }
.sitebar .btn-secondary:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, .06); }
@media (pointer: coarse) { .sitenav a { height: 44px; } }
@media (max-width: 959px) {
  .sitebar-in { flex-wrap: wrap; height: auto; padding: 10px 16px 6px; gap: 6px 12px; }
  .sitenav { order: 3; flex-basis: 100%; margin: 0 -8px; }
  .session-box { max-width: calc(100% - 150px); }
  .sitebar-user .user-chip { max-width: 180px; }
}
@media (max-width: 640px) {
  .sitebar-brand { font-size: var(--fs-body); }
  .session-box .user-chip.num { display: none; }
  .sitebar-user .user-chip { max-width: 150px; }
}

/* ===== Page container: the column grows, the footer band sits at the bottom ===== */
body { display: flex; flex-direction: column; min-height: 100vh; }
.site-shell, .claim-shell { width: 100%; flex: 1 0 auto; }
.site-shell { max-width: 1120px; margin: 0 auto; padding: 24px 16px 0; }

/* ===== Footer band on every buyer page (navy; /c/<token> uses the light variant) ===== */
.site-foot { margin-top: 48px; background: var(--navy); color: var(--navy-text); }
.site-foot-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; max-width: 1120px; margin: 0 auto; padding: 24px; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.site-foot-name { color: #fff; font-weight: 600; }
.site-foot-rules { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0; list-style: none; }
.site-foot-light { background: transparent; border-top: 1px solid var(--border); color: var(--text-3); }
.site-foot-light .site-foot-in { justify-content: center; max-width: 592px; }
.site-foot-light .site-foot-name { color: var(--text-2); font-weight: 500; }
@media (max-width: 520px) { .site-foot-in { padding: 20px 16px 28px; } }
@media (min-width: 768px) { .site-shell { padding: 32px 24px 0; } }
.site-shell .card + .card { margin-top: 16px; }
.auth-card { max-width: 440px; margin: 24px auto 0; }
.land-shell .auth-card { max-width: none; margin-top: 16px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: clamp(26px, 3.6vw, 32px); }
.page-head p { margin-top: 8px; max-width: 36em; }

/* ===== /me: one column on phones (cards re-ordered), 5/4 from 960 ===== */
.home-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.home-col { display: contents; }
.home-grid .card + .card { margin-top: 0; }
#balance { order: 1; } #v-order { order: 2; } #records, #records-slot { order: 3; } #packs { order: 4; }
@media (min-width: 960px) {
  .home-grid { grid-template-columns: 5fr 4fr; gap: 24px; align-items: start; }
  .home-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
  .home-col .card + .card { margin-top: 0; }
}
#records-slot:empty { display: none; }
.balance-card .card-head { margin-bottom: 4px; }
.balance-card .balance-num { margin: 4px 0 8px; font-size: 36px; line-height: 44px; font-weight: 650; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.balance-card > #btn-to-shop { margin-top: 20px; }
.balance-card #promo-me { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--border); }
.balance-card #bal-invite:not([hidden]) { display: inline-flex; align-items: center; height: 24px; margin-top: 8px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--success-bg); color: var(--success-text); font-size: var(--fs-xs); font-weight: 500; }
.card h2 .icon, .card h3 .icon, .card-head h2 .icon, .card-head h3 .icon { width: 20px; height: 20px; color: var(--text-2); }
.sub-h { margin: 16px 0 8px; font-size: var(--fs-sm); font-weight: 500; color: var(--text); }
.hint.center { text-align: center; margin-top: 8px; }
/* service picker on /me, same tile as /: name, what it is for, then the price large; on phones name and sub left, price right */
#svc-grid { margin-bottom: 16px; }
#svc-grid .opt-title { white-space: nowrap; }
#svc-grid .svc-opt { padding: 16px 20px; gap: 4px; }
.svc-opt-price { margin-top: auto; padding-top: 8px; font-size: var(--fs-2xl); line-height: var(--lh-2xl); font-weight: 650; letter-spacing: -0.01em; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.svc-opt-price small { margin-left: 4px; font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0; color: var(--text-2); }
@media (max-width: 519px) {
  #svc-grid { grid-template-columns: 1fr; }
  #svc-grid .svc-opt { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "title price" "sub price"; align-items: center; gap: 2px 12px; }
  #svc-grid .svc-opt .opt-title { grid-area: title; }
  #svc-grid .svc-opt .opt-sub { grid-area: sub; }
  .svc-opt-price { grid-area: price; margin: 0; padding: 0; font-size: var(--fs-xl); line-height: var(--lh-xl); }
}
/* /me signed out: the page heading says what signing in opens */
.auth-card .auth-title { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 650; letter-spacing: -0.01em; }
.card form > .auth-title + .hint { margin: 4px 0 16px; }
.rc-pay { margin-top: 16px; }

.opt.is-disabled { cursor: not-allowed; }
.opt.is-disabled .opt-body { background: var(--neutral-bg); border-color: var(--border); color: var(--text-placeholder); }
.opt.is-disabled .opt-title { color: var(--text-placeholder); }
.tier-grid { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 480px) { .tier-grid { grid-template-columns: repeat(3, 1fr); } }

/* segmented tabs */
.seg { display: inline-flex; padding: 3px; background: var(--neutral-bg); border-radius: var(--radius-btn); gap: 2px; max-width: 100%; overflow-x: auto; }
.seg-btn { height: 34px; padding: 0 14px; border: 0; border-radius: var(--radius-inner); background: transparent; color: var(--text-2); font: 500 var(--fs-sm)/var(--lh-sm) var(--font); cursor: pointer; white-space: nowrap; transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out); }
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--card); color: var(--text); font-weight: 600; box-shadow: var(--shadow-xs); }
.seg-lg .seg-btn { height: 40px; padding: 0 20px; font-size: var(--fs-body); }
@media (pointer: coarse) { .seg-btn { height: 40px; } }

/* share list rows */
.pack { padding: 12px 0; border-bottom: 1px solid var(--border); }
.pack:first-child { padding-top: 0; }
.pack:last-child { border-bottom: 0; padding-bottom: 0; }
.pack .progress { margin: 10px 0 6px; }
.pack .nums { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; color: var(--text-2); font-size: var(--fs-xs); }
.pack-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 12px; }
.state.compact { padding: 16px; }
.state.compact .icon-xl { width: 32px; height: 32px; margin-bottom: 4px; }

/* money in/out */
.amt-in { color: var(--success-text); font-weight: 600; }
.amt-out { color: var(--text); }
.amt-zero { color: var(--text-3); }
/* records list while a tab loads */
.history-list[aria-busy="true"] { opacity: .5; transition: opacity var(--dur) var(--ease-out); }
.history-list .mono { font-size: var(--fs-body); }
.rec-error { display: flex; align-items: center; gap: 8px; }
.empty-cell .rec-error { justify-content: center; }
.rec-right { display: flex; flex-direction: column; align-items: flex-end; }
.rec-right .mono { color: var(--success-text); font-weight: 600; letter-spacing: .06em; }
#rec-empty:not([hidden]) { padding: 24px 0 8px; text-align: center; }

/* stepper */
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--border-input); border-radius: var(--radius-btn); overflow: hidden; background: var(--card); }
.stepper button { width: 44px; border: 0; background: var(--bg); color: var(--text); font-size: var(--fs-lg); cursor: pointer; }
.stepper button:hover:not(:disabled) { background: var(--cobalt-tint); color: var(--cobalt); }
.stepper button:disabled { color: var(--text-placeholder); cursor: not-allowed; }
.stepper input { width: 72px; height: 44px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; font: 600 16px/24px var(--font); font-variant-numeric: tabular-nums; color: var(--text); -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: var(--cobalt-tint); }
.qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ===== /me/log ===== */
#v-log .section-head { margin-bottom: 20px; }
#v-log .section-head h1 { font-size: var(--fs-lg); line-height: var(--lh-lg); letter-spacing: -0.01em; }
#bal-now { font-variant-numeric: tabular-nums; color: var(--text-2); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 16px; padding: 16px; background: var(--bg); border-radius: var(--radius-btn); }
.filters .field { margin: 0; }
.filters .field + .field { margin: 0; }
.filters .label { margin-bottom: 4px; font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-2); }
.filters .select, .filters .input { width: auto; min-width: 150px; }
.filters .grow-end { margin-left: auto; }
.table td .tag { vertical-align: middle; }
.table th.amt-col, .table td[data-label="金额"] { text-align: right; }

/* ===== /shop ===== */
.shop-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.shop-main .card + .card { margin-top: 16px; }
.shop-side { display: flex; flex-direction: column; gap: 16px; }
.shop-side .card + .card { margin-top: 0; }
@media (min-width: 768px) {
  .shop-grid { grid-template-columns: 7fr 5fr; gap: 24px; align-items: start; }
}
@media (min-width: 960px) {
  .shop-side { position: sticky; top: 84px; }
  /* floats above the flow: a shadow instead of the hairline */
  .shop-side .summary-card { border-color: transparent; box-shadow: var(--shadow); }
}
.opt-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.pack-title { margin: 4px 0 2px; color: var(--text); font-weight: 500; }
.pack-rule { margin-top: 4px; overflow-wrap: anywhere; }
.textarea { height: auto; min-height: 72px; padding-top: 10px; padding-bottom: 10px; resize: vertical; font: inherit; font-size: 16px; }
.btn.is-disabled { opacity: .5; pointer-events: none; }
#v-log .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
#v-log .seg-btn { white-space: nowrap; flex: none; }
#v-log .filters .field { min-width: 0; max-width: 100%; }
#f-pack { width: 100%; max-width: 100%; min-width: 0; text-overflow: ellipsis; }
#email-field { margin-top: 16px; }
.summary-card h2 { margin-bottom: 16px; }
.shop-guide { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; }
.shop-guide .icon { flex: none; margin-top: 3px; }
.pack-grid { grid-template-columns: 1fr; }
@media (min-width: 480px) { .pack-grid { grid-template-columns: repeat(2, 1fr); } }
.pack-opt .opt-body { gap: 6px; padding: 16px; min-height: 132px; }
.pack-price { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 600; color: var(--text); }
.retail-opt .opt-body, .retail-opt:hover .opt-body, .retail-opt input:checked + .opt-body { padding: 0; border-color: transparent; background: none; box-shadow: none; }
.retail-opt input:checked + .opt-body .amount-input input { border-color: var(--cobalt); box-shadow: inset 0 0 0 1px var(--cobalt); background: var(--cobalt-tint); }
.retail-opt .opt-title, .retail-opt .opt-sub { display: block; }
.retail-label { cursor: pointer; min-width: 0; flex: 1 1 200px; }
.retail-tip { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 12px; }
#retail-tip-text { flex: 1 1 200px; min-width: 0; }
#retail-tip-icon:empty { display: none; }
.approx-line { margin-top: 4px; color: var(--text-2); font-size: var(--fs-sm); }
.links-hint { margin: -4px 0 12px; }
.pack-name { min-width: 0; }
.warn-text { color: var(--warning-text); }
.input-narrow { max-width: 160px; }
fieldset.field { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.opt .stepper input { position: static; opacity: 1; pointer-events: auto; }
/* one payment method: shown as the chosen option, nothing else to pick */
.pay-single { display: flex; align-items: center; gap: 10px; margin: 0; min-height: 52px; padding: 12px 16px; border: 1px solid var(--cobalt); border-radius: var(--radius-btn); background: var(--cobalt-tint); box-shadow: inset 0 0 0 1px var(--cobalt); color: var(--text); font-weight: 600; }
.pay-single > .icon { width: 20px; height: 20px; color: var(--cobalt-press); }
.pay-single-name { flex: 1; min-width: 0; }
.pay-single-check { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cobalt); color: #fff; flex: none; }
.pay-single-check .icon { width: 14px; height: 14px; color: #fff; stroke-width: 2.25; vertical-align: 0; }
.amount-input { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: 600; margin-left: auto; }
.opt .amount-input input { position: static; opacity: 1; pointer-events: auto; width: 160px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.pack-credit { display: flex; align-items: baseline; gap: 6px; font-size: 26px; line-height: 34px; font-weight: 650; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pack-credit small { font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }
.pack-tags { display: flex; gap: 6px; flex-wrap: wrap; min-height: 24px; }
.pack-opt .opt-sub { margin-top: auto; }
.pack-opt .opt-sub b { font-weight: 600; color: var(--text); }
.pack-tags .tag { margin-top: 0; }
.price-ref { margin-top: 12px; }
#pk-note { margin-top: 8px; }
.shop-flow { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; max-width: 40em; }
.shop-flow .icon { flex: none; margin-top: 3px; }
.pay-account { margin-top: 12px; overflow-wrap: anywhere; }
.invoice-note { margin-top: 4px; text-align: center; color: var(--text-3); }
main > .invoice-note { margin-top: 16px; }
#btn-next { display: inline-flex; align-items: center; gap: 8px; }
.site-shell.buy-shell { max-width: 608px; }

/* /me 分享 form rhythm */
.card-head + .hint { margin-bottom: 16px; }
.share-toggle { display: flex; align-items: center; min-height: 56px; padding: 8px 14px; border-radius: var(--radius-btn); background: var(--bg); margin-bottom: 16px; }
.share-toggle .check { gap: 12px; font-weight: 600; }
.share-toggle + .hint { margin: -8px 0 16px; }
fieldset.field legend { padding: 0; }
#sh-note { margin-top: 8px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
#sh-live .input.mono { font-family: var(--mono); font-size: var(--fs-sm); }

/* /shop inline amount state */
.retail-tip.alert-warning .icon { color: var(--warning-text); }
.pay-hint { margin-top: 8px; text-align: center; color: var(--warning-text); }

/* /me/log on phones: each row reads as a dense two-line card */
@media (max-width: 640px) {
  .filters { display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 12px; padding: 12px; }
  .filters .select, .filters .input, #v-log .filters .field { width: 100%; min-width: 0; }
  #v-log .filters .grow-end { grid-column: 1 / -1; margin-left: 0; display: flex; justify-content: flex-end; }
  #v-log .filters .grow-end .btn { width: 100%; }
  #v-log .section-head { flex-wrap: nowrap; }
  #v-log .table-wrap { border: 0; background: transparent; overflow: visible; }
  #v-log .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  #v-log .table, #v-log .table tbody { display: block; }
  /* line 1: type, amount. line 2: time · service · tail · detail, status on the right */
  #v-log .table tr { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  #v-log .table tr::after { content: ""; order: 3; flex-basis: 100%; height: 0; }
  #v-log .table tbody tr:hover td { background: transparent; }
  #v-log .table td { height: auto; padding: 0; border: 0; white-space: nowrap; min-width: 0; }
  #v-log .table td.empty-cell { flex-basis: 100%; height: 96px; display: flex; align-items: center; justify-content: center; }
  #v-log .table td[data-label="类型"] { order: 1; flex: 1; font-weight: 500; font-size: var(--fs-body); }
  #v-log .table td[data-label="金额"] { order: 2; text-align: right; font-size: var(--fs-body); }
  #v-log .table td[data-label="时间"], #v-log .table td[data-label="服务"], #v-log .table td[data-label="手机尾号"], #v-log .table td[data-label="详情"] { color: var(--text-3); font-size: var(--fs-xs); line-height: var(--lh-xs); }
  #v-log .table td[data-label="时间"] { order: 4; }
  #v-log .table td[data-label="服务"] { order: 5; }
  #v-log .table td[data-label="手机尾号"] { order: 6; }
  #v-log .table td[data-label="详情"] { order: 7; flex: 1 1 0; min-width: 3em; overflow: hidden; text-overflow: ellipsis; }
  /* rows with a status reserve line 2 for time, service, tail and status; their detail opens on tap */
  #v-log .table tr:has(td[data-label="状态"]:not([data-empty])):not(.is-open) td[data-label="详情"] { display: none; }
  #v-log .table tr:has(td[data-label="详情"]:not([data-empty])) { cursor: pointer; }
  #v-log .table tr.is-open td[data-label="详情"] { flex-basis: 100%; order: 9; white-space: normal; overflow-wrap: anywhere; }
  #v-log .table tr.is-open td[data-label="详情"]::before { content: none; }
  #v-log .table td[data-label="服务"]::before, #v-log .table td[data-label="手机尾号"]::before, #v-log .table td[data-label="详情"]::before { content: "· "; color: var(--text-3); }
  #v-log .table td[data-label="详情"] .hint { font-size: inherit; line-height: inherit; }
  #v-log .table td[data-label="状态"] { order: 8; flex: none; margin-left: auto; }
  #v-log .table td[data-label="状态"] .tag { margin-top: 0; }
  #v-log .table td[data-empty] { display: none; }
}
