: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):not(.warning) {
  display: none;
}

.input-status.ok,
.input-status.error,
.input-status.warning,
.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);
}

.input-status.warning {
  color: #8a5a00;
  background: #fff8df;
}

.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;
}

.policy-auto-note {
  margin: -4px 0 12px;
  color: #718098;
  font-size: 11px;
  line-height: 1.55;
  text-align: left;
}

.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;
  }
}

/* Pixel-match surface: CardKey reference desktop shell */
.portal-header {
  height: 58px;
  background: rgba(247, 246, 244, 0.96);
  backdrop-filter: none;
}

.portal-header-inner,
.portal-footer-inner {
  max-width: 1040px;
}

.portal-header-inner {
  padding-right: 0;
  padding-left: 0;
}

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

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

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

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

.portal-main {
  max-width: 1040px;
  padding-top: 48px;
  padding-bottom: 64px;
}

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

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

.steps-overview {
  gap: 14px;
  margin-top: 31px;
}

.overview-card {
  height: 146px;
  padding: 19px;
  border-radius: 15px;
  box-shadow: 0 0 2px rgba(145, 158, 171, 0.15), 0 10px 20px -5px rgba(145, 158, 171, 0.1);
}

.redeem-card {
  padding: 24px;
  margin-top: 30px;
  border-radius: 15px;
  box-shadow: 0 0 2px rgba(145, 158, 171, 0.15), 0 12px 24px -5px rgba(145, 158, 171, 0.11);
}

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

.product-tab {
  height: 42px;
  padding: 11px 12px;
  font-size: 13px;
}

.surface-title-row {
  gap: 11px;
  min-height: 55px;
  padding: 13px 0;
}

.surface-icon {
  width: 38px;
  height: 38px;
  border-radius: 13px;
}

.batch-icon {
  flex-direction: column;
  gap: 0;
  font-size: 9px;
  line-height: 11px;
}

.surface-title-row h2,
.redeem-heading h2 {
  font-size: 16px;
  line-height: 22px;
}

.surface-title-row p,
.redeem-heading p {
  font-size: 11px;
  line-height: 17px;
}

.batch-title-row {
  margin-bottom: 15px;
}

.batch-code-field textarea {
  min-height: 148px;
  padding: 14px;
  font-size: 13px;
  line-height: 20px;
}

.batch-code-field textarea::placeholder {
  color: #a6adb2;
}

.batch-meta {
  margin: 5px 14px 19px;
  color: #476a87;
  font-size: 11px;
  line-height: 17px;
}

.batch-session-title {
  margin-bottom: 8px;
  color: #1c252e;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}

.batch-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 43px;
  padding: 8px 12px;
  border: 1px dashed rgba(236, 126, 91, 0.52);
  border-radius: 8px;
  color: var(--accent-strong);
  background: #fffdfc;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}

.batch-upload:hover {
  border-color: var(--accent-strong);
  background: #fff7f3;
}

.batch-upload:focus-within {
  outline: 3px solid rgba(236, 126, 91, 0.18);
  outline-offset: 2px;
}

.batch-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.batch-upload-icon {
  font-size: 18px;
  line-height: 1;
}

.batch-file-meta {
  margin-top: 7px;
  color: #253846;
  font-size: 10px;
  line-height: 16px;
}

.batch-preview {
  padding: 10px 12px;
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.batch-preview-head,
.batch-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.batch-preview-head {
  padding-bottom: 7px;
  color: #1c252e;
  font-size: 11px;
}

.batch-preview-head span,
.batch-preview-more {
  color: var(--muted);
  font-size: 10px;
}

.batch-preview-row {
  padding: 7px 0;
  border-top: 1px solid var(--line);
  font-size: 10px;
}

.batch-preview-row > span {
  overflow: hidden;
  color: #3d4b57;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-preview-row strong.ready {
  color: #148447;
}

.batch-preview-row strong.missing {
  color: #a66b00;
}

.batch-preview-more {
  padding-top: 7px;
  border-top: 1px solid var(--line);
}

.batch-policy-note {
  padding: 9px 11px;
  margin: 13px 0;
  border-radius: 7px;
  color: #5c6871;
  background: #f7f8f9;
  font-size: 10px;
  line-height: 16px;
}

.batch-submit-button {
  height: 43px;
  font-size: 13px;
}

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

.query-primary-field textarea,
.progress-query-field input {
  border-color: rgba(145, 158, 171, 0.3);
}

.query-primary-field textarea {
  min-height: 98px;
  font-size: 13px;
  line-height: 20px;
}

.query-actions {
  display: block;
  margin-top: 17px;
}

.query-actions .primary-button {
  height: 43px;
  color: #fff;
  background: #1b2834;
  box-shadow: none;
}

.query-actions .primary-button:hover:not(:disabled) {
  background: #263948;
  box-shadow: 0 8px 16px rgba(27, 40, 52, 0.14);
}

.query-actions #cardQueryClearBtn {
  display: none;
}

.progress-query-field {
  margin-top: 0;
}

.progress-query-field input {
  height: 50px;
  padding: 0 13px;
  font-size: 13px;
}

.query-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 15px 0;
  color: #99a2a9;
  font-size: 11px;
  text-align: center;
}

