/* ==========================================================================
   Redemption page polish
   Loaded last, on the customer redemption page only. Visual layer only:
   no element, id, class or data attribute that app.js relies on is changed.

   Shape of the page
     - one 820px column, hero and card share the same edges
     - one card; the steps inside sit on a rail instead of in nested boxes
     - the CDK field keeps a complete border beside the recognised plan

   Colours come from the existing theme tokens (--ui-*), so the classic,
   black and white themes all keep working.
   ========================================================================== */

:root[data-theme] .site-shell {
  --xd-col: 820px;
  --xd-rail: 48px;
  --xd-node: 32px;
  --xd-pad: 32px;
  --xd-hair: color-mix(in srgb, var(--ui-border) 72%, transparent);
  --xd-fill: color-mix(in srgb, var(--ui-text) 4.5%, var(--ui-surface));
  --xd-fill-strong: color-mix(in srgb, var(--ui-text) 8%, var(--ui-surface));
  --xd-input-border: color-mix(in srgb, var(--ui-text-muted) 78%, var(--ui-surface));
  --xd-input-fill: color-mix(in srgb, var(--ui-primary) 5%, var(--ui-surface));
  --xd-seg-on: color-mix(in srgb, var(--ui-text) 14%, transparent);
  --xd-card-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -18px rgba(0, 0, 0, .55);
  /* status tints: mixed in oklab so they stay clean instead of going grey */
  --xd-tint-info: color-mix(in oklab, var(--ui-primary) 13%, var(--ui-surface));
  --xd-tint-ok: color-mix(in oklab, var(--ui-success) 15%, var(--ui-surface));
  --xd-tint-bad: color-mix(in oklab, var(--ui-danger) 13%, var(--ui-surface));
  --xd-stub: var(--xd-tint-ok);
  --xd-mono: "JetBrains Mono", "Cascadia Mono", "SF Mono", "Roboto Mono", Consolas, ui-monospace, Menlo, monospace;
  --xd-sans: Inter, "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

:root[data-theme="white"] .site-shell {
  --xd-seg-on: #ffffff;
  --xd-card-shadow: 0 1px 2px rgba(23, 32, 56, .05), 0 18px 40px -20px rgba(23, 32, 56, .2);
  --xd-tint-info: color-mix(in oklab, var(--ui-primary) 9%, var(--ui-surface));
  --xd-tint-ok: color-mix(in oklab, #22c55e 11%, var(--ui-surface));
  --xd-tint-bad: color-mix(in oklab, #ef4444 9%, var(--ui-surface));
}

/* ---------- Page ---------- */

:root[data-theme] body.site-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--xd-sans);
  font-size: 14px;
  line-height: 1.6;
  background: var(--ui-canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:root[data-theme] .site-shell button,
:root[data-theme] .site-shell input,
:root[data-theme] .site-shell select,
:root[data-theme] .site-shell textarea {
  font-family: inherit;
}

:root[data-theme] .site-shell > main {
  flex: 1 0 auto;
  width: min(var(--xd-col), calc(100% - 40px));
  margin: 0 auto;
}

/* ---------- Top bar ---------- */

:root[data-theme] .site-shell .topbar {
  min-height: 60px;
  padding: 8px max(20px, calc((100% - 1120px) / 2));
  border-bottom: 1px solid var(--xd-hair);
  background: color-mix(in srgb, var(--ui-surface) 86%, transparent);
  box-shadow: none;
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
}

:root[data-theme] .site-shell .brand {
  gap: 11px;
}

:root[data-theme] .site-shell .brand-mark.brand-avatar-mark {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border-radius: 11px;
  border-color: var(--xd-hair);
  box-shadow: none;
}

:root[data-theme] .site-shell .brand strong {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
}

:root[data-theme] .site-shell .brand small {
  margin-top: 1px;
  font-size: 12px;
  letter-spacing: 0;
  color: var(--ui-text-soft);
}

:root[data-theme] .site-shell .top-actions {
  gap: 2px;
}

:root[data-theme] .site-shell .top-actions .soft-button,
:root[data-theme] .site-shell .top-actions .ghost-button {
  min-height: 34px;
  padding: 0 11px;
  gap: 6px;
  border: 0;
  border-radius: 9px;
  color: var(--ui-text-muted);
  background: transparent;
  box-shadow: none;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}

:root[data-theme] .site-shell .top-actions .soft-button:hover,
:root[data-theme] .site-shell .top-actions .ghost-button:hover {
  color: var(--ui-text);
  background: color-mix(in srgb, var(--ui-text) 7%, transparent);
  transform: none;
}

:root[data-theme] .site-shell .top-actions .front-admin-entry[data-authenticated="true"] {
  color: var(--ui-success-text);
  background: var(--ui-success-soft);
}

:root[data-theme] .site-shell .top-actions #upgradeEntry {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 8px 13px;
  margin-right: 10px;
  gap: 10px;
  border: 1px solid #315ed3;
  border-radius: 8px;
  background: #315ed3;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(49, 94, 211, .2);
}

:root[data-theme] .site-shell .top-actions #upgradeEntry:hover {
  background: #264cb7;
  border-color: #264cb7;
  color: #fff;
}

:root[data-theme] .site-shell .top-actions #upgradeEntry:focus-visible {
  outline: 3px solid var(--ui-primary);
  outline-offset: 3px;
}

.upgrade-entry-symbol {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .16);
  font-size: 20px;
  font-weight: 700;
}

.upgrade-entry-copy { display: grid; gap: 3px; text-align: left; }
.upgrade-entry-copy strong { color: inherit; font-size: 14px; font-weight: 700; line-height: 1.2; }
.upgrade-entry-copy small { color: inherit; font-size: 11px; font-weight: 500; line-height: 1.3; }
.upgrade-entry-arrow { margin-left: auto; font-size: 18px; line-height: 1; }

:root[data-theme] .site-shell .top-actions .top-action-icon {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
  color: currentColor;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  opacity: .8;
}

:root[data-theme] .site-shell .top-actions .language-icon {
  border: 1.5px solid currentColor;
  border-radius: 5px;
  font-size: 10px;
}

:root[data-theme] .site-shell .top-actions .theme-switch {
  min-height: 34px;
  margin-right: 8px;
  padding: 3px;
  gap: 0;
  border: 0;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ui-text) 7%, transparent);
  box-shadow: none;
}

