/*
 * CDK Tech Theme
 * Final cascade layer for the public portal and admin console.
 * Keep this stylesheet after styles.css and admin-theme.css.
 */

:root {
  --tech-bg: #eef2f6;
  --tech-panel: #ffffff;
  --tech-panel-soft: #f7f9fb;
  --tech-ink: #101828;
  --tech-muted: #667085;
  --tech-line: #d6dee8;
  --tech-line-strong: #aebdca;
  --tech-accent: #0788a8;
  --tech-accent-dark: #08657d;
  --tech-accent-soft: #e7f7fa;
  --tech-ok: #147a55;
  --tech-ok-soft: #e9f7f0;
  --tech-warn: #9a6700;
  --tech-warn-soft: #fff7df;
  --tech-danger: #b42318;
  --tech-danger-soft: #fff0ee;
  --tech-radius: 10px;
  --tech-shadow: 0 12px 32px rgba(16, 24, 40, 0.07);
  color-scheme: light;
}

/* Goal additions: quota cards and multi-format exchange ---------------- */

.portal-select {
  width: 100%;
  min-height: 48px;
  padding: 0 42px 0 14px;
  border: 1px solid var(--tech-line);
  background: var(--tech-panel);
  color: var(--tech-ink);
  font: inherit;
}

.portal-select:focus {
  border-color: var(--tech-accent);
  outline: 3px solid rgba(7, 136, 168, 0.12);
}

.quota-extract-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 92px;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid #9fd4df;
  border-radius: var(--tech-radius);
  background: var(--tech-accent-soft);
}

.quota-extract-panel[hidden] {
  display: none;
}

.quota-extract-panel > div {
  display: grid;
  gap: 3px;
}

.quota-extract-panel span,
.quota-extract-panel label {
  color: var(--tech-muted);
  font-size: 12px;
}

.quota-extract-panel strong {
  color: var(--tech-accent-dark);
  font-size: 15px;
}

.quota-extract-panel input {
  width: 92px;
  min-height: 42px;
  border: 1px solid #84c6d4;
  background: #fff;
  color: var(--tech-ink);
  text-align: center;
  font-weight: 700;
}

.merge-card {
  margin-top: 14px;
  padding: 0;
  overflow: hidden;
}

.merge-card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}

.merge-card > summary::-webkit-details-marker {
  display: none;
}

.merge-card > summary span {
  display: grid;
  gap: 3px;
}

.merge-card > summary b {
  color: var(--tech-ink);
  font-size: 14px;
}

.merge-card > summary small {
  color: var(--tech-muted);
  font-size: 12px;
}

.merge-card > summary > i {
  color: var(--tech-accent);
  font-size: 24px;
  font-style: normal;
  transition: transform 160ms ease;
}

.merge-card[open] > summary > i {
  transform: rotate(45deg);
}

.merge-card form,
.merge-result {
  margin: 0 18px 18px;
  padding-top: 16px;
  border-top: 1px solid var(--tech-line);
}

.merge-card textarea {
  width: 100%;
  min-height: 122px;
  resize: vertical;
}

.merge-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 14px;
  padding: 14px;
  border: 1px solid #b7ddcf;
  border-radius: 8px;
  background: var(--tech-ok-soft);
}

.merge-result[hidden] {
  display: none;
}

.merge-result > span,
.merge-result > small {
  color: var(--tech-muted);
  font-size: 12px;
}

.merge-result > small {
  grid-column: 2;
}

.merge-result > strong {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-all;
  user-select: all;
}