.query-divider::before,
.query-divider::after {
  flex: 1;
  height: 1px;
  background: var(--line);
  content: "";
}

.query-divider span {
  min-width: 16px;
}

.query-result-card {
  border-color: rgba(145, 158, 171, 0.28);
  border-radius: 10px;
  background: #f1f0ee;
}

.query-result-card .query-result-grid > div,
.query-result-card .protocol-grid > div {
  border-top-color: rgba(145, 158, 171, 0.24);
}

.query-result-card {
  padding: 15px 14px;
}

.query-result-card .query-result-head {
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(145, 158, 171, 0.24);
}

.query-result-card .query-result-grid {
  gap: 0 16px;
  margin-top: 0;
}

.query-result-card .query-result-grid > div {
  padding: 12px 0 11px;
}

.query-result-card .query-result-grid span {
  margin-bottom: 3px;
  font-size: 10px;
}

.query-result-card .query-result-grid strong {
  color: #101820;
  font-size: 12px;
  font-weight: 700;
}

.query-exchange-action,
.exchange-success {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
  padding: 11px 0 0;
  margin-top: 2px;
  border-top: 1px solid rgba(145, 158, 171, 0.24);
}

.query-exchange-action > div,
.exchange-success > span,
.exchange-success > strong {
  min-width: 0;
}

.query-exchange-action > div {
  display: grid;
  gap: 2px;
}

.query-exchange-action strong {
  color: #148447;
  font-size: 11px;
}

.query-exchange-action span {
  color: #68757e;
  font-size: 10px;
  line-height: 16px;
}

.query-exchange-button {
  flex: 0 0 auto;
  width: auto;
  height: 34px;
  padding: 0 15px;
  color: #1b2834;
  border-color: rgba(27, 40, 52, 0.55);
  font-size: 11px;
}

.exchange-success {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.exchange-success > span {
  color: #148447;
  font-size: 10px;
}

.exchange-success > strong {
  overflow-wrap: anywhere;
  color: #101820;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.exchange-success .text-button {
  flex: 0 0 auto;
  font-size: 11px;
}

.order-result-card .order-result-grid {
  grid-template-columns: 1fr;
}

.order-result-card .order-result-grid > div {
  padding: 13px 0 12px;
}

.order-technical-details {
  margin-top: 4px;
  border-top: 1px solid rgba(145, 158, 171, 0.24);
}

.order-technical-details summary {
  padding: 11px 0 1px;
  color: #476a87;
  font-size: 10px;
  cursor: pointer;
  list-style-position: inside;
}

.order-technical-details .query-protocol-grid {
  margin-top: 10px;
}

.order-technical-grid {
  margin-top: 7px;
}

@media (max-width: 760px) {
  .query-result-card .query-result-grid,
  .order-result-card .order-result-grid {
    grid-template-columns: 1fr;
  }

  .query-exchange-action {
    align-items: flex-start;
  }
}

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

@media (max-width: 760px) {
  .portal-header-inner {
    padding-right: 16px;
    padding-left: 16px;
  }

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

  .portal-stack {
    width: 100%;
  }

  .steps-overview {
    gap: 10px;
  }

  .overview-card {
    padding: 14px;
  }

  .redeem-card {
    padding: 17px;
  }
}

@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;
  grid-template-columns: repeat(5, minmax(76px, 1fr));
}