:root[data-theme] .site-shell .top-actions .theme-switch button {
  min-height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  color: var(--ui-text-muted);
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 500;
}

:root[data-theme] .site-shell .top-actions .theme-switch button:hover {
  color: var(--ui-text);
}

:root[data-theme] .site-shell .top-actions .theme-switch button.is-active {
  color: var(--ui-text);
  background: var(--xd-seg-on);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 0 0 .5px color-mix(in srgb, var(--ui-text) 10%, transparent);
  font-weight: 600;
}

/* ---------- Hero: plain header on the canvas, with a live step tracker ---------- */

:root[data-theme] .site-shell .customer-hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px 36px;
  min-height: 0;
  margin: 40px 0 22px;
  padding: 0 4px;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

:root[data-theme] .site-shell .customer-hero-panel::before,
:root[data-theme] .site-shell .customer-hero-panel::after {
  content: none;
}

:root[data-theme] .site-shell .customer-hero-panel .pill {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--ui-primary-strong);
  background: none;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0;
}

:root[data-theme="black"] .site-shell .customer-hero-panel .pill,
:root[data-theme="classic"] .site-shell .customer-hero-panel .pill {
  color: var(--ui-primary);
}

:root[data-theme] .site-shell .customer-hero-panel .hero-copy h1 {
  max-width: none;
  margin: 6px 0 6px;
  color: var(--ui-text);
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.012em;
}

:root[data-theme] .site-shell .customer-hero-panel .hero-copy h1 span {
  margin: 0;
  color: inherit;
  background: none;
  -webkit-text-fill-color: currentColor;
}

:root[data-theme] .site-shell .customer-hero-panel .hero-copy p {
  margin: 0;
  color: var(--ui-text-muted);
  font-size: 15px;
}

:root[data-theme] .site-shell .customer-hero-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 3px;
}

:root[data-theme] .site-shell .customer-hero-steps li {
  position: static;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 9px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  text-align: left;
}

:root[data-theme] .site-shell .customer-hero-steps li::after {
  content: none;
}

:root[data-theme] .site-shell .customer-hero-steps li + li::before {
  content: "";
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: start;
  width: 28px;
  height: 2px;
  margin: 0 12px 0 14px;
  border-radius: 2px;
  background: var(--ui-border);
}

:root[data-theme] .site-shell .customer-hero-steps li + li {
  grid-template-columns: auto auto auto;
}

:root[data-theme] .site-shell .customer-hero-steps li + li::before {
  grid-column: 1;
}

:root[data-theme] .site-shell .customer-hero-steps li > span {
  position: static;
  width: 22px;
  height: 22px;
  transform: none;
  border: 1.5px solid var(--ui-border);
  color: var(--ui-text-soft);
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

:root[data-theme] .site-shell .customer-hero-steps li > strong {
  color: var(--ui-text-soft);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}

:root[data-theme] .site-shell .customer-hero-steps li > small {
  display: none;
}

/* current step */
:root[data-theme] .site-shell .customer-hero-steps li:first-child > span {
  border-color: var(--ui-primary-strong);
  color: #fff;
  background: var(--ui-primary-strong);
}

/* :has() rules are kept in their own blocks so older browsers only lose the live tracking */
:root[data-theme] .site-shell > main:has(.submission-row.credential-ready):not(:has(.submission-row:not(.credential-ready))) .customer-hero-steps li:nth-child(2) > span {
  border-color: var(--ui-primary-strong);
  color: #fff;
  background: var(--ui-primary-strong);
}

:root[data-theme] .site-shell .customer-hero-steps li:first-child > strong {
  color: var(--ui-text);
  font-weight: 600;
}

:root[data-theme] .site-shell > main:has(.submission-row.credential-ready):not(:has(.submission-row:not(.credential-ready))) .customer-hero-steps li:nth-child(2) > strong {
  color: var(--ui-text);
  font-weight: 600;
}

/* finished step */
:root[data-theme] .site-shell > main:has(.submission-row.credential-ready):not(:has(.submission-row:not(.credential-ready))) .customer-hero-steps li:first-child > span,
:root[data-theme] .site-shell > main:has(#step1 .all-rows-ready) .customer-hero-steps li > span,
:root[data-theme] .site-shell > main:has(#step3:not(.hidden)) .customer-hero-steps li > span {
  border-color: var(--ui-success);
  color: #fff;
  background: var(--ui-success);
  font-size: 0;
}

:root[data-theme] .site-shell > main:has(.submission-row.credential-ready):not(:has(.submission-row:not(.credential-ready))) .customer-hero-steps li:first-child > span::after,
:root[data-theme] .site-shell > main:has(#step1 .all-rows-ready) .customer-hero-steps li > span::after,
:root[data-theme] .site-shell > main:has(#step3:not(.hidden)) .customer-hero-steps li > span::after {
  content: "✓";
  font-size: 12px;
  font-weight: 700;
}

:root[data-theme] .site-shell > main:has(.submission-row.credential-ready):not(:has(.submission-row:not(.credential-ready))) .customer-hero-steps li:first-child > strong,
:root[data-theme] .site-shell > main:has(#step1 .all-rows-ready) .customer-hero-steps li > strong,
:root[data-theme] .site-shell > main:has(#step3:not(.hidden)) .customer-hero-steps li > strong {
  color: var(--ui-text-muted);
  font-weight: 500;
}

:root[data-theme] .site-shell > main:has(.submission-row.credential-ready):not(:has(.submission-row:not(.credential-ready))) .customer-hero-steps li + li::before,
:root[data-theme] .site-shell > main:has(#step3:not(.hidden)) .customer-hero-steps li + li::before {
  background: var(--ui-success);
}

/* ---------- Buttons ---------- */

:root[data-theme] .site-shell .primary-button,
:root[data-theme] .site-shell .success-button,
:root[data-theme] .site-shell .soft-button,
:root[data-theme] .site-shell .ghost-button {
  min-height: 44px;
  padding: 0 18px;
  gap: 8px;
  border-radius: 12px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .08s ease;
}

:root[data-theme] .site-shell .primary-button:hover,
:root[data-theme] .site-shell .success-button:hover,
:root[data-theme] .site-shell .soft-button:hover,
:root[data-theme] .site-shell .ghost-button:hover,
:root[data-theme] .site-shell .text-button:hover {
  transform: none;
}

:root[data-theme] .site-shell .primary-button:active,
:root[data-theme] .site-shell .success-button:active,
:root[data-theme] .site-shell .soft-button:active,
:root[data-theme] .site-shell .ghost-button:active {
  transform: translateY(1px);
}

:root[data-theme] .site-shell .primary-button {
  border: 0;
  color: #fff;
  background: var(--ui-primary-strong);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08), 0 8px 18px -8px color-mix(in srgb, var(--ui-primary-strong) 70%, transparent);
}

:root[data-theme] .site-shell .primary-button:hover {
  background: color-mix(in srgb, var(--ui-primary-strong) 88%, #000);
}

:root[data-theme] .site-shell .success-button {
  border: 0;
  color: #fff;
  background: var(--ui-success);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08), 0 8px 18px -8px color-mix(in srgb, var(--ui-success) 70%, transparent);
}

:root[data-theme] .site-shell .success-button:hover {
  background: color-mix(in srgb, var(--ui-success) 88%, #000);
}

:root[data-theme] .site-shell main .soft-button,
:root[data-theme] .site-shell main .ghost-button,
:root[data-theme] .site-shell .modal .soft-button,
:root[data-theme] .site-shell .modal .ghost-button {
  border: 1px solid var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface);
  box-shadow: none;
  font-weight: 500;
}

:root[data-theme] .site-shell main .soft-button:hover,
:root[data-theme] .site-shell main .ghost-button:hover,
:root[data-theme] .site-shell .modal .soft-button:hover,
:root[data-theme] .site-shell .modal .ghost-button:hover {
  border-color: color-mix(in srgb, var(--ui-text) 28%, var(--ui-border));
  background: var(--xd-fill);
}

:root[data-theme] .site-shell .primary-button.compact,
:root[data-theme] .site-shell .soft-button.compact,
:root[data-theme] .site-shell .ghost-button.compact {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 11px;
  font-size: 14px;
}

:root[data-theme] .site-shell .primary-button:disabled,
:root[data-theme] .site-shell .success-button:disabled {
  opacity: .5;
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
}

:root[data-theme] .site-shell :is(button, a, summary, input, select, textarea):focus-visible {
  outline: 2px solid var(--ui-primary);
  outline-offset: 2px;
}

/* ---------- Card ---------- */

:root[data-theme] .site-shell #step1.flow-card,
:root[data-theme] .site-shell #step3.flow-card {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 28px var(--xd-pad) var(--xd-pad);
  border: 1px solid var(--xd-hair);
  border-radius: 20px;
  background: var(--ui-surface);
  box-shadow: var(--xd-card-shadow);
}

:root[data-theme] .site-shell #step1 .section-heading {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 26px;
  padding: 0;
  border: 0;
}

:root[data-theme] .site-shell #step1 .section-heading > div {
  flex: 1 1 auto;
  min-width: 0;
}