.merge-result-actions {
  grid-column: 3;
  grid-row: 1 / span 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.merge-result-actions .secondary-action {
  min-height: 32px;
  padding: 6px 10px;
  white-space: nowrap;
}

.generated-cards-result {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #9fd4df;
  border-radius: var(--tech-radius);
  background: var(--tech-accent-soft);
}

.generated-cards-result[hidden] {
  display: none;
}

.generated-cards-heading,
.generated-cards-heading > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.generated-cards-heading {
  margin-bottom: 10px;
}

.generated-cards-heading span,
.generated-cards-heading small {
  color: var(--tech-muted);
  font-size: 12px;
}

.generated-cards-heading strong {
  color: var(--tech-accent-dark);
  font-size: 13px;
}

.generated-cards-result textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  resize: vertical;
  border: 1px solid #b6d8df;
  background: #fff;
  color: var(--tech-ink);
  font: 12px/1.7 ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.generated-cards-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.format-badge.fixed,
.format-badge.quota {
  min-width: 58px;
}

.format-badge.fixed {
  color: #475467;
  border-color: #cfd8e3;
  background: #f5f7fa;
}

.format-badge.quota {
  color: var(--tech-accent-dark);
  border-color: #9fd4df;
  background: var(--tech-accent-soft);
}

.status.merged {
  color: #475467;
  border-color: #cfd8e3;
  background: #f2f4f7;
}

.cards-type-col {
  width: 82px;
}

@media (max-width: 640px) {
  .quota-extract-panel {
    grid-template-columns: minmax(0, 1fr) 86px;
    gap: 9px 12px;
  }

  .quota-extract-panel > div {
    grid-column: 1 / -1;
  }

  .quota-extract-panel label {
    align-self: center;
  }

  .quota-extract-panel input {
    width: 86px;
  }

  .merge-card > summary {
    min-height: 60px;
    padding: 12px 14px;
  }

  .merge-card form,
  .merge-result {
    margin-inline: 14px;
  }

  .merge-result {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .merge-result > span,
  .merge-result > strong,
  .merge-result > small {
    grid-column: 1;
  }

  .merge-result-actions {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .generated-cards-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Delivery format matrix ---------------------------------------------- */
.portal-shell .redeem-format-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.portal-shell .redeem-format-grid .format-option {
  min-width: 0;
  min-height: 88px;
  gap: 12px;
  padding: 14px;
}

.portal-shell .redeem-format-grid .format-icon {
  width: 38px;
  height: 38px;
  font-size: 13px;
}

.portal-shell .redeem-format-grid .format-option > span:nth-child(3) {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.portal-shell .redeem-format-grid .format-option b,
.portal-shell .redeem-format-grid .format-option small {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.portal-shell .redeem-format-grid .format-option b {
  font-size: 14px;
  line-height: 1.3;
}

.portal-shell .redeem-format-grid .format-option small {
  font-size: 11px;
  line-height: 1.4;
}

.portal-shell .redeem-format-grid .format-option:last-child {
  grid-column: 1 / -1;
}

@media (max-width: 700px) {
  .portal-shell .redeem-format-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-shell .redeem-format-grid .format-option {
    min-height: 82px;
    padding: 12px;
  }

  .portal-shell .redeem-format-grid .format-option:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 340px) {
  .portal-shell .redeem-format-grid {
    grid-template-columns: 1fr;
  }

  .portal-shell .redeem-format-grid .format-option:last-child {
    grid-column: auto;
  }
}

/* Redeem verification and confirmation -------------------------------- */
.portal-shell .redeem-confirmation {
  display: grid;
  gap: 13px;
  padding: 15px;
  border: 1px solid #9fd4df;
  border-radius: var(--tech-radius);
  background: linear-gradient(145deg, #f5fbfc 0%, #edf8fa 100%);
  box-shadow: inset 3px 0 0 var(--tech-accent);
}

.portal-shell .redeem-confirmation[hidden] {
  display: none;
}

.redeem-confirm-heading,
.redeem-confirm-heading > div,
.redeem-confirm-card > div {
  display: flex;
  align-items: center;
}

.redeem-confirm-heading {
  justify-content: space-between;
  gap: 12px;
}

.redeem-confirm-heading > div {
  min-width: 0;
  gap: 9px;
}

.redeem-confirm-heading span {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid #9fd4df;
  border-radius: 999px;
  color: var(--tech-accent-dark);
  background: #fff;
  font-size: 10px;
  font-weight: 700;
}

.redeem-confirm-heading strong {
  color: var(--tech-ink);
  font-size: 14px;
}

.redeem-confirm-heading small {
  flex: 0 0 auto;
  color: var(--tech-muted);
  font-size: 11px;
}

.redeem-confirm-cards {
  display: grid;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid rgba(132, 198, 212, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.portal-shell .redeem-confirm-formats {
  min-width: 0;
  margin: 0;
  padding: 13px 0 0;
  border: 0;
  border-top: 1px solid rgba(132, 198, 212, 0.55);
}

.portal-shell .redeem-confirm-formats > legend {
  margin-bottom: 9px;
  padding: 0;
  color: #344054;
  font-size: 11px;
  font-weight: 700;
}

.redeem-confirm-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 11px;
}

.redeem-confirm-card + .redeem-confirm-card {
  border-top: 1px solid #e4edf1;
}

.redeem-confirm-card > div {
  min-width: 0;
  gap: 8px;
}

.redeem-confirm-card strong {
  overflow: hidden;
  color: #344054;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.redeem-confirm-card span {
  flex: 0 0 auto;
  color: var(--tech-accent-dark);
  font-size: 10px;
  font-weight: 700;
}

.redeem-confirm-card > small {
  flex: 0 0 auto;
  color: var(--tech-muted);
  font-size: 11px;
}

.redeem-confirm-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 9px;
}

.redeem-confirm-actions > button {
  width: 100%;
}

/* Merge input ---------------------------------------------------------- */
.portal-shell .merge-input-panel {
  overflow: hidden;
  border: 1px solid var(--tech-line);
  border-radius: 9px;
  background: #fbfdff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.portal-shell .merge-input-panel:focus-within {
  border-color: #75becd;
  box-shadow: 0 0 0 3px rgba(7, 136, 168, 0.1);
}

.merge-input-heading,
.merge-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
}

.merge-input-heading {
  border-bottom: 1px solid #e5ebf1;
  background: #f5f8fb;
}

.merge-input-heading label {
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.merge-input-heading span {
  min-width: 48px;
  padding: 3px 7px;
  border: 1px solid #d3dee8;
  border-radius: 999px;
  color: var(--tech-muted);
  background: #fff;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
}

.merge-input-heading span.has-codes {
  border-color: #9fd4df;
  color: var(--tech-accent-dark);
  background: var(--tech-accent-soft);
}

.portal-shell .merge-card .merge-input-panel textarea {
  display: block;
  width: 100%;
  min-height: 144px;
  margin: 0;
  padding: 13px;
  resize: vertical;
  border: 0;
  border-radius: 0;
  outline: 0;
  background-color: #fbfdff;
  background-image: linear-gradient(#eaf0f5 1px, transparent 1px);
  background-size: 100% 28px;
  color: var(--tech-ink);
  font: 12px/28px ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.merge-input-footer {
  min-height: 38px;
  padding-block: 7px;
  border-top: 1px solid #e5ebf1;
  background: #fff;
}

.merge-input-footer small {
  color: var(--tech-muted);
  font-size: 10px;
}

.merge-input-footer button {
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid var(--tech-line);
  color: #475467;
  background: #fff;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.merge-input-footer button:hover {
  border-color: #9cb0c2;
  color: var(--tech-ink);
  background: #f7f9fb;
}

@media (max-width: 390px) {
  .redeem-confirm-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .redeem-confirm-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .redeem-confirm-card > small {
    padding-left: 0;
  }

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

  .portal-shell .merge-card .merge-input-panel textarea {
    min-height: 128px;
  }
}

/* Keep public form labels readable after the legacy sand-color rules. */
body:not(.admin-surface) .portal-field > label:not(.portal-file-drop),
body:not(.admin-surface) .portal-field .field-label-row label,
body:not(.admin-surface) .format-fieldset > legend {
  color: #344054;
}

html {
  background: var(--tech-bg);
}

body:not(.admin-surface) {
  color: var(--tech-ink);
  background: var(--tech-bg);
  background-image: none;
}

body:not(.admin-surface),
.admin-surface {
  font-family: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  border-radius: 8px;
}

.route-progress span {
  background: var(--tech-accent);
  box-shadow: none;
}

/* Public portal --------------------------------------------------------- */

.portal-shell {
  --portal-ink: var(--tech-ink);
  --portal-muted: var(--tech-muted);
  --portal-line: var(--tech-line);
  --portal-blue: var(--tech-accent);
  --portal-blue-deep: var(--tech-accent-dark);
  --portal-blue-soft: var(--tech-accent-soft);
  --portal-surface: var(--tech-panel-soft);
  --portal-shadow: var(--tech-shadow);
  min-height: 100svh;
  padding: 18px clamp(20px, 4vw, 56px) 32px;
  color: var(--tech-ink);
  background: var(--tech-bg);
}

.portal-shell::before,
.portal-shell::after,
.portal-aurora {
  display: none;
}

.portal-header,
.portal-stage,
.login-stage,
.portal-footer {
  width: min(1180px, 100%);
  margin-inline: auto;
}

.portal-header {
  min-height: 64px;
  grid-template-columns: minmax(150px, 1fr) minmax(545px, 565px) minmax(120px, 1fr);
  gap: 18px;
  border-bottom: 1px solid var(--tech-line);
}

.portal-brand {
  min-width: 0;
  gap: 10px;
  color: var(--tech-ink);
}

.portal-brand-mark {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border: 1px solid #0b2230;
  border-radius: 8px;
  background: #0b2230;
  box-shadow: none;
}

.portal-brand-mark i {
  top: 9px;
  width: 10px;
  height: 16px;
  border-radius: 1px;
  background: #ffffff;
}

.portal-brand-mark i:first-child {
  left: 8px;
}

.portal-brand-mark i:last-child {
  right: 8px;
  background: #63d9ee;
}

.portal-shell .portal-brand b {
  max-width: 230px;
  color: var(--tech-ink);
  font-size: 15px;
  font-weight: 720;
}

.portal-brand small {
  color: var(--tech-muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 8px;
}

.portal-nav {
  min-width: 0;
  min-height: 42px;
  padding: 3px;
  border: 1px solid var(--tech-line);
  border-radius: 10px;
  background: #e5ebf1;
  box-shadow: none;
}

.portal-nav-indicator {
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 4);
  border-radius: 7px;
  background: #102633;
  box-shadow: none;
}

.portal-nav a {
  min-width: 0;
  padding: 8px 12px;
  border-radius: 7px;
  color: #526171;
  font-size: 12px;
  font-weight: 650;
  transition: color 150ms ease, background 150ms ease;
}

.portal-nav a:hover {
  color: var(--tech-ink);
  background: transparent;
  transform: none;
}

.portal-nav a.active {
  color: #ffffff;
  background: transparent;
}

.admin-entry,
.back-entry {
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--tech-line);
  border-radius: 8px;
  color: #344054;
  background: var(--tech-panel);
  box-shadow: none;
}

.admin-entry::before {
  width: 19px;
  height: 19px;
  border-radius: 5px;
  color: #ffffff;
  background: #102633;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
}

.admin-entry:hover,
.back-entry:hover {
  color: var(--tech-accent-dark);
  border-color: #8bbdca;
  background: var(--tech-accent-soft);
  box-shadow: none;
  transform: none;
}

.portal-stage,
.login-stage {
  min-height: 0;
  padding: clamp(42px, 7vh, 72px) 0 48px;
  grid-template-columns: minmax(0, 1.2fr) minmax(390px, 0.8fr);
  align-items: center;
  gap: clamp(36px, 7vw, 88px);
}

.portal-intro,
.login-message {
  max-width: 620px;
}

.portal-intro h1,
.login-message h1 {
  max-width: 620px;
  margin: 12px 0 14px;
  color: var(--tech-ink);
  font-family: inherit;
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 720;
  line-height: 1.08;
}

.portal-intro > p,
.login-message > p {
  max-width: 540px;
  color: var(--tech-muted);
  font-size: 14px;
  line-height: 1.7;
}

.claim-column,
.portal-login-card {
  width: 100%;
  max-width: 470px;
}

.claim-card,
.portal-login-card {
  padding: 26px;
  border: 1px solid var(--tech-line);
  border-radius: 14px;
  background: var(--tech-panel);
  box-shadow: var(--tech-shadow);
}

.claim-card:hover,
.portal-login-card:hover {
  border-color: var(--tech-line);
  box-shadow: var(--tech-shadow);
  transform: none;
}

.portal-shell [data-portal-reveal],
.portal-shell .claim-card > *,
.portal-shell .portal-login-card > * {
  opacity: 1;
  transform: none;
  animation: none;
}

.claim-card-heading {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e8edf2;
}

.claim-card-heading h2 {
  color: var(--tech-ink);
  font-size: 21px;
  font-weight: 720;
}

.portal-field {
  margin-bottom: 18px;
}

.portal-field > label,
.portal-field > legend,
.field-label-row label {
  color: #344054;
  font-size: 12px;
  font-weight: 650;
}

.field-label-row small,
.portal-file-drop small,
.portal-shell .format-option small {
  color: var(--tech-muted);
}

.code-input-wrap textarea,
.login-input-wrap input {
  border: 1px solid var(--tech-line);
  border-radius: 8px;
  color: var(--tech-ink);
  background: #f8fafc;
  box-shadow: none;
}

.code-input-wrap textarea {
  min-height: 118px;
  padding: 14px 42px 14px 14px;
  font-family: "Cascadia Mono", Consolas, "Microsoft YaHei UI", monospace;
  font-size: 12px;
  line-height: 1.6;
}

.code-input-wrap textarea:focus,
.login-input-wrap input:focus {
  border-color: var(--tech-accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(7, 136, 168, 0.12);
}

.code-input-wrap > span {
  border-radius: 5px;
  color: #475467;
  background: #e7edf3;
  font-family: "Cascadia Mono", Consolas, monospace;
}

.portal-shell .format-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.portal-shell .format-option {
  min-height: 68px;
  padding: 11px;
  border: 1px solid var(--tech-line);
  border-radius: 9px;
  color: #344054;
  background: #f8fafc;
  box-shadow: none;
  transform: none;
}

.portal-shell .format-option:hover {
  border-color: var(--tech-line-strong);
  box-shadow: none;
  transform: none;
}

.portal-shell .format-option.selected {
  border-color: var(--tech-accent);
  color: #0f5061;
  background: var(--tech-accent-soft);
  box-shadow: inset 3px 0 0 var(--tech-accent);
  transform: none;
}

.portal-shell .format-icon {
  border-radius: 6px;
  color: #344054;
  background: #e7edf3;
  transform: none;
}

.portal-shell .format-option.selected .format-icon {
  color: #ffffff;
  background: var(--tech-accent);
  transform: none;
}

.portal-shell .format-option.selected > i {
  animation: none;
}

.portal-primary {
  min-height: 48px;
  border: 1px solid #102633;
  border-radius: 9px;
  color: #ffffff;
  background: #102633;
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
}

.portal-primary::after {
  display: none;
}

.portal-primary b {
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
}

.portal-primary:hover {
  color: #ffffff;
  border-color: var(--tech-accent-dark);
  background: var(--tech-accent-dark);
  box-shadow: none;
  transform: none;
}

.portal-primary:hover b,
.portal-primary:active {
  transform: none;
}

.inventory-card {
  width: min(330px, 100%);
  margin-top: 24px;
  padding: 16px 18px;
  border: 1px solid var(--tech-line);
  border-radius: 10px;
  background: var(--tech-panel);
  box-shadow: none;
}

.inventory-card:hover {
  border-color: var(--tech-line);
  box-shadow: none;
  transform: none;
}

.inventory-card > div {
  color: var(--tech-muted);
}

.inventory-card strong {
  color: var(--tech-ink);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 36px;
  font-variant-numeric: tabular-nums;
}

.live-dot {
  background: #22a06b;
  box-shadow: 0 0 0 4px rgba(34, 160, 107, 0.1);
}

/* Public inventory: part of the primary form so it remains visible on mobile. */
.portal-shell .public-inventory-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: -2px 0 18px;
  padding: 12px;
  border: 1px solid #d7e1e8;
  border-radius: 10px;
  background: linear-gradient(145deg, #f8fbfc 0%, #f3f7f9 100%);
}

.portal-shell .public-inventory-heading,
.portal-shell .public-inventory-heading > span {
  display: flex;
  align-items: center;
}

.portal-shell .public-inventory-heading {
  justify-content: space-between;
  gap: 12px;
}

.portal-shell .public-inventory-heading > span {
  gap: 8px;
  min-width: 0;
}

.portal-shell .public-inventory-heading b {
  color: #263746;
  font-size: 12px;
  font-weight: 720;
}

.portal-shell .public-inventory-heading small {
  flex: 0 0 auto;
  color: #667085;
  font: 650 9px/1.2 "Cascadia Mono", Consolas, monospace;
}

.portal-shell .public-inventory-panel[data-state="error"] .live-dot {
  background: #d97706;
  box-shadow: 0 0 0 4px rgba(217, 119, 6, 0.1);
}

.portal-shell .public-inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}

.portal-shell .public-inventory-tile {
  position: relative;
  display: grid;
  align-content: space-between;
  gap: 5px;
  min-width: 0;
  min-height: 86px;
  overflow: hidden;
  padding: 11px;
  border: 1px solid #d7e1e8;
  border-radius: 8px;
  background: #ffffff;
}

.portal-shell .public-inventory-tile::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #0788a8;
  content: "";
}

.portal-shell .public-inventory-tile > span {
  color: #475467;
  font-size: 10px;
  font-weight: 720;
  white-space: nowrap;
}

.portal-shell .public-inventory-tile strong {
  min-width: 0;
  color: #086f86;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: clamp(20px, 6vw, 30px);
  font-variant-numeric: tabular-nums;
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1;
}

.portal-shell .public-inventory-tile small {
  overflow: hidden;
  color: #7b8794;
  font-size: 9px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-shell .public-inventory-tile.problem {
  border-color: #efd2cc;
  background: #fff9f7;
}

.portal-shell .public-inventory-tile.problem::before {
  background: #c65449;
}

.portal-shell .public-inventory-tile.problem strong {
  color: #b5473f;
}

.portal-shell .public-inventory-tile.unchecked {
  border-color: #dfe3e8;
  background: #f8f9fb;
}

.portal-shell .public-inventory-tile.unchecked::before {
  background: #7a8699;
}

.portal-shell .public-inventory-tile.unchecked strong {
  color: #5f6b7a;
}

@media (max-width: 700px) {
  .portal-shell .public-inventory-panel {
    gap: 9px;
    margin-bottom: 15px;
    padding: 10px;
  }

  .portal-shell .public-inventory-tile {
    min-height: 80px;
    padding: 9px;
  }
}

@media (max-width: 390px) {
  .portal-shell .public-inventory-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .portal-shell .public-inventory-tile {
    min-height: 76px;
    padding: 8px;
  }
}

@media (max-width: 360px) {
  .portal-shell .public-inventory-panel {
    padding: 8px;
  }

  .portal-shell .public-inventory-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .portal-shell .public-inventory-tile {
    min-height: 74px;
    padding: 7px;
  }

  .portal-shell .public-inventory-tile > span {
    font-size: 9px;
  }

  .portal-shell .public-inventory-tile small {
    font-size: 8px;
  }
}

.portal-file-drop {
  min-height: 132px;
  border: 1px dashed var(--tech-line-strong) !important;
  border-radius: 10px;
  color: #344054 !important;
  background: #f8fafc;
  box-shadow: none;
  transform: none;
}

.portal-file-drop:hover,
.portal-file-drop.is-dragging,
.portal-file-drop.has-files {
  border-color: var(--tech-accent) !important;
  background: var(--tech-accent-soft);
  box-shadow: none;
  transform: none;
}

.upload-glyph {
  border: 1px solid var(--tech-line);
  border-radius: 7px;
  color: var(--tech-accent-dark);
  background: #ffffff;
  box-shadow: none;
}

.portal-shell .delivery-result {
  border: 1px solid #a9dbc5;
  border-radius: 11px;
  background: var(--tech-ok-soft);
  box-shadow: none;
}

.portal-shell .delivery-result.visible,
.portal-shell .delivery-result.visible .result-check {
  animation: none;
}

.result-check {
  color: #ffffff;
  background: var(--tech-ok);
  box-shadow: none;
}

.portal-shell .delivery-result p,
.portal-shell .expiry-line,
.portal-shell .result-summary {
  color: #48645a;
}

.portal-shell .portal-support {
  margin: 0 auto 16px;
  padding: 7px 10px;
  border: 1px solid var(--tech-line);
  border-radius: 7px;
  color: var(--tech-muted);
  background: var(--tech-panel);
  font-size: 12px;
}

.portal-shell .portal-support strong {
  color: var(--tech-ink);
  font-family: "Cascadia Mono", Consolas, monospace;
}

.portal-shell .toast {
  border: 1px solid var(--tech-line);
  border-radius: 9px;
  color: var(--tech-ink);
  background: #ffffff;
  box-shadow: var(--tech-shadow);
}

.portal-shell .toast.error {
  border-color: #efb2ad;
  background: var(--tech-danger-soft);
}

.portal-shell .toast.success {
  border-color: #a9dbc5;
  background: var(--tech-ok-soft);
}

.portal-shell a:focus-visible,
.portal-shell button:focus-visible,
.portal-shell input:focus-visible,
.portal-shell textarea:focus-visible,
.portal-shell label:has(input:focus-visible) {
  outline: 3px solid rgba(7, 136, 168, 0.2);
  outline-offset: 2px;
}

/* Admin console --------------------------------------------------------- */

body.admin-surface {
  --bg: var(--tech-bg);
  --panel: var(--tech-panel);
  --panel-soft: var(--tech-panel);
  --line: var(--tech-line);
  --line-strong: var(--tech-accent);
  --text: var(--tech-ink);
  --muted: var(--tech-muted);
  --green: #55d3e8;
  --green-soft: #8fdbea;
  --danger: var(--tech-danger);
  --ok: var(--tech-ok);
  --shadow: var(--tech-shadow);
  color: var(--tech-ink);
  background: var(--tech-bg);
  background-image: none;
}

.admin-surface .admin-shell {
  height: auto;
  min-height: 100dvh;
  grid-template-columns: 232px minmax(0, 1fr);
  align-items: start;
  overflow: visible;
  background: var(--tech-bg);
}

.admin-surface .admin-sidebar {
  position: sticky;
  top: 0;
  min-height: 100dvh;
  padding: 18px 14px;
  border-right: 1px solid #253545;
  background: #0c1824;
  box-shadow: none;
}

.admin-surface .admin-title {
  min-height: 46px;
  margin: 0 6px 20px;
  gap: 10px;
  color: #ffffff;
}

.admin-surface .admin-brand-mark {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border: 1px solid #55d3e8;
  border-radius: 7px;
  background: #55d3e8;
  box-shadow: none;
}

.admin-surface .admin-title:hover .admin-brand-mark {
  box-shadow: none;
  transform: none;
}

.admin-surface .admin-brand-mark i {
  left: 9px;
  width: 16px;
  height: 4px;
  background: #0c1824;
}

.admin-surface .admin-brand-mark i:first-child {
  top: 10px;
}

.admin-surface .admin-brand-mark i:last-child {
  bottom: 10px;
  background: #0c1824;
}

.admin-surface .admin-brand-copy {
  min-width: 0;
  width: auto;
  height: auto;
  display: grid;
  flex: 1 1 auto;
  place-items: initial;
  justify-items: start;
  border-radius: 0;
  color: inherit;
  background: transparent;
  font-size: inherit;
}

.admin-surface .admin-brand-copy b {
  width: 100%;
  max-width: 145px;
  overflow: hidden;
  color: #ffffff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-surface .admin-brand-copy small,
.admin-surface .admin-topbar::before,
.admin-surface .page-index,
.admin-surface .section-heading > span {
  display: none;
}

.admin-surface .admin-sidebar nav {
  display: grid;
  gap: 4px;
}

.admin-surface .nav-link {
  min-height: 42px;
  padding: 0 10px 0 7px;
  grid-template-columns: 29px minmax(0, 1fr);
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #a9b7c5;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 620;
  animation: none;
}

.admin-surface .nav-link span {
  width: 26px;
  height: 26px;
  border: 1px solid #314356;
  border-radius: 5px;
  color: #91a2b3;
  background: #132334;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
}

.admin-surface .nav-link:hover {
  color: #ffffff;
  border-color: #263b4f;
  background: #132334;
  transform: none;
}

.admin-surface .nav-link.active {
  color: #ffffff;
  border-color: #2e4558;
  background: #172a3b;
  box-shadow: inset 3px 0 0 #55d3e8;
}

.admin-surface .nav-link.active::after {
  display: none;
}

.admin-surface .nav-link.active span {
  color: #0c1824;
  border-color: #55d3e8;
  background: #55d3e8;
}

.admin-surface .admin-main {
  min-width: 0;
  min-height: 100dvh;
  padding: 0 24px 28px;
  overflow: visible;
  background: transparent;
}

.admin-surface .admin-topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  height: 58px;
  margin: 0 -24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--tech-line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  animation: none;
}

.admin-surface .admin-content-frame {
  min-width: 0;
  min-height: 0;
  padding-bottom: 0;
  animation: none;
}

.admin-surface .user-actions {
  gap: 10px;
  color: var(--tech-muted);
}

.admin-surface .user-actions strong {
  color: var(--tech-ink);
}

.admin-surface .admin-session-dot {
  width: 7px;
  height: 7px;
  background: #22a06b;
  box-shadow: 0 0 0 3px rgba(34, 160, 107, 0.11);
}

.admin-surface .logout-button {
  min-width: 78px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--tech-line);
  border-radius: 7px;
  color: #344054;
  background: #ffffff;
  box-shadow: none;
}

.admin-surface .logout-button:hover {
  color: #ffffff;
  border-color: #102633;
  background: #102633;
  box-shadow: none;
  transform: none;
}

.admin-surface .page-heading,
.admin-surface .dashboard-heading {
  min-height: 0;
  margin: 20px 0 16px;
  padding: 0;
  align-items: end;
  animation: none;
}

.admin-surface .page-heading h1 {
  margin: 0;
  color: var(--tech-ink);
  font-size: 27px;
  font-weight: 720;
  line-height: 1.2;
}

.admin-surface .page-heading p {
  margin: 5px 0 0;
  color: var(--tech-muted);
  font-size: 13px;
}

.admin-surface .system-clock {
  min-width: 190px;
  padding: 9px 11px;
  border: 1px solid var(--tech-line);
  border-radius: 8px;
  background: #ffffff;
}

.admin-surface .system-clock strong {
  color: var(--tech-ink);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

.admin-surface .control-stats {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  animation: none;
}

.admin-surface .control-stats .stat-card {
  min-height: 104px;
  padding: 15px;
  border: 1px solid var(--tech-line);
  border-radius: var(--tech-radius);
  background: #ffffff;
  box-shadow: none;
  animation: none;
}

.admin-surface .control-stats .stat-card:hover {
  border-color: var(--tech-line-strong);
  box-shadow: none;
  transform: none;
}

.admin-surface .control-stats .stat-card span {
  color: var(--tech-muted);
  font-size: 11px;
}

.admin-surface .control-stats .stat-card strong {
  margin-top: 8px;
  color: var(--tech-ink);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
}

.admin-surface .control-stats .stat-card i,
.admin-surface .control-stats .stat-card:nth-child(n) i {
  width: 28px;
  height: 3px;
  background: var(--tech-accent);
}

.admin-surface .dashboard-band {
  min-height: 0;
  grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.2fr);
  gap: 10px;
  margin-top: 10px;
  animation: none;
}

.admin-surface .comparison-block,
.admin-surface .activity-block {
  min-height: 0;
  padding: 16px;
  border: 1px solid var(--tech-line);
  border-radius: var(--tech-radius);
  background: #ffffff;
  box-shadow: none;
}

.admin-surface .section-heading h2 {
  color: var(--tech-ink);
  font-size: 17px;
}

.admin-surface .comparison-row,
.admin-surface .activity-row {
  border-color: #e8edf2;
}

.admin-surface .comparison-row i {
  height: 3px;
  background: #78cadd;
}

.admin-surface .filters,
.admin-surface .tool-panel,
.admin-surface .table-wrap,
.admin-surface .upload-card,
.admin-surface .upload-panel,
.admin-surface .liveness-panel,
.admin-surface .sub2-embed-panel {
  border: 1px solid var(--tech-line);
  border-radius: var(--tech-radius);
  background: #ffffff;
  background-image: none;
  box-shadow: none;
  animation: none;
}

.admin-surface .filters {
  gap: 9px;
  padding: 11px;
  margin-bottom: 10px;
}

.admin-surface .cards-filters {
  grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(120px, 0.8fr)) auto auto;
}

.admin-surface .files-filters {
  grid-template-columns: minmax(190px, 1.3fr) minmax(170px, 1fr) repeat(2, minmax(125px, 0.75fr)) auto auto;
}

.admin-surface input,
.admin-surface textarea,
.admin-surface select,
.admin-surface .system-select-button,
.admin-surface .system-select-search {
  min-height: 40px;
  border: 1px solid var(--tech-line);
  border-radius: 7px;
  color: var(--tech-ink);
  background: #f8fafc;
  box-shadow: none;
}

.admin-surface input::placeholder,
.admin-surface textarea::placeholder {
  color: #98a2b3;
}

.admin-surface input:focus,
.admin-surface textarea:focus,
.admin-surface select:focus,
.admin-surface .system-select.open .system-select-button {
  border-color: var(--tech-accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(7, 136, 168, 0.11);
  outline: none;
}

.admin-surface .payload-editor {
  min-height: 300px;
  border-radius: 7px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
}

.admin-surface .primary-action,
.admin-surface .secondary-action,
.admin-surface .ghost-action,
.admin-surface .danger-action,
.admin-surface .copy-button,
.admin-surface .drawer-close,
.admin-surface .confirm-close {
  min-height: 38px;
  border-radius: 7px;
  box-shadow: none;
  font-weight: 680;
}

.admin-surface .primary-action {
  color: #ffffff;
  border: 1px solid #102633;
  background: #102633;
}

.admin-surface .secondary-action {
  color: #0e5264;
  border: 1px solid #83c8d7;
  background: var(--tech-accent-soft);
}

.admin-surface .ghost-action,
.admin-surface .copy-button,
.admin-surface .drawer-close,
.admin-surface .confirm-close {
  color: #344054;
  border: 1px solid var(--tech-line);
  background: #ffffff;
}

.admin-surface .danger-action {
  color: #ffffff;
  border: 1px solid var(--tech-danger);
  background: var(--tech-danger);
}

.admin-surface .primary-action:hover,
.admin-surface .secondary-action:hover,
.admin-surface .ghost-action:hover,
.admin-surface .copy-button:hover,
.admin-surface .drawer-close:hover,
.admin-surface .confirm-close:hover,
.admin-surface .danger-action:hover {
  box-shadow: none;
  transform: none;
}

.admin-surface .primary-action:hover {
  border-color: var(--tech-accent-dark);
  background: var(--tech-accent-dark);
}

.admin-surface .secondary-action:hover,
.admin-surface .ghost-action:hover,
.admin-surface .copy-button:hover {
  color: #0e5264;
  border-color: #83c8d7;
  background: var(--tech-accent-soft);
}

.admin-surface .primary-action:disabled,
.admin-surface .secondary-action:disabled,
.admin-surface .ghost-action:disabled,
.admin-surface .danger-action:disabled {
  color: #98a2b3;
  border-color: #e1e7ed;
  background: #f1f4f7;
  opacity: 1;
}

.admin-surface .table-actions,
.admin-surface .split-actions {
  min-height: 0;
  margin-bottom: 9px;
  gap: 8px;
  animation: none;
}

.admin-surface .bulk-actions,
.admin-surface .create-actions {
  gap: 7px;
}

.admin-surface .create-actions {
  min-height: 38px;
  padding-left: 10px;
  border-color: var(--tech-line);
}

.admin-surface .selected-count {
  color: var(--tech-muted);
  font-size: 12px;
}

.admin-surface .table-wrap {
  max-width: 100%;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: auto;
}

.admin-surface table {
  min-width: 960px;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--tech-ink);
  background: #ffffff;
}

.admin-surface .cards-list-form table {
  min-width: 1460px;
}

.admin-surface .files-list-form table {
  min-width: 1560px;
}

.admin-surface .liveness-table table {
  min-width: 940px;
}

.admin-surface .cards-code-col {
  width: 360px;
}

.admin-surface th,
.admin-surface td {
  padding: 11px 12px;
  border-color: #e8edf2;
  color: #344054;
  font-size: 12px;
}

.admin-surface thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #475467;
  background: #f2f5f8;
  backdrop-filter: none;
  font-size: 11px;
  font-weight: 700;
}

.admin-surface tbody tr,
.admin-surface .liveness-table tbody tr.normal,
.admin-surface .liveness-table tbody tr.problem {
  background: #ffffff;
  background-image: none;
}

.admin-surface tbody tr:hover {
  background: #f5fafb;
}

.admin-surface .mono,
.admin-surface .usage-count,
.admin-surface .monitor-meta dd {
  font-family: "Cascadia Mono", Consolas, "Microsoft YaHei UI", monospace;
  font-variant-numeric: tabular-nums;
}

.admin-surface input[type="checkbox"] {
  accent-color: var(--tech-accent);
}

.admin-surface .status,
.admin-surface .format-badge,
.admin-surface .monitor-state {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--tech-line);
  border-radius: 999px;
  color: #475467;
  background: #f2f4f7;
  font-size: 11px;
  font-weight: 680;
}

.admin-surface .status.pending,
.admin-surface .status.available,
.admin-surface .status.locked,
.admin-surface .status.account-unchecked,
.admin-surface .format-badge.raw {
  color: var(--tech-warn);
  border-color: #ebce81;
  background: var(--tech-warn-soft);
}

.admin-surface .status.sold,
.admin-surface .status.account-available,
.admin-surface tr.normal .status.account-available,
.admin-surface .format-badge.sub,
.admin-surface .monitor-state.is-online {
  color: var(--tech-ok);
  border-color: #9fd3bb;
  background: var(--tech-ok-soft);
}

.admin-surface .status.voided,
.admin-surface .status.expired,
.admin-surface .status.account-unavailable,
.admin-surface tr.problem .status.account-unavailable,
.admin-surface .format-badge.unknown,
.admin-surface .monitor-state.is-offline {
  color: var(--tech-danger);
  border-color: #efb2ad;
  background: var(--tech-danger-soft);
}

.admin-surface .format-badge.cpa {
  color: var(--tech-accent-dark);
  border-color: #99d0dc;
  background: var(--tech-accent-soft);
}

.admin-surface .monitor-state {
  gap: 7px;
  margin: 6px 0 12px;
  letter-spacing: 0;
}

.admin-surface .monitor-state span {
  width: 7px;
  height: 7px;
  box-shadow: none;
}

.admin-surface .liveness-grid {
  grid-template-columns: repeat(3, minmax(230px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.admin-surface .liveness-panel {
  min-height: 0;
  padding: 15px;
  overflow: visible;
}

.admin-surface .liveness-panel::before {
  display: none;
}

.admin-surface .liveness-panel:hover {
  border-color: var(--tech-line-strong);
  box-shadow: none;
  transform: none;
}

.admin-surface .monitor-status-panel,
.admin-surface .compact-upload,
.admin-surface .readonly-actions,
.admin-surface .sub2-dashboard-entry,
.admin-surface .embed-empty {
  border-color: var(--tech-line);
  background: #f8fafc;
  background-image: none;
  box-shadow: none;
}

.admin-surface .compact-upload:hover,
.admin-surface .compact-upload:focus-within {
  border-color: var(--tech-accent);
  background: var(--tech-accent-soft);
  box-shadow: none;
  transform: none;
}

.admin-surface .sub2-embed-panel {
  margin-bottom: 12px;
  padding: 14px;
}

.admin-surface .sub2-embed-frame {
  min-height: 520px;
  border: 1px solid var(--tech-line);
  border-radius: 8px;
}

.admin-surface .upload-card {
  padding: 18px;
}

.admin-surface .upload-file-box {
  border: 1px dashed var(--tech-line-strong);
  border-radius: 8px;
  background: #f8fafc;
}

.admin-surface .upload-limit {
  border-color: #99d0dc;
  border-radius: 6px;
  background: var(--tech-accent-soft);
}

.admin-surface .upload-limit strong {
  color: var(--tech-accent-dark);
}

.admin-surface .import-mode-switch {
  border: 1px solid var(--tech-line);
  border-radius: 8px;
  background: #e7edf3;
  animation: none;
}

.admin-surface .import-mode-switch button {
  border-radius: 6px;
}

.admin-surface .import-mode-switch button.active {
  color: var(--tech-ink);
  background: #ffffff;
  box-shadow: none;
}

.admin-surface .settings-panel,
.admin-surface .profile-panel {
  max-width: 760px;
  padding: 20px;
}

.admin-surface .settings-form,
.admin-surface .profile-form {
  max-width: 620px;
}

.admin-surface .profile-identity,
.admin-surface .one-code-rule {
  border-color: var(--tech-line);
  background: #f8fafc;
}

.admin-surface .profile-identity strong,
.admin-surface .one-code-rule b {
  color: var(--tech-ink);
}

.admin-surface .one-code-rule span {
  color: var(--tech-accent-dark);
}

.admin-surface .one-code-rule i {
  background: var(--tech-line);
}

.admin-surface .toggle-switch {
  color: #475467;
  border-color: var(--tech-line);
  background: #f2f4f7;
}

.admin-surface .toggle-switch.on {
  color: var(--tech-accent-dark);
  border-color: #99d0dc;
  background: var(--tech-accent-soft);
}

.admin-surface .switch-track {
  border-color: #d0d5dd;
  background: #e4e7ec;
}

.admin-surface .toggle-switch.on .switch-track {
  border-color: #83c8d7;
  background: #bfe9f0;
}

.admin-surface .toggle-switch.on .switch-thumb {
  background: var(--tech-accent-dark);
  box-shadow: none;
}

.admin-surface .drawer-backdrop,
.admin-surface .confirm-backdrop {
  background: rgba(12, 24, 36, 0.52);
  backdrop-filter: blur(2px);
}

.admin-surface .drawer {
  width: min(460px, 100vw);
  height: 100dvh;
  padding: 0;
  overflow-y: auto;
  border-left: 1px solid var(--tech-line);
  color: var(--tech-ink);
  background: #ffffff;
  background-image: none;
  box-shadow: -18px 0 50px rgba(16, 24, 40, 0.16);
  overscroll-behavior: contain;
}

.admin-surface .usage-drawer {
  width: min(560px, 100vw);
}

.admin-surface .drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--tech-line);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
}

.admin-surface .drawer-header h2 {
  color: var(--tech-ink);
  font-size: 20px;
}

.admin-surface .drawer-header p {
  margin-top: 5px;
  color: var(--tech-muted);
  font-size: 12px;
}

.admin-surface .drawer-form {
  gap: 15px;
  padding: 20px;
}

.admin-surface .drawer > .usage-summary,
.admin-surface .drawer > .usage-list {
  margin-right: 20px;
  margin-left: 20px;
}

.admin-surface .drawer > .usage-summary {
  margin-top: 20px;
}

.admin-surface .usage-summary,
.admin-surface .usage-item {
  border: 1px solid var(--tech-line);
  border-radius: 8px;
  background: #f8fafc;
}

.admin-surface .confirm-dialog {
  top: 50%;
  width: min(420px, calc(100vw - 28px));
  padding: 22px 50px 22px 22px;
  border: 1px solid var(--tech-line);
  border-radius: 10px;
  color: var(--tech-ink);
  background: #ffffff;
  background-image: none;
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.2);
}

.admin-surface .confirm-dialog h2 {
  color: var(--tech-ink);
  font-size: 20px;
}

.admin-surface .confirm-dialog p {
  color: var(--tech-muted);
}

.admin-surface .pagination {
  margin-top: 10px;
  color: var(--tech-muted);
  animation: none;
}

.admin-surface .pager-links a,
.admin-surface .pager-links span {
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--tech-line);
  border-radius: 6px;
  color: #344054;
  background: #ffffff;
}

.admin-surface .pager-links a:hover {
  color: var(--tech-accent-dark);
  border-color: #83c8d7;
  background: var(--tech-accent-soft);
}

.admin-surface .notice,
.admin-surface .toast {
  border: 1px solid var(--tech-line);
  border-radius: 8px;
  color: var(--tech-ink);
  background: #ffffff;
  box-shadow: var(--tech-shadow);
}

.admin-surface .notice.success {
  border-color: #9fd3bb;
  background: var(--tech-ok-soft);
}

.admin-surface .notice.error {
  border-color: #efb2ad;
  background: var(--tech-danger-soft);
}

/* Responsive layout ----------------------------------------------------- */

@media (max-width: 1120px) {
  .portal-stage,
  .login-stage {
    grid-template-columns: minmax(0, 1fr) minmax(370px, 0.85fr);
    gap: 34px;
  }

  .admin-surface .admin-shell {
    grid-template-columns: 214px minmax(0, 1fr);
  }

  .admin-surface .liveness-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-surface .cards-filters,
  .admin-surface .files-filters {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }
}

@media (max-width: 900px) {
  .portal-stage,
  .login-stage {
    grid-template-columns: 1fr;
  }

  .claim-column,
  .portal-login-card {
    max-width: 620px;
  }

  .admin-surface .admin-shell {
    height: auto;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .admin-surface .admin-sidebar {
    position: relative;
    top: auto;
    height: auto;
    min-height: 0;
    padding: 12px 14px 10px;
    border-right: 0;
    border-bottom: 1px solid #253545;
    overflow: hidden;
  }

  .admin-surface .admin-title {
    min-height: 38px;
    margin: 0 0 9px;
  }

  .admin-surface .admin-brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .admin-surface .admin-brand-mark i {
    left: 8px;
  }

  .admin-surface .admin-brand-mark i:first-child {
    top: 8px;
  }

  .admin-surface .admin-brand-mark i:last-child {
    bottom: 8px;
  }

  .admin-surface .admin-sidebar nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .admin-surface .admin-sidebar nav::-webkit-scrollbar {
    display: none;
  }

  .admin-surface .nav-link {
    width: auto;
    min-width: max-content;
    min-height: 38px;
    flex: 0 0 auto;
    padding-right: 12px;
  }

  .admin-surface .admin-main {
    min-height: 0;
    padding: 0 16px 22px;
    overflow: visible;
  }

  .admin-surface .admin-topbar {
    position: relative;
    height: 50px;
    margin: 0 -16px;
    padding: 0 16px;
  }

  .admin-surface .admin-content-frame,
  .admin-surface .dashboard-band,
  .admin-surface .comparison-block,
  .admin-surface .activity-block,
  .admin-surface .liveness-grid,
  .admin-surface .liveness-panel {
    min-height: 0;
  }

  .admin-surface .dashboard-band {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .portal-shell {
    padding: 12px 14px 22px;
  }

  .portal-header {
    min-height: 94px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
    padding-bottom: 10px;
  }

  .portal-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    margin: 0;
  }

  .portal-nav a {
    padding-inline: 7px;
  }

  .admin-entry {
    grid-column: 2;
    grid-row: 1;
  }

  .login-portal .portal-header {
    min-height: 50px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .portal-shell .portal-stage,
  .portal-shell .login-stage {
    gap: 12px;
    padding: 14px 0 22px;
  }

  .portal-shell .redeem-stage > .claim-column,
  .portal-shell .lookup-stage > .claim-column,
  .portal-shell .convert-stage > .claim-column,
  .portal-shell .login-stage > .portal-login-card {
    order: -1;
  }

  .portal-shell .portal-intro,
  .portal-shell .login-message {
    display: none;
  }

  .portal-shell .claim-card,
  .portal-shell .portal-login-card {
    max-width: none;
    padding: 19px 17px;
    border-radius: 12px;
  }

  .portal-shell .claim-card-heading {
    margin-bottom: 16px;
    padding-bottom: 11px;
  }

  .portal-shell .format-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portal-shell .delivery-result {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .portal-shell .delivery-result .portal-primary.compact,
  .portal-shell .expiry-line {
    grid-column: 1 / -1;
    width: 100%;
  }

  .admin-surface .page-heading,
  .admin-surface .dashboard-heading {
    margin: 15px 0 12px;
  }

  .admin-surface .page-heading h1 {
    font-size: 23px;
  }

  .admin-surface .page-heading p,
  .admin-surface .system-clock,
  .admin-surface .user-actions > span:not(.admin-session-dot) {
    display: none;
  }

  .admin-surface .admin-topbar {
    justify-content: flex-end;
  }

  .admin-surface .control-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-surface .filters,
  .admin-surface .cards-filters,
  .admin-surface .files-filters,
  .admin-surface .tool-panel,
  .admin-surface .liveness-grid,
  .admin-surface .upload-spec-grid {
    grid-template-columns: 1fr;
  }

  .admin-surface .split-actions,
  .admin-surface .pager-controls,
  .admin-surface .sub2-dashboard-entry {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-surface .bulk-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
  }

  .admin-surface .bulk-actions .selected-count {
    grid-column: 1 / -1;
    text-align: left;
  }

  .admin-surface .bulk-actions > button,
  .admin-surface .bulk-actions > select,
  .admin-surface .create-actions > button,
  .admin-surface .create-actions > a {
    width: 100%;
  }

  .admin-surface .create-actions {
    padding: 9px 0 0;
    border-top: 1px solid var(--tech-line);
    border-left: 0;
  }

  .admin-surface .table-wrap {
    border-radius: 8px;
  }

  .admin-surface .pagination {
    align-items: stretch;
  }

  .admin-surface .sub2-embed-frame {
    min-height: 420px;
  }

  .admin-surface .drawer,
  .admin-surface .usage-drawer {
    width: 100%;
    max-width: 100vw;
  }

  .admin-surface .drawer-header {
    padding: 15px 16px;
  }

  .admin-surface .drawer-form {
    padding: 16px;
  }

  .admin-surface .drawer > .usage-summary,
  .admin-surface .drawer > .usage-list {
    margin-right: 16px;
    margin-left: 16px;
  }
}

@media (max-width: 390px) {
  .portal-shell {
    padding: 10px 12px 18px;
  }

  .portal-header {
    min-height: 88px;
  }

  .portal-brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .portal-brand-mark i {
    top: 8px;
    height: 14px;
  }

  .portal-brand-mark i:first-child {
    left: 7px;
  }

  .portal-brand-mark i:last-child {
    right: 7px;
  }

  .portal-shell .portal-brand b {
    max-width: 128px;
    font-size: 12px;
  }

  .portal-brand small {
    display: none;
  }

  .admin-entry,
  .back-entry {
    min-height: 34px;
    padding-inline: 10px;
    font-size: 11px;
  }

  .admin-entry::before {
    display: none;
  }

  .portal-nav {
    min-height: 38px;
  }

  .portal-nav a {
    padding: 7px 4px;
    font-size: 11px;
  }

  .portal-shell .portal-stage,
  .portal-shell .login-stage {
    padding-top: 10px;
  }

  .portal-shell .claim-card,
  .portal-shell .portal-login-card {
    padding: 16px 14px;
  }

  .claim-card-heading h2 {
    font-size: 19px;
  }

  .portal-field {
    margin-bottom: 15px;
  }

  .code-input-wrap textarea {
    min-height: 104px;
    padding: 12px 38px 12px 12px;
  }

  .portal-shell .format-option {
    min-height: 62px;
    padding: 8px;
  }

  .portal-shell .format-option small {
    font-size: 9px;
  }

  .portal-primary {
    min-height: 46px;
  }

  .portal-file-drop {
    min-height: 118px;
  }

  .portal-shell .portal-support {
    width: 100%;
    margin-bottom: 10px;
    text-align: center;
  }

  .admin-surface .admin-sidebar {
    padding-inline: 10px;
  }

  .admin-surface .admin-main {
    padding: 0 10px 18px;
  }

  .admin-surface .settings-section-nav {
    width: calc(100% + 20px);
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .admin-surface .admin-topbar {
    height: 46px;
    margin-inline: -10px;
    padding-inline: 10px;
  }

  .admin-surface .page-heading h1 {
    font-size: 21px;
  }

  .admin-surface .control-stats .stat-card {
    min-height: 88px;
    padding: 12px;
  }

  .admin-surface .control-stats .stat-card strong {
    font-size: 25px;
  }

  .admin-surface .comparison-block,
  .admin-surface .activity-block,
  .admin-surface .settings-panel,
  .admin-surface .profile-panel,
  .admin-surface .liveness-panel,
  .admin-surface .upload-card {
    padding: 13px;
  }

  .admin-surface .table-wrap {
    margin-inline: -2px;
  }

  .admin-surface th,
  .admin-surface td {
    padding: 10px;
  }

  .admin-surface .drawer-header h2 {
    font-size: 18px;
  }

  .admin-surface .confirm-dialog {
    width: calc(100vw - 20px);
  }
}

/* Goal36 coupon management ---------------------------------------------- */
.admin-surface .order-coupon-line {
  color: #456316;
}

.admin-surface .order-coupon-line code {
  color: #334a10;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: inherit;
  overflow-wrap: anywhere;
}

.admin-surface .coupon-create-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  padding: 16px;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  background: #f8fafc;
}

.admin-surface .coupon-create-form .field,
.admin-surface .coupon-row-fields .field {
  min-width: 0;
}

.admin-surface .coupon-create-form input,
.admin-surface .coupon-create-form select,
.admin-surface .coupon-row input,
.admin-surface .coupon-row select {
  width: 100%;
  min-width: 0;
}

.admin-surface .coupon-code-field input,
.admin-surface .coupon-row-heading strong {
  font-family: "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0;
}

.admin-surface .coupon-active {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: #52525b;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.admin-surface .coupon-active input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.admin-surface .coupon-list {
  display: grid;
  min-width: 0;
  margin-top: 24px;
  border-top: 2px solid #18181b;
}

.admin-surface .coupon-row {
  min-width: 0;
  padding: 16px 0 18px;
  border-bottom: 1px solid #e7e9e4;
}

.admin-surface .coupon-row-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  margin-bottom: 13px;
}

.admin-surface .coupon-row-heading > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.admin-surface .coupon-row-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #27272a;
  font-size: 14px;
}

.admin-surface .coupon-row-state {
  display: grid;
  justify-items: end;
  gap: 5px;
  flex: 0 0 auto;
}

.admin-surface .coupon-row-state small {
  color: #71717a;
  font-size: 10px;
  white-space: nowrap;
}

.admin-surface .coupon-row-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.admin-surface .coupon-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid #eef0ec;
}

.admin-surface .coupon-row-actions .coupon-active {
  margin-right: auto;
}

.admin-surface .coupon-empty {
  margin: 0;
  padding: 22px 0;
}

@media (max-width: 1100px) {
  .admin-surface .coupon-create-form,
  .admin-surface .coupon-row-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-surface .coupon-create-form,
  .admin-surface .coupon-row-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-surface .coupon-create-form {
    padding: 13px;
  }

  .admin-surface .coupon-row-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-surface .coupon-row-state {
    justify-items: start;
  }

  .admin-surface .coupon-row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-surface .coupon-row-actions .coupon-active {
    grid-column: 1 / -1;
    margin-right: 0;
  }

  .admin-surface .coupon-row-actions .secondary-action,
  .admin-surface .coupon-row-actions .danger-button,
  .admin-surface .coupon-create-form .primary-action {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .admin-surface .coupon-row-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-surface .coupon-row-actions .coupon-active {
    grid-column: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-shell *,
  .admin-surface * {
    scroll-behavior: auto;
  }

  .portal-shell [data-portal-reveal],
  .portal-shell .claim-card > *,
  .portal-shell .portal-login-card > *,
  .admin-surface .admin-content-frame,
  .admin-surface .nav-link,
  .admin-surface .page-heading,
  .admin-surface .control-stats,
  .admin-surface .dashboard-band,
  .admin-surface .filters,
  .admin-surface .table-actions,
  .admin-surface .table-wrap,
  .admin-surface .tool-panel,
  .admin-surface .upload-panel,
  .admin-surface .pagination {
    animation: none;
    transition: none;
  }
}

/* Keep quota components authoritative after the general card rules. */
.portal-shell .merge-card {
  padding: 0;
}

.portal-shell .merge-card form {
  display: grid;
  gap: 14px;
}

.portal-shell .merge-card form .portal-field {
  margin: 0;
}

.admin-surface .generated-cards-result {
  margin: 0 22px 22px;
}

.admin-surface .generated-cards-result textarea {
  min-height: 180px;
}

.admin-surface .format-badge.quota {
  color: var(--tech-accent-dark);
  border-color: #9fd4df;
  background: var(--tech-accent-soft);
}

@media (max-width: 640px) {
  .portal-shell .merge-card {
    padding: 0;
  }

  .admin-surface .generated-cards-result {
    margin: 0 16px 16px;
  }
}

.portal-shell .format-grid.redeem-format-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 700px) {
  .portal-shell .format-grid.redeem-format-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 340px) {
  .portal-shell .format-grid.redeem-format-grid {
    grid-template-columns: 1fr;
  }
}

/* CDK query ------------------------------------------------------------ */
.lookup-heading {
  display: grid;
  gap: 12px;
}

.lookup-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--tech-line);
  border-radius: 9px;
  background: #f3f6f9;
}

.lookup-mode-switch button {
  min-height: 34px;
  padding: 6px 10px;
  border: 0;
  color: var(--tech-muted);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.lookup-mode-switch button.active {
  color: var(--tech-accent-dark);
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.08);
}

.portal-shell .lookup-code-input textarea {
  min-height: 136px;
  resize: none;
}

.portal-shell .lookup-query-form.is-batch-mode .lookup-code-input {
  min-height: 118px;
}

.portal-shell .lookup-query-form.is-batch-mode .lookup-code-input textarea {
  min-height: 118px;
  resize: vertical;
}

.portal-shell .lookup-query-form.is-batch-mode .cdk-segment-display {
  display: none;
}

.portal-shell .cdk-detail-result {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.portal-shell .cdk-detail-result[hidden] {
  display: none;
}

.cdk-detail-heading,
.cdk-usage-heading,
.cdk-selection-actions,
.cdk-export-result,
.cdk-usage-record > header,
.cdk-usage-record > header > div {
  display: flex;
  align-items: center;
}

.cdk-detail-heading,
.cdk-usage-heading,
.cdk-usage-record > header,
.cdk-export-result {
  justify-content: space-between;
  gap: 12px;
}

.cdk-detail-heading > div {
  display: grid;
  gap: 2px;
}

.cdk-detail-heading span {
  color: var(--tech-accent-dark);
  font: 700 9px/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.12em;
}

.cdk-detail-heading h2 {
  color: var(--tech-ink);
  font-size: 20px;
}

.cdk-status-badge {
  padding: 5px 9px;
  border: 1px solid var(--tech-line);
  border-radius: 999px;
  color: #475467;
  background: #f5f7fa;
  font-size: 11px;
  white-space: nowrap;
}

.cdk-status-badge.pending {
  border-color: #a6d8c3;
  color: var(--tech-ok);
  background: var(--tech-ok-soft);
}

.cdk-status-badge.sold,
.cdk-status-badge.merged {
  color: #475467;
  background: #f2f4f7;
}

.cdk-status-badge.voided,
.cdk-status-badge.expired {
  border-color: #f4b4ae;
  color: var(--tech-danger);
  background: var(--tech-danger-soft);
}

.cdk-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.cdk-detail-stats > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--tech-line);
  border-radius: 8px;
  background: #f8fafc;
}

.cdk-detail-stats dt {
  color: var(--tech-muted);
  font-size: 10px;
}

.cdk-detail-stats dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--tech-ink);
  font-size: 12px;
  font-weight: 700;
}

