/* 027AI public interface. All colors are scoped to the public page. */
.ai-page {
  --page: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-hover: #f1f5f9;
  --text: #17243b;
  --text-secondary: #475569;
  --text-muted: #66758c;
  --border: #e3e9f1;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff5ff;
  --primary-border: #c9dcff;
  --success: #138657;
  --success-soft: #effaf4;
  --success-border: #c7e8d5;
  --warning: #a3650a;
  --warning-soft: #fff8eb;
  --error: #c94149;
  --error-soft: #fff3f3;
  --error-border: #f0d0d3;
  --track: #eaf0f8;
  --shadow: 0 3px 16px rgb(25 46 80 / 3%);
  --radius: 14px;
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--text);
  font: 14px/1.6 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  color-scheme: light;
}

.ai-page.theme-dark {
  --page: #111927;
  --surface: #182335;
  --surface-soft: #1d2b3e;
  --surface-hover: #25354b;
  --text: #edf2fa;
  --text-secondary: #c2cede;
  --text-muted: #9eafc5;
  --border: #304056;
  --border-strong: #465b75;
  --primary: #76a6ff;
  --primary-hover: #99bdff;
  --primary-soft: #233858;
  --primary-border: #3c5881;
  --success: #75d7a6;
  --success-soft: #1a3830;
  --success-border: #315d4d;
  --warning: #edbf73;
  --warning-soft: #3a3022;
  --error: #ffa0a6;
  --error-soft: #3b2832;
  --error-border: #70404b;
  --track: #2c3d54;
  --shadow: 0 3px 16px rgb(0 0 0 / 10%);
  color-scheme: dark;
}