:root[data-theme] .site-shell #step1 .section-heading h2 {
  margin: 0 0 3px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}

:root[data-theme] .site-shell #step1 .section-heading p {
  margin: 0;
  color: var(--ui-text-muted);
  font-size: 14px;
}

:root[data-theme] .site-shell #step1 #addSubmissionRow {
  flex: 0 0 auto;
  width: auto;
  min-height: 34px;
  margin: -3px -8px 0 0;
  padding: 0 10px;
  border: 0;
  border-radius: 9px;
  color: var(--ui-primary-strong);
  background: transparent;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}

:root[data-theme="black"] .site-shell #step1 #addSubmissionRow,
:root[data-theme="classic"] .site-shell #step1 #addSubmissionRow {
  color: var(--ui-primary);
}

:root[data-theme] .site-shell #step1 #addSubmissionRow:hover {
  background: var(--ui-primary-soft);
}

:root[data-theme] .site-shell #step1 .batch-submission-form {
  gap: 20px;
}

:root[data-theme] .site-shell #step1 .activation-mode-panel {
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--xd-fill);
}

:root[data-theme] .site-shell #step1 .activation-mode-panel[data-state="blocked"] {
  background: color-mix(in srgb, var(--ui-danger) 9%, var(--ui-surface));
}

:root[data-theme] .site-shell #step1 .activation-mode-kicker {
  color: var(--ui-text-muted);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

:root[data-theme] .site-shell #step1 .activation-mode-panel strong {
  font-size: 14.5px;
  font-weight: 650;
}

:root[data-theme] .site-shell #step1 .activation-mode-panel small {
  font-size: 13px;
}

:root[data-theme] .site-shell #step1 .activation-mode-badge {
  padding: 4px 10px;
  color: var(--ui-text-muted);
  background: color-mix(in srgb, var(--ui-text) 8%, transparent);
  font-size: 12px;
  font-weight: 600;
}

:root[data-theme] .site-shell #step1 .site-access-key-panel {
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

:root[data-theme] .site-shell #step1 .site-access-key-panel input {
  margin: 0;
  min-height: 52px;
}

:root[data-theme] .site-shell #step1 .activation-secret-notice {
  padding: 11px 16px;
  border: 0;
  border-radius: 12px;
  color: var(--ui-warning-text);
  background: var(--ui-warning-soft);
  font-size: 13px;
}

/* ---------- Rows and the step rail ---------- */

:root[data-theme] .site-shell #step1 .submission-rows {
  gap: 16px;
}

:root[data-theme] .site-shell #step1 .submission-row {
  --xd-row-pad: 0px;
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

/* batch mode: each account group becomes its own panel */
:root[data-theme] .site-shell #submissionRows .submission-row:not(:only-child) {
  --xd-row-pad: 20px;
  padding: 16px var(--xd-row-pad) var(--xd-row-pad);
  border: 1px solid var(--xd-hair);
  border-radius: 16px;
}

:root[data-theme] .site-shell #step1 .submission-row-head {
  min-height: 0;
  margin: 0 0 18px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--xd-hair);
}

:root[data-theme] .site-shell #step1 .submission-row-head strong {
  font-size: 14.5px;
  font-weight: 700;
}

:root[data-theme] .site-shell #step1 .submission-row-head [data-row-summary] {
  color: var(--ui-text-muted);
  font-size: 13px;
}

:root[data-theme] .site-shell #step1 .submission-row-head .remove-row {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: var(--ui-danger-text);
  background: transparent;
  font-size: 13px;
}