#cdkExportForm {
  display: grid;
  gap: 14px;
}

.cdk-export-guide {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid #b8cfeb;
  border-left: 3px solid #2563eb;
  border-radius: 6px;
  color: #334155;
  background: #f7fbff;
  outline: none;
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.cdk-export-guide > span {
  color: #1d4ed8;
  font: 800 11px/1 "Cascadia Mono", monospace;
}

.cdk-export-guide > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cdk-export-guide strong {
  color: #172554;
  font-size: 12px;
  line-height: 1.45;
}

.cdk-export-guide small {
  color: #52647a;
  font-size: 10px;
  line-height: 1.45;
}

.cdk-export-guide.is-attention {
  border-color: #7aa7de;
  background: #eff7ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.cdk-export-guide.is-ready {
  border-color: #82c9ac;
  border-left-color: #16805b;
  background: #f2fbf6;
  box-shadow: none;
}

.cdk-export-guide.is-ready > span,
.cdk-export-guide.is-ready strong { color: #126047; }

.cdk-export-guide.is-unavailable {
  border-color: #d9e0e8;
  border-left-color: #8c98a7;
  background: #f8fafc;
  box-shadow: none;
}

.cdk-usage-heading {
  padding-top: 14px;
  border-top: 1px solid var(--tech-line);
}

.cdk-usage-heading > div:first-child {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.cdk-usage-heading span,
.cdk-usage-heading strong {
  color: #344054;
  font-size: 12px;
}

.cdk-selection-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.cdk-selection-actions button {
  min-height: 29px;
  padding: 4px 8px;
  border: 1px solid var(--tech-line);
  color: #475467;
  background: #fff;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.cdk-selection-actions button:disabled {
  opacity: 0.45;
  cursor: default;
}

.cdk-selection-actions small {
  width: 100%;
  color: var(--tech-muted);
  text-align: right;
  font-size: 10px;
}

.cdk-usage-list {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.cdk-usage-record {
  min-height: max-content;
  overflow: hidden;
  border: 1px solid var(--tech-line);
  border-radius: 9px;
  background: #fff;
}

.cdk-usage-record > header {
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid #e7edf3;
  background: #f7f9fb;
}

.cdk-usage-record > header > div {
  gap: 7px;
}

.cdk-usage-record > header strong {
  color: #344054;
  font-size: 11px;
}

.cdk-usage-record > header span {
  padding: 3px 6px;
  border-radius: 999px;
  color: var(--tech-accent-dark);
  background: var(--tech-accent-soft);
  font-size: 9px;
  font-weight: 700;
}

.cdk-usage-record > header small {
  color: var(--tech-muted);
  font-size: 9px;
}

.cdk-account-list {
  display: grid;
  gap: 0;
}

.cdk-account-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 9px 12px;
  cursor: pointer;
}

.cdk-account-option + .cdk-account-option {
  border-top: 1px solid #edf1f5;
}

.cdk-account-option:hover {
  background: #f8fbfc;
}

.cdk-account-option input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  accent-color: var(--tech-accent);
}

.cdk-batch-summary {
  display: grid;
  gap: 9px;
  padding: 10px 12px;
  border-left: 3px solid var(--tech-accent);
  color: #405269;
  background: #f4f8fc;
  font-size: 11px;
  line-height: 1.55;
}

.cdk-batch-summary[hidden] {
  display: none;
}

.cdk-batch-summary > strong {
  color: #26384d;
  font-size: 11px;
}

.cdk-batch-result-list {
  display: grid;
  grid-auto-rows: max-content;
  gap: 0;
  max-height: 220px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cdk-batch-result {
  display: grid;
  grid-template-columns: minmax(100px, auto) minmax(0, 1fr);
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid #dfe8f1;
}

.cdk-batch-result b {
  color: #29465f;
  font: 700 10px/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.cdk-batch-result small {
  min-width: 0;
  overflow-wrap: anywhere;
  color: #52647a;
  font-size: 10px;
}

.cdk-batch-result.is-error small {
  color: var(--tech-danger);
}

@media (max-width: 520px) {
  .cdk-batch-result {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
}

.cdk-account-option > span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cdk-account-option b,
.cdk-account-option small {
  overflow-wrap: anywhere;
}

.cdk-account-option b {
  color: #344054;
  font-size: 11px;
}

.cdk-account-option small,
.cdk-record-empty,
.cdk-empty-usage {
  color: var(--tech-muted);
  font-size: 10px;
}

.cdk-record-empty {
  padding: 12px;
}

.cdk-recovery-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 12px 12px;
  padding-top: 10px;
  border-top: 1px solid #edf1f5;
}

.cdk-recovery-action small {
  flex: 1 1 220px;
  color: var(--tech-muted);
  font-size: 10px;
}

.cdk-recovery-claim {
  min-height: 32px;
  white-space: nowrap;
}

.cdk-recovery-status,
.cdk-recovery-pending {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--tech-accent-dark);
  background: var(--tech-accent-soft);
  font-size: 9px;
  font-weight: 700;
}

.cdk-recovery-status.is-claimed {
  color: #18734d;
  background: #e7f6ee;
}

.cdk-recovery-status.is-superseded {
  color: var(--tech-muted);
  background: #eef1f4;
}

.cdk-recovery-status.is-payload_invalid {
  color: #96500f;
  background: #fff2df;
}

.cdk-empty-usage {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--tech-line-strong);
  border-radius: 8px;
  text-align: center;
}

.portal-shell .lookup-format-fieldset {
  min-width: 0;
  margin: 0;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid var(--tech-line);
}

.portal-shell .lookup-format-fieldset[hidden],
#exportSelectedCdkAccounts[hidden] {
  display: none;
}

.portal-shell .lookup-format-fieldset > legend {
  margin-bottom: 10px;
  padding: 0;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.cdk-export-result {
  padding: 11px;
  border: 1px solid #a6d8c3;
  border-radius: 8px;
  background: var(--tech-ok-soft);
}

.cdk-export-result[hidden] {
  display: none;
}

.cdk-export-result > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.cdk-export-result strong {
  color: var(--tech-ok);
  font-size: 11px;
}

.cdk-export-result small {
  overflow-wrap: anywhere;
  color: var(--tech-muted);
  font-size: 9px;
}

@media (max-width: 700px) {
  .cdk-detail-stats {
    grid-template-columns: 1fr;
  }

  .cdk-usage-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .cdk-selection-actions {
    justify-content: flex-start;
  }

  .cdk-selection-actions small {
    text-align: left;
  }

  .cdk-export-result {
    align-items: stretch;
    flex-direction: column;
  }

  .cdk-export-result .portal-primary {
    width: 100%;
  }
}
.portal-shell .product-inventory-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-shell .product-inventory-tile {
  min-height: 132px;
}

.portal-shell .product-inventory-tile strong {
  font-size: 44px;
  line-height: 1;
}

.portal-shell .product-inventory-tile[data-state="error"] strong,
.portal-shell .product-inventory-tile[data-state="empty"] strong {
  color: #b42318;
}

.portal-shell .product-inventory-tile[data-state="stale"] strong {
  color: #8a5a00;
}

.portal-shell .product-inventory-tile[data-state="on-demand"] strong {
  color: #a3541e;
  font-size: 28px;
  line-height: 1.15;
}

.portal-shell .purchase-inventory-panel {
  width: min(1120px, 100%);
  margin: 0 auto 16px;
}

.product-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.product-mode-switch button {
  min-height: 44px;
  border: 1px solid #d0d5dd;
  background: #fff;
  color: #344054;
  font-weight: 700;
}

.product-mode-switch button.active {
  border-color: #101828;
  background: #101828;
  color: #fff;
}

/* CDK checkout ---------------------------------------------------------- */

.buy-cdk-shell .purchase-stage {
  width: min(1040px, 100%);
  display: block;
  min-height: 0;
  padding: 34px 0 48px;
}

.purchase-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.purchase-page-heading > div:first-child > span,
.purchase-form-heading > div > span {
  color: var(--tech-accent-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.purchase-page-heading h1 {
  margin: 4px 0 3px;
  color: var(--tech-ink);
  font-size: clamp(27px, 3vw, 34px);
  font-weight: 760;
  line-height: 1.15;
}

.purchase-page-heading p {
  margin: 0;
  color: var(--tech-muted);
  font-size: 12px;
  line-height: 1.6;
}

.purchase-service-points {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.purchase-service-points span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--tech-line);
  border-radius: 999px;
  color: #475467;
  background: #fff;
  font-size: 10px;
  font-weight: 650;
}

.purchase-service-points i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tech-ok);
  box-shadow: 0 0 0 3px rgba(23, 123, 85, 0.1);
}

.purchase-workspace,
.purchase-checkout-grid,
.purchase-config,
.purchase-checkout-actions {
  min-width: 0;
}

.buy-cdk-shell .purchase-form {
  width: 100%;
  max-width: none;
  display: block;
  overflow: hidden;
  padding: 0;
  border-radius: 15px;
  box-shadow: 0 14px 34px rgba(16, 38, 51, 0.09);
}

.purchase-form-heading {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--tech-line);
  background: #f8fafc;
}