.ai-page *, .ai-page *::before, .ai-page *::after { box-sizing: border-box; }
.ai-page [hidden] { display: none !important; }
.ai-page :is(button, input, textarea, select) { font: inherit; }
.ai-page button { cursor: pointer; }
.ai-page button:disabled { cursor: not-allowed; }
.ai-page a { color: var(--primary); text-decoration: none; }
.ai-page a:hover { text-decoration: underline; }
.ai-page :is(button, a, input, textarea, select):focus-visible {
  outline: 3px solid var(--primary-border);
  outline-offset: 3px;
}
.ai-page :is(h1, h2, h3, p) { margin-top: 0; }
.ai-page :is(h1, h2, h3) { line-height: 1.35; }
.ai-page h2 { margin-bottom: 12px; font-size: 19px; font-weight: 650; }
.ai-page h3 { margin-bottom: 8px; font-size: 15px; font-weight: 650; }
.ai-page :is(svg, img) { max-width: 100%; }
.ai-page svg { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.ai-page .mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

/* Frame and navigation. */
.site-header {
  min-height: 52px;
  padding: 10px max(32px, calc((100% - 1240px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.ai-page .brand:hover { text-decoration: none; }
.brand-symbol { display: block; width: 30px; height: 30px; }
.brand-wordmark { display: inline-flex; font-size: 24px; font-weight: 700; letter-spacing: -1px; line-height: 1; }
.brand-number { color: var(--text); }
.brand-ai { color: var(--primary); }
.header-actions { display: flex; align-items: center; gap: 14px; min-width: 0; }
.header-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.ai-page .header-link { color: var(--text-secondary); }
.icon-button, .btn-ghost {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
}
.icon-button:hover, .btn-ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.site-main { width: min(1240px, calc(100% - 64px)); margin: 24px auto 0; flex: 1; min-width: 0; }
.page-heading { width: min(900px, 100%); margin: 4px auto 22px; text-align: left; }
.site-main:has(#subscriptionSection:not([hidden]) #subResult:not([hidden])) .page-heading { width: min(1160px, 100%); }
.site-main:has(#querySection:not([hidden]) .batch-lookup-results:not([hidden])) .page-heading { width: min(1100px, 100%); }
.page-heading h1 { margin-bottom: 8px; font-size: 28px; font-weight: 700; letter-spacing: -.7px; line-height: 1.25; }
.page-heading p { margin-bottom: 18px; color: var(--text-muted); font-size: 14px; line-height: 1.7; }
.page-heading .exchange-tabs { width: 100%; margin: 0; text-align: left; }
.exchange-tabs {
  display: flex;
  align-items: stretch;
  gap: 28px;
  margin-bottom: 22px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
}
.exchange-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  min-height: 46px;
  margin-bottom: -1px;
  padding: 11px 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
}
.exchange-tab:hover { color: var(--text); background: transparent; }
.exchange-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 650; }
.exchange-section { min-width: 0; }
.redeem-layout, .subscription-layout, .refresh-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.subscription-layout { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.refresh-layout { grid-template-columns: minmax(0, 1fr); }
.redeem-layout > *, .subscription-layout > *, .refresh-layout > * { min-width: 0; }
.exchange-card, .task-progress { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.exchange-card-panel { padding: 30px 32px; }
.exchange-card-panel > :last-child { margin-bottom: 0; }
.card-heading, .panel-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; }
.card-heading h2, .panel-heading h2 { margin-bottom: 0; }
.card-heading svg, .panel-heading svg { color: var(--primary); }
.card-subtitle, .panel-description { margin-bottom: 22px; color: var(--text-muted); }

/* Forms and actions. */
.exchange-form-group { margin-bottom: 22px; min-width: 0; }
.exchange-form-group label, .form-label { display: block; margin-bottom: 10px; color: var(--text); font-weight: 600; }
.form-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.form-label-row label { margin-bottom: 0; }
.exchange-input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 12px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.65;
  transition: border-color .15s, box-shadow .15s;
}
textarea.exchange-input { display: block; min-height: 140px; resize: vertical; overflow-wrap: anywhere; }
.exchange-input::placeholder { color: var(--text-muted); opacity: .85; }
.exchange-input:hover { border-color: var(--text-muted); }
.exchange-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.exchange-input:disabled { background: var(--surface-soft); color: var(--text-muted); cursor: not-allowed; }
.exchange-input[aria-invalid="true"] { border-color: var(--error); }
.exchange-hint { margin: 10px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.75; overflow-wrap: anywhere; }
.exchange-query-count { margin: 9px 0 0; color: var(--primary); font-size: 12px; }
.exchange-buttons { display: flex; align-items: center; justify-content: flex-start; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.exchange-buttons.split { justify-content: space-between; }
.exchange-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  min-width: 126px;
  max-width: 100%;
  padding: 10px 24px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 600;
  line-height: 1.5;
  transition: background .15s, border-color .15s;
}
.exchange-btn.primary { color: #fff; background: #2563eb; border-color: #2563eb; }
.exchange-btn.primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.exchange-btn.ghost, .exchange-btn.secondary { color: var(--text-secondary); background: var(--surface); border-color: var(--border-strong); }
.exchange-btn.ghost:hover, .exchange-btn.secondary:hover { color: var(--text); background: var(--surface-hover); }
.ai-page [data-refresh-next] { color: var(--text-secondary); background: var(--surface); border-color: var(--border-strong); }
.ai-page [data-refresh-next]:hover { color: var(--text); background: var(--surface-hover); }
.exchange-btn.danger { color: var(--error); background: var(--error-soft); border-color: var(--error-border); }
.exchange-btn:disabled, .exchange-mini-btn:disabled, .exchange-reuse-btn:disabled { opacity: .5; }
.exchange-btn.is-loading { opacity: .8; cursor: wait; }
.btn-text { min-width: 0; }
.loader { display: none; width: 17px; height: 17px; flex-shrink: 0; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ai-spin .8s linear infinite; }
@keyframes ai-spin { to { transform: rotate(360deg); } }
.text-link { display: inline-flex; align-items: center; gap: 5px; padding: 0; border: 0; background: transparent; color: var(--primary); font-size: 13px; }
.text-link:hover { text-decoration: underline; }
.note-strip, .info-box {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  padding: 12px 15px;
  border: 1px solid var(--primary-border);
  border-radius: 12px;
  color: var(--text-secondary);
  background: var(--primary-soft);
  font-size: 12px;
  line-height: 1.65;
}
.note-strip svg, .info-box svg { margin-top: 2px; color: var(--primary); }
.note-strip p, .info-box p { margin: 0; }
.info-box { display: block; margin-bottom: 24px; background: var(--primary-soft); border-color: var(--primary-border); color: var(--text-secondary); }
.info-box ul, .info-box ol { margin: 0; padding-left: 19px; }

/* Redemption steps and progress. */
.exchange-steps { list-style: none; display: flex; align-items: center; gap: 16px; margin: 0 0 30px; padding: 0 0 26px; border-bottom: 1px solid var(--border); }
.exchange-step { display: flex; align-items: center; gap: 9px; min-width: 0; color: var(--text-muted); }
.exchange-step-number { display: grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface-soft); font-size: 12px; font-weight: 650; }
.exchange-step-label { font-size: 13px; white-space: nowrap; }
.exchange-step.active { color: var(--primary); font-weight: 650; }
.exchange-step.active .exchange-step-number { border-color: #2563eb; background: #2563eb; color: #fff; }
.exchange-step.done { color: var(--primary); }
.exchange-step.done .exchange-step-number { border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary); }
.exchange-step-line { flex: 1; min-width: 16px; height: 1px; background: var(--border); }
.exchange-valid { padding: 13px 15px; margin-bottom: 20px; border: 1px solid var(--success-border); border-radius: 9px; background: var(--success-soft); color: var(--success); }
.exchange-valid > strong { display: block; font-size: 14px; }
.exchange-plan-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 7px; color: var(--text-secondary); font-size: 12px; }
.plan-pill, .exchange-plan-mini { display: inline-flex; align-items: center; width: fit-content; padding: 3px 9px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 650; line-height: 1.45; text-transform: capitalize; }
.flow-badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px; background: var(--surface-soft); color: var(--text-muted); font-size: 12px; }
.flow-badge.running, .flow-badge.pending { color: var(--primary); background: var(--primary-soft); }
.flow-badge.success { color: var(--success); background: var(--success-soft); }
.flow-badge.failed { color: var(--error); background: var(--error-soft); }
.task-progress { padding: 26px 28px; }
.progress-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.progress-heading h2, .progress-heading h3 { margin: 0; font-size: 16px; }
.progress-heading > svg { color: var(--primary); }
.progress-ring {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 170px;
  height: 170px;
  margin: 23px auto 17px;
  border-radius: 50%;
  color: var(--primary);
}
.ai-page .progress-ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.progress-ring-track, .progress-ring-value { fill: none; stroke-width: 10; }
.progress-ring-track { stroke: var(--track); }
.progress-ring-value { stroke: currentColor; stroke-linecap: round; transition: stroke .25s ease; }
.progress-ring > div { position: relative; z-index: 1; }
.progress-number { color: var(--text); font-size: 35px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.progress-ring .progress-caption { margin: 4px 0 0; }
.progress-caption, .task-progress-text { color: var(--text-muted); font-size: 12px; text-align: center; }
.task-progress-text { margin: 9px 0 16px; overflow-wrap: anywhere; }
.progress-stages { list-style: none; padding: 0; margin: 20px 0; }
.progress-stages > li { display: flex; align-items: center; gap: 10px; min-height: 36px; color: var(--text-muted); font-size: 12px; }
.stage-dot { display: inline-grid; place-items: center; width: 17px; height: 17px; flex-shrink: 0; border: 1px solid var(--border-strong); border-radius: 50%; background: var(--surface-soft); }
.stage-dot svg { display: none; width: 11px; height: 11px; }
.progress-stages > li.is-complete .stage-dot svg { display: block; }
.progress-stages > li.is-complete { color: var(--text-secondary); }
.progress-stages > li.is-complete .stage-dot { border-color: var(--success); background: var(--success); color: var(--surface); }
.progress-stages > li.is-active { color: var(--primary); font-weight: 600; }
.progress-stages > li.is-active .stage-dot { border: 5px solid var(--primary); background: var(--surface); }
.progress-stages > li.is-error { color: var(--error); }
.progress-stages > li.is-error .stage-dot { border-color: var(--error); background: var(--error-soft); }
.progress-actions { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.task-progress-track { height: 6px; overflow: hidden; border-radius: 9px; background: var(--track); }
.task-progress-bar { height: 100%; width: 0; background: var(--primary); }
.task-progress-bar.error { background: var(--error); }

/* Batch lookup results. */
.query-card { margin-bottom: 24px; }
.query-card textarea { min-height: 118px; }
.exchange-results-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.exchange-results-layout.with-list { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); }
.batch-result-card { padding: 24px; }
.exchange-batch-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.exchange-result-kicker { display: block; margin-bottom: 7px; color: var(--text-muted); font-size: 12px; font-weight: 600; }
.exchange-batch-headline { min-width: 0; }
.exchange-batch-headline h2 { margin-bottom: 6px; font-size: 18px; }
.exchange-batch-headline p { margin: 0; color: var(--text-muted); font-size: 12px; }
.exchange-mini-btn, .exchange-reuse-btn, .exchange-batch-copy, .copy-error-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 33px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.exchange-mini-btn:hover, .exchange-reuse-btn:hover, .exchange-batch-copy:hover, .copy-error-code:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.exchange-reuse-btn { flex-shrink: 0; color: var(--primary); border-color: var(--primary-border); background: var(--primary-soft); }
.exchange-batch-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.exchange-chip { display: inline-flex; gap: 6px; padding: 4px 8px; border-radius: 5px; background: var(--surface-soft); color: var(--text-muted); font-size: 12px; }
.exchange-chip strong { color: var(--text-secondary); font-weight: 650; font-variant-numeric: tabular-nums; }
.exchange-chip.processing, .exchange-chip.found { color: var(--primary); background: var(--primary-soft); }
.exchange-chip.failed { color: var(--error); background: var(--error-soft); }
.exchange-chip.unused { color: var(--text-secondary); }
.exchange-chip.processing strong, .exchange-chip.found strong, .exchange-chip.failed strong { color: inherit; }
.exchange-batch-list { display: grid; gap: 10px; max-height: 490px; padding: 2px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.exchange-batch-item { width: 100%; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); text-align: left; }
.exchange-batch-item.clickable:hover { border-color: var(--primary-border); background: var(--surface-soft); }
.exchange-batch-item.active { border-color: var(--primary); background: var(--primary-soft); }
.exchange-batch-codeline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.exchange-batch-code { min-width: 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; }
.exchange-batch-copy { flex-shrink: 0; min-height: 28px; padding: 3px 7px; font-size: 12px; }
.exchange-batch-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; font-size: 12px; }
.exchange-batch-meta > strong { font-weight: 550; color: var(--text-muted); }
.exchange-batch-meta.completed > strong { color: var(--success); }
.exchange-batch-meta.processing > strong, .exchange-batch-meta.queued > strong { color: var(--primary); }
.exchange-batch-meta.failed > strong, .exchange-batch-meta.missing > strong { color: var(--error); }
.exchange-batch-sub { color: var(--text-muted); overflow-wrap: anywhere; }
.exchange-detail-card { overflow: hidden; }
.exchange-detail-banner { position: relative; padding: 26px 27px; border-bottom: 1px solid var(--border); background: var(--surface-soft); }
.exchange-detail-banner h2 { margin: 0 0 9px; padding-right: 66px; font-size: 20px; }
.exchange-detail-banner p { margin: 0; color: var(--text-secondary); font-size: 12px; overflow-wrap: anywhere; }
.exchange-detail-banner.completed { background: var(--success-soft); border-color: var(--success-border); }
.exchange-detail-banner.failed, .exchange-detail-banner.missing { background: var(--error-soft); border-color: var(--error-border); }
.exchange-detail-banner.processing, .exchange-detail-banner.queued { background: var(--primary-soft); border-color: var(--primary-border); }
.exchange-detail-status { position: absolute; top: 26px; right: 25px; padding: 3px 8px; border-radius: 20px; color: var(--text-muted); background: var(--surface); font-size: 12px; font-weight: 550; }
.completed .exchange-detail-status { color: var(--success); }
.processing .exchange-detail-status, .queued .exchange-detail-status { color: var(--primary); }
.failed .exchange-detail-status, .missing .exchange-detail-status { color: var(--error); }
.exchange-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 21px 24px; padding: 25px 27px; }
.exchange-detail-grid > div { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; }
.exchange-detail-grid > div > span:first-child { color: var(--text-muted); font-size: 12px; }
.exchange-detail-grid strong { font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }
.exchange-detail-grid .span-2 { grid-column: 1 / -1; }
.exchange-detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 27px 25px; }
.exchange-job-id { width: 100%; margin-top: 8px; color: var(--text-muted); font: 12px/1.6 Consolas, monospace; overflow-wrap: anywhere; }

/* Subscription, confirmation and replacement. */
.result-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 292px; padding: 30px 22px; color: var(--text-muted); text-align: center; }
.result-empty > svg { width: 40px; height: 40px; margin-bottom: 17px; color: var(--border-strong); }
.result-empty h3 { margin-bottom: 7px; color: var(--text-secondary); font-size: 15px; font-weight: 550; }
.result-empty p { max-width: 290px; margin-bottom: 0; font-size: 12px; }
.query-result-card { overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.query-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 15px 17px; border-bottom: 1px solid var(--border); font-size: 13px; }
.query-row:last-child { border-bottom: 0; }
.query-row > span:first-child { flex-shrink: 0; color: var(--text-muted); }
.query-row strong { min-width: 0; text-align: right; font-weight: 550; overflow-wrap: anywhere; }
.confirm-summary { margin-bottom: 25px; }
.confirm-summary > p { color: var(--text-muted); font-size: 13px; }
.subscription-plan { display: block; margin-bottom: 22px; padding: 18px; border: 1px solid var(--primary-border); border-radius: 10px; background: var(--primary-soft); }
.subscription-plan > svg { width: 28px; height: 28px; color: var(--primary); }
.subscription-plan h3, .subscription-plan strong { margin: 0; color: var(--text); font-size: 17px; }
.subscription-plan p { margin: 2px 0 0; color: var(--text-muted); font-size: 12px; }
.renewal-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.renewal-actions p { flex: 1; min-width: 160px; margin: 0; color: var(--text-muted); font-size: 12px; }
.refresh-result { min-width: 0; text-align: center; }
.success-symbol { display: grid; place-items: center; width: 48px; height: 48px; margin: 2px auto 16px; border-radius: 50%; background: var(--success-soft); color: var(--success); font-size: 25px; }
.success-symbol svg { width: 25px; height: 25px; }
.refresh-result h2 { margin-bottom: 7px; font-size: 20px; }
.refresh-result > p { color: var(--text-muted); font-size: 13px; }
.code-box { display: block; gap: 12px; margin: 22px 0 16px; padding: 16px; border: 1px solid var(--primary-border); border-radius: 9px; background: var(--primary-soft); color: var(--text); text-align: left; }
.code-box code, .code-box strong { min-width: 0; overflow-wrap: anywhere; font: 600 13px/1.8 "SFMono-Regular", Consolas, monospace; }
.code-box button { flex-shrink: 0; }
.remaining-badge { display: inline-flex; align-items: center; gap: 5px; margin: 0 auto; padding: 5px 11px; border-radius: 20px; background: var(--surface-soft); color: var(--text-muted); font-size: 12px; }
.remaining-badge strong { color: var(--primary); }
.refresh-result .exchange-buttons { justify-content: center; }

