:root {
  color-scheme: light;
  --page: #f7f6f4;
  --paper: #ffffff;
  --text: #1c252e;
  --muted: #637381;
  --subtle: #919eab;
  --accent: #ec7e5b;
  --accent-strong: #f15b33;
  --line: rgba(145, 158, 171, 0.2);
  --line-strong: rgba(145, 158, 171, 0.38);
  --disabled-bg: rgba(145, 158, 171, 0.24);
  --disabled-text: rgba(145, 158, 171, 0.8);
  --success: #22c55e;
  --success-bg: #f1fdf3;
  --danger: #d92d20;
  --danger-bg: #fff4f2;
  --info-bg: #f4f7fb;
  --radius: 16px;
  --control-radius: 8px;
  --shadow: 0 0 2px rgba(145, 158, 171, 0.2), 0 12px 24px -4px rgba(145, 158, 171, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background: var(--page);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:not(:disabled),
a {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(236, 126, 91, 0.24);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.portal-header {
  position: relative;
  z-index: 5;
  height: 65px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 246, 244, 0.82);
  backdrop-filter: blur(10px);
}

.portal-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  height: 100%;
  padding: 0 24px;
  margin: 0 auto;
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #101820;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.portal-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: #fff;
  border: 1px solid rgba(209, 75, 41, 0.5);
  border-radius: 14px;
  background: linear-gradient(145deg, #fb8966, #ef6f48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  font-size: 18px;
  font-weight: 700;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: #38576c;
  border-radius: 50%;
  background: transparent;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.theme-toggle:hover {
  color: var(--accent-strong);
  background: rgba(145, 158, 171, 0.09);
}

.theme-toggle:active {
  transform: scale(0.94);
}

.theme-toggle svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.portal-main {
  width: 100%;
  max-width: 1200px;
  padding: 48px 24px;
  margin: 0 auto;
}

.portal-stack {
  width: min(100%, 720px);
  margin: 0 auto;
}

.portal-intro {
  height: 57.6875px;
  text-align: center;
}

.portal-intro h1 {
  margin: 0;
  color: #101820;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.02em;
}

.portal-intro p {
  margin: 6px 0 0;
  color: #101820;
  font-size: 14px;
  line-height: 1.7;
}

.steps-overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.overview-card {
  height: 146.34375px;
  padding: 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.overview-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  color: #fff;
  border-radius: 11px;
  background: #14212d;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.overview-card h2 {
  margin: 10px 0 4px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 21.98px;
}

.overview-card p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 19.92px;
}

.redeem-card {
  width: 100%;
  padding: 24px;
  margin-top: 32px;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.product-strip {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.product-tab {
  position: relative;
  min-width: 0;
  height: 44px;
  padding: 12px 16px;
  color: var(--muted);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 17.5px;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease;
}

.product-tab::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: transparent;
  content: "";
  transition: background 160ms ease;
}

.product-tab:hover {
  color: var(--accent-strong);
  background: rgba(236, 126, 91, 0.035);
}

.product-tab.active {
  color: var(--accent);
  font-weight: 600;
}

.product-tab.active::after {
  background: var(--accent);
}

.notice {
  padding: 11px 14px;
  margin: 18px 0 0;
  border: 1px solid rgba(31, 93, 157, 0.12);
  border-radius: var(--control-radius);
  color: #285b84;
  background: #f2f8fd;
  font-size: 13px;
  line-height: 1.55;
}

.notice.success {
  color: #177c3c;
  border-color: rgba(34, 197, 94, 0.16);
  background: var(--success-bg);
}

.notice.error {
  color: var(--danger);
  border-color: rgba(217, 45, 32, 0.14);
  background: var(--danger-bg);
}

.surface-panel {
  width: 100%;
}

.surface-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.redeem-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 0;
  padding: 0 0 16px;
  margin: 0 0 20px;
  border-bottom: 1px solid var(--line);
}

.surface-icon {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: #fff;
  border: 1px solid rgba(209, 75, 41, 0.42);
  border-radius: 16px;
  background: linear-gradient(145deg, #fb8966, #ef6f48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 8px 18px rgba(236, 126, 91, 0.14);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.gpt-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: #fff;
  border: 1px solid rgba(209, 75, 41, 0.42);
  border-radius: 14px;
  background: linear-gradient(145deg, #fb8966, #ef6f48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38), 0 8px 18px rgba(236, 126, 91, 0.14);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.surface-title-row h2,
.redeem-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  line-height: 26.1px;
}

.surface-title-row p,
.redeem-heading p {
  margin: 1px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 20.68px;
}

.workflow-stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  height: 6px;
  padding: 0;
  margin: 0 0 24px;
}

.step-item {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e8eb;
  transition: background 180ms ease, transform 180ms ease;
}

.step-item.active,
.step-item.done {
  background: var(--accent);
}

.step-item.active {
  transform: translateY(-0.5px);
}

.workflow-stage {
  padding-top: 0;
}

.workflow-panel {
  display: none;
  width: 100%;
}

body[data-step="1"] #cardPanel,
body[data-step="2"] #sessionPanel,
body[data-step="3"] #confirmPanel {
  display: block;
}

.field {
  position: relative;
  width: 100%;
}

.field label {
  display: block;
  margin: 0 0 6px;
  color: #536471;
  font-size: 12px;
  line-height: 1.4;
}

.floating-field label {
  position: absolute;
  z-index: 1;
  top: -9px;
  left: 12px;
  padding: 0 5px;
  margin: 0;
  color: #456072;
  background: var(--paper);
  font-size: 11px;
  line-height: 18px;
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  color: #1c252e;
  background: var(--paper);
  box-shadow: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.field input {
  height: 54.5625px;
  padding: 0 15px;
}

.field textarea {
  min-height: 96px;
  padding: 14px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #9ca5ad;
  opacity: 1;
}

#cardCode {
  color: #3d4b57;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 21.56px;
  letter-spacing: 0.025em;
}

.field input:hover,
.field textarea:hover {
  border-color: rgba(99, 115, 129, 0.56);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(236, 126, 91, 0.12);
}

.field-hint {
  margin: 3px 14px 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 19.92px;
}

.primary-button,
.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 48px;
  padding: 0 18px;
  border-radius: var(--control-radius);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, box-shadow 150ms ease, transform 120ms ease;
}

.primary-button {
  width: 100%;
  color: #fff;
  background: var(--accent);
  box-shadow: none;
}

.primary-button:hover:not(:disabled) {
  background: #e96e47;
  box-shadow: 0 8px 18px rgba(236, 126, 91, 0.2);
}

.primary-button:active:not(:disabled),
.outline-button:active:not(:disabled) {
  transform: translateY(1px);
}

.primary-button:disabled {
  color: var(--disabled-text);
  background: var(--disabled-bg);
  box-shadow: none;
  cursor: not-allowed;
}

.outline-button {
  color: #101820;
  border: 1px solid #667784;
  background: transparent;
}

.outline-button:hover:not(:disabled) {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: rgba(236, 126, 91, 0.03);
}

.text-button {
  color: #24475d;
  background: transparent;
  font-size: 12px;
}

.issue-button {
  display: block;
  padding: 0;
  margin: 24px auto 0;
  line-height: 19.92px;
}

.issue-button:hover {
  color: var(--accent-strong);
}

.verified-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 10px 14px;
  margin: -1px 0 16px;
  color: #087a35;
  border-radius: 14px;
  background: var(--success-bg);
  font-size: 13px;
}