:root[data-theme] .site-shell #step1 .submission-row-head .remove-row:hover {
  background: var(--ui-danger-soft);
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field],
:root[data-theme] .site-shell #step1 .submission-row > .submission-plan-field,
:root[data-theme] .site-shell #step1 .submission-row > .session-entry {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: none;
  align-content: start;
  gap: 8px;
  padding: 0 0 26px var(--xd-rail);
  border: 0;
  border-radius: 0;
  background: none;
}

:root[data-theme] .site-shell #step1 .submission-row > .session-entry {
  padding-bottom: 0;
}

/* step 2 stays hidden until step 1 passes, and again once the account is recognised */
:root[data-theme] .site-shell #step1 .submission-row:not(.credential-ready) > .customer-progressive-step,
:root[data-theme] .site-shell #step1 .submission-row.session-ready > .customer-progressive-step {
  display: none;
}

/* rail segment under step 1 */
:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]::before,
:root[data-theme] .site-shell #step1 .submission-row > .submission-plan-field::before {
  content: "";
  position: absolute;
  top: calc(var(--xd-node) + 6px);
  bottom: 6px;
  left: calc(var(--xd-node) / 2 - 1px);
  width: 2px;
  border-radius: 2px;
  background: var(--ui-border);
}

:root[data-theme] .site-shell #step1 .submission-row.credential-ready > [data-cdk-field]::before,
:root[data-theme] .site-shell #step1 .submission-row.credential-ready > .submission-plan-field::before {
  background: color-mix(in srgb, var(--ui-success) 55%, var(--ui-border));
}

:root[data-theme] .site-shell #step1 .customer-step-label {
  grid-area: auto;
  min-height: var(--xd-node);
  margin: 0;
  color: var(--ui-text);
  font-size: 15.5px !important; /* legacy rule pins this at 13px with !important */
  font-weight: 650;
  line-height: 1.4;
}

:root[data-theme] .site-shell #step1 .customer-step-label > span {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--xd-node);
  height: var(--xd-node);
  color: #fff;
  background: var(--ui-primary-strong);
  box-shadow: none;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
}

/* step 1 done */
:root[data-theme] .site-shell #step1 .submission-row.credential-ready > [data-cdk-field] > .customer-step-label > span,
:root[data-theme] .site-shell #step1 .submission-row.credential-ready > .submission-plan-field > .customer-step-label > span {
  background: var(--ui-success);
  font-size: 0;
}

:root[data-theme] .site-shell #step1 .submission-row.credential-ready > [data-cdk-field] > .customer-step-label > span::after,
:root[data-theme] .site-shell #step1 .submission-row.credential-ready > .submission-plan-field > .customer-step-label > span::after {
  content: "✓";
  font-size: 15px;
  font-weight: 700;
}

/* step 2 while it is still locked: a quiet line on the rail, not a dashed box */
:root[data-theme] .site-shell #step1 .submission-row:not(.credential-ready)::before {
  content: "2";
  position: absolute;
  left: var(--xd-row-pad);
  bottom: var(--xd-row-pad);
  display: grid;
  place-items: center;
  width: var(--xd-node);
  height: var(--xd-node);
  border: 1.5px solid var(--ui-border);
  border-radius: 999px;
  color: var(--ui-text-soft);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

:root[data-theme] .site-shell #step1 .submission-row:not(.credential-ready)::after {
  content: "登录并获取账号信息（卡密验证通过后自动展开）";
  display: block;
  min-height: var(--xd-node);
  padding: 0 0 0 var(--xd-rail);
  border: 0;
  border-radius: 0;
  color: var(--ui-text-soft);
  background: none;
  font-size: 15px;
  font-weight: 500;
  line-height: var(--xd-node);
  text-align: left;
}

/* ---------- Fields ---------- */

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field] > input,
:root[data-theme] .site-shell #step1 .submission-row > .submission-plan-field > select,
:root[data-theme] .site-shell #step1 .site-access-key-panel input {
  grid-area: auto;
  width: 100%;
  min-height: 56px;
  margin: 4px 0 0;
  padding: 0 18px;
  border: 1.5px solid transparent;
  border-radius: 14px;
  color: var(--ui-text);
  background-color: var(--xd-fill);
  box-shadow: none;
  font-size: 15px;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

:root[data-theme] .site-shell #step1 .submission-row > .submission-plan-field > select {
  height: auto;
  padding-right: 46px;
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ui-text-muted) 50%),
    linear-gradient(135deg, var(--ui-text-muted) 50%, transparent 50%);
  background-position: calc(100% - 24px) 50%, calc(100% - 18px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field] > input {
  border-width: 2px;
  border-color: var(--xd-input-border);
  background-color: var(--xd-input-fill);
  font-family: var(--xd-mono);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: .03em;
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field] > input::placeholder {
  color: var(--ui-text-muted);
  opacity: 1;
  font-weight: 400;
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field] > input:hover,
:root[data-theme] .site-shell #step1 .submission-row > .submission-plan-field > select:hover,
:root[data-theme] .site-shell #step1 .site-access-key-panel input:hover {
  background-color: var(--xd-fill-strong);
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field] > input:hover {
  border-color: var(--ui-primary);
  background-color: var(--xd-input-fill);
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field] > input:focus,
:root[data-theme] .site-shell #step1 .submission-row > .submission-plan-field > select:focus,
:root[data-theme] .site-shell #step1 .site-access-key-panel input:focus {
  border-color: var(--ui-primary);
  background-color: var(--ui-surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ui-primary) 16%, transparent);
  outline: none;
}

:root[data-theme] .site-shell #step1 .field-hint {
  grid-area: auto;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

:root[data-theme] .site-shell #step1 .field-hint.ok::before {
  content: "✓ ";
  font-weight: 700;
}

:root[data-theme] .site-shell #step1 .site-access-key-panel label {
  font-size: 14px;
  font-weight: 600;
}

/* Recognised plan, separated from the input field. */
:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field] > .cdk-plan-display {
  position: relative;
  grid-area: auto;
  align-self: stretch;
  min-height: 52px;
  margin: 0;
  padding: 10px 18px;
  border: 0;
  border-radius: 14px;
  color: var(--ui-success-text);
  background: var(--xd-stub);
}

:root[data-theme] .site-shell #step1 .cdk-plan-display span {
  color: color-mix(in srgb, var(--ui-success-text) 76%, var(--ui-text-muted));
  font-size: 12.5px;
  font-weight: 500;
}

:root[data-theme] .site-shell #step1 .cdk-plan-display strong {
  color: var(--ui-success-text);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
}