.entry-policy {
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  color: var(--text);
  background: var(--info-bg);
  font-size: 13px;
  line-height: 1.7;
}

.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;
}

.portal-session-summary .session-validation-row > span { min-width: 0; overflow-wrap: anywhere; }
.portal-session-failure { white-space: pre-wrap; overflow-wrap: anywhere; }
body.dark-theme .portal-order-steps span { color: #b7c2d0; }
#editSessionBtn { margin-bottom: 12px; }
.portal-order-steps { margin: 12px 0; padding-inline-start: 24px; color: var(--text); font-size: 12px; }
.portal-order-steps li { padding: 5px 0; overflow-wrap: anywhere; }
.portal-order-steps span { display: block; color: #485665; line-height: 1.6; }
#queueExternalOrderLine { font-size: 12px; overflow-wrap: anywhere; }

.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;
  }
}

/* Query/progress pixel match: CardKey result surfaces */
.query-result-card {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.query-voucher-card {
  padding: 18px 16px 16px;
  border: 1px solid #d8dadd;
  border-radius: 15px;
  background: #f0efed;
}

.query-voucher-card .query-result-head {
  min-height: 59px;
  padding: 0 0 15px;
  border-bottom: 1px solid #d7d8da;
}

.query-voucher-card .query-result-head small,
.query-order-info-grid span {
  color: #5e7080;
  font-size: 10px;
  line-height: 15px;
}

.query-voucher-card .query-result-head strong {
  margin-top: 3px;
  color: #101820;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.query-voucher-card .query-status {
  margin-top: -2px;
  padding: 7px 10px;
  color: #24708a;
  background: #eef7fb;
  font-size: 10px;
  line-height: 18px;
}

.query-voucher-card .query-status.ok,
.query-voucher-card .query-status.warn,
.query-voucher-card .query-status.danger {
  color: #087a35;
  background: #e7faec;
}

.query-voucher-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 26px;
  margin-top: 0;
}

.query-voucher-grid > div {
  min-height: 64px;
  padding: 13px 0 11px;
  border-top: 1px solid #d7d8da;
}

.query-voucher-grid > div:nth-child(-n + 2) {
  border-top: 0;
}

.query-voucher-grid span {
  display: block;
  margin-bottom: 4px;
  color: #5e7080;
  font-size: 10px;
  line-height: 15px;
}

.query-voucher-grid strong {
  display: block;
  overflow-wrap: anywhere;
  color: #101820;
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
}

.query-progress-stepper {
  padding: 28px 18px 25px;
  border: 1px solid #d8dadd;
  border-radius: 15px;
  background: #f0efed;
}

.query-progress-stepper ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.query-progress-stepper li {
  position: relative;
  display: flex;
  align-items: center;
  flex-direction: column;
  min-width: 0;
  color: #5e7080;
  text-align: center;
}

.query-progress-stepper li:not(:last-child)::after {
  position: absolute;
  top: 17px;
  left: calc(50% + 19px);
  width: calc(100% - 38px);
  height: 2px;
  background: #cbd2d6;
  content: "";
}

.query-progress-stepper li.done:not(:last-child)::after {
  background: #25c967;
}

.query-progress-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #617482;
  background: #fff;
  font-size: 15px;
  font-weight: 700;
}

.query-progress-stepper li.done .query-progress-dot,
.query-progress-stepper li.active .query-progress-dot {
  color: #fff;
  background: #25c967;
}

.query-progress-stepper li.failed .query-progress-dot {
  background: #db594d;
}

.query-progress-label {
  margin-top: 7px;
  color: #087a35;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  white-space: nowrap;
}

.query-progress-stepper li:not(.done):not(.active) .query-progress-label {
  color: #5e7080;
  font-weight: 500;
}

.query-order-success {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 43px;
  padding: 10px 15px;
  margin-top: 16px;
  border-radius: 14px;
  color: #087a35;
  background: #effcf2;
  font-size: 12px;
}