.verified-banner svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: #18bd5d;
}

.verified-banner strong {
  font-weight: 500;
}

.session-field textarea {
  height: 98px;
  min-height: 98px;
  padding-top: 15px;
  font-size: 11px;
}

.session-hint {
  margin-bottom: 15px;
}

.input-status {
  padding: 10px 12px;
  margin: 0 0 14px;
  border-radius: var(--control-radius);
  color: #456072;
  background: var(--info-bg);
  font-size: 11px;
}

.input-status:not(.ok):not(.error):not(.loading) {
  display: none;
}

.input-status.ok,
.input-status.error,
.input-status.loading {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.input-status.ok {
  color: #087a35;
  background: var(--success-bg);
}

.input-status.error {
  color: var(--danger);
  background: var(--danger-bg);
}

.split-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}

.split-actions .outline-button {
  width: 100%;
  height: 34px;
  font-size: 12px;
}

.return-button {
  width: 100%;
  height: 42px;
  margin-top: 15px;
  font-size: 12px;
}

.confirm-summary {
  display: grid;
  gap: 0;
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
}

.summary-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-row span {
  color: var(--muted);
}

.summary-row strong {
  overflow-wrap: anywhere;
  text-align: right;
  font-weight: 600;
}

.policy-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 13px;
  margin: 0 0 16px;
  border-radius: var(--control-radius);
  color: #52616d;
  background: #f7f8f9;
  font-size: 11px;
  line-height: 1.6;
  cursor: pointer;
}