/* User-facing messages and help. */
.status-message { position: relative; margin: 22px 0 0; padding: 16px 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-secondary); overflow-wrap: anywhere; }
.status-message:empty { display: none; }
.status-message.success { background: var(--success-soft); border-color: var(--success-border); }
.status-message.error { background: var(--error-soft); border-color: var(--error-border); }
.status-icon { display: inline-flex; align-items: center; justify-content: center; position: absolute; top: 18px; left: 17px; width: 20px; height: 20px; color: var(--primary); }
.status-message.success .status-icon { color: var(--success); }
.status-message.error .status-icon { color: var(--error); }
.status-copy { min-width: 0; padding-left: 30px; }
.status-title { display: block; margin: 0; color: var(--text); font-size: 13px; font-weight: 550; }
.status-code { display: inline-block; margin-top: 7px; color: var(--text-muted); font: 12px/1.7 Consolas, monospace; }
.copy-error-code { min-height: 27px; margin-left: 9px; padding: 3px 7px; background: transparent; font-size: 12px; }
.site-footer { width: min(1240px, calc(100% - 64px)); display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 12px; margin: 46px auto 0; padding: 22px 0 25px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12px; text-align: center; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--text-muted); }
.footer-links { display: flex; align-items: center; gap: 18px; }
.help-dialog { position: fixed; width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 48px); max-height: calc(100svh - 48px); padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 20px 70px rgb(0 0 0 / 18%); overflow: auto; }
.help-dialog::backdrop { background: rgb(12 23 41 / 45%); }
.help-content { position: relative; padding: 30px; }
.help-content h2 { margin: 0 34px 20px 0; font-size: 20px; }
.help-content p, .help-content li { color: var(--text-secondary); font-size: 13px; overflow-wrap: anywhere; }
.help-content ol, .help-content ul { padding-left: 22px; }
.help-content li + li { margin-top: 10px; }
.help-content code { padding: 2px 5px; border-radius: 4px; background: var(--surface-soft); color: var(--text); }
.help-close { position: absolute; top: 22px; right: 22px; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 7px; background: var(--surface-soft); color: var(--text-muted); }
.help-close:hover { background: var(--surface-hover); color: var(--text); }

@media (max-width: 1050px) {
  .exchange-steps { gap: 11px; }
  .exchange-step { gap: 7px; }
  .exchange-step-label { font-size: 12px; }
  .exchange-batch-head { flex-wrap: wrap; }
  .exchange-detail-grid { gap: 20px 15px; }
}

@media (max-width: 900px) {
  .site-header { padding-right: 24px; padding-left: 24px; }
  .site-main, .site-footer { width: calc(100% - 48px); }
  .subscription-layout { grid-template-columns: minmax(0, 1fr); }
  .task-progress { display: block; }
  .progress-heading { grid-column: 1 / -1; }
  .progress-ring { grid-column: 1; margin: 0 auto 10px; }
  .task-progress > .progress-caption, .task-progress-text { grid-column: 1; }
  .progress-stages { grid-column: 2; grid-row: 2 / span 2; margin: 10px 0; }
  .progress-actions { grid-column: 1 / -1; }
  .exchange-results-layout.with-list { grid-template-columns: minmax(0, 1fr); }
  .exchange-batch-list { max-height: 330px; }
  .result-empty { min-height: 200px; }
}

@media (max-width: 600px) {
  .site-header { min-height: 48px; padding: 8px 14px; gap: 10px; }
  .brand-symbol { width: 26px; height: 26px; }
  .brand { gap: 7px; }
  .brand-wordmark { font-size: 21px; }
  .header-actions { gap: 8px; }
  .header-link { gap: 4px; font-size: 12px; }
  .header-link svg { width: 14px; height: 14px; }
  .icon-button, .btn-ghost { width: 30px; height: 30px; }
  .site-main { width: calc(100% - 32px); margin-top: 16px; }
  .page-heading { margin-bottom: 20px; }
  .page-heading h1 { margin-bottom: 7px; font-size: 24px; letter-spacing: -.4px; }
  .page-heading p { margin-bottom: 13px; font-size: 13px; line-height: 1.7; }
  .page-heading .exchange-tabs { width: 100%; }
  .exchange-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 20px; }
  html[lang="en"] .exchange-tabs { grid-template-columns: .95fr .75fr 1.25fr 1.05fr; }
  .exchange-tab { min-height: 48px; gap: 4px; padding: 10px 2px; font-size: 13px; }
  .exchange-tab svg { display: none; }
  .exchange-card, .task-progress { border-radius: 12px; }
  .exchange-card-panel { padding: 22px 18px; }
  .exchange-steps { gap: 8px; margin-bottom: 22px; padding-bottom: 22px; }
  .exchange-step { flex-direction: column; gap: 6px; }
  .exchange-step-number { width: 25px; height: 25px; font-size: 12px; }
  .exchange-step-label { font-size: 12px; }
  .exchange-step-line { margin-top: -20px; min-width: 10px; }
  .exchange-form-group { margin-bottom: 20px; }
  .exchange-form-group label { font-size: 13px; }
  .exchange-input { min-height: 46px; padding: 11px 12px; font-size: 14px; }
  textarea.exchange-input { min-height: 140px; }
  .exchange-buttons { margin-top: 22px; gap: 10px; }
  .exchange-buttons .exchange-btn { flex: 1; min-width: 0; padding: 10px 12px; font-size: 13px; }
  .exchange-buttons.split { flex-wrap: nowrap; }
  .note-strip, .info-box { margin-top: 16px; padding: 12px; font-size: 12px; }
  .redeem-layout, .subscription-layout, .refresh-layout, .exchange-results-layout { gap: 18px; }
  .query-card { margin-bottom: 18px; }
  .task-progress { display: block; padding: 22px; }
  .progress-ring { margin: 20px auto 15px; }
  .progress-stages { max-width: 220px; margin: 19px auto; }
  .progress-stages > li { min-height: 35px; }
  .batch-result-card { padding: 20px 17px; }
  .exchange-batch-head { gap: 12px; }
  .exchange-batch-headline h2 { font-size: 17px; }
  .exchange-batch-chips { gap: 6px; }
  .exchange-chip { gap: 5px; padding: 4px 6px; font-size: 12px; }
  .exchange-batch-item { padding: 12px; }
  .exchange-batch-codeline { gap: 6px; }
  .exchange-batch-code { font-size: 12px; }
  .exchange-detail-banner { padding: 23px 19px; }
  .exchange-detail-banner h2 { font-size: 19px; }
  .exchange-detail-status { top: 23px; right: 19px; }
  .exchange-detail-grid { padding: 22px 19px; gap: 20px 16px; }
  .exchange-detail-grid strong { font-size: 12px; }
  .exchange-detail-actions { padding: 0 19px 22px; }
  .query-row { gap: 12px; padding: 14px; font-size: 12px; }
  .subscription-plan { padding: 15px; }
  .renewal-actions { justify-content: flex-start; gap: 13px; }
  .renewal-actions p { flex-basis: 100%; }
  .code-box { padding: 13px; gap: 9px; }
  .code-box code, .code-box strong { font-size: 12px; }
  .status-message { margin-top: 18px; padding: 14px; }
  .status-icon { top: 16px; left: 13px; }
  .status-copy { padding-left: 29px; }
  .status-title { font-size: 12px; }
  .copy-error-code { margin-left: 5px; }
  .site-footer { width: calc(100% - 32px); justify-content: center; text-align: center; margin-top: 32px; padding: 20px 0; gap: 8px 15px; font-size: 12px; }
  .help-content { padding: 25px 20px; }
  .help-close { top: 19px; right: 17px; }
}