.purchase-form-heading h2 {
  margin: 2px 0 0;
  color: var(--tech-ink);
  font-size: 18px;
  font-weight: 740;
}

.purchase-form-heading small {
  color: var(--tech-muted);
  font-size: 10px;
}

.purchase-checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.38fr) minmax(300px, 0.82fr);
  align-items: stretch;
}

.purchase-config {
  padding: 22px;
}

.purchase-form fieldset {
  min-width: 0;
  margin-inline: 0;
  padding: 0;
  border: 0;
}

.purchase-form .portal-field {
  min-width: 0;
  margin-bottom: 17px;
}

.purchase-form .portal-field > label,
.purchase-form .portal-field > legend {
  display: block;
  margin: 0 0 8px;
  padding: 0;
  color: #344054;
  font-size: 11px;
  font-weight: 700;
}

.purchase-form select,
.purchase-form input[type="number"],
.purchase-form input[type="text"],
.purchase-form input[type="password"] {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--tech-line);
  border-radius: 8px;
  color: #1d2939;
  background-color: #fff;
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
}

.purchase-form select:focus,
.purchase-form input[type="number"]:focus,
.purchase-form input[type="text"]:focus,
.purchase-form input[type="password"]:focus {
  border-color: var(--tech-accent);
  box-shadow: 0 0 0 3px rgba(7, 136, 168, 0.11);
}