.policy-consent input {
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.surface-message {
  padding: 18px;
  margin: 24px 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
}

.surface-message strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.surface-message p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.info-surface > .outline-button {
  width: 100%;
}

.query-surface .surface-title-row {
  margin-bottom: 24px;
}

.query-primary-field textarea {
  min-height: 84px;
}

.query-claim-field {
  margin-top: 18px;
}

.query-claim-field input {
  height: 48px;
}

.query-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 148px;
  gap: 12px;
  margin-top: 18px;
}

.query-actions .outline-button {
  width: 100%;
}

.query-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 22px;
}

.query-summary > div {
  padding: 9px 6px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  text-align: center;
}

.query-summary span,
.query-summary strong {
  display: block;
}

.query-summary span {
  color: var(--muted);
  font-size: 10px;
}

.query-summary strong {
  margin-top: 2px;
  font-size: 16px;
}

.query-summary .ok strong {
  color: #148447;
}

.query-summary .danger strong {
  color: var(--danger);
}

.query-results {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.query-result-card,
.query-empty {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
  font-size: 11px;
}

.query-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.query-result-head small,
.query-result-head strong {
  display: block;
}

.query-result-head small {
  color: var(--muted);
}

.query-result-head strong {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.query-status {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  color: #35627e;
  background: #edf5fa;
}

.query-status.ok,
.query-result-card.ok .query-status {
  color: #087a35;
  background: var(--success-bg);
}

.query-status.danger,
.query-result-card.danger .query-status {
  color: var(--danger);
  background: var(--danger-bg);
}

.query-result-grid,
.order-result-grid,
.protocol-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin-top: 12px;
}

.query-result-grid > div,
.protocol-grid > div {
  min-width: 0;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.query-result-grid span,
.query-result-grid strong,
.protocol-grid span,
.protocol-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.query-result-grid span,
.protocol-grid span {
  color: var(--muted);
  font-size: 10px;
}

.query-error-line {
  padding: 9px 10px;
  margin-top: 10px;
  border-radius: 7px;
  color: var(--danger);
  background: var(--danger-bg);
}

.queue-panel {
  padding: 16px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
}

.queue-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.queue-head h3 {
  margin: 6px 0 0;
  font-size: 14px;
}

.queue-head p,
.queue-feedback {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.queue-head > strong {
  color: var(--accent-strong);
  font-size: 22px;
}

.queue-badge {
  color: #7a4b30;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.queue-progress {
  height: 7px;
  overflow: hidden;
  margin-top: 14px;
  border-radius: 999px;
  background: #e5e8eb;
}

.queue-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.queue-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
  margin: 14px 0 0;
}

.queue-meta > div {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.queue-meta dt {
  color: var(--muted);
}

.queue-meta dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
  font-weight: 600;
}

.queue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.queue-actions .outline-button {
  height: 36px;
  font-size: 11px;
}

.portal-footer {
  width: 100%;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.portal-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  padding: 0 24px;
  margin: 0 auto;
  font-size: 12px;
  line-height: 19.92px;
}

body.dark-theme {
  color-scheme: dark;
  --page: #10161c;
  --paper: #182129;
  --text: #f3f5f7;
  --muted: #aab4bd;
  --subtle: #87939e;
  --line: rgba(187, 199, 209, 0.14);
  --line-strong: rgba(187, 199, 209, 0.3);
  --disabled-bg: rgba(145, 158, 171, 0.18);
  --disabled-text: rgba(200, 209, 217, 0.48);
  --success-bg: rgba(26, 139, 72, 0.13);
  --danger-bg: rgba(217, 45, 32, 0.12);
  --info-bg: #202b34;
  --shadow: 0 0 2px rgba(0, 0, 0, 0.35), 0 12px 24px -4px rgba(0, 0, 0, 0.28);
}

body.dark-theme .portal-header {
  background: rgba(16, 22, 28, 0.86);
}

body.dark-theme .portal-brand,
body.dark-theme .portal-intro h1,
body.dark-theme .portal-intro p,
body.dark-theme .overview-card h2,
body.dark-theme .overview-card p,
body.dark-theme .surface-title-row h2,
body.dark-theme .redeem-heading h2,
body.dark-theme .surface-title-row p,
body.dark-theme .redeem-heading p,
body.dark-theme .outline-button,
body.dark-theme .field input,
body.dark-theme .field textarea {
  color: var(--text);
}

body.dark-theme .floating-field label {
  background: var(--paper);
}

body.dark-theme .product-tab {
  color: #c3ccd3;
}

body.dark-theme .product-tab.active,
body.dark-theme .product-tab:hover {
  color: #ff9878;
}

body.dark-theme .surface-message,
body.dark-theme .query-result-card,
body.dark-theme .query-empty,
body.dark-theme .queue-panel,
body.dark-theme .policy-consent {
  background: #1d272f;
}

@media (max-width: 760px) {
  .portal-header {
    height: 64px;
  }

  .portal-header-inner {
    padding: 0 16px;
  }

  .portal-brand {
    font-size: 18px;
  }

  .portal-brand-mark {
    width: 34px;
    height: 34px;
  }

  .portal-main {
    padding: 32px 16px 40px;
  }

  .portal-intro h1 {
    font-size: 19px;
  }

  .portal-intro {
    height: auto;
  }

  .steps-overview {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 26px;
  }

  .overview-card {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    column-gap: 13px;
    height: auto;
    min-height: 0;
    padding: 16px;
  }

  .overview-card h2 {
    align-self: end;
    margin: 0 0 1px;
  }

  .overview-card p {
    grid-column: 2;
  }

  .redeem-card {
    padding: 18px;
    margin-top: 22px;
    border-radius: 14px;
  }

  .product-strip {
    overflow-x: auto;
    grid-template-columns: repeat(4, minmax(82px, 1fr));
    scrollbar-width: none;
  }

  .product-strip::-webkit-scrollbar {
    display: none;
  }

  .product-tab {
    height: 44px;
    font-size: 12px;
  }

  .surface-title-row {
    min-height: 64px;
  }

  .surface-title-row h2,
  .redeem-heading h2 {
    font-size: 17px;
  }

  .field-hint {
    margin-right: 5px;
    margin-left: 5px;
  }

  .query-actions {
    grid-template-columns: 1fr;
  }

  .query-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-row,
  .query-result-grid,
  .order-result-grid,
  .protocol-grid,
  .queue-meta {
    grid-template-columns: 1fr;
  }

  .summary-row strong {
    text-align: left;
  }

  .queue-meta > div {
    grid-template-columns: 72px minmax(0, 1fr);
  }
}

@media (max-width: 430px) {
  .portal-main {
    padding-right: 12px;
    padding-left: 12px;
  }

  .redeem-card {
    padding: 15px;
  }

  .split-actions {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .query-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #cardCode {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* 2026-08-29: screenshot-matched redemption and factual four-stage order states. */
body {
  display: flex;
  flex-direction: column;
}

.portal-header {
  height: 59px;
}

.portal-header-inner,
.portal-footer-inner {
  max-width: 1040px;
  padding-right: 0;
  padding-left: 0;
}

.portal-brand {
  gap: 11px;
  font-size: 17px;
}

.portal-brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  font-size: 15px;
}

.theme-toggle {
  width: 34px;
  height: 34px;
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.portal-main {
  flex: 1 0 auto;
  max-width: 1040px;
  padding: 42px 24px 40px;
}

.portal-stack {
  width: min(100%, 650px);
}

.portal-intro {
  height: 50px;
}

.portal-intro h1 {
  font-size: 19px;
  line-height: 27px;
}

.portal-intro p {
  margin-top: 2px;
  font-size: 13px;
}

.steps-overview {
  gap: 12px;
  margin-top: 30px;
}

.overview-card {
  height: 133px;
  padding: 18px;
  border-radius: 15px;
}

.overview-number {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  font-size: 13px;
}

.overview-card h2 {
  margin-top: 9px;
  font-size: 13px;
}

.overview-card p {
  font-size: 11px;
  line-height: 18px;
}

.redeem-card {
  padding: 22px;
  margin-top: 29px;
  border-radius: 15px;
}

.product-strip {
  margin-bottom: 20px;
}

.product-tab {
  height: 39px;
  padding: 9px 12px 11px;
  font-size: 12px;
}

.redeem-heading {
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.gpt-badge {
  width: 37px;
  height: 37px;
  border-radius: 13px;
  font-size: 11px;
}

.redeem-heading h2 {
  font-size: 17px;
}

.redeem-heading p {
  font-size: 12px;
}

.workflow-stepper {
  height: 6px;
  margin-bottom: 20px;
}

.step-item {
  height: 6px;
}

.session-secured {
  color: transparent !important;
  background: #fbfcfc !important;
  cursor: default;
}

.session-secured::placeholder {
  color: #8d99a3 !important;
  opacity: 1;
}

.session-validation-stack {
  display: grid !important;
  gap: 9px !important;
  padding: 0 !important;
  margin-bottom: 14px;
  background: transparent !important;
}

.session-validation-row {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 13px;
  color: #087a35;
  background: var(--success-bg);
  font-size: 12px;
  line-height: 19px;
}

.session-validation-row svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: #18bd5d;
}

.session-validation-row strong {
  font-weight: 600;
}

.consent-dialog:not([open]) {
  display: none !important;
}

.consent-dialog[open] {
  display: block;
  width: min(520px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 16px;
  color: var(--text);
  background: transparent;
  box-shadow: 0 22px 70px rgba(16, 24, 32, 0.22);
}

.consent-dialog::backdrop {
  background: rgba(20, 33, 45, 0.36);
  backdrop-filter: blur(2px);
}

.consent-card {
  width: 100%;
  padding: 22px;
  border: 1px solid rgba(145, 158, 171, 0.2);
  border-radius: 16px;
  background: var(--paper);
}

.consent-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.consent-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 26px;
}

.consent-kicker {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.consent-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  color: #62717d;
  background: #f3f5f6;
  font-size: 22px;
  line-height: 1;
}

.consent-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.consent-actions .primary-button,
.consent-actions .outline-button {
  width: 100%;
  height: 42px;
  font-size: 12px;
}

.console-panel.is-charging .workflow-stage {
  display: none;
}

.queue-panel {
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.charge-journey {
  padding: 27px 17px 20px;
  border: 1px solid rgba(145, 158, 171, 0.3);
  border-radius: 14px;
  background: #f3f2f0;
}

.charge-stage-list {
  display: flex;
  align-items: flex-start;
  width: 100%;
  padding: 0;
  margin: 0;
  list-style: none;
}

.charge-stage {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  color: #6b7a86;
}

.charge-stage:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 19px;
  left: calc(50% + 27px);
  width: calc(100% - 54px);
  height: 1px;
  background: #cbd2d7;
  content: "";
}

.charge-stage.done:not(:last-child)::after {
  background: #23c660;
}

.charge-stage-dot {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid #d4dbe0;
  border-radius: 50%;
  color: #758491;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.charge-stage-label {
  margin-top: 7px;
  font-size: 11px;
  line-height: 17px;
  white-space: nowrap;
}

.charge-stage.active {
  color: var(--accent-strong);
}

.charge-stage.active .charge-stage-dot {
  color: #fff;
  border-color: #ea6d46;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(236, 126, 91, 0.13);
}

.charge-stage.done {
  color: #078331;
}

.charge-stage.done .charge-stage-dot {
  color: #fff;
  border-color: #10aa4c;
  background: #20c35c;
}

.charge-stage.failed {
  color: #b5473c;
}

.charge-stage.failed .charge-stage-dot {
  border-color: #d9584b;
  background: #d9584b;
}

.charge-order-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  margin-top: 19px;
  color: #111820;
  font-size: 11px;
  line-height: 17px;
}

.charge-order-line strong {
  max-width: 250px;
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.charge-copy-button {
  padding: 0 3px;
  color: var(--accent-strong);
  background: transparent;
  font-size: 10px;
}

.charge-stage-status {
  margin: 12px 0 0;
  color: #253846;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.charge-journey.is-complete {
  padding-bottom: 26px;
}

.charge-journey.is-complete .charge-order-line,
.charge-journey.is-complete + .charge-stage-status {
  display: none !important;
}

.charge-success-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 14px;
  margin-top: 14px;
  border-radius: 13px;
  color: #087a35;
  background: var(--success-bg);
  font-size: 12px;
  line-height: 19px;
}

.charge-success-banner svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: #18bd5d;
}

.charge-success-banner strong {
  font-weight: 700;
}

.charge-return-button {
  width: 100%;
  height: 42px;
  margin-top: 13px;
  font-size: 12px;
}

.portal-footer {
  flex: 0 0 auto;
  min-height: 51px;
  padding: 15px 0;
}

.footer-security {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer-security svg {
  width: 13px;
  height: 13px;
  fill: currentColor;
}

body.dark-theme .consent-card {
  background: var(--paper);
}

body.dark-theme .charge-journey {
  border-color: rgba(182, 195, 204, 0.2);
  background: #1d272f;
}

body.dark-theme .charge-stage-dot {
  border-color: #53616b;
  color: #c3ccd3;
  background: #26323b;
}

body.dark-theme .charge-order-line,
body.dark-theme .charge-stage-status {
  color: #dce3e8;
}

@media (max-width: 1100px) {
  .portal-header-inner,
  .portal-footer-inner {
    padding-right: 24px;
    padding-left: 24px;
  }
}

@media (max-width: 760px) {
  .portal-header {
    height: 59px;
  }

  .portal-header-inner,
  .portal-footer-inner {
    padding-right: 16px;
    padding-left: 16px;
  }

  .portal-main {
    padding: 30px 16px 34px;
  }

  .portal-intro {
    height: auto;
  }

  .steps-overview {
    margin-top: 25px;
  }

  .overview-card {
    height: auto;
  }

  .redeem-card {
    padding: 17px;
    margin-top: 22px;
  }

  .charge-journey {
    padding: 23px 8px 15px;
  }

  .charge-stage:not(:last-child)::after {
    left: calc(50% + 22px);
    width: calc(100% - 44px);
  }

  .charge-stage-dot {
    width: 34px;
    height: 34px;
  }

  .charge-stage:not(:last-child)::after {
    top: 17px;
  }

  .charge-stage-label {
    font-size: 10px;
  }
}

@media (max-width: 430px) {
  .consent-actions {
    grid-template-columns: 1fr;
  }

  .charge-stage-label {
    max-width: 54px;
    white-space: normal;
    text-align: center;
  }

  .charge-order-line strong {
    max-width: 160px;
  }
}