/* Page structure and accessible controls. */
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 10; padding: 10px 18px; background: var(--surface); border: 1px solid var(--primary); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.header-actions { flex-shrink: 0; }
button.header-link { padding: 0; border: 0; background: transparent; }
.section-description { margin-bottom: 22px; color: var(--text-muted); font-size: 14px; line-height: 1.8; }
.redeem-layout { max-width: 900px; margin-inline: auto; }
#redeemSection > .note-strip,
#querySection > .note-strip,
#subscriptionSection > .note-strip,
#refreshSection > .note-strip {
  width: min(900px, 100%);
  max-width: 900px;
  margin-inline: auto;
  box-sizing: border-box;
}
.field-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.field-heading label { margin-bottom: 0; }
.full-width { width: 100%; }
.exchange-btn.warning { color: var(--warning); background: var(--warning-soft); border-color: var(--warning); }
.exchange-btn.warning:hover { filter: brightness(.97); }
.exchange-btn.loading { cursor: wait; }
.exchange-btn.loading::after { content: ''; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: ai-spin .8s linear infinite; }
.note-icon { display: inline-grid; place-items: center; flex-shrink: 0; width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 50%; color: var(--primary); font-size: 12px; line-height: 1; font-weight: 600; }
.info-box h3 { color: var(--primary); font-size: 14px; }
.info-box p + p { margin-top: 5px; }
#redeemValidBanner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; background: var(--primary-soft); border-color: transparent; }
#redeemValidBanner > strong { margin-right: auto; }
#redeemValidBanner .exchange-plan-chip { margin: 0; padding: 3px 8px; border-radius: 5px; background: var(--surface); font-size: 12px; }
#verifiedCodePreview { color: var(--text-secondary); font-size: 12px; }
.task-progress > h2 { text-align: center; font-size: 21px; }
.progress-ring > div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
#progressRingLabel { color: var(--text-muted); font-size: 12px; }
.task-progress.is-error .progress-ring { color: var(--warning); }
.task-progress.is-success .progress-ring { color: var(--success); }
.progress-actions { flex-wrap: wrap; }
.query-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 15px; }
.query-toolbar .exchange-hint { flex: 1; min-width: 220px; margin: 0; }
.query-toolbar .exchange-query-count, .query-toolbar .exchange-buttons { margin: 0; }
.exchange-batch-item { display: flex; align-items: center; gap: 10px; }
.batch-select { display: block; flex: 1; min-width: 0; padding: 0; border: 0; background: transparent; color: var(--text); text-align: left; }
.exchange-batch-item:hover { border-color: var(--primary-border); }
.exchange-detail-banner h2 { padding-right: 0; }
.empty-symbol { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 18px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 32px; font-weight: 300; }
.result-empty h2 { color: var(--text-secondary); font-size: 18px; }
.subscription-plan > span { display: block; margin-bottom: 8px; color: var(--text-muted); font-size: 12px; }
.subscription-plan h3 { margin-bottom: 22px; font-size: 26px; }
.subscription-plan .query-row { padding: 15px 0; }
.subscription-plan .query-row strong { font-size: 13px; }
.renewal-actions { justify-content: space-between; padding-top: 20px; border-top: 1px solid var(--border); }
.renewal-actions > div { flex: 1; }
.code-box > span { display: block; margin-bottom: 12px; color: var(--text-secondary); font-size: 12px; }
.code-box > strong { display: block; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); text-align: center; }
.refresh-result > .remaining-badge { margin-bottom: 24px; color: var(--success); background: var(--success-soft); }
.refresh-result > .text-link { margin-top: 18px; }
.site-footer .brand-wordmark { font-size: 14px; letter-spacing: -.3px; vertical-align: baseline; }
.ai-page .note-strip { margin-top: 14px; }
.site-footer > div { display: flex; align-items: center; gap: 15px; }
.status-code { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.status-code strong { font-weight: 600; }
.help-content ol { padding-left: 22px; color: var(--text-secondary); }
.help-content li { margin: 12px 0; }

@media (max-width: 1000px) {
  .header-actions { margin-left: auto; }
}
@media (max-width: 600px) {
  .site-header { gap: 14px 8px; }
  .header-actions { gap: 8px; }
  .page-heading { margin-top: 0; }
  .page-heading .exchange-tabs { margin-bottom: 0; }
  .query-toolbar .exchange-hint { flex-basis: 100%; }
  .query-toolbar .exchange-buttons { width: 100%; }
  .query-toolbar .exchange-query-count { margin-right: auto; }
  .info-box h3 { font-size: 13px; }
  #redeemValidBanner { gap: 8px; }
  #verifiedCodePreview { width: 100%; }
  .exchange-batch-item { padding: 12px 10px; }
  .exchange-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .subscription-plan h3 { font-size: 23px; }
  .site-footer { justify-content: center; text-align: center; }
  .help-dialog { width: calc(100% - 28px); }
}

@media (prefers-reduced-motion: reduce) {
  .ai-page *, .ai-page *::before, .ai-page *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Subscription and billing dashboard. */
.subscription-entry { max-width: 900px; margin-inline: auto; }
.subscription-form-heading { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 24px; }
.subscription-form-heading h2 { margin-bottom: 8px; }
.subscription-form-heading .section-description { margin: 0; }
/* Subscription failures stay with the form or the retained result. */
.subscription-query-notice { margin: 8px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.subscription-query-notice.error { color: var(--error); }
.subscription-query-notice.success { color: var(--success); }
#subscriptionResultNotice { margin: 18px 0 0; }
#subscriptionRefreshBanner { margin: 18px 0 0; }
#subSessionInput { min-height: 140px; }
.subscription-session-hint { display: flex; align-items: flex-start; gap: 7px; margin-top: 8px; }
.subscription-session-hint .note-icon { flex-shrink: 0; margin-top: 2px; }
.session-account-preview { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--text-secondary); font-size: 13px; line-height: 1.75; overflow-wrap: anywhere; }
.session-account-preview strong { color: var(--text); font-size: 14px; font-weight: 600; }
.session-account-preview :is(p, small) { display: block; margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }

#subCheckBtn > svg { width: 19px; height: 19px; flex-shrink: 0; }

.billing-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; flex-shrink: 0; color: var(--primary); }
.billing-icon svg { width: 22px; height: 22px; }
.subscription-result { --subscription-rule: color-mix(in srgb, var(--border) 75%, var(--surface)); width: 100%; max-width: 1160px; min-width: 0; margin-inline: auto; outline: none; }
.subscription-overview-card { padding: 24px; }
.subscription-account-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--subscription-rule); }
.subscription-account { min-width: 0; }
.account-caption { display: block; color: var(--text-muted); font-size: 13px; }
#subscriptionAccountEmail { display: block; margin-top: 3px; overflow-wrap: anywhere; font-size: 17px; font-weight: 600; }
.subscription-account-actions { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: end; gap: 8px 20px; flex-shrink: 0; }
.subscription-query-time { grid-column: 1 / -1; color: var(--text-muted); font-size: 12px; line-height: 1.7; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.subscription-account-actions .text-link { font-size: 14px; }
.subscription-account-actions .exchange-btn { min-width: 112px; min-height: 40px; padding: 8px 14px; font-size: 13px; }
.subscription-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; padding-block: 22px; }
.subscription-metric { min-width: 0; margin: 0; }
.subscription-metric dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.billing-label, .subscription-renewal .billing-label { display: block; margin: 0 0 8px; color: var(--text-muted); font-size: 13px; font-weight: 500; line-height: 1.6; }
.subscription-metric .subscription-metric-value { color: var(--text); font-size: 24px; font-weight: 600; line-height: 1.35; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
#subscriptionPlanSummary .subscription-metric-value { font-size: 26px; font-weight: 650; }
.subscription-metric-value small { display: inline-block; margin-left: 4px; color: var(--text-muted); font-size: 13px; font-weight: 400; letter-spacing: 0; }
.subscription-metric .subscription-expiry { font-size: 20px; font-weight: 550; }
.subscription-metric .subscription-metric-status { margin-top: 10px; }
.subscription-metric .subscription-metric-note { margin: 6px 0 0; color: var(--text-muted); font-size: 13px; font-weight: 400; line-height: 1.7; }
.subscription-overview-card.is-free .subscription-metric:not(:first-child) :is(.subscription-metric-value, .billing-state) { color: var(--text-muted); font-size: 18px; font-weight: 500; letter-spacing: 0; }
.subscription-history-context { margin: 0 0 18px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--text-secondary); font-size: 13px; line-height: 1.75; }