.cdk-purchase-segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid #d7e0e8;
  border-radius: 10px;
  background: #edf2f6;
}

.cdk-purchase-option {
  position: relative;
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #667085;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 720;
  text-align: center;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.cdk-purchase-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.cdk-purchase-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.cdk-purchase-option:hover {
  color: #1d2939;
}

.cdk-purchase-option.selected {
  border-color: #102633;
  color: #fff;
  background: #102633;
  box-shadow: 0 2px 7px rgba(16, 38, 51, 0.17);
}

.cdk-purchase-option:focus-within {
  outline: 3px solid rgba(7, 136, 168, 0.17);
  outline-offset: 1px;
}

.purchase-quantity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.purchase-form[data-cdk-mode="quota"] .purchase-quantity-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.purchase-quantity-grid .portal-field {
  margin-bottom: 17px;
}

.purchase-private-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 17px;
}

.purchase-private-fields .portal-field {
  margin-bottom: 0;
}

.purchase-contact-field > small,
.purchase-password-field > small {
  display: block;
  margin-top: 7px;
  color: var(--tech-muted);
  font-size: 10px;
  line-height: 1.5;
}

.purchase-number-control {
  position: relative;
  min-width: 0;
}

.purchase-number-control input[type="number"] {
  padding-right: 42px;
}

.purchase-number-control > span {
  position: absolute;
  top: 50%;
  right: 12px;
  padding-left: 9px;
  border-left: 1px solid #dbe3ea;
  color: #667085;
  font-size: 10px;
  font-weight: 700;
  transform: translateY(-50%);
  pointer-events: none;
}

.purchase-coupon-panel {
  min-width: 0;
  margin: 0 0 17px;
  padding: 12px;
  border: 1px solid #d7e0e8;
  border-radius: 9px;
  background: #f8fafc;
  transition: border-color 150ms ease, background 150ms ease;
}

.purchase-coupon-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.purchase-coupon-panel > header > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.purchase-coupon-panel > header strong {
  color: #344054;
  font-size: 11px;
}

.purchase-coupon-panel > header small {
  color: var(--tech-muted);
  font-size: 9px;
}

.purchase-coupon-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.purchase-coupon-control .secondary-action,
.purchase-coupon-control .ghost-action {
  min-width: 70px;
  min-height: 48px;
  margin: 0;
}