.query-order-success span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #18bd5d;
  border: 1.5px solid #18bd5d;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.query-order-info-card {
  padding: 0 18px;
  margin-top: 16px;
  border: 1px solid #d8dadd;
  border-radius: 15px;
  background: #f0efed;
}

.query-order-info-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.query-order-info-grid > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 50px;
  padding: 12px 0;
  border-bottom: 1px solid #d7d8da;
}

.query-order-info-grid > div:last-child {
  border-bottom: 0;
}

.query-order-info-grid strong {
  max-width: 75%;
  overflow-wrap: anywhere;
  color: #101820;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: right;
}

.query-order-info-grid strong.query-order-state {
  padding: 2px 9px;
  border-radius: 999px;
  color: #087a35;
  background: #d8f5df;
  font-size: 10px;
}

.order-result-card .order-technical-details {
  margin: 11px 0 0;
  border-top: 0;
}

.order-result-card .order-technical-details summary {
  padding: 4px 0 0;
  color: #476a87;
  font-size: 10px;
}

.order-result-card .query-error-line,
.order-result-card .query-timeline {
  margin-top: 12px;
}

@media (max-width: 560px) {
  .query-voucher-grid {
    gap: 0 14px;
  }

  .query-progress-stepper {
    padding-right: 8px;
    padding-left: 8px;
  }

  .query-progress-stepper li:not(:last-child)::after {
    left: calc(50% + 18px);
    width: calc(100% - 36px);
  }

  .query-progress-label {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .query-progress-stepper * {
    transition: none !important;
  }
}

/* Card exchange surface: pixel-matched success state */
.card-exchange-panel {
  padding: 10px;
  margin-top: 20px;
  border: 1px solid #d8dadd;
  border-radius: 12px;
  background: #f0efed;
}

.card-exchange-copy {
  margin: 0 2px 11px;
  color: #253846;
  font-size: 10px;
  line-height: 17px;
}

.card-exchange-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 35px;
  padding: 0 14px;
  border-radius: 8px;
  color: #fff;
  background: #1b2834;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease, opacity 150ms ease;
}

.card-exchange-confirm:hover:not(:disabled) {
  background: #263948;
}

.card-exchange-confirm:disabled {
  opacity: 0.62;
  cursor: wait;
}

.card-exchange-status {
  padding: 9px 10px;
  margin-top: 9px;
  border-radius: 8px;
  font-size: 10px;
  line-height: 16px;
}

.card-exchange-status.loading {
  color: #476a87;
  background: #e9f1f6;
}

.card-exchange-status.error {
  color: #b5473c;
  background: #fff0ed;
}

.card-exchange-result {
  padding: 10px 12px;
  border-radius: 12px;
  color: #087a35;
  background: #effcf2;
}

.card-exchange-result > span {
  display: block;
  margin-bottom: 7px;
  font-size: 10px;
  line-height: 16px;
}

.card-exchange-code-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.card-exchange-code-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #087a35;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
  line-height: 18px;
  letter-spacing: 0.01em;
}

.card-exchange-copy-button {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  color: #fff;
  background: #20c35c;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.card-exchange-copy-button:hover {
  background: #18ad50;
}

.issue-button[aria-expanded="true"] {
  color: #476a87;
}

body.dark-theme .card-exchange-panel {
  border-color: rgba(187, 199, 209, 0.2);
  background: #202b34;
}

body.dark-theme .card-exchange-copy {
  color: #c4d0d8;
}

body.dark-theme .card-exchange-result {
  background: rgba(26, 139, 72, 0.15);
}