/* Keep the input outline intact when the plan is displayed. */
:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]:has(> .cdk-plan-display:not(.hidden)) {
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px);
  grid-template-areas:
    "label label"
    "control plan"
    "status status";
  column-gap: 12px;
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]:has(> .cdk-plan-display:not(.hidden)) > .customer-step-label {
  grid-area: label;
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]:has(> .cdk-plan-display:not(.hidden)) > input {
  grid-area: control;
  border-width: 2px;
  border-radius: 14px;
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]:has(> .cdk-plan-display:not(.hidden)) > .field-hint {
  grid-area: status;
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]:has(> .cdk-plan-display:not(.hidden)) > .cdk-plan-display {
  grid-area: plan;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  min-height: 56px;
  margin: 4px 0 0;
  padding: 6px 18px;
  border: 0;
  border-radius: 14px;
}

:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]:has(> .cdk-plan-display:not(.hidden)) > .cdk-plan-display::before,
:root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]:has(> .cdk-plan-display:not(.hidden)) > .cdk-plan-display::after {
  content: none;
}

/* Go plan warning sits on the rail too */
:root[data-theme] .site-shell #step1 .submission-row > .go-plan-warning::before {
  content: "";
  position: absolute;
  top: -8px;
  bottom: -16px;
  left: calc(var(--xd-rail) * -1 + var(--xd-node) / 2 - 1px);
  width: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ui-success) 55%, var(--ui-border));
}

:root[data-theme] .site-shell #step1 .submission-row > .go-plan-warning {
  position: relative;
  margin: -8px 0 22px var(--xd-rail);
  padding: 12px 16px;
  border: 0;
  border-radius: 12px;
  background: var(--ui-warning-soft);
  box-shadow: none;
}

:root[data-theme] .site-shell #step1 .go-plan-warning span {
  font-size: 13px;
}

/* ---------- Step 2 ---------- */

:root[data-theme] .site-shell #step1 .session-entry > .customer-step-label,
:root[data-theme] .site-shell #step1 .session-entry > .session-entry-help,
:root[data-theme] .site-shell #step1 .session-entry > .session-entry-actions,
:root[data-theme] .site-shell #step1 .session-entry > textarea,
:root[data-theme] .site-shell #step1 .session-entry > .field-hint {
  grid-column: 1;
  grid-row: auto;
}

:root[data-theme] .site-shell #step1 .session-entry-help {
  margin: 0;
  color: var(--ui-text-muted);
  font-size: 14px;
  line-height: 1.6;
}

:root[data-theme] .site-shell #step1 .session-entry-actions {
  align-items: center;
  gap: 8px;
  margin: 6px 0 0;
}

:root[data-theme] .site-shell #step1 .session-entry-actions > .primary-button {
  flex: 0 0 auto;
  min-height: 46px;
  padding: 0 22px;
  font-size: 15px;
}

:root[data-theme] .site-shell #step1 .session-entry-actions .soft-button.compact {
  min-height: 46px;
}

:root[data-theme] .site-shell #step1 .session-more-actions > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 46px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  color: var(--ui-text-muted);
  background: transparent;
  font-size: 14px;
  font-weight: 500;
}

:root[data-theme] .site-shell #step1 .session-more-actions > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  transition: transform .15s ease;
}

:root[data-theme] .site-shell #step1 .session-more-actions[open] > summary::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}

:root[data-theme] .site-shell #step1 .session-more-actions > summary:hover {
  color: var(--ui-text);
  background: var(--xd-fill);
}

:root[data-theme] .site-shell #step1 .session-more-actions[open] {
  flex-wrap: wrap;
  gap: 8px;
}

:root[data-theme] .site-shell #step1 .session-file-name {
  font-size: 13px;
}

:root[data-theme] .site-shell #step1 .submission-row .session-entry > textarea {
  min-height: 112px;
  height: auto;
  margin: 8px 0 0;
  padding: 14px 16px;
  border: 2px solid var(--xd-input-border);
  border-radius: 14px;
  color: var(--ui-text);
  background: var(--xd-input-fill);
  box-shadow: none;
  font-family: var(--xd-mono);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

:root[data-theme] .site-shell #step1 .submission-row .session-entry > textarea::placeholder {
  color: var(--ui-text-muted);
  opacity: 1;
  font-family: var(--xd-sans);
  font-size: 14px;
}

:root[data-theme] .site-shell #step1 .submission-row .session-entry > textarea:hover {
  border-color: var(--ui-primary);
}

:root[data-theme] .site-shell #step1 .submission-row .session-entry > textarea:focus {
  border-color: var(--ui-primary);
  background: var(--ui-surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ui-primary) 16%, transparent);
  outline: none;
}

/* recognised account */
:root[data-theme] .site-shell #step1 .submission-row.session-ready > .session-recognized {
  position: relative;
  grid-column: 1;
  flex-wrap: nowrap;
  gap: 12px;
  min-height: 0;
  margin: 0 0 0 var(--xd-rail);
  padding: 14px 14px 14px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--xd-stub);
}

:root[data-theme] .site-shell #step1 .session-recognized-icon {
  position: absolute;
  top: 50%;
  left: calc(var(--xd-rail) * -1);
  width: var(--xd-node);
  height: var(--xd-node);
  flex-basis: var(--xd-node);
  margin-top: calc(var(--xd-node) / -2);
  background: var(--ui-success);
  font-size: 15px;
  font-weight: 700;
}

:root[data-theme] .site-shell #step1 .submission-row.session-ready > .session-recognized::before {
  content: "";
  position: absolute;
  top: -6px;
  bottom: calc(50% + var(--xd-node) / 2 + 6px);
  left: calc(var(--xd-rail) * -1 + var(--xd-node) / 2 - 1px);
  width: 2px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ui-success) 55%, var(--ui-border));
}

:root[data-theme] .site-shell #step1 .session-recognized p {
  gap: 1px;
}

:root[data-theme] .site-shell #step1 .session-recognized strong {
  color: color-mix(in srgb, var(--ui-success-text) 76%, var(--ui-text-muted));
  font-size: 12.5px;
  font-weight: 500;
}

:root[data-theme] .site-shell #step1 .session-recognized small {
  overflow: visible;
  color: var(--ui-text);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