.purchase-coupon-panel[data-state="applied"] {
  border-color: #8cc8b3;
  background: #f0faf6;
}

.purchase-coupon-panel[data-state="applied"] input {
  color: #175c44;
  border-color: #a8d8c6;
  background: #fff;
}

.purchase-coupon-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid #a8d8c6;
  border-radius: 999px;
  color: #176e50;
  background: #e7f7f0;
  font-size: 9px;
  font-weight: 750;
}

.purchase-coupon-status {
  margin: 8px 0 0;
  color: var(--tech-muted);
  font-size: 10px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.purchase-coupon-status.is-success { color: var(--tech-ok); }
.purchase-coupon-status.is-warning { color: #8a5b08; }
.purchase-coupon-status.is-error { color: var(--tech-danger); }

.purchase-tier-panel {
  margin: 0 0 17px;
  padding: 12px;
  border: 1px solid #b9dce5;
  border-radius: 9px;
  background: #f3fafc;
}

.purchase-tier-panel.is-suppressed {
  border-color: #d7e0e8;
  background: #f7f8fa;
}

.purchase-tier-panel.is-suppressed #purchaseTierOffers {
  opacity: .52;
}

.purchase-tier-panel[hidden] {
  display: none;
}

.purchase-tier-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}

.purchase-tier-panel > header strong {
  color: #164e5d;
  font-size: 11px;
}

.purchase-tier-panel > header small {
  color: #66818a;
  font-size: 9px;
}

#purchaseTierOffers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.purchase-tier-offer {
  position: relative;
  min-width: 0;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid #d7e6ea;
  border-radius: 7px;
  color: #667085;
  background: rgba(255, 255, 255, 0.82);
  font-size: 9px;
}

.purchase-tier-offer strong {
  color: #344054;
  font-size: 10px;
  white-space: nowrap;
}

.purchase-tier-offer.reached {
  border-color: #8cc8d6;
}

.purchase-tier-offer.active {
  padding-right: 55px;
  border-color: var(--tech-accent);
  color: #164e5d;
  background: #e6f6f9;
}

.purchase-tier-offer.active i {
  position: absolute;
  top: 50%;
  right: 7px;
  padding: 2px 5px;
  border-radius: 999px;
  color: #fff;
  background: var(--tech-accent-dark);
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  transform: translateY(-50%);
}

.product-description {
  display: block;
  margin: 0 0 17px;
  padding: 0 12px;
  border: 1px solid #dce3e9;
  border-radius: 9px;
  background: #f8fafc;
}

.product-description[hidden] {
  display: none;
}

.product-description summary {
  position: relative;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding-right: 22px;
  color: #344054;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  list-style: none;
}

.product-description summary::-webkit-details-marker {
  display: none;
}

.product-description summary::after {
  content: "+";
  position: absolute;
  right: 2px;
  color: var(--tech-accent-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 15px;
}

.product-description[open] summary::after {
  content: "−";
}

.product-description p {
  margin: 0;
  padding: 0 0 12px;
  color: #475467;
  font-size: 11px;
  line-height: 1.7;
  white-space: pre-line;
}

.payment-types {
  margin-bottom: 0 !important;
}

.payment-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.payment-option {
  position: relative;
  min-width: 0;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--tech-line);
  border-radius: 8px;
  color: #344054;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.payment-option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.payment-option-mark {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: grid;
  place-items: center;
  border: 1px solid #aeb9c5;
  border-radius: 50%;
  background: #fff;
}

.payment-option-mark::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tech-accent);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 120ms ease, transform 120ms ease;
}

.payment-option:has(input:checked) {
  border-color: var(--tech-accent);
  color: #164e5d;
  background: var(--tech-accent-soft);
}

.payment-option input:checked + .payment-option-mark {
  border-color: var(--tech-accent);
}

.payment-option input:checked + .payment-option-mark::after {
  opacity: 1;
  transform: scale(1);
}

.payment-option:focus-within {
  outline: 3px solid rgba(7, 136, 168, 0.15);
  outline-offset: 1px;
}

.purchase-unavailable {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px;
  border: 1px dashed #d0d5dd;
  border-radius: 8px;
  color: #667085;
  background: #f8fafc;
  font-size: 11px;
  text-align: center;
}

.purchase-result {
  width: 100%;
  margin-top: 14px;
}