.billing-state { display: inline-flex; align-items: center; max-width: 100%; gap: 5px; padding: 3px 10px; border-radius: 20px; background: var(--surface-soft); color: var(--text-muted); font-size: 12px; font-weight: 550; line-height: 1.6; }
.billing-state.positive { background: var(--success-soft); color: var(--success); }
.billing-state.attention { background: var(--warning-soft); color: var(--warning); }
.billing-state.info { background: var(--primary-soft); color: var(--primary); }
.billing-state.negative { background: var(--error-soft); color: var(--error); }
.subscription-renewal > .billing-state { padding: 0; border-radius: 0; background: transparent; color: var(--text); font-size: 20px; font-weight: 600; line-height: 1.35; }
.subscription-next-billing { display: flex; flex-wrap: wrap; gap: 2px 8px; margin: 8px 0 0; color: var(--text-secondary); font-size: 13px; }
#subscriptionNextBillingLabel { color: var(--text-muted); }
.subscription-renewal .exchange-btn { min-width: 0; min-height: 36px; margin-top: 12px; padding: 6px 12px; font-size: 13px; }
.subscription-details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; padding-top: 18px; border-top: 1px solid var(--subscription-rule); }
.subscription-details-grid > section { min-width: 0; }
.billing-card-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.billing-card-heading h3 { margin: 0; font-size: 16px; }
.billing-card-heading > svg { color: var(--primary); }
.billing-entity { display: grid; gap: 6px; margin: 0; }
.billing-entity > div { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 16px; align-items: baseline; }
.billing-entity dt { color: var(--text-muted); font-size: 14px; }
.billing-entity dd { min-width: 0; margin: 0; color: var(--text); font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.payment-card-identity { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.payment-card-number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.billing-unavailable { margin: 0; color: var(--text-muted); font-size: 14px; line-height: 1.8; }
.billing-history-card { margin-top: 18px; overflow: hidden; }
.billing-history-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; padding: 20px 24px; }
.billing-history-heading > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; min-width: 0; }
.billing-history-heading h2 { margin: 0; font-size: 18px; }
.billing-history-heading p { margin: 0; color: var(--text-muted); font-size: 13px; }
.billing-count { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.billing-table-wrap { min-width: 0; margin-inline: 24px; border-radius: 8px 8px 0 0; overflow: hidden; }
.billing-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
.billing-table th { padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--surface-soft); color: var(--text-muted); font-size: 13px; font-weight: 500; }
.billing-table th:nth-child(1) { width: 14%; }
.billing-table th:nth-child(2) { width: 14%; }
.billing-table th:nth-child(3) { width: 10%; }
.billing-table th:nth-child(4) { width: 38%; }
.billing-table th:nth-child(5) { width: 24%; }
.billing-table td { padding: 14px 16px; border-bottom: 1px solid var(--subscription-rule); color: var(--text-secondary); font-size: 14px; vertical-align: middle; overflow-wrap: anywhere; }
.billing-table .billing-row-void .billing-amount { color: var(--text-secondary); font-weight: 500; }
.billing-table td:first-child { font-variant-numeric: tabular-nums; }
.billing-table .billing-amount { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.billing-table .billing-description { line-height: 1.75; }
.document-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.document-link { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px; max-width: 100%; padding: 6px 10px; border: 1px solid var(--primary-border); border-radius: 6px; background: var(--surface); color: var(--primary); font-size: 12px; font-weight: 550; line-height: 1.6; white-space: normal; }
.document-link svg { width: 14px; height: 14px; }
.ai-page a.document-link:hover { background: var(--primary-soft); border-color: var(--primary); text-decoration: none; }
.document-link[data-document-type="receipt"] { padding-inline: 2px; border-color: transparent; background: transparent; }
.ai-page a.document-link[data-document-type="receipt"]:hover { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.document-unavailable { display: inline-block; max-width: 100%; color: var(--text-muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.billing-empty { padding: 30px 24px; border-top: 1px solid var(--border); color: var(--text-muted); text-align: center; font-size: 14px; }
.billing-history-note { margin: 0; padding: 13px 24px 18px; color: var(--text-muted); font-size: 12px; }
.subscription-data-notice { margin: 20px 0 0; padding: 12px 16px; border: 1px solid var(--primary-border); border-radius: 8px; background: var(--primary-soft); color: var(--text-secondary); font-size: 13px; line-height: 1.7; }
@media (max-width: 1100px) {
  .subscription-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 28px; }
  .billing-table th, .billing-table td { padding-inline: 12px; }
}
@media (max-width: 700px) {
  .subscription-overview-card { padding: 20px 18px; }
  .subscription-account-bar { align-items: flex-start; flex-direction: column; gap: 16px; padding-bottom: 20px; }
  .subscription-account-actions { grid-template-columns: minmax(0, 1fr) auto; width: 100%; gap: 8px 12px; }
  .subscription-account-actions .text-link { justify-self: start; }
  .subscription-query-time { text-align: left; }
  .subscription-details-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
  .subscription-details-grid > section { padding: 0; }
  .subscription-details-grid > section + section { padding: 18px 0 0; border-top: 1px solid var(--subscription-rule); }
  .billing-history-card { margin-top: 18px; }
  .billing-history-heading { padding: 20px 18px; }
  .billing-table-wrap { margin-inline: 18px; }
  .billing-table, .billing-table tbody { display: block; }
  .billing-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .billing-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 18px; border-top: 1px solid var(--border); }
  .billing-table tr:first-child { border-top: 0; }
  .billing-table td { display: block; min-width: 0; padding: 0; border: 0; }
  .billing-table td::before { display: block; content: attr(data-label); margin-bottom: 6px; color: var(--text-muted); font-size: 12px; font-weight: 400; }
  .billing-table td:nth-child(n+3) { grid-column: 1 / -1; }
  .billing-history-note { padding: 13px 18px 18px; }
  .billing-empty { padding: 28px 18px; text-align: left; }
  .document-actions { gap: 10px; }
  .document-link { min-height: 40px; padding: 8px 12px; }
}
@media (max-width: 540px) {
  .subscription-summary-grid { grid-template-columns: minmax(0, 1fr); gap: 0; padding-block: 0 20px; }
  .subscription-metric { padding: 16px 0; border-top: 1px solid var(--subscription-rule); }
  .subscription-metric:first-child { border-top: 0; }
  .subscription-metric:last-child { padding-bottom: 0; }
  .subscription-metric .subscription-metric-value { font-size: 24px; }
  .subscription-metric .subscription-expiry { font-size: 20px; font-weight: 550; }
  .billing-entity > div { grid-template-columns: 58px minmax(0, 1fr); gap: 12px; }
}

/* Recharge confirmation and live states share one card. */
#rechargeCard { min-width: 0; }
.recharge-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.recharge-card-heading > div { min-width: 0; }
.recharge-card-heading h2 { margin-bottom: 9px; }
.recharge-card-heading .section-description { margin-bottom: 0; font-size: 13px; line-height: 1.85; }
.recharge-card-heading .flow-badge { flex-shrink: 0; margin-top: 2px; }
.task-progress.recharge-progress { display: block; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.recharge-progress-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: 30px; max-width: 580px; margin: 0 auto 23px; }
.recharge-progress .progress-ring { grid-column: auto; width: 156px; height: 156px; margin: 8px auto; }
.recharge-progress .progress-number { font-size: 32px; }
.recharge-progress .progress-stages { grid-column: auto; grid-row: auto; margin: 5px 0; }
.recharge-progress .progress-stages > li { min-height: 39px; font-size: 13px; }
.recharge-progress .progress-actions { margin-top: 23px; padding-top: 22px; justify-content: flex-start; }
.recharge-progress .status-message { margin: 18px 0 0; }
.submitting-indicator { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 112px; padding: 22px 12px; color: var(--text-muted); font-size: 13px; text-align: center; }
.submission-spinner { display: inline-block; width: 23px; height: 23px; flex-shrink: 0; border: 2px solid var(--primary-border); border-top-color: var(--primary); border-radius: 50%; animation: ai-spin .8s linear infinite; }
.lookup-account-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.lookup-account-actions .exchange-btn { min-width: 0; min-height: 38px; padding: 8px 14px; font-size: 12px; }
.exchange-detail-card.completed > .lookup-account-actions { justify-content: flex-end; margin: 0; padding: 18px 27px 24px; border-top: 1px solid var(--border); }
.exchange-detail-card.completed > .lookup-account-actions .exchange-btn { min-height: 44px; padding: 10px 20px; font-size: 14px; }
@media (max-width: 600px) {
  .recharge-card-heading { flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
  .recharge-card-heading .section-description { font-size: 12px; }
  .recharge-progress-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-bottom: 18px; }
  .recharge-progress .progress-ring { margin: 3px auto 10px; }
  .recharge-progress .progress-stages { width: fit-content; max-width: 100%; margin: 0 auto; }
  .recharge-progress .progress-stages > li { font-size: 12px; min-height: 35px; }
  .recharge-progress .progress-actions { margin-top: 20px; gap: 10px; }
  .recharge-progress .progress-actions .exchange-btn { flex: 1; min-width: 0; padding: 10px 12px; font-size: 12px; }
  .submitting-indicator { min-height: 100px; font-size: 12px; }
  .lookup-account-actions .exchange-btn { flex: 1; padding: 9px 10px; }
  .exchange-detail-card.completed > .lookup-account-actions { padding: 18px; }
}

/* Distinct single and batch lookup views. */
.query-mode-switch { display: inline-flex; gap: 4px; padding: 4px; margin: 0 0 25px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.query-mode-switch button { min-height: 36px; padding: 7px 18px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text-secondary); font-size: 13px; cursor: pointer; }
.query-mode-switch button.active { background: var(--surface); color: var(--primary); border-color: var(--primary-border); font-weight: 600; }
.single-lookup-results { max-width: 900px; margin-inline: auto; }
.batch-lookup-results { grid-template-columns: minmax(0, 1fr); }
.lookup-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 12px; }
.lookup-filter { display: inline-flex; align-items: center; gap: 8px; min-height: 35px; padding: 7px 13px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text-secondary); cursor: pointer; font-size: 12px; }
.lookup-filter span { font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }
.lookup-filter.active { color: #fff; background: var(--primary); border-color: var(--primary); }
.lookup-copy-hint { color: var(--text-muted); font-size: 12px; margin: 0 0 20px; }
.lookup-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
.lookup-table th { padding: 14px 12px; background: var(--surface-soft); color: var(--text-muted); font-size: 12px; font-weight: 500; }
.lookup-table td { padding: 20px 12px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; color: var(--text-secondary); font-size: 12px; line-height: 1.8; vertical-align: middle; }
.lookup-table th:first-child { width: 27%; }
.lookup-table th:nth-child(2) { width: 13%; }
.lookup-table th:nth-child(3) { width: 18%; }
.lookup-table th:nth-child(4) { width: 24%; }
.lookup-table .mono { color: var(--text); }
.lookup-status { display: inline-block; padding: 3px 9px; border-radius: 5px; background: var(--surface-soft); color: var(--text-secondary); white-space: nowrap; }
.lookup-status.completed { background: var(--surface-hover); color: var(--text-secondary); }
.lookup-status.unused { background: var(--success-soft); color: var(--success); }
.lookup-status.processing, .lookup-status.queued { background: var(--primary-soft); color: var(--primary); }
.lookup-status.failed, .lookup-status.missing { background: var(--error-soft); color: var(--error); }
.lookup-empty { padding: 40px 16px; border: 1px dashed var(--border); border-radius: 10px; color: var(--text-muted); text-align: center; font-size: 13px; }
@media (max-width: 700px) {
  .query-mode-switch { display: flex; }
  .query-mode-switch button { flex: 1; padding-inline: 10px; }
  .batch-lookup-results .exchange-batch-head { flex-wrap: wrap; }
  .batch-lookup-results .exchange-reuse-btn { min-height: 38px; }
  .lookup-table, .lookup-table tbody { display: block; }
  .lookup-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .lookup-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding: 20px 0; border-top: 1px solid var(--border); }
  .lookup-table td { display: block; min-width: 0; border: 0; padding: 0; }
  .lookup-table td::before { display: block; content: attr(data-label); color: var(--text-muted); font-size: 12px; margin-bottom: 5px; }
  .lookup-table td:first-child, .lookup-table td:nth-child(4) { grid-column: 1 / -1; }
  .lookup-filters { gap: 7px; }
  .lookup-filter { padding: 6px 10px; }
}

/* Consistent single lookup width and compact action feedback. */
/* Keep the query form the same width in single and batch modes so the switch does not jump. */
#querySection .query-card,
#querySection > .note-strip {
  max-width: 900px;
  margin-inline: auto;
}

/* Batch results stay a bit wider than the form, with roomy row spacing so items are not cramped. */
#querySection .batch-lookup-results {
  max-width: 1100px;
  margin-inline: auto;
}
#querySection .batch-lookup-results .lookup-table td {
  padding: 18px 14px;
}
#querySection .batch-lookup-results .lookup-table th {
  padding: 14px 14px;
}
#querySection .batch-lookup-results .lookup-filters {
  gap: 10px;
}
#querySection .batch-lookup-results .batch-result-card {
  padding: 24px 26px;
}

#querySection .query-card textarea {
  min-height: 110px;
}
.code-availability-note { margin: 20px 0 0; padding: 13px 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-soft); color: var(--text-secondary); font-size: 12px; line-height: 1.8; }
.code-availability-note.confirmed { border-color: var(--success-border); background: var(--success-soft); color: var(--success); }
.exchange-detail-banner .code-availability-note { margin-top: 18px; }
button.is-copied { color: var(--success) !important; background: var(--success-soft) !important; border-color: var(--success-border) !important; }
.copy-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 100; width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); box-shadow: 0 8px 30px rgba(0,0,0,.12); font-size: 13px; line-height: 1.7; }
.lookup-empty .text-link { display: block; margin: 14px auto 0; }