:root[data-theme] .site-shell #step1 .submission-row.session-ready > .session-recognized > button {
  flex: 0 0 auto;
  min-height: 36px;
  margin-left: auto;
  padding: 0 13px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ui-surface) 70%, transparent);
  border-color: color-mix(in srgb, var(--ui-success) 30%, var(--ui-border));
  font-size: 13.5px;
}

/* ---------- Notice and submit ---------- */

:root[data-theme] .site-shell #step1 .safe-tip {
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--ui-text-muted);
  background: var(--xd-fill);
  font-size: 13.5px;
  line-height: 1.6;
}

:root[data-theme] .site-shell #step1 .safe-tip:empty {
  display: none;
}

:root[data-theme] .site-shell #step1 .customer-submit-bar {
  gap: 16px;
  margin: 4px 0 0;
  padding: 22px 0 0;
  border-top: 1px solid var(--xd-hair);
}

:root[data-theme] .site-shell #step1 .customer-submit-bar p {
  font-size: 14px;
}

:root[data-theme] .site-shell #step1 .all-rows-ready .customer-submit-bar p {
  color: var(--ui-success-text);
  font-weight: 500;
}

:root[data-theme] .site-shell #step1 .customer-submit-bar .primary-button {
  min-width: 208px;
  min-height: 48px;
  padding: 0 26px;
  font-size: 15.5px;
}

/* ---------- Result page ---------- */

:root[data-theme] .site-shell #step3 .result-panel {
  max-width: none;
}

:root[data-theme] .site-shell #step3 .result-panel > h2 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}

:root[data-theme] .site-shell #step3 .result-panel > p {
  font-size: 14px;
  line-height: 1.6;
}

:root[data-theme] .site-shell #step3 .customer-order-progress {
  margin: 24px 0 8px;
  padding: 20px 22px 18px;
  border: 0;
  border-radius: 16px;
  background: var(--xd-tint-info);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ui-primary) 22%, transparent);
}

:root[data-theme] .site-shell #step3 .customer-order-progress::before {
  content: none;
}

:root[data-theme] .site-shell #step3 .customer-order-progress[data-status="success"] {
  background: var(--xd-tint-ok);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ui-success) 26%, transparent);
}

:root[data-theme] .site-shell #step3 .customer-order-progress[data-status="failed"] {
  background: var(--xd-tint-bad);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ui-danger) 24%, transparent);
}

:root[data-theme] .site-shell #step3 .customer-order-progress-copy > span {
  font-size: 12.5px;
  font-weight: 600;
}

:root[data-theme] .site-shell #step3 .customer-order-progress-copy > strong {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.45;
}

:root[data-theme] .site-shell #step3 .customer-order-progress-copy > small {
  font-size: 13.5px;
}

:root[data-theme] .site-shell #step3 .customer-order-progress-track {
  margin: 16px 0 14px;
}

:root[data-theme] .site-shell #step3 .customer-order-progress-steps li > span {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

:root[data-theme] .site-shell #step3 .customer-order-progress-steps li > strong {
  font-size: 13px;
  font-weight: 500;
}

:root[data-theme] .site-shell #step3 .customer-order-progress-steps li.active > strong {
  font-weight: 650;
}

:root[data-theme] .site-shell #step3 .result-panel > dl {
  gap: 0 32px;
  margin: 0 0 4px;
  overflow: visible;
  border: 0;
  border-radius: 0;
}

:root[data-theme] .site-shell #step3 .result-panel > dl > div,
:root[data-theme] .site-shell #step3 .result-panel > dl > div:last-child {
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  padding: 14px 2px;
  border: 0;
  border-bottom: 1px solid var(--xd-hair);
  border-radius: 0;
  background: none;
}

:root[data-theme] .site-shell #step3 .result-panel dt {
  color: var(--ui-text-muted);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.6;
}

:root[data-theme] .site-shell #step3 .result-panel dd {
  margin: 0;
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

:root[data-theme] .site-shell #step3 .button-row {
  margin: 0;
  padding: 18px 0 0;
  border: 0;
  background: color-mix(in srgb, var(--ui-surface) 94%, transparent);
}

:root[data-theme] .site-shell #step3 .button-row > button {
  min-height: 44px;
  border-radius: 12px;
}

/* when "重新提交" or "完成" is on offer, "提交新卡密" steps back to a secondary button */
:root[data-theme] .site-shell #step3 .button-row:has(#resubmitOrder:not(.hidden), #completeFlow:not(.hidden)) > #newSubmissionButton {
  border: 1px solid var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface);
  box-shadow: none;
  font-weight: 500;
}

:root[data-theme] .site-shell #step3 .button-row:has(#resubmitOrder:not(.hidden), #completeFlow:not(.hidden)) > #newSubmissionButton:hover {
  border-color: color-mix(in srgb, var(--ui-text) 28%, var(--ui-border));
  background: var(--xd-fill);
}

/* list of all orders submitted from this page */
:root[data-theme] .site-shell #step3 .tracked-orders-panel {
  margin-top: 24px;
  border: 1px solid var(--xd-hair);
  border-radius: 16px;
  background: none;
  box-shadow: none;
}

:root[data-theme] .site-shell #step3 .tracked-orders-head {
  padding: 13px 18px;
  border-bottom: 1px solid var(--xd-hair);
  background: var(--xd-fill);
}

:root[data-theme] .site-shell #step3 .tracked-orders-head strong {
  font-size: 14.5px;
  font-weight: 650;
}

:root[data-theme] .site-shell #step3 .tracked-orders-head span {
  color: var(--ui-text-muted);
  font-size: 13px;
}

:root[data-theme] .site-shell #step3 .tracked-order.status-pending,
:root[data-theme] .site-shell #step3 .tracked-order.status-success,
:root[data-theme] .site-shell #step3 .tracked-order.status-failed {
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--xd-hair);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .15s ease;
}

:root[data-theme] .site-shell #step3 .tracked-order.status-pending:last-child,
:root[data-theme] .site-shell #step3 .tracked-order.status-success:last-child,
:root[data-theme] .site-shell #step3 .tracked-order.status-failed:last-child {
  border-bottom: 0;
}

:root[data-theme] .site-shell #step3 .tracked-orders-list {
  scrollbar-gutter: auto;
}

:root[data-theme] .site-shell #step3 .tracked-order:not(.active):hover {
  background: var(--xd-fill);
}

:root[data-theme] .site-shell #step3 .tracked-order strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

:root[data-theme] .site-shell #step3 .tracked-order > div:first-of-type > strong {
  font-family: var(--xd-mono);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: .01em;
}