.purchased-cdk-result {
  min-width: 0;
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.purchased-cdk-result textarea {
  width: 100%;
  min-width: 0;
  min-height: 112px;
  padding: 12px;
  border: 1px solid #a6d8c3;
  color: #17342a;
  background: #fff;
  font: 12px/1.6 "Cascadia Mono", Consolas, monospace;
}

.purchased-cdk-result > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.purchased-cdk-result .portal-primary {
  margin-left: auto;
}

.payment-return-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.payment-return-card { width: min(680px, 100%); display: grid; gap: 16px; }
.payment-return-card textarea { min-height: 180px; padding: 14px; font: 13px/1.65 "Cascadia Mono", Consolas, monospace; resize: vertical; }
.payment-return-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.payment-return-actions > * { flex: 1 1 140px; }

/* First-party payment checkout ----------------------------------------- */
.payment-checkout-shell {
  min-height: 100vh;
  padding: 24px clamp(16px, 4vw, 64px) 56px;
  background: var(--tech-bg);
}
.payment-checkout-header {
  width: min(1120px, 100%);
  margin: 0 auto 22px;
}
.payment-checkout-secure {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--tech-ok);
  font-size: 13px;
  font-weight: 700;
}
.payment-checkout-secure i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tech-ok);
  box-shadow: 0 0 0 5px rgba(20, 122, 85, .12);
}
.payment-checkout-card {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 4vw, 48px);
  border: 1px solid var(--tech-line);
  border-radius: 14px;
  background: var(--tech-panel);
  box-shadow: 0 18px 50px rgba(16, 24, 40, .08);
}
.payment-checkout-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
}
.payment-checkout-heading h1 { margin: 7px 0 5px; font-size: clamp(25px, 3vw, 36px); letter-spacing: 0; }
.payment-checkout-heading p { margin: 0; color: var(--tech-muted); font-size: 14px; }
.payment-checkout-amount { min-width: 220px; padding: 14px 20px; border-left: 4px solid var(--tech-accent); background: var(--tech-accent-soft); }
.payment-checkout-amount small { display: block; color: var(--tech-muted); font-size: 12px; }
.payment-checkout-amount strong { display: block; margin-top: 3px; color: var(--tech-accent-dark); font: 800 clamp(30px, 4vw, 48px)/1.05 "Cascadia Mono", Consolas, monospace; letter-spacing: 0; }
.payment-checkout-order { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 28px; padding: 16px; border: 1px solid var(--tech-line); background: var(--tech-panel-soft); }
.payment-checkout-order div { min-width: 0; display: grid; gap: 5px; }
.payment-checkout-order span { color: var(--tech-muted); font-size: 11px; }
.payment-checkout-order b { overflow-wrap: anywhere; color: var(--tech-ink); font-size: 13px; }
.payment-order-number { font-family: "Cascadia Mono", Consolas, monospace; }
.payment-checkout-pricing { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 12px 0 0; padding: 0; border: 1px solid var(--tech-line); background: #fff; }
.payment-checkout-pricing > div { min-width: 0; display: grid; gap: 5px; padding: 12px 13px; border-right: 1px solid var(--tech-line); }
.payment-checkout-pricing > div:last-child { border-right: 0; }
.payment-checkout-pricing dt { color: var(--tech-muted); font-size: 10px; }
.payment-checkout-pricing dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--tech-ink); font: 700 12px/1.4 "Cascadia Mono", Consolas, monospace; }
.payment-checkout-pricing code { color: inherit; font: inherit; }
.payment-checkout-pricing .payment-checkout-discount dd { color: var(--tech-ok); }
.payment-checkout-pricing .payment-checkout-order-total { background: var(--tech-accent-soft); }
.payment-checkout-pricing .payment-checkout-order-total dd { color: var(--tech-accent-dark); font-size: 14px; }
.payment-checkout-divider { height: 1px; margin: 28px 0; background: var(--tech-line); }
.payment-qr-panel { display: grid; justify-items: center; gap: 14px; text-align: center; }
.payment-method-heading { display: inline-flex; align-items: center; gap: 9px; color: var(--tech-ink); font-size: 16px; }
.payment-method-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; background: var(--tech-accent); font-weight: 800; }
.payment-qr-frame { display: grid; place-items: center; width: min(300px, 72vw); aspect-ratio: 1; padding: 14px; border: 8px solid #f5f7f9; outline: 1px solid var(--tech-line); background: #fff; }
.payment-qr-frame svg { display: block; width: 100%; height: 100%; }
.payment-qr-unavailable { display: grid; place-items: center; width: min(300px, 72vw); aspect-ratio: 1; padding: 24px; border: 1px dashed var(--tech-line-strong); color: var(--tech-muted); background: var(--tech-panel-soft); }
.payment-qr-unavailable small { margin-top: 6px; }
.payment-qr-amount { color: var(--tech-accent-dark); font: 800 clamp(32px, 4vw, 46px)/1 "Cascadia Mono", Consolas, monospace; letter-spacing: 0; }
.payment-exact-amount { margin: 0; padding: 10px 14px; border: 1px solid #f2c66d; color: #805b00; background: var(--tech-warn-soft); font-size: 14px; font-weight: 800; }
.payment-direct-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; width: min(420px, 100%); min-height: 54px; margin-top: 4px; border-radius: 7px; color: #fff; background: var(--tech-accent); box-shadow: 0 8px 18px rgba(7, 136, 168, .2); font-size: 16px; font-weight: 800; text-decoration: none; }
.payment-direct-button:hover { color: #fff; background: var(--tech-accent-dark); }
.payment-checkout-status { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 28px; color: var(--tech-muted); font-size: 13px; }
.payment-checkout-status.is-complete { color: var(--tech-ok); }
.payment-checkout-status.is-error { color: var(--tech-danger); }
.payment-status-spinner { width: 15px; height: 15px; border: 2px solid #dfe6ec; border-top-color: var(--tech-accent); border-radius: 50%; animation: payment-spin .8s linear infinite; }
.payment-checkout-status.is-complete .payment-status-spinner { border-color: var(--tech-ok); animation: none; }
.payment-checkout-status.is-error .payment-status-spinner { border-color: var(--tech-danger); animation: none; }
.payment-checkout-expiry { margin: 9px 0 0; color: var(--tech-muted); font-size: 12px; text-align: center; }
.payment-checkout-expiry time { color: var(--tech-accent-dark); font-family: "Cascadia Mono", Consolas, monospace; font-weight: 700; }
.payment-checkout-expiry time.expired { color: var(--tech-danger); }
@keyframes payment-spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .payment-checkout-shell { padding: 14px 12px 32px; }
  .payment-checkout-header { margin-bottom: 12px; }
  .payment-checkout-card { padding: 20px 14px 26px; border-radius: 10px; }
  .payment-checkout-heading { display: grid; gap: 15px; }
  .payment-checkout-amount { min-width: 0; width: 100%; border-left: 0; border-top: 3px solid var(--tech-accent); }
  .payment-checkout-order { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 20px; }
  .payment-checkout-pricing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-checkout-pricing > div { border-right: 1px solid var(--tech-line); border-bottom: 1px solid var(--tech-line); }
  .payment-checkout-pricing > div:nth-child(2n) { border-right: 0; }
  .payment-checkout-pricing .payment-checkout-order-total { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
  .payment-checkout-divider { margin: 20px 0; }
  .payment-exact-amount { font-size: 12px; line-height: 1.6; }
}

@media (max-width: 390px) {
  .payment-checkout-pricing { grid-template-columns: minmax(0, 1fr); }
  .payment-checkout-pricing > div,
  .payment-checkout-pricing > div:nth-child(2n),
  .payment-checkout-pricing > div:nth-last-child(-n + 2) { border-right: 0; border-bottom: 1px solid var(--tech-line); }
  .payment-checkout-pricing .payment-checkout-order-total { grid-column: 1; border-bottom: 0; }
}

@media (max-width: 760px) {
  .buy-cdk-shell .purchase-stage {
    padding: 20px 0 28px;
  }

  .purchase-page-heading {
    align-items: flex-start;
  }

  .purchase-service-points {
    padding-top: 3px;
  }

  .purchase-checkout-grid {
    grid-template-columns: minmax(0, 1fr);
  }

}

@media (max-width: 520px) {
  .buy-cdk-shell .purchase-stage {
    padding-top: 15px;
  }

  .purchase-page-heading {
    margin-bottom: 13px;
  }

  .purchase-page-heading h1 {
    margin-top: 2px;
    font-size: 25px;
  }

  .purchase-page-heading p,
  .purchase-service-points,
  .purchase-form-heading small {
    display: none;
  }

  .purchase-form-heading {
    min-height: 60px;
    padding: 12px 16px;
  }

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

  .purchase-config {
    padding: 16px;
  }

  .purchase-form[data-cdk-mode="quota"] .purchase-quantity-grid,
  #purchaseTierOffers {
    grid-template-columns: minmax(0, 1fr);
  }

  .purchased-cdk-result > div > * {
    flex: 1 1 120px;
  }

  .purchased-cdk-result .portal-primary {
    margin-left: 0;
  }
}

@media (max-width: 350px) {
  .purchase-config {
    padding: 14px;
  }

  .cdk-purchase-option {
    padding-inline: 7px;
    font-size: 11px;
  }

  .payment-option-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .purchase-coupon-control {
    grid-template-columns: minmax(0, 1fr);
  }

  .purchase-coupon-control .secondary-action,
  .purchase-coupon-control .ghost-action {
    width: 100%;
  }

  .purchase-checkout-actions {
    padding-inline: 14px;
  }
}

/* Checkout actions ----------------------------------------------------- */
.purchase-checkout-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  min-height: 0;
  padding: 16px 22px;
  border-top: 1px solid var(--tech-line);
  color: var(--tech-ink);
  background: #f7fafb;
}

.purchase-price-summary {
  display: grid;
  gap: 4px;
  min-width: 0;
  width: min(260px, 100%);
  margin-left: auto;
}

.purchase-price-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  color: var(--tech-muted);
  font-size: 10px;
}

.purchase-price-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-price-line s,
.purchase-price-line b {
  color: #667085;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.purchase-price-line b {
  color: var(--tech-ok);
  text-decoration: none;
}

.purchase-checkout-grid {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.purchase-config {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 18px;
}

.purchase-product-field,
.purchase-quantity-grid {
  grid-column: 1;
}

.cdk-purchase-types,
.purchase-tier-panel {
  grid-column: 2;
}

.purchase-private-fields,
.purchase-coupon-panel,
.product-description,
.payment-types {
  grid-column: 1 / -1;
}

.purchase-total-row {
  min-width: 118px;
  display: grid;
  justify-items: end;
  gap: 3px;
  margin: 0;
  padding: 0;
}

.purchase-total-row span {
  color: var(--tech-muted);
  font-size: 10px;
}

.purchase-total-row strong {
  color: var(--tech-ink);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 24px;
  font-weight: 780;
  line-height: 1;
  white-space: nowrap;
}

.purchase-checkout-actions .portal-primary {
  width: 142px;
  min-height: 44px;
  margin: 0;
  border-color: var(--tech-accent);
  color: #fff;
  background: var(--tech-accent);
}

.purchase-checkout-actions .portal-primary:hover {
  border-color: var(--tech-accent-dark);
  color: #fff;
  background: var(--tech-accent-dark);
}

@media (max-width: 760px) {
  .purchase-config {
    grid-template-columns: minmax(0, 1fr);
  }

  .purchase-product-field,
  .purchase-quantity-grid,
  .cdk-purchase-types,
  .purchase-tier-panel,
  .purchase-private-fields,
  .purchase-coupon-panel,
  .product-description,
  .payment-types {
    grid-column: 1;
  }

  .purchase-private-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .purchase-checkout-actions {
    margin: 0;
    padding: 16px;
    border-top: 1px solid var(--tech-line);
  }

  .purchase-price-summary {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .purchase-checkout-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(118px, 42%);
    gap: 12px;
    padding: 14px;
  }

  .purchase-total-row {
    min-width: 0;
    justify-items: start;
  }

  .purchase-total-row strong {
    font-size: 22px;
  }
  .purchase-checkout-actions .portal-primary {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .portal-shell .product-inventory-grid { grid-template-columns: minmax(0, 1fr); }
  .portal-shell .product-inventory-tile { min-height: 104px; }
  .portal-shell .product-inventory-tile strong { font-size: 38px; }
  .portal-shell .product-inventory-tile[data-state="on-demand"] strong { font-size: 26px; }
}

/* Dense desktop workspace: keep the task and inventory in one scan path. */
@media (min-width: 901px) {
  .portal-shell .redeem-stage {
    grid-template-columns: minmax(240px, 0.62fr) minmax(620px, 1.38fr);
    align-items: start;
    gap: 52px;
    padding-top: 54px;
  }

  .portal-shell .redeem-stage > .portal-intro {
    padding-top: 210px;
  }

  .portal-shell .redeem-stage > .claim-column {
    max-width: 720px;
  }

  .portal-shell .redeem-stage .claim-card {
    padding: 28px 32px;
  }

  .portal-shell .redeem-stage .product-inventory-tile {
    min-height: 144px;
  }

  .portal-shell .redeem-stage .redeem-format-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Public redemption polish ------------------------------------------------ */
.portal-shell .inventory-zero-state {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid rgba(190, 109, 37, .28);
  color: #a3541e;
  background: #fff7ed;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0;
}

.portal-shell .inventory-zero-state[hidden],
.portal-shell .inventory-buy-link[hidden] { display: none; }

.portal-shell .inventory-buy-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  margin-top: 2px;
  color: #9a4d1c;
  font-size: 11px;
  font-weight: 780;
  text-decoration: none;
}

.portal-shell .inventory-buy-link:hover { color: #6f3314; text-decoration: underline; }
.portal-shell .inventory-buy-link span { transition: transform 160ms ease; }
.portal-shell .inventory-buy-link:hover span { transform: translateX(3px); }

.portal-shell .redeem-purchase-cta {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  margin-top: 11px;
  padding: 0 13px;
  border: 1px solid rgba(7, 136, 168, .22);
  color: #14576a;
  background: #f0fafc;
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.portal-shell .redeem-purchase-cta:hover { border-color: var(--tech-accent); background: #e6f7fa; transform: translateY(-1px); }
.portal-shell .redeem-purchase-cta span { color: var(--tech-muted); font-size: 11px; }
.portal-shell .redeem-purchase-cta b { font-size: 12px; }
.portal-shell .redeem-purchase-cta i { margin-left: auto; font-style: normal; }

.portal-shell .warranty-guidance {
  margin: 14px 0 2px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #c8d9ee;
  border-left: 3px solid #2563eb;
  border-radius: 5px;
  color: #334155;
  background: #f7fbff;
  font-size: 12px;
  line-height: 1.55;
}

.portal-shell .warranty-guidance > span {
  min-width: 40px;
  color: #1d4ed8;
  font: 800 12px/1 "Microsoft YaHei UI", sans-serif;
}

.portal-shell .warranty-guidance p { margin: 0; }
.portal-shell .warranty-guidance p strong { color: #172554; }
.portal-shell .warranty-guidance code { color: #9f1239; font-size: 11px; }
.portal-shell .warranty-guidance a {
  color: #1d4ed8;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .portal-shell .warranty-guidance { grid-template-columns: auto minmax(0, 1fr); }
  .portal-shell .warranty-guidance a { grid-column: 1 / -1; white-space: normal; }
}

.portal-shell .code-input-wrap {
  position: relative;
  min-height: 136px;
  overflow: hidden;
}
.portal-shell .code-input-wrap[data-segment-mode="single"] textarea.is-segment-input {
  position: relative;
  z-index: 2;
  color: transparent;
  /* The visual caret lives in the active slot; avoid a second native caret. */
  caret-color: transparent;
  background: transparent;
  text-shadow: none;
}
.portal-shell .code-input-wrap[data-segment-mode="single"] textarea.is-segment-input::selection { background: rgba(7, 136, 168, .18); }
.portal-shell .cdk-segment-display {
  position: absolute;
  z-index: 1;
  inset: 18px 14px 24px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-content: center;
  pointer-events: none;
  contain: layout paint;
  transform: translateZ(0);
}
.portal-shell .cdk-segment-display[hidden] { display: none; }
.portal-shell .cdk-segment-display.is-legacy { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.portal-shell .cdk-group {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  min-width: 0;
}
.portal-shell .cdk-group:not(:last-child)::after {
  content: "-";
  position: absolute;
  top: 50%;
  right: -9px;
  color: #9aa8b2;
  font: 700 12px/1 "Cascadia Mono", Consolas, monospace;
  transform: translate(50%, -50%);
}
.portal-shell .cdk-character {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 48px;
  border: 1px solid #d5e0e7;
  border-radius: 6px;
  color: #9eabb3;
  background: rgba(248, 251, 252, .94);
  font: 750 13px/1 "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0;
  overflow: hidden;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease, transform 180ms cubic-bezier(.2,.8,.2,1), box-shadow 140ms ease;
  contain: layout paint;
}
.portal-shell .cdk-character.is-filled { color: var(--tech-ink); border-color: #9ccbd4; background: #f1fbfc; }
.portal-shell .cdk-character.is-active { border-color: var(--tech-accent); box-shadow: 0 0 0 2px rgba(7, 136, 168, .12); }
.portal-shell .cdk-character.is-invalid { color: #9f2d2d; border-color: #e6a4a4; background: #fff7f7; }
.portal-shell .cdk-segment-display.is-complete .cdk-character.is-filled { color: #0c684e; border-color: #7bc9ae; background: #f0fbf5; }
.portal-shell .cdk-character-content { position: absolute; inset: 0; display: grid; place-items: center; will-change: transform, opacity; }
.portal-shell .cdk-character-caret { width: 1px; height: 16px; background: var(--tech-accent-dark); animation: cdk-caret-blink 1.25s ease-out infinite; }
.portal-shell .code-input-wrap.is-focused .cdk-segment-display { filter: saturate(1.08); }
@keyframes cdk-character-input { 0% { transform: translateY(7px) scale(.88); opacity: 0; } 65% { transform: translateY(-1px) scale(1.02); opacity: 1; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes cdk-character-delete { 0% { transform: scale(1); opacity: 1; } 45% { transform: scale(.86); opacity: .35; } 100% { transform: scale(1); opacity: 1; } }
@keyframes cdk-segment-paste { 0% { transform: translateY(3px) scale(.985); opacity: .72; } 60% { transform: translateY(-1px) scale(1.01); opacity: 1; } 100% { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes cdk-segment-complete { 0%, 100% { transform: translateY(0); } 48% { transform: translateY(-3px); } }
@keyframes cdk-segment-delete { 0%, 100% { transform: translateX(0); } 40% { transform: translateX(-2px); } 72% { transform: translateX(1px); } }
@keyframes cdk-caret-blink { 0%, 70%, 100% { opacity: 1; } 20%, 50% { opacity: 0; } }
.portal-shell .cdk-character.is-entering .cdk-character-content { animation: cdk-character-input 220ms cubic-bezier(.175,.885,.32,1.275) both; }
.portal-shell .cdk-character.is-deleting .cdk-character-content { animation: cdk-character-delete 180ms ease-out both; }
.portal-shell .cdk-segment-display.is-pasting .cdk-group { animation: cdk-segment-paste 400ms cubic-bezier(.2,.8,.2,1) both; }
.portal-shell .cdk-segment-display.is-pasting .cdk-group:nth-child(2n) { animation-delay: 35ms; }
.portal-shell .cdk-segment-display.is-pasting .cdk-group:nth-child(3n) { animation-delay: 70ms; }
.portal-shell .cdk-segment-display.is-completing .cdk-group { animation: cdk-segment-complete 440ms cubic-bezier(.175,.885,.32,1.275) both; }
.portal-shell .cdk-segment-display.is-completing .cdk-group:nth-child(2) { animation-delay: 35ms; }
.portal-shell .cdk-segment-display.is-completing .cdk-group:nth-child(3) { animation-delay: 70ms; }
.portal-shell .cdk-segment-display.is-completing .cdk-group:nth-child(4) { animation-delay: 105ms; }
.portal-shell .cdk-segment-display.is-completing .cdk-group:nth-child(5) { animation-delay: 140ms; }
.portal-shell .cdk-segment-display.is-deleting { animation: cdk-segment-delete 180ms ease-out both; }

.portal-shell .merge-card[data-merge-state="working"] { border-color: rgba(7, 136, 168, .42); }
.portal-shell .merge-card[data-merge-state="complete"] { border-color: rgba(23, 123, 85, .36); }
.portal-shell .merge-state {
  min-width: 54px;
  color: var(--tech-muted);
  font-size: 10px;
  font-weight: 720;
  text-align: center;
}
.portal-shell .merge-card[data-merge-state="ready"] .merge-state { color: #126b83; }
.portal-shell .merge-card[data-merge-state="working"] .merge-state { color: var(--tech-accent-dark); }
.portal-shell .merge-card[data-merge-state="complete"] .merge-state { color: #16734d; }

.portal-shell .convert-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 18px;
  padding: 4px;
  border: 1px solid #dce6eb;
  background: #f2f6f8;
}
.portal-shell .convert-mode-switch button {
  min-height: 40px;
  border: 0;
  color: var(--tech-muted);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 740;
  cursor: pointer;
}
.portal-shell .convert-mode-switch button.active { color: #fff; background: var(--tech-ink); box-shadow: 0 3px 10px rgba(16, 38, 51, .14); }
.portal-shell .convert-mode-switch button:focus-visible { outline: 3px solid rgba(7, 136, 168, .24); outline-offset: 1px; }
.portal-shell [data-convert-pane][hidden] { display: none; }
.portal-shell .convert-paste-pane textarea {
  width: 100%;
  min-height: 214px;
  resize: vertical;
  border: 1px solid #d5e0e7;
  color: var(--tech-ink);
  background: #fbfdfe;
  font: 12px/1.65 "Cascadia Mono", Consolas, monospace;
}
.portal-shell .convert-paste-pane textarea:focus { border-color: var(--tech-accent); box-shadow: 0 0 0 3px rgba(7, 136, 168, .11); }
.portal-shell .convert-paste-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--tech-muted);
  font-size: 10px;
}
.portal-shell .convert-paste-footer label { white-space: nowrap; }
.portal-shell .convert-paste-footer input { min-width: 0; flex: 1; min-height: 34px; padding: 0 9px; border: 1px solid #d5e0e7; color: var(--tech-ink); background: #fff; }
.portal-shell .convert-paste-footer span { min-width: 52px; text-align: right; font-family: "Cascadia Mono", Consolas, monospace; }
.portal-shell .convert-preview {
  grid-column: 1 / -1;
  min-width: 0;
  margin-top: 14px;
  border: 1px solid #d5e0e7;
  background: #f8fbfc;
}
.portal-shell .convert-preview[hidden] { display: none; }
.portal-shell .convert-preview header { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid #e1eaee; color: var(--tech-muted); font-size: 10px; }
.portal-shell .convert-preview pre { max-height: 300px; margin: 0; padding: 13px; overflow: auto; color: #243746; background: #fff; font: 11px/1.6 "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Public order query --------------------------------------------------- */
.portal-nav[data-active-route] .portal-nav-indicator {
  width: calc((100% - 6px) / var(--portal-nav-count, 5));
  transform: translateX(var(--portal-nav-offset, 0%));
}

.portal-shell .order-query-column {
  display: grid;
  gap: 14px;
}

.portal-shell .order-query-form input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--tech-line);
  color: var(--tech-ink);
  background: #fff;
  font: 600 13px/1.2 "Cascadia Mono", Consolas, monospace;
}

.portal-shell .order-query-form input:focus {
  border-color: var(--tech-accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(7, 136, 168, .11);
}

.portal-shell .order-query-form #publicOrderLookup,
.portal-shell .order-query-form #publicOrderPassword {
  font-family: inherit;
  text-transform: none;
}

.portal-shell .order-query-form .portal-field > small {
  display: block;
  margin-top: 7px;
  color: var(--tech-muted);
  font-size: 10px;
  line-height: 1.5;
}

.portal-shell .order-query-result {
  display: grid;
  gap: 18px;
}

.portal-shell .order-query-result[hidden],
.portal-shell .order-query-matches[hidden],
.portal-shell .order-query-cdks[hidden],
.portal-shell .order-query-waiting[hidden] {
  display: none;
}

.portal-shell .order-query-matches {
  min-width: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--tech-line);
}

.portal-shell .order-query-matches > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--tech-muted);
  font-size: 10px;
}

.portal-shell #publicOrderMatchList {
  max-height: 238px;
  display: grid;
  gap: 7px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.portal-shell .order-query-match {
  width: 100%;
  min-width: 0;
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--tech-line);
  border-radius: 6px;
  color: var(--tech-ink);
  background: #fff;
  text-align: left;
}

.portal-shell .order-query-match:hover,
.portal-shell .order-query-match.active {
  border-color: #87bfcc;
  background: #f2fafb;
}

.portal-shell .order-query-match:focus-visible {
  outline: 3px solid rgba(7, 136, 168, .14);
  outline-offset: 1px;
}

.portal-shell .order-query-match > span {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.portal-shell .order-query-match > span:last-child {
  justify-items: end;
}

.portal-shell .order-query-match strong,
.portal-shell .order-query-match b {
  overflow-wrap: anywhere;
  font-size: 11px;
}

.portal-shell .order-query-match strong {
  font-family: "Cascadia Mono", Consolas, monospace;
}

.portal-shell .order-query-match small {
  color: var(--tech-muted);
  font-size: 9px;
}

.portal-shell .order-query-result-heading,
.portal-shell .order-query-cdks > header,
.portal-shell .order-query-cdks > header > div {
  display: flex;
  align-items: center;
}

.portal-shell .order-query-result-heading {
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--tech-line);
}

.portal-shell .order-query-result-heading > div {
  min-width: 0;
}

.portal-shell .order-query-result-heading span {
  color: var(--tech-muted);
  font: 700 9px/1.2 "Cascadia Mono", Consolas, monospace;
}

.portal-shell .order-query-result-heading h2 {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  color: var(--tech-ink);
  font: 700 13px/1.35 "Cascadia Mono", Consolas, monospace;
}

.portal-shell .order-query-status {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 30px;
  padding: 6px 9px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #a7c7d0;
  border-radius: 6px;
  color: #126b83;
  background: #edf9fb;
  font-size: 11px;
}

.portal-shell .order-query-status[data-status="fulfilled"] {
  color: #16734d;
  border-color: #9fcbb9;
  background: #edf9f3;
}

.portal-shell .order-query-status[data-status="pending"] {
  color: #7b5718;
  border-color: #d9c38e;
  background: #fff9e9;
}

.portal-shell .order-query-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.portal-shell .order-query-meta > div {
  min-width: 0;
  min-height: 70px;
  padding: 11px 12px;
  border: 1px solid var(--tech-line);
  background: var(--tech-panel-soft);
}

.portal-shell .order-query-meta dt {
  color: var(--tech-muted);
  font-size: 10px;
}

.portal-shell .order-query-meta dd {
  margin: 6px 0 0;
  overflow-wrap: anywhere;
  color: var(--tech-ink);
  font-size: 13px;
  font-weight: 700;
}

.portal-shell .order-query-cdks {
  padding-top: 16px;
  border-top: 1px solid var(--tech-line);
}

.portal-shell .order-query-cdks > header {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.portal-shell .order-query-cdks > header > div {
  gap: 8px;
  min-width: 0;
}

.portal-shell .order-query-cdks > header span,
.portal-shell .order-query-cdks > header strong {
  font-size: 11px;
}

.portal-shell .order-query-cdks button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #b8ccd3;
  color: #14576a;
  background: #f4fbfc;
  font-size: 11px;
}

.portal-shell .order-query-cdk-list {
  display: grid;
  gap: 7px;
}

.portal-shell .order-query-cdk-list > div {
  min-width: 0;
  min-height: 42px;
  padding: 6px 6px 6px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--tech-line);
  background: #fff;
}

.portal-shell .order-query-cdk-list code {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
  color: var(--tech-ink);
  font-size: 11px;
}

.portal-shell .order-query-copy-status,
.portal-shell .order-query-waiting {
  margin: 9px 0 0;
  color: var(--tech-muted);
  font-size: 11px;
}

@media (max-width: 520px) {
  .portal-shell .order-query-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-shell .order-query-meta > div {
    min-height: 60px;
  }
}

@media (max-width: 390px) {
  .portal-nav a {
    padding-inline: 2px;
    font-size: 10px;
  }

  .portal-shell .order-query-result-heading {
    align-items: flex-start;
  }

  .portal-shell .order-query-status {
    min-width: 64px;
  }

  .portal-shell .order-query-cdks > header {
    align-items: flex-start;
  }
}

/* Keep the recovery escape hatch visible without changing the task state. */
.supplier-progress-dialog { position: relative; }
.supplier-progress-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(126, 164, 220, .32);
  border-radius: 50%;
  color: #d6e5fa;
  background: rgba(25, 52, 84, .78);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.supplier-progress-close:hover { color: #fff; border-color: #75cfe2; background: #1d5272; }
.supplier-progress-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, .45fr); gap: 10px; }
.supplier-progress-actions .supplier-progress-task-link,
.supplier-progress-actions .supplier-progress-home { width: 100%; min-height: 48px; margin-top: 18px; }
.supplier-progress-home { display: grid; place-items: center; border: 1px solid rgba(126, 164, 220, .35); color: #d6e5fa; background: transparent; text-decoration: none; font-weight: 750; }
.supplier-progress-home:hover { color: #fff; border-color: #75cfe2; background: #193454; }

@media (max-width: 600px) {
  .portal-shell .cdk-segment-display { inset-inline: 10px; gap: 9px; }
  .portal-shell .cdk-segment-display.is-legacy { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, 42px); gap: 8px 10px; }
  .portal-shell .cdk-character { min-height: 43px; border-radius: 4px; font-size: 10px; }
  .portal-shell .cdk-group { gap: 1px; }
  .portal-shell .cdk-group:not(:last-child)::after { right: -7px; font-size: 10px; }
  .portal-shell .cdk-segment-display.is-legacy .cdk-group:nth-child(4)::after { content: none; }
  .portal-shell .convert-paste-footer { align-items: stretch; flex-wrap: wrap; }
  .portal-shell .convert-paste-footer input { flex-basis: calc(100% - 55px); }
  .portal-shell .convert-paste-footer span { margin-left: auto; }
  .supplier-progress-actions { grid-template-columns: minmax(0, 1fr); }
  .supplier-progress-actions .supplier-progress-task-link,
  .supplier-progress-actions .supplier-progress-home { margin-top: 12px; }
}

@media (max-width: 350px) {
  .portal-shell .code-input-wrap[data-segment-mode="single"] textarea.is-segment-input {
    min-height: 122px;
  }

  .portal-shell .cdk-segment-display:not(.is-legacy) {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: repeat(2, 43px);
    gap: 8px 6px;
  }

  .portal-shell .cdk-segment-display:not(.is-legacy) .cdk-group {
    grid-column: span 2;
  }

  .portal-shell .cdk-segment-display:not(.is-legacy) .cdk-group:nth-child(4) {
    grid-column: 2 / span 2;
  }

  .portal-shell .cdk-segment-display:not(.is-legacy) .cdk-group:nth-child(3)::after {
    content: none;
  }

  .portal-shell .cdk-character { font-size: 11px; }
}

/* Multi-row public navigation for phone widths. */
@media (min-width: 701px) and (max-width: 960px) {
  .portal-shell .portal-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 14px;
    padding-bottom: 12px;
  }

  .portal-shell .portal-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
  }

  .portal-shell .admin-entry {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 700px) {
  .portal-shell .portal-header {
    min-height: 0;
    row-gap: 10px;
    padding-bottom: 12px;
  }

  .portal-shell .portal-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    min-height: 0;
    padding: 4px;
    overflow: visible;
  }

  .portal-shell .portal-nav-indicator {
    display: none;
    view-transition-name: none;
  }

  .portal-shell .portal-nav a {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .portal-shell .portal-nav a:last-of-type:nth-of-type(odd) {
    grid-column: 1 / -1;
  }

  .portal-shell .portal-nav a.active,
  .portal-shell .portal-nav a[aria-current="page"] {
    color: #fff;
    border-color: #102633;
    background: #102633;
    box-shadow: none;
  }
}

/* The warranty route stays visible as an operational action, not a passive link. */
.portal-shell .portal-nav a.warranty-entry:not(.active) {
  color: #174ea6;
  background: #eef6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .2);
}

.portal-shell .portal-nav a.warranty-entry:not(.active):hover {
  color: #123b7b;
  background: #e4f0ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .34);
}

.cdk-warranty-notice {
  position: fixed;
  left: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 120;
  width: min(720px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid #a9c5e9;
  border-left: 4px solid #2563eb;
  border-radius: 8px;
  color: #26364c;
  background: rgba(248, 252, 255, .98);
  box-shadow: 0 18px 48px rgba(28, 56, 94, .22);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.cdk-warranty-notice[hidden] { display: none; }
.cdk-warranty-notice.is-visible { opacity: 1; transform: translateY(0); }

.cdk-warranty-notice-mark {
  display: grid;
  place-items: center;
  min-width: 42px;
  min-height: 34px;
  border-radius: 5px;
  color: #fff;
  background: #1d4ed8;
  font: 800 12px/1 "Cascadia Mono", monospace;
}

.cdk-warranty-notice-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cdk-warranty-notice-copy strong {
  color: #172554;
  font-size: 13px;
  line-height: 1.35;
}

.cdk-warranty-notice-copy p {
  margin: 0;
  overflow-wrap: anywhere;
  color: #52647a;
  font-size: 11px;
  line-height: 1.5;
}

.cdk-warranty-notice > a {
  min-height: 38px;
  padding: 8px 12px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}

.cdk-warranty-notice > a:hover { background: #173fae; }

.cdk-warranty-notice > button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #cad8e7;
  border-radius: 50%;
  color: #52647a;
  background: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.cdk-warranty-notice > a:focus-visible,
.cdk-warranty-notice > button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .24);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .cdk-warranty-notice {
    right: 10px;
    left: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 9px;
    padding: 11px;
  }

  .cdk-warranty-notice > a {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    white-space: normal;
  }

  html.has-cdk-warranty-notice .supplier-delivery-center {
    --supplier-delivery-max-height: min(
      52vh,
      440px,
      max(
        58px,
        calc(
          100dvh - var(--cdk-warranty-notice-height, 0px) -
          max(40px, calc(env(safe-area-inset-bottom) + 30px))
        )
      )
    );
    bottom: calc(
      var(--cdk-warranty-notice-height, 0px) +
      max(20px, calc(env(safe-area-inset-bottom) + 10px))
    );
    max-height: var(--supplier-delivery-max-height);
  }

  html.has-cdk-warranty-notice .supplier-delivery-list {
    max-height: calc(var(--supplier-delivery-max-height) - 58px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-shell .cdk-character-content,
  .portal-shell .cdk-group,
  .portal-shell .cdk-segment-display,
  .portal-shell .cdk-character,
  .portal-shell .cdk-character-caret,
  .cdk-export-guide,
.cdk-warranty-notice { animation: none !important; transition: none !important; }
}

/* Goal37 independent coupon workspace ---------------------------------- */
.admin-surface .coupon-nav-link { color: #315b16; }
.admin-surface .coupon-toolbar { align-items: flex-start; }
.admin-surface .coupon-bulk-actions { flex-wrap: wrap; }
.admin-surface .coupon-table-wrap { overflow-x: auto; }
.admin-surface .coupon-table { min-width: 930px; }
.admin-surface .coupon-table th,
.admin-surface .coupon-table td { vertical-align: middle; }
.admin-surface .coupon-table .coupon-select-col { width: 44px; }
.admin-surface .coupon-table .coupon-code-col { width: 220px; }
.admin-surface .coupon-table .coupon-product-col { width: 140px; }
.admin-surface .coupon-table .coupon-mode-col { width: 150px; }
.admin-surface .coupon-table .coupon-limit-col { width: 120px; }
.admin-surface .coupon-table .coupon-window-col { width: 170px; }
.admin-surface .coupon-table .coupon-count-col { width: 110px; }
.admin-surface .coupon-table .coupon-status-col { width: 100px; }
.admin-surface .coupon-table .coupon-action-col { width: 150px; }
.admin-surface .coupon-code-cell { align-items: center; gap: 8px; }
.admin-surface .coupon-code-text {
  color: #172b11;
  font-size: 12px;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.admin-surface .coupon-table td strong,
.admin-surface .coupon-table td small { display: block; }
.admin-surface .coupon-rule-value {
  margin-top: 4px;
  color: #737a73;
  font-size: 10px;
}
.admin-surface .coupon-window-cell span {
  display: block;
  color: #4a534b;
  font-size: 11px;
  white-space: nowrap;
}
.admin-surface .coupon-window-cell span + span { margin-top: 4px; color: #7d857d; }
.admin-surface .coupon-count strong { display: inline; color: #355d1f; }
.admin-surface .coupon-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border: 1px solid #cbd8c2;
  border-radius: 4px;
  color: #3f641d;
  background: #f0f7eb;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.admin-surface .coupon-status.inactive {
  border-color: #d8dadd;
  color: #6e737a;
  background: #f5f6f7;
}
.admin-surface .coupon-row-actions-cell { white-space: nowrap; }
.admin-surface .coupon-row-actions-cell .mini + .mini { margin-left: 4px; }
body.admin-surface.overlay-open .admin-content-frame {
  position: relative;
  z-index: 40;
}
.admin-surface .coupon-drawer { width: min(560px, calc(100vw - 24px)); }
.admin-surface .coupon-drawer .drawer-close {
  flex: 0 0 auto;
  min-width: 52px;
  white-space: nowrap;
}
.admin-surface .coupon-generate-form,
.admin-surface .coupon-edit-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.admin-surface .coupon-generate-form .coupon-active,
.admin-surface .coupon-edit-form .coupon-active,
.admin-surface .coupon-generate-form > button,
.admin-surface .coupon-edit-form > button { grid-column: 1 / -1; }
.admin-surface .coupon-generated-result { margin: 0 22px 22px; }
.admin-surface .coupon-generated-result textarea {
  min-height: 190px;
  font-family: "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0;
}
@media (max-width: 1100px) {
  .admin-surface .coupon-generate-form,
  .admin-surface .coupon-edit-form { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .admin-surface .coupon-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .admin-surface .coupon-bulk-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-surface .coupon-bulk-actions .selected-count { grid-column: 1 / -1; }
  .admin-surface .coupon-bulk-actions > button,
  .admin-surface .coupon-toolbar .create-actions,
  .admin-surface .coupon-toolbar .create-actions button { width: 100%; }
  .admin-surface .coupon-generated-result { margin: 0 16px 16px; }
}
@media (max-width: 380px) {
  .admin-surface .coupon-bulk-actions { grid-template-columns: minmax(0, 1fr); }
  .admin-surface .coupon-bulk-actions .selected-count { grid-column: 1; }
}