/* Recovery, connectivity and terminal results. */
.task-recovery-notice { display:flex; align-items:center; gap:12px; max-width:900px; margin:0 auto 18px; padding:15px 20px; border:1px solid var(--primary-border); border-radius:12px; background:var(--primary-soft); color:var(--primary); }
.task-recovery-notice strong { display:block; font-size:14px; }
.task-recovery-notice p { margin:3px 0 0; font-size:12px; color:var(--text-secondary); }
.recovery-symbol { font-size:24px; }
.task-connection { margin:0 0 22px; padding:13px 16px; border:1px solid var(--border); border-radius:10px; background:var(--surface-soft); }
.task-connection-heading { display:flex; align-items:center; flex-wrap:wrap; gap:8px; font-size:12px; color:var(--text-secondary); }
.connection-dot { width:7px; height:7px; flex:0 0 7px; border-radius:50%; background:var(--success); }
.task-connection time { margin-left:auto; color:var(--text-muted); font-size: 12px; font-variant-numeric:tabular-nums; }
.task-connection p { margin:7px 0 0; color:var(--text-secondary); font-size:12px; }
.task-connection .text-link { margin-top:7px; font-size:12px; }
.task-connection.is-interrupted { background:var(--warning-soft); border-color:var(--warning); }
.task-connection.is-interrupted .connection-dot { background:var(--warning); }
.task-connection.is-interrupted strong { color:var(--warning); }
.task-result-icon { display:grid; place-items:center; width:48px; height:48px; border-radius:50%; background:var(--error-soft); color:var(--error); font-size:25px; flex-shrink:0; }
.recharge-card-heading > div { min-width:0; flex:1; }
.recharge-card-heading .flow-badge { flex-shrink:0; }
.recharge-progress .task-support { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; margin-top:22px; color:var(--text-muted); font-size:12px; }
.task-support .exchange-mini-btn { white-space:nowrap; }
#taskCodeNotice { display:flex; align-items:center; gap:12px; padding:17px; }
#taskCodeNotice strong { display:block; color:var(--text); font-size:14px; }
#taskCodeNotice.confirmed strong { color:var(--success); }
#taskCodeNotice p { margin:5px 0 0; }
.code-state-symbol { font-size:23px; flex-shrink:0; }
.code-state-pill { flex-shrink:0; margin-left:auto; padding:2px 10px; border:1px solid var(--success-border); border-radius:20px; background:var(--surface); font-size:12px; white-space:nowrap; }
.ai-page .exchange-input[aria-invalid="true"] { border-color:var(--error); box-shadow:0 0 0 3px var(--error-soft); }
.field-error { margin:11px 0 0; color:var(--error); font-size:13px; line-height:1.75; }
.field-error p { margin:4px 0; }
.field-error .text-link { margin-top:3px; font-size:13px; }
/* Page scrolling keeps the batch controls visible. */
.batch-sticky-toolbar { position:sticky; top:0; z-index:4; margin:-24px -24px 0; padding:24px 24px 1px; background:var(--surface); border-bottom:1px solid var(--border); border-radius:13px 13px 0 0; box-shadow:0 6px 12px rgb(25 46 80 / 4%); }
.batch-result-card { overflow:visible; }
.batch-sticky-toolbar .lookup-filters { margin-top:16px; }
.batch-sticky-toolbar .lookup-copy-hint { margin-bottom:15px; }
.help-dialog { width:min(640px, calc(100% - 32px)); }
.help-eyebrow { color:var(--text-muted); font-size: 12px; letter-spacing:.6px; }
.help-content h2 { margin:14px 35px 10px 0; }
.help-categories { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; padding:4px; margin:20px 0; border:1px solid var(--border); border-radius:9px; background:var(--surface-soft); }
.help-category { min-height:40px; padding:8px 5px; border:1px solid transparent; border-radius:6px; background:transparent; color:var(--text-muted); font-size:12px; overflow-wrap:anywhere; }
.help-category.active { border-color:var(--border); background:var(--surface); color:var(--primary); box-shadow:var(--shadow); }
.help-topic { padding:16px 0; border-bottom:1px solid var(--border); }
.help-topic:first-child { padding-top:0; }
.help-topic summary { font-size:14px; font-weight:600; cursor:pointer; line-height:1.7; }
.help-topic p { margin:12px 0 0; line-height:1.85; }
.help-topic a { display:inline-block; margin-top:10px; }
.help-content > .note-strip { margin:24px 0 0; }
@media (max-width:600px) {
 .task-recovery-notice { padding:13px 16px; }
 .task-result-icon { width:36px; height:36px; font-size:21px; }
 .recharge-card-heading { gap:10px; flex-wrap:wrap; }
 .recharge-card-heading .flow-badge { margin-left:auto; }
 #taskCodeNotice { flex-wrap:wrap; padding:14px; }
 #taskCodeNotice > div { flex:1; min-width:150px; }
 .task-connection time { flex-basis:100%; margin-left:15px; }
 .batch-sticky-toolbar { margin:-20px -17px 0; padding:16px 17px 1px; }
 .batch-sticky-toolbar .exchange-batch-headline h2 { font-size:16px; }
 .batch-sticky-toolbar .exchange-batch-head { gap:9px; }
 .batch-sticky-toolbar .lookup-filters { margin-top:12px; gap:6px; }
 .batch-sticky-toolbar .lookup-filter { min-height:40px; }
 .batch-sticky-toolbar .lookup-copy-hint { font-size: 12px; margin-bottom:10px; }
 .help-category { min-height:44px; }
}
@media(max-width:380px){.help-categories{grid-template-columns:repeat(2,minmax(0,1fr));}}


/* Guided recharge tutorial and complete Session instructions. */
.help-content .help-guide-steps { list-style:none; margin:22px 0 8px; padding:0; }
.help-content .help-guide-steps li { display:flex; align-items:flex-start; gap:14px; margin:0 0 19px; color:var(--text); }
.help-guide-number { display:grid; place-items:center; flex:0 0 27px; height:27px; border-radius:50%; background:var(--primary-soft); border:1px solid var(--primary-border); color:var(--primary); font-size:12px; font-weight:600; }
.help-guide-steps strong { display:block; margin-top:2px; font-size:14px; }
.help-content .help-guide-steps p { margin:5px 0 0; color:var(--text-muted); font-size:13px; line-height:1.9; }
.help-guide-steps > li > div { min-width:0; }
.help-topic .help-session-link { margin-top:8px; font-size:13px; overflow-wrap:anywhere; }
.help-keyboard-tip { display:flex; align-items:center; flex-wrap:wrap; gap:5px; padding:12px 14px; margin:4px 0 16px; border:1px solid var(--border); border-radius:8px; background:var(--surface-soft); color:var(--text-secondary); font-size:12px; }
.help-keyboard-tip > span:first-child { margin-right:10px; color:var(--text-muted); }
.help-keyboard-tip > span[aria-hidden] { margin-inline:7px; }
.help-keyboard-tip kbd { padding:2px 6px; border:1px solid var(--border-strong); border-bottom-width:2px; border-radius:4px; background:var(--surface); color:var(--text); font:12px/1.6 Consolas, monospace; }
.help-keyboard-tip small { flex-basis:100%; margin-top:5px; color:var(--text-muted); font-size: 12px; }
.help-session-reminder { padding:14px 16px; margin:4px 0 5px; border:1px solid var(--primary-border); border-radius:9px; background:var(--primary-soft); }
.help-session-reminder strong { color:var(--primary); font-size:13px; }
.help-content .help-session-reminder p { margin:6px 0 0; color:var(--text-secondary); font-size:12px; line-height:1.9; }
.help-privacy-note { padding:15px 17px; margin-top:24px; border:1px solid var(--border); border-radius:10px; background:var(--surface-soft); }
.help-privacy-note strong { color:var(--text-secondary); font-size:12px; }
.help-content .help-privacy-note p { margin:6px 0 0; color:var(--text-muted); font-size:12px; line-height:1.9; }
@media (max-width:600px) {
  .help-content .help-guide-steps li { gap:11px; }
  .help-guide-steps strong { font-size:13px; }
  .help-content .help-guide-steps p { font-size:12px; }
}