:root[data-theme] .site-shell #step3 .tracked-order span {
  font-size: 13px;
  line-height: 1.55;
}

:root[data-theme] .site-shell #step3 .tracked-order .tracked-order-dot {
  width: 9px;
  height: 9px;
  box-shadow: none;
}

:root[data-theme] .site-shell #step3 .tracked-order .tracked-order-action {
  margin-top: 2px;
  font-size: 12.5px;
  font-weight: 500;
}

/* ---------- Dialogs ---------- */

:root[data-theme] .site-shell .modal {
  border-radius: 20px;
}

:root[data-theme] .site-shell .modal > .modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  left: auto;
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 0;
  height: 32px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: var(--ui-text-muted);
  background: transparent;
  box-shadow: none;
  font-size: 20px;
  line-height: 1;
}

:root[data-theme] .site-shell .modal > .modal-close:hover {
  color: var(--ui-text);
  background: color-mix(in srgb, var(--ui-text) 8%, transparent);
}

:root[data-theme] .site-shell .modal h2 {
  font-weight: 700;
  letter-spacing: 0;
}

:root[data-theme] .site-shell .modal-form label {
  font-size: 13.5px;
}

:root[data-theme] .site-shell .modal-form input {
  min-height: 48px;
  padding: 0 16px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: var(--xd-fill);
  box-shadow: none;
  font-size: 15px;
}

:root[data-theme] .site-shell .modal-form input:focus {
  border-color: var(--ui-primary);
  background: var(--ui-surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ui-primary) 16%, transparent);
  outline: none;
}

:root[data-theme] .site-shell #queryModal .query-form-row button {
  min-height: 48px;
  border-radius: 12px;
}

/* legacy rule centres this close button above the icon; put it where the others are */
:root[data-theme] .site-shell #confirmModal .modal-close {
  top: 14px;
  right: 14px;
  left: auto;
  transform: none;
  font-size: 20px;
  font-weight: 400;
}

/* confirm: one clear primary, the alternative steps back */
:root[data-theme] .site-shell #confirmModal .recharge-confirm-modal {
  padding: 32px 26px 26px;
  border-radius: 20px;
}

:root[data-theme] .site-shell #confirmModal .confirm-status-icon {
  margin-top: 0;
  box-shadow: none;
}

:root[data-theme] .site-shell #confirmModal .confirm-box {
  margin: 18px 0 22px;
  border: 0;
  border-radius: 14px;
  background: var(--xd-fill);
}

:root[data-theme] .site-shell #confirmModal .confirm-box div {
  padding: 13px 16px;
}

:root[data-theme] .site-shell #confirmModal .confirm-box div:not(:last-child) {
  border-bottom: 2px dashed var(--ui-surface);
}

:root[data-theme] .site-shell #confirmModal .confirm-box span {
  font-size: 13.5px;
}

:root[data-theme] .site-shell #confirmModal .confirm-box strong {
  font-size: 14.5px;
  font-weight: 600;
}

:root[data-theme] .site-shell #confirmModal #confirmCdk {
  font-family: var(--xd-mono);
  font-weight: 500;
  letter-spacing: .02em;
}

:root[data-theme] .site-shell #confirmModal .success-button.wide,
:root[data-theme] .site-shell #confirmModal .primary-button.wide {
  min-height: 48px;
  font-size: 15.5px;
}

:root[data-theme] .site-shell #confirmModal #switchAccount {
  margin-top: 10px;
  border: 1px solid var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface);
  box-shadow: none;
  font-weight: 500;
}

:root[data-theme] .site-shell #confirmModal #switchAccount:hover {
  border-color: color-mix(in srgb, var(--ui-text) 28%, var(--ui-border));
  background: var(--xd-fill);
}

:root[data-theme] .site-shell #confirmModal .button-icon {
  width: 20px;
  height: 20px;
  background: transparent;
  font-size: 16px;
  font-weight: 700;
}

/* tutorial: same flat primary as the rest of the page */
:root[data-theme] .site-shell #guideModal .guide-actions .primary-button,
:root[data-theme] .site-shell #guideModal .customer-session-steps .guide-step-button.primary-button {
  border: 0;
  color: #fff;
  background: var(--ui-primary-strong);
  box-shadow: 0 1px 1px rgba(0, 0, 0, .08), 0 8px 18px -8px color-mix(in srgb, var(--ui-primary-strong) 70%, transparent);
}

:root[data-theme] .site-shell #guideModal .guide-actions .primary-button:hover,
:root[data-theme] .site-shell #guideModal .customer-session-steps .guide-step-button.primary-button:hover {
  background: color-mix(in srgb, var(--ui-primary-strong) 88%, #000);
}

/* ---------- Footer ---------- */

:root[data-theme] .site-shell .footer-line {
  width: min(var(--xd-col), calc(100% - 40px));
  margin: 36px auto 0;
  padding: 0 4px 28px;
  border: 0;
  color: var(--ui-text-soft);
  font-size: 12.5px;
  text-align: center;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 820px) {
  :root[data-theme] .site-shell .customer-hero-panel {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    margin-top: 28px;
  }
}