/* Reference query surface: compact rows with status aligned on the right. */
.product-strip {grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:22px;}
.product-tab {height:44px;padding:12px 4px;font-size:12px;font-weight:500;}
body[data-surface="query"] #cardQueryPanel {margin:0;padding:0;border:0;}
body[data-surface="query"] #cardQueryPanel>.surface-title-row {display:none;}
body[data-surface="query"] #cardQueryField {position:relative;margin:0;}
body[data-surface="query"] #cardQueryField>label {position:absolute;top:-8px;left:9px;z-index:1;padding:0 4px;background:var(--paper);font-size:11px;line-height:16px;color:#637381;}
body[data-surface="query"] #cardQueryInput {display:block;height:148px;min-height:148px;width:100%;padding:15px 12px;border:1px solid #e5e8eb;border-radius:8px;background:var(--paper);font-size:14px;font-family:Arial,"Microsoft YaHei",sans-serif;line-height:19px;letter-spacing:0;resize:vertical;color:#07304b;}
.query-input-count {display:none;}
body[data-surface="query"] .query-input-count {display:block;margin-top:5px;text-align:right;color:#8493a3;font-size:11px;line-height:16px;}
body[data-surface="query"] .query-actions {display:block;margin:20px 0 0;}
body[data-surface="query"] #cardQueryBtn {height:43px;min-height:43px;margin:0;border-radius:7px;background:#1c272f;font-size:13px;line-height:19px;font-weight:600;padding:12px;}
body[data-surface="query"] #cardQuerySummary {display:flex;align-items:center;gap:8px;margin:18px 0;padding:0;}
body[data-surface="query"] #cardQueryResults {display:flex;flex-direction:column;gap:9px;margin:0;}
body[data-surface="query"] #cardQuerySummary .query-count-chip {display:inline-flex;align-items:center;gap:5px;padding:1px 7px;border-radius:12px;font-size:12px;font-weight:600;line-height:20px;}
.query-count-chip::before,.compact-query-state::before {content:"";width:6px;height:6px;border-radius:50%;background:currentColor;flex:none;}
.query-count-chip.unused {background:#def7e8;color:#00a66b;}
.query-count-chip.used {background:#f3f5f7;color:#63788b;}
.query-count-chip.other {background:#fff1ec;color:#b64525;}
.compact-query-card {border:1px solid #e5e8eb;border-radius:16px;background:var(--paper);margin:0;overflow:hidden;}
.compact-query-card summary {display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:57px;padding:10px 15px;list-style:none;cursor:pointer;}
.compact-query-card summary::-webkit-details-marker {display:none;}
.compact-query-copy {display:flex;flex:1;min-width:0;flex-direction:column;gap:2px;}
.compact-query-copy strong {font:400 11px/17px Arial,"Microsoft YaHei",sans-serif;color:#07304b;overflow-wrap:anywhere;}
.compact-query-copy small {font:400 10px/15px Arial,"Microsoft YaHei",sans-serif;color:#8493a3;overflow-wrap:anywhere;}
.compact-query-state {display:inline-flex;align-items:center;gap:5px;flex:none;font-size:11px;line-height:18px;font-weight:600;}
.compact-query-state.unused {color:#00a66b;}
.compact-query-state.used {color:#7a8fa2;}
.compact-query-state.other {color:#b64525;}
.compact-query-details {padding:10px 15px;border-top:1px solid #e5e8eb;font-size:12px;}
.compact-query-details p {margin:0 0 8px;}
body.dark-theme .compact-query-card,body.dark-theme[data-surface="query"] #cardQueryInput {border-color:var(--line);}
body.dark-theme .compact-query-copy strong,body.dark-theme[data-surface="query"] #cardQueryInput {color:var(--text);}
body.dark-theme .compact-query-copy small {color:var(--muted);}

.order-connection-panel {margin:12px 0;padding:14px;border:1px solid var(--line,#d7dee4);border-radius:10px;background:var(--paper,#fff);color:var(--text,#18364b);}
.order-connection-panel p {margin:0 0 12px;font-size:13px;line-height:1.6;overflow-wrap:anywhere;}
.order-connection-actions {display:flex;flex-wrap:wrap;gap:8px;}
.order-connection-actions .outline-button {flex:1 1 130px;min-height:44px;margin:0;padding:9px 12px;}
.order-connection-actions button:disabled {opacity:.65;cursor:wait;}
/* Network feedback must remain readable in both existing themes. */
.notice.request-connection-issue,
.input-status.request-connection-issue {
  color: #b42318;
}
body.dark-theme .notice.request-connection-issue,
body.dark-theme .input-status.request-connection-issue {
  color: #ffb4ab;
}