/* Session tips + subscription refresh + failure CTAs (v15) */
.session-tips {
  margin: 10px 0 0;
  padding: 12px 14px 12px 32px;
  border: 1px solid var(--border, #d7dee8);
  border-radius: 12px;
  background: var(--surface-soft, #f5f8fc);
  color: var(--text-secondary, #4b5563);
  font-size: 12px;
  line-height: 1.65;
}
.session-tips li { margin: 0 0 8px; }
.session-tips li:last-child { margin-bottom: 0; }
.session-tips strong { display: inline-block; margin-right: 6px; color: var(--text, #111827); }
.session-tips.session-tips-emphasis {
  border-color: var(--warning-border, #f0b429);
  background: var(--warning-soft, #fff8e8);
  box-shadow: 0 0 0 3px rgb(240 180 41 / 16%);
}
.subscription-refresh-banner {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--primary-soft, #eaf2ff);
  color: var(--primary, #1d4ed8);
  font-size: 13px;
  font-weight: 550;
}
.task-support { display: grid; gap: 10px; }
.task-support-copy p { margin: 6px 0 0; color: var(--text-secondary, #4b5563); font-size: 13px; line-height: 1.6; }
.task-support-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.exchange-mini-btn.primary {
  border-color: var(--primary, #1d4ed8);
  background: var(--primary, #1d4ed8);
  color: #fff;
}
#viewTaskBtn.primary {
  border-color: var(--primary, #1d4ed8);
  background: var(--primary, #1d4ed8);
  color: #fff;
}


/* Public refresh: single-column form + batch/single results (v24). */
#refreshSection .query-card,
#refreshSection > .note-strip {
  max-width: 900px;
  margin-inline: auto;
}
#refreshSection .exchange-results-layout {
  max-width: 900px;
  margin: 24px auto 0;
}
#refreshSection .query-card textarea {
  min-height: 140px;
}
#refreshSection .info-box {
  margin-top: 0;
  margin-bottom: 18px;
}
#refreshSection .query-toolbar {
  margin-top: 0;
}
.refresh-result-card {
  padding: 24px 26px;
}
.refresh-result-card .exchange-batch-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 4px;
}
.refresh-result-card .exchange-batch-headline h2 {
  margin: 0 0 6px;
  font-size: 18px;
}
.refresh-result-card .exchange-batch-headline p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}
.refresh-result-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}
.refresh-result-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px 18px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.refresh-result-row.is-success {
  border-color: var(--success-border);
  background: color-mix(in srgb, var(--success-soft) 55%, var(--surface));
}
.refresh-result-row.is-failed {
  border-color: var(--error-border);
  background: color-mix(in srgb, var(--error-soft) 55%, var(--surface));
}
.refresh-result-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.refresh-result-row.is-success .refresh-result-badge {
  color: var(--success);
  background: var(--success-soft);
}
.refresh-result-row.is-failed .refresh-result-badge {
  color: var(--error);
  background: var(--error-soft);
}
.refresh-result-body {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: baseline;
}
.refresh-result-body > div {
  min-width: 0;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.refresh-result-body span {
  color: var(--text-muted);
  margin-right: 6px;
}
.refresh-result-body strong.mono {
  color: var(--text);
  font-weight: 600;
}
.refresh-result-row.is-success .refresh-new-code strong.mono {
  color: var(--primary);
}
.refresh-result-row.is-failed .refresh-reason {
  color: var(--error);
}
.refresh-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.refresh-single-result {
  text-align: left;
}
.refresh-single-result .code-pair {
  display: grid;
  gap: 12px;
  margin: 18px 0 16px;
}
.refresh-single-result .code-box {
  margin: 0;
}
.refresh-single-result .remaining-badge {
  margin: 0 0 18px;
}
.refresh-copy-hint {
  color: var(--text-muted);
  font-size: 12px;
  margin: 0 0 16px;
}
.refresh-copy-hint.is-disabled-hint {
  color: var(--warning);
}
.refresh-single-result { padding: 0; }
.refresh-single-result .success-symbol { margin: 0 0 16px; }
.code-box.replacement-old-code { border-color: var(--border); background: var(--surface-soft); }
.code-box.replacement-old-code > span { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.code-box.replacement-old-code > strong { padding: 0; border: 0; background: transparent; color: var(--text-muted); text-align: left; font-weight: 400; }
.replacement-expired { padding: 2px 7px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted); background: var(--surface); font-size: 12px; font-weight: 500; line-height: 1.5; }
.code-box.replacement-new-code { border-color: var(--primary-border); background: var(--primary-soft); }
.replacement-code-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; color: var(--text-secondary); font-size: 13px; }
.replacement-copy { min-height: 34px; color: var(--primary); border-color: var(--primary-border); background: var(--surface); }
.code-box.replacement-new-code > strong { padding: 14px 16px; color: var(--primary); font-size: 15px; line-height: 1.8; }
.replacement-retention-note { margin: 0 0 18px; color: var(--text-muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.refresh-single-result .replacement-result-actions { justify-content: flex-start; padding-top: 20px; margin-top: 0; border-top: 1px solid var(--border); }
.replacement-progress { max-width: 900px; margin: 18px auto; padding: 16px 20px; border: 1px solid var(--primary-border); border-radius: 10px; background: var(--primary-soft); color: var(--text-secondary); font-size: 13px; line-height: 1.8; }
.replacement-progress p { margin: 0; }
.refresh-result-body .replacement-old-code strong.mono { color: var(--text-muted); font-weight: 400; }
.refresh-result-body .replacement-expired { display: inline-flex; margin: 0 0 0 8px; }
.refresh-result-card:not(.refresh-single-result) > .exchange-card-panel { padding: 20px 0 0; }
.refresh-result-card:not(.refresh-single-result) .replacement-result-actions { margin-top: 0; }

@media (max-width: 700px) {
  .refresh-result-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .refresh-result-actions {
    justify-content: stretch;
  }
  .refresh-result-actions .exchange-mini-btn,
  .refresh-result-actions .exchange-btn {
    flex: 1;
  }
}

/* Completed replacement keeps a compact, selectable summary of submitted codes. */
#refreshSection.replacement-has-results #refreshForm[aria-busy="false"] .exchange-card-panel { padding: 18px 32px; }
#refreshSection.replacement-has-results #refreshForm[aria-busy="false"] :is(.exchange-card-panel > h2, .query-mode-switch, .info-box, .query-toolbar) { display: none; }
#refreshSection.replacement-has-results #refreshForm[aria-busy="false"] .exchange-form-group { margin-bottom: 0; }
#refreshSection.replacement-has-results #refreshForm[aria-busy="false"] label { margin-bottom: 7px; color: var(--text-muted); font-size: 12px; font-weight: 500; }
#refreshSection.replacement-has-results #refreshForm[aria-busy="false"] .exchange-input { background: var(--surface-soft); border-color: var(--border); color: var(--text-muted); }
#refreshSection.replacement-has-results #refreshForm[aria-busy="false"] textarea { min-height: 84px; height: 84px; }
#refreshSection.replacement-has-results:has(#refreshForm[aria-busy="false"]) > .note-strip { display: none; }
@media (max-width: 600px) {
  #refreshSection.replacement-has-results #refreshForm[aria-busy="false"] .exchange-card-panel { padding: 16px 18px; }
}

/* Completion uses the same width, heading and information layout as processing. */
#rechargeCard.is-complete .task-result-icon { width: 54px; height: 54px; flex: 0 0 54px; color: var(--success); background: var(--success-soft); border: 1px solid var(--success-border); font-size: 28px; }
.completion-value { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.completion-value-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.completion-icon-button { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; gap: 4px; min-width: 32px; min-height: 32px; padding: 6px; color: var(--text-muted); background: transparent; border: 1px solid transparent; border-radius: 6px; font-size: 12px; cursor: pointer; }
.completion-icon-button svg { width: 17px; height: 17px; }
.completion-icon-button:hover { color: var(--primary); background: var(--primary-soft); }
.completion-plan { padding: 4px 10px; color: var(--primary); background: var(--primary-soft); border-radius: 6px; font-size: 12px; }
.ai-page .completion-help { max-width: 900px; margin: 16px auto 0; padding: 0 14px; color: var(--text-muted); text-align: center; font-size: 12px; line-height: 1.9; }
.completion-help .text-link { font-size: inherit; }
@media (max-width: 600px) {
  .completion-value { width: 100%; justify-content: space-between; }
  .completion-value strong { text-align: left; }
  .completion-icon-button { min-height: 36px; min-width: 36px; }
  .completion-help { padding: 0 4px; font-size: 12px; }
}


/* Account step: compact verification, secondary links and an on-demand guide. */
#rechargeCard:has(#step2:not([hidden])) .exchange-card-panel { padding-top: 26px; padding-bottom: 26px; }
#rechargeCard:has(#step2:not([hidden])) .exchange-steps { margin-bottom: 20px; padding-bottom: 20px; }
#rechargeCard:has(#step2:not([hidden])) .exchange-step.done { color: var(--success); }
#rechargeCard:has(#step2:not([hidden])) .exchange-step.done .exchange-step-number { color: var(--success); background: var(--success-soft); border-color: var(--success-border); }
#rechargeCard:has(#step2:not([hidden])) #redeemValidBanner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  min-height: 50px;
  padding: 10px 16px;
  border: 1px solid var(--success-border);
  background: var(--success-soft);
  color: var(--success);
}
#rechargeCard:has(#step2:not([hidden])) #redeemValidBanner > strong { margin: 0; }
#rechargeCard:has(#step2:not([hidden])) #verifiedCodePreview { grid-column: 2; grid-row: 1; padding-left: 14px; border-left: 1px solid var(--success-border); color: var(--text-secondary); }
#rechargeCard:has(#step2:not([hidden])) #redeemPlanInfo { grid-column: 3; grid-row: 1; color: var(--success); background: color-mix(in srgb, var(--success) 9%, var(--success-soft)); }
#verifiedCodePreview { overflow-wrap: anywhere; min-width: 0; }
#redeemSection:has(#step2:not([hidden])) > #rechargeDefaultNote { display: none; }
#step2 > h2 { margin-bottom: 8px; }
#step2 > .section-description { margin-bottom: 20px; }
.session-quick-start { padding: 14px 16px; margin-bottom: 20px; border-radius: 9px; background: var(--surface-soft); }
.session-quick-start h3 { margin-bottom: 10px; font-size: 14px; }
.session-quick-start p { margin: 8px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.7; }
.session-quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.session-quick-actions .exchange-btn { min-height: 40px; min-width: 190px; padding: 8px 14px; font-size: 13px; text-align: center; text-decoration: none; }
.session-login-link { border-color: var(--primary-border); background: var(--surface); color: var(--primary); }
.session-login-link:hover { border-color: var(--primary); background: var(--surface-hover); }
.session-quick-actions .session-page-link { min-width: 220px; border-color: var(--primary-border); background: var(--primary-soft); color: var(--primary); }
.session-page-link:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--primary-soft)); }
#step2 .exchange-form-group { margin-bottom: 14px; }
#step2 #tokenInput { min-height: 140px; font-size: 14px; }
#step2 #sessionHint { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
#step2 .session-hint-icon { display: inline-grid; place-items: center; flex: 0 0 14px; height: 14px; margin-top: 3px; border: 1px solid currentColor; border-radius: 50%; font-size: 12px; line-height: 1; }
#step2 .session-guide { border: 0; border-radius: 6px; background: transparent; }
#step2 .session-guide > summary { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 0; border-radius: 5px; cursor: pointer; list-style: none; }
#step2 .session-guide > summary::-webkit-details-marker { display: none; }
#step2 .session-guide > summary::marker { content: ''; }
#step2 .session-guide > summary:hover { background: var(--surface-soft); }
#step2 .session-guide > summary:focus-visible { outline: 3px solid var(--primary-border); outline-offset: 3px; }
#step2 .session-guide-icon { width: 20px; height: 20px; color: var(--primary); }
#step2 .session-guide-label { display: flex; flex: 1; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; min-width: 0; }
#step2 .session-guide-title { font-weight: 500; font-size: 13px; }
#step2 .session-guide-caption { font-size: 13px; color: var(--primary); }
#step2 .session-guide-chevron { margin-left: auto; color: var(--text-muted); }
#step2 .session-guide[open] .session-guide-chevron { transform: rotate(180deg); }
#step2 .session-guide-body { padding: 16px; margin-top: 4px; border: 1px solid var(--border); border-radius: 9px; }
#step2 .session-guide-steps { display: grid; gap: 14px; margin: 0 0 16px; padding: 0; list-style: none; }
#step2 .session-guide-steps li { display: flex; align-items: flex-start; gap: 12px; }
#step2 .session-guide-steps li > div { min-width: 0; }
#step2 .session-guide-number { display: grid; place-items: center; flex: 0 0 26px; height: 26px; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-size: 13px; font-weight: 600; }
#step2 .session-guide-steps strong { display: block; color: var(--text); font-size: 13px; }
#step2 .session-guide-steps p { margin: 3px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
#step2 .session-guide-keyboard { padding: 10px 12px; border-radius: 7px; background: var(--surface-soft); color: var(--text-muted); font-size: 12px; }
#step2 .session-guide-keyboard p { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px; margin: 0; }
#step2 .session-guide-keyboard p + p { margin-top: 4px; }
#step2 .session-guide-keyboard kbd { color: var(--text-secondary); font: inherit; }
#step2 .session-guide:has(.session-tips-emphasis) .session-guide-body { border-color: var(--warning); }
#step2 .session-guide:has(.session-tips-emphasis) > summary { background: var(--warning-soft); }
#step2 .session-step-actions { display: flex; justify-content: space-between; padding-top: 18px; margin-top: 10px; border-top: 1px solid var(--border); }
#step2 .session-step-actions .exchange-btn { flex: none; min-width: 0; padding-inline: 14px; }
#step2 #backToStep1 { width: 100px; }
#step2 #toConfirmBtn { width: 220px; }
@media (max-width: 600px) {
  #rechargeCard:has(#step2:not([hidden])) .exchange-card-panel { padding-top: 22px; padding-bottom: 22px; }
  #rechargeCard:has(#step2:not([hidden])) #redeemValidBanner { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; padding: 12px; }
  #rechargeCard:has(#step2:not([hidden])) #redeemValidBanner > strong { font-size: 13px; }
  #rechargeCard:has(#step2:not([hidden])) #redeemPlanInfo { grid-column: 2; }
  #rechargeCard:has(#step2:not([hidden])) #verifiedCodePreview { grid-column: 1 / -1; grid-row: 2; padding-left: 0; border: 0; }
  .session-quick-start { padding: 14px; }
  .session-quick-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .session-quick-actions .exchange-btn { min-width: 0; min-height: 44px; }
  #step2 .session-guide > summary { gap: 8px; }
  #step2 .session-guide-body { padding: 14px 12px; }
  #step2 .session-guide-steps li { gap: 10px; }
  #step2 .session-step-actions { gap: 10px; }
  #step2 .session-step-actions .exchange-btn { font-size: 13px; padding-inline: 10px; }
  #step2 #backToStep1 { width: 80px; }
  #step2 #toConfirmBtn { flex: 1; width: auto; }
}

#verifiedPaymentRegion { grid-column: 1 / -1; font-size: 12px; overflow-wrap: anywhere; }


/* Shared processing/completion layout; only the progress panel collapses on success. */
#rechargeCard:is(.is-processing, .is-complete) .exchange-card-panel { padding: 30px 32px; }
#rechargeCard:is(.is-processing, .is-complete) #flowStepper { display: none; }
#rechargeCard:is(.is-processing, .is-complete) .recharge-card-heading { align-items: center; justify-content: flex-start; flex-wrap: nowrap; gap: 16px; margin-bottom: 26px; }
#rechargeCard:is(.is-processing, .is-complete) .recharge-card-heading h2 { font-size: 24px; margin-bottom: 6px; }
.task-working-icon { display: grid; place-items: center; flex: 0 0 54px; height: 54px; border-radius: 50%; background: var(--primary-soft); }
.task-working-icon .submission-spinner { width: 26px; height: 26px; border-width: 3px; }
.recharge-process-panel { padding: 24px 18px 14px; margin-bottom: 22px; border: 1px solid var(--primary-border); border-radius: 10px; background: var(--primary-soft); }
.recharge-progress-visual { display: block; max-width: none; margin: 0; }
.recharge-progress-visual .progress-stages { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); width: 100%; max-width: none; margin: 0; padding: 0 0 24px; list-style: none; }
.recharge-progress-visual .progress-stages > li { display: flex; flex-direction: column; align-items: center; position: relative; gap: 12px; min-width: 0; min-height: 0; padding: 0 5px; font-size: 13px; text-align: center; line-height: 1.5; }
.recharge-progress-visual .progress-stages > li::after { content: ""; position: absolute; top: 14px; left: calc(50% + 22px); right: calc(-50% + 22px); height: 2px; background: var(--border-strong); }
.recharge-progress-visual .progress-stages > li:last-child::after { content: none; }
.recharge-progress-visual .progress-stages > li.is-complete::after { background: var(--success-border); }
.recharge-progress-visual .stage-dot { width: 30px; height: 30px; flex: 0 0 30px; border-width: 1px; background: var(--surface-soft); }
.recharge-progress-visual .is-complete .stage-dot { background: var(--success); border-color: var(--success); color: white; }
.recharge-progress-visual .is-active .stage-dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 6px var(--primary-border); }
.recharge-progress-visual .stage-dot svg { width: 15px; height: 15px; }
.recharge-process-panel .task-connection { border: 0; border-top: 1px solid var(--primary-border); border-radius: 0; padding: 13px 0 0; margin: 0; background: none; }
.recharge-process-panel .task-connection.is-interrupted { background: var(--warning-soft); padding: 13px; border: 1px solid var(--warning); border-radius: 8px; }
.task-time-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-left: auto; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.recharge-process-panel .task-connection time { margin: 0; flex-basis: auto; }
#rechargeCard:is(.is-processing, .is-complete) .confirm-summary { margin: 0 0 18px; }
.processing-summary { padding: 18px 20px; }
.processing-summary h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.processing-summary .query-row { padding: 14px 0; gap: 14px; min-width: 0; }
.processing-summary .processing-account { border-bottom: 1px solid var(--border); }
.processing-summary .query-row strong { overflow-wrap: anywhere; min-width: 0; }
.processing-summary .query-row > span { flex-shrink: 0; }
.processing-summary-grid { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.5fr); gap: 20px; }
.processing-summary-grid .query-row { border: 0; padding-bottom: 0; }
.processing-summary-grid .query-row + .query-row { border-left: 1px solid var(--border); padding-left: 20px; }
.processing-summary .completion-value { gap: 6px; }
.processing-summary .completion-value strong { font-size: 12px; }
.processing-summary [data-payment-region] { padding-bottom: 0; margin-top: 14px; }
#rechargeCard:is(.is-processing, .is-complete) .task-progress { display: block; }
#rechargeCard:is(.is-processing, .is-complete) .task-progress > .status-message { grid-column: 1 / -1; margin: 0 0 18px; }
#rechargeCard:is(.is-processing, .is-complete) .progress-actions { padding: 0; margin: 0; border: 0; justify-content: flex-end; }
#rechargeCard:is(.is-processing, .is-complete) .progress-actions .exchange-btn { min-width: 124px; min-height: 42px; }
@media(max-width:600px) {
  #rechargeCard:is(.is-processing, .is-complete) .exchange-card-panel { padding: 22px 18px; }
  #rechargeCard:is(.is-processing, .is-complete) .recharge-card-heading { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 10px; margin-bottom: 20px; }
  #rechargeCard:is(.is-processing, .is-complete) .recharge-card-heading h2 { font-size: 21px; }
  .task-working-icon { width: 42px; height: 42px; }
  .recharge-process-panel { padding: 22px 12px 12px; }
  .recharge-progress-visual .progress-stages > li { font-size: 12px; gap: 10px; }
  .recharge-progress-visual .stage-dot { width: 24px; height: 24px; flex-basis: 24px; }
  .recharge-progress-visual .progress-stages > li::after { top: 11px; left: calc(50% + 17px); right: calc(-50% + 17px); }
  .task-time-meta { flex-basis: 100%; margin: 3px 0 0 15px; }
  .processing-summary { padding: 16px; }
  .processing-summary .processing-account { flex-direction: column; align-items: flex-start; gap: 7px; }
  .processing-summary-grid { grid-template-columns: minmax(0,1fr); gap: 0; }
  .processing-summary-grid .query-row + .query-row { border: 0; padding-left: 0; }
  .processing-summary .completion-value { width: auto; min-width: 0; }
  .processing-summary .query-row strong { text-align: left; }
}
@media(prefers-reduced-motion:reduce) { .task-working-icon .submission-spinner { animation: none; } }

.lookup-status.disabled { background: var(--warning-soft, #fff3d8); color: #a56609; }
.exchange-detail-banner.disabled { background: var(--warning-soft, #fff7e8); border-color: #f0d5a3; }
.theme-dark .lookup-status.disabled, .theme-dark .exchange-detail-banner.disabled { background: #3b3020; color: #f7ca75; border-color: #79603a; }

/* Compact code entry and success collapse. */
#rechargeCard:has(#step1:not([hidden])) .exchange-card-panel { padding: 30px 32px; }
#redeemSection:has(#step1:not([hidden])) > #rechargeDefaultNote { display: none; }
.code-entry-controls { display: grid; grid-template-columns: minmax(0, 1fr) 164px; align-items: start; gap: 12px; }
.code-entry-field { min-width: 0; }
.code-entry-controls .exchange-input, .code-entry-controls .exchange-btn { min-height: 48px; }
.code-entry-controls .exchange-btn { width: 100%; padding: 11px 12px; white-space: nowrap; }
#redeemBtn.loading .button-arrow { display: none; }
.code-entry-hint { display: flex; align-items: flex-start; gap: 9px; margin: 4px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.8; }
.code-entry-hint .note-icon { margin-top: 2px; flex-shrink: 0; }
.completion-collapse { overflow: hidden; pointer-events: none; min-height: 0; }
#rechargeCard:is(.is-processing, .is-complete) .progress-actions .exchange-btn { min-height: 44px; }
@media(max-width:600px) {
  #rechargeCard:has(#step1:not([hidden])) .exchange-card-panel { padding: 22px 18px; }
  .code-entry-controls { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  #rechargeCard.is-complete .task-result-icon { width: 42px; height: 42px; flex-basis: 42px; font-size: 24px; }
  #rechargeCard:is(.is-processing, .is-complete) .progress-actions .exchange-btn { min-width: 0; white-space: normal; }
}

/* A short in-card note replaces the redundant processing details and actions. */
.recharge-pending-note { display: flex; min-height: 44px; align-items: center; gap: 9px; margin: 0; color: var(--text-muted); font-size: 12px; line-height: 1.8; }
.recharge-pending-note .note-icon { flex-shrink: 0; margin-top: 2px; }

/* 手机端点击区域与字号（GPT设计师 2026-10-23） */
@media (max-width: 600px) {
  .header-link { min-height: 40px; padding: 0 6px; font-size: 13px; }
  .site-header .icon-button { width: 40px; height: 40px; }
  .exchange-step-label { font-size: 13px; }
}