@media (max-width: 640px) {
  :root[data-theme] .site-shell {
    --xd-pad: 18px;
    --xd-rail: 0px;
    --xd-node: 26px;
  }

  :root[data-theme] .site-shell > main {
    width: calc(100% - 24px);
  }

  :root[data-theme] .site-shell .topbar {
    min-height: 54px;
    padding: 8px 14px;
  }

  :root[data-theme] .site-shell .top-actions #openQuery {
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--ui-border);
    color: var(--ui-text);
  }

  :root[data-theme] .site-shell .topbar:has(#upgradeEntry) { flex-wrap: wrap; }
  :root[data-theme] .site-shell .top-actions:has(#upgradeEntry) {
    flex: 1 0 100%;
    flex-wrap: nowrap;
    width: 100%;
    margin-left: 0;
    gap: 10px;
    align-items: stretch;
  }
  :root[data-theme] .site-shell .top-actions #upgradeEntry { flex: 1 1 0; width: auto; min-width: 0; margin-right: 0; }
  :root[data-theme] .site-shell #upgradeEntry .upgrade-entry-arrow { display: none; }
  :root[data-theme] .site-shell .top-actions:has(#upgradeEntry) #openQuery { flex: 0 0 auto; align-self: center; }

  :root[data-theme] .site-shell .customer-hero-panel {
    display: grid;
    gap: 14px;
    margin: 22px 0 16px;
    padding: 0 2px;
  }

  :root[data-theme] .site-shell .customer-hero-panel .hero-copy h1 {
    font-size: 25px;
  }

  :root[data-theme] .site-shell .customer-hero-panel .hero-copy p {
    font-size: 14.5px;
  }

  :root[data-theme] .site-shell .customer-hero-steps {
    flex-wrap: wrap;
    row-gap: 8px;
    margin: 0;
  }

  :root[data-theme] .site-shell .customer-hero-steps li + li::before {
    width: 16px;
    margin: 0 8px;
  }

  :root[data-theme] .site-shell .customer-hero-steps li > strong {
    font-size: 13px;
  }

  :root[data-theme] .site-shell #step1.flow-card,
  :root[data-theme] .site-shell #step3.flow-card {
    padding: 20px var(--xd-pad) 22px;
    border-radius: 18px;
  }

  :root[data-theme] .site-shell #step1 .section-heading {
    margin-bottom: 20px;
  }

  :root[data-theme] .site-shell #step1 .section-heading h2 {
    font-size: 19px;
  }

  :root[data-theme] .site-shell #submissionRows .submission-row:not(:only-child) {
    --xd-row-pad: 14px;
  }

  /* no rail on phones: number sits beside its label */
  :root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field],
  :root[data-theme] .site-shell #step1 .submission-row > .submission-plan-field {
    padding-bottom: 22px;
  }

  :root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]::before,
  :root[data-theme] .site-shell #step1 .submission-row > .submission-plan-field::before,
  :root[data-theme] .site-shell #step1 .submission-row.session-ready > .session-recognized::before {
    content: none;
  }

  :root[data-theme] .site-shell #step1 .customer-step-label {
    gap: 9px;
    font-size: 15px !important;
  }

  :root[data-theme] .site-shell #step1 .customer-step-label > span {
    position: static;
    flex: 0 0 var(--xd-node);
    font-size: 13px;
  }

  :root[data-theme] .site-shell #step1 .submission-row:not(.credential-ready)::before {
    font-size: 13px;
  }

  :root[data-theme] .site-shell #step1 .submission-row:not(.credential-ready)::after {
    content: "登录并获取账号信息";
    padding-left: calc(var(--xd-node) + 9px);
  }

  :root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field] > input {
    min-height: 54px;
    padding: 0 15px;
    font-size: 16px;
    letter-spacing: .01em;
  }

  /* Stack the separate plan below the complete input on phones. */
  :root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]:has(> .cdk-plan-display:not(.hidden)) {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "label"
      "control"
      "plan"
      "status";
    row-gap: 8px;
  }

  :root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]:has(> .cdk-plan-display:not(.hidden)) > .customer-step-label {
    margin-bottom: 0;
  }

  :root[data-theme] .site-shell #step1 .submission-row > [data-cdk-field]:has(> .cdk-plan-display:not(.hidden)) > .cdk-plan-display {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    margin: 0;
    padding: 8px 16px;
    border: 0;
    border-radius: 14px;
  }

  :root[data-theme] .site-shell #step1 .submission-row > .go-plan-warning {
    margin-top: -4px;
  }

  :root[data-theme] .site-shell #step1 .submission-row > .go-plan-warning::before {
    content: none;
  }

  :root[data-theme] .site-shell #step1 .session-entry-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
  }

  :root[data-theme] .site-shell #step1 .submission-row .session-entry > textarea {
    font-size: 16px;
  }

  :root[data-theme] .site-shell #step1 .session-entry-actions > .primary-button,
  :root[data-theme] .site-shell #step1 .session-entry-actions > .session-more-actions,
  :root[data-theme] .site-shell #step1 .session-entry-actions > .session-file-name {
    grid-column: 1 / -1;
  }

  :root[data-theme] .site-shell #step1 .session-entry-actions > .primary-button {
    min-height: 48px;
  }

  :root[data-theme] .site-shell #step1 .session-entry-actions .soft-button.compact {
    width: 100%;
    padding: 0 10px;
  }

  :root[data-theme] .site-shell #step1 .session-more-actions > summary {
    min-height: 36px;
    padding: 0 4px;
  }

  :root[data-theme] .site-shell #step1 .submission-row.session-ready > .session-recognized {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 14px 14px 56px;
  }

  :root[data-theme] .site-shell #step1 .session-recognized p {
    flex: 1 1 100%;
  }

  :root[data-theme] .site-shell #step1 .submission-row.session-ready > .session-recognized > button {
    margin-left: 0;
  }

  :root[data-theme] .site-shell #step1 .session-recognized-icon {
    left: 14px;
  }

  :root[data-theme] .site-shell #step1 .session-recognized small {
    font-size: 14.5px;
  }

  :root[data-theme] .site-shell #step1 .customer-submit-bar {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
    gap: 12px;
    padding-top: 18px;
  }

  :root[data-theme] .site-shell #step1 .customer-submit-bar .primary-button {
    width: 100%;
    min-height: 50px;
  }

  :root[data-theme] .site-shell #step3 .customer-order-progress {
    padding: 16px 16px 14px;
  }

  :root[data-theme] .site-shell #step3 .button-row:has(#resubmitOrder:not(.hidden), #completeFlow:not(.hidden)) > #newSubmissionButton {
    grid-column: 1 / -1;
  }

  :root[data-theme] .site-shell #step3 .tracked-order.status-pending,
  :root[data-theme] .site-shell #step3 .tracked-order.status-success,
  :root[data-theme] .site-shell #step3 .tracked-order.status-failed {
    gap: 6px 12px;
    padding: 13px 14px;
  }

  :root[data-theme] .site-shell #step3 .tracked-orders-head {
    padding: 12px 14px;
  }

  :root[data-theme] .site-shell #step3 .result-panel > dl {
    grid-template-columns: minmax(0, 1fr);
  }

  :root[data-theme] .site-shell #step3 .result-panel > dl > div,
  :root[data-theme] .site-shell #step3 .result-panel > dl > div:last-child {
    grid-template-columns: 76px minmax(0, 1fr);
    padding: 12px 2px;
  }

  :root[data-theme] .site-shell .footer-line {
    margin-top: 28px;
    padding-bottom: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root[data-theme] .site-shell * {
    transition-duration: .01ms !important;
  }
}
