/* ==========================================================================
   ACPL Purchase & Subscription portal — portal patterns
   Loads after tokens.css + components.css (shared ACPL design system).
   Many selectors below are FIXED CLASS NAMES that page JavaScript or C#
   code-behind depend on (product-card, product-qty, product-price,
   product-term, is-selected, product-port-list, product-port-static,
   wa-switch/on/off, discount-message/error, step/active …). Restyle them
   freely, but never rename them.
   Sections: 1 Shell · 2 Page head · 3 Checkout layout & panels
             4 Product selector · 5 Forms (WebForms) · 6 Order summary
             7 Toggle, toast, stepper · 8 Results · 9 Data views
             10 Bootstrap-JS compatibility · 11 Utilities
             12 Page patterns · 13 Small modifiers · 14 Cart & checkout
   ========================================================================== */

/* 1. Shell ------------------------------------------------------------------ */
/* WebForms MaintainScrollPositionOnPostback restores scroll with scrollTo();
   smooth scrolling would make every postback visibly glide. */
html {
  scroll-behavior: auto;
}

body > form {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
}

.portal-main {
  flex: 1 0 auto;
  padding-block: clamp(var(--space-6), 3vw, var(--space-12)) clamp(var(--space-12), 5vw, var(--space-20));
  background:
    radial-gradient(70% 320px at 85% 0%, rgb(42 162 226 / 0.1), transparent 70%),
    linear-gradient(180deg, var(--surface-tint) 0, var(--surface-secondary) 360px);
}

.portal-main--plain {
  background: var(--surface-secondary);
}

.portal-secure {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--success);
}

.portal-secure .icon {
  width: 16px;
  height: 16px;
}

.portal-footer {
  background: var(--navy-950);
  color: var(--text-inverse-muted);
  font-size: var(--fs-xs);
}

.portal-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4) var(--space-8);
  padding-block: var(--space-6) calc(var(--space-6) + env(safe-area-inset-bottom));
  container-type: inline-size; /* the former-name line sizes itself to this width */
}

.portal-footer a:not(.btn) {
  color: var(--text-inverse-muted);
  text-decoration: none;
}

.portal-footer a:not(.btn):hover {
  color: #fff;
}

/* "© Access Computech Ltd." then, directly under it, "(Formerly known as Access Computech Pvt Ltd)".
   Each part stays on one line; on phones "All rights reserved." moves to a third
   line so it never pushes the former name away from the company name. */
.portal-footer__company {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: start;
  column-gap: 0.3em;
}

.portal-footer__name,
.portal-footer__rights,
.portal-footer__former {
  white-space: nowrap;
}

/* On the narrowest phones (under ~300px) the line shrinks just enough to stay on one line. */
.portal-footer__former {
  grid-column: 1 / -1;
  margin-top: 2px;
  font-size: min(1em, 4.7cqi);
}

@media (max-width: 599.98px) {
  .portal-footer__company {
    grid-template-columns: auto;
  }

  .portal-footer__rights {
    grid-row: 3;
    margin-top: 2px;
  }
}

.portal-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.portal-footer__contact {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}

.portal-footer__contact a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.portal-footer .icon {
  width: 14px;
  height: 14px;
}

/* 2. Page head ---------------------------------------------------------------- */
.portal-head {
  display: grid;
  gap: var(--space-3);
  margin-bottom: clamp(var(--space-6), 3vw, var(--space-10));
}

.portal-head__title {
  font-size: var(--fs-h1);
  font-weight: var(--fw-heavy);
  color: var(--navy-900);
}

.portal-head__lead {
  max-width: 68ch;
  color: var(--text-secondary);
  font-size: var(--fs-body-lg);
}

.portal-head__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-1);
}

.trust-point {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
}

.trust-point .icon {
  width: 18px;
  height: 18px;
  color: var(--success);
}

/* 3. Checkout layout & panels ---------------------------------------------------- */
.checkout {
  display: grid;
  gap: var(--space-6);
  align-items: start;
}

@media (min-width: 1024px) {
  .checkout {
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: var(--space-8);
  }

  .checkout__aside {
    position: sticky;
    top: calc(var(--header-h) + var(--space-6));
  }
}

/* Short laptop screens: a sticky summary taller than the viewport would hide
   the coupon field and Pay button, so let it scroll normally */
@media (min-width: 1024px) and (max-height: 899.98px) {
  .checkout__aside {
    position: static;
  }
}

.checkout__main,
.checkout__aside {
  display: grid;
  gap: var(--space-6);
  min-width: 0;
}

.panel {
  min-width: 0;
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel__head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

.panel__num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-primary-soft);
  border: 1px solid var(--blue-200);
  color: var(--brand-primary);
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: var(--fw-heavy);
}

.panel__head .icon-tile {
  width: 36px;
  height: 36px;
}

.panel__title {
  font-size: 1.125rem;
  line-height: 1.3;
}

.panel__desc {
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.panel__head-end {
  margin-left: auto;
}

.panel__body {
  padding: var(--space-6);
}

.panel__foot {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

@media (max-width: 479.98px) {
  .panel__head,
  .panel__body,
  .panel__foot {
    padding-inline: var(--space-4);
  }
}

.panel--narrow {
  max-width: 720px;
  margin-inline: auto;
}

/* 4. Product selector (fixed class names — used by checkout JS & C#) --------------- */
.product-selector .product-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
}

.product-selector .product-tile {
  display: flex;
  min-width: 0;
}

.product-selector .product-card {
  width: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--space-3);
  padding: var(--space-3);
  overflow: visible;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: none;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-base) var(--ease-out),
    background-color var(--dur-fast), transform var(--dur-base) var(--ease-out);
}

.product-selector .product-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue-200);
  box-shadow: var(--shadow-md);
}

.product-selector .product-card:focus-within {
  transform: none;
  border-color: var(--blue-300);
  box-shadow: var(--shadow-sm);
}

.product-selector .product-card.is-selected {
  border-color: var(--brand-primary);
  background: var(--brand-primary-soft);
  box-shadow: inset 0 0 0 1px var(--brand-primary), var(--shadow-md);
}

.product-selector .product-card.is-selected::after {
  content: "";
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-primary)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E")
    center / 14px no-repeat;
  box-shadow: 0 0 0 3px #fff;
}

/* Flex centring + max-* sizing: a percentage height inside an auto grid row would
   resolve to the image's natural height and crop it */
.product-selector .product-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 140px;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: radial-gradient(90% 90% at 50% 100%, var(--blue-50), #fff 70%);
  overflow: hidden;
}

.product-selector .product-img {
  width: auto;
  height: auto;
  max-width: min(100%, 190px);
  max-height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: transform var(--dur-slow) var(--ease-out);
}

.product-selector .product-card:hover .product-img {
  transform: scale(1.04);
}

.product-selector .product-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.product-selector .product-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: var(--fw-bold);
  line-height: 1.3;
  letter-spacing: var(--tracking-snug);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.product-selector .product-price {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: var(--fw-heavy);
  color: var(--brand-primary);
  font-variant-numeric: tabular-nums;
}

.product-selector .product-terms {
  display: grid;
  gap: 2px;
}

.product-selector .product-term {
  min-height: 1.2em;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.product-selector .product-actions {
  display: grid;
  gap: var(--space-2);
}

.product-selector .qty-box,
.product-selector .product-qty {
  width: 100%;
  min-height: var(--control-h-md);
  padding: 0 var(--space-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: #fff;
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  text-align: center;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.product-selector .qty-box:focus-visible,
.product-selector .product-qty:focus-visible {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--ring-focus);
}

/* Port / connector choice — HTML emitted by RenderPortControl() in C# */
.product-port-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface-tertiary);
}

.product-port-list input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.product-port-list label {
  flex: 1 1 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 var(--space-3);
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}

.product-port-list label:hover {
  color: var(--text-primary);
}

.product-port-list input:checked + label {
  background: #fff;
  color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.product-port-list input:focus-visible + label {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}

.product-port-static {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface-tertiary);
  color: var(--text-secondary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
  text-align: center;
}

.product-footnote {
  display: grid;
  gap: var(--space-1);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border-subtle);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

/* 5. Forms — WebForms controls on design-system fields -------------------------- */
/* Validators render as <span>; Display="Dynamic" sets inline display:none/inline,
   which always wins — so only colour/spacing is styled here */
span.field-error {
  margin-top: 2px;
  line-height: 1.4;
}

.form-grid .field--span {
  grid-column: 1 / -1;
}

.field__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
}

.field__row > .input,
.field__row > .select {
  flex: 1 1 200px;
}

.validation-summary {
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-md);
  background: var(--error-soft);
  color: var(--error-text);
  font-size: var(--fs-sm);
}

.validation-summary ul {
  margin: var(--space-2) 0 0;
  padding-left: 1.25rem;
}

/* Native file input */
.input[type="file"] {
  padding: 0.5rem;
  font-size: var(--fs-sm);
}

.input[type="file"]::file-selector-button {
  margin-right: var(--space-3);
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--surface-secondary);
  color: var(--text-primary);
  font: inherit;
  font-weight: var(--fw-semibold);
  cursor: pointer;
}

/* WebForms CheckBox / RadioButton render <input> + <label> (or a table for lists) */
.check-list input,
.check-list label {
  vertical-align: middle;
}

.check-list label {
  margin-left: var(--space-2);
  font-size: var(--fs-sm);
}

.check-list table {
  border-collapse: collapse;
}

.check-list td {
  padding: var(--space-1) var(--space-4) var(--space-1) 0;
}

/* 6. Order summary --------------------------------------------------------------- */
.order-summary {
  display: grid;
  gap: var(--space-3);
  margin: 0;
  font-size: var(--fs-sm);
}

.order-summary__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-4);
}

.order-summary__label {
  color: var(--text-secondary);
}

.order-summary__value {
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

/* Summary labels are server-rendered empty on first load (C# overwrites their
   Text from hidden fields) and filled by JS later: show a dash until then, and
   prefix amounts with ₹ only once a value exists. */
.order-summary__value > span:empty::before {
  content: "\2014";
  color: var(--text-muted);
  font-weight: var(--fw-regular);
}

.money:not(:empty)::before {
  content: "\20B9";
}

.money--minus:not(:empty)::before {
  content: "\2212\00a0\20B9";
}

.order-summary__divider {
  height: 1px;
  margin: var(--space-1) 0;
  background: var(--border-subtle);
}

.order-summary__row--total {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-default);
  font-size: var(--fs-body);
}

.order-summary__row--total .order-summary__label {
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.order-summary__row--total .order-summary__value {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: var(--fw-heavy);
  color: var(--navy-900);
}

.order-summary__row--discount .order-summary__value {
  color: var(--success);
}

.order-summary__note {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.pay-actions {
  display: grid;
  gap: var(--space-3);
}

.pay-actions .btn--lg {
  width: 100%;
}

/* Page JS writes inline background colours on the Pay button (processing /
   retry states); keep the brand colours and hover feedback */
.pay-actions > .btn--primary {
  background-color: var(--btn-bg) !important;
}

.pay-actions > .btn--primary:hover {
  background-color: var(--btn-bg-hover) !important;
}

.pay-actions > .btn--primary[disabled] {
  opacity: 0.75;
}

.coupon .input-group .btn {
  border: 0;
  border-left: 1px solid var(--border-subtle);
  flex: none;
  white-space: nowrap;
}

.coupon .input-group .input {
  min-width: 0;
}

.coupon {
  display: grid;
  gap: var(--space-2);
}

/* 7. Toggle, toast, stepper -------------------------------------------------------- */
/* WhatsApp opt-in switch — JS toggles .on / .off on #waSwitch */
.wa-switch-wrapper {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--control-h-md);
}

.wa-label-inline {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  cursor: pointer;
}

.wa-switch {
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--gray-500);
  cursor: pointer;
  transition: background-color var(--dur-base) var(--ease-out);
}

.wa-switch:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.wa-switch.on {
  background: var(--success);
}

.wa-switch.off {
  background: var(--gray-500);
}

.wa-switch .wa-slider {
  position: absolute;
  top: 3px;
  left: 23px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: left var(--dur-base) var(--ease-out);
}

.wa-switch.off .wa-slider {
  left: 3px;
}

.wa-switch.on .wa-slider::after {
  content: none;
}

/* Discount / coupon toast — C# startup script shows #discountMessage and restarts
   its CSS animation (fadeInOut), toggling .error for failures */
.discount-message {
  position: fixed;
  top: calc(var(--header-h) + var(--space-4));
  left: 50%;
  z-index: var(--z-toast);
  display: none;
  width: min(420px, calc(100% - 2rem));
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--success-border);
  border-left: 4px solid var(--success);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--success-text);
  box-shadow: var(--shadow-xl);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-align: left;
  transform: translateX(-50%);
  animation: fadeInOut 4s var(--ease-out) forwards;
}

.discount-message.error {
  border-color: var(--error-border);
  border-left-color: var(--error);
  color: var(--error-text);
}

.discount-message .message-text {
  position: relative;
}

.discount-message .confetti {
  display: none;
}

/* Reduced motion: components.css shortens every animation to 1ms, which would
   jump straight to the invisible last frame — show the toast statically instead
   (the C# script still hides it after 4.2s) */
@media (prefers-reduced-motion: reduce) {
  .discount-message {
    animation: none !important;
  }
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translate(-50%, -12px);
  }

  8%,
  88% {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -12px);
  }
}

/* Wizard / stepper — C# sets class="step" / "step active" on step elements */
.stepper {
  display: flex;
  gap: var(--space-2);
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;
  counter-reset: portal-step;
}

.stepper .step {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding-top: var(--space-3);
  border-top: 3px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  counter-increment: portal-step;
  transition: border-color var(--dur-slow) var(--ease-out), color var(--dur-base);
}

.stepper .step::before {
  content: counter(portal-step);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-tertiary);
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: var(--fw-heavy);
}

.stepper .step.active,
.stepper .step.done,
.stepper .step.completed {
  border-top-color: var(--brand-primary);
  color: var(--text-primary);
}

.stepper .step.active::before {
  background: var(--brand-primary);
  color: #fff;
}

.stepper .step.done::before,
.stepper .step.completed::before {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

.stepper .step span,
.stepper .step small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 479.98px) {
  .stepper .step span,
  .stepper .step small {
    display: none;
  }

  .stepper .step.active span,
  .stepper .step.active small {
    display: inline;
  }
}

/* 8. Results (payment success / failure / error) ----------------------------------- */
.result {
  display: grid;
  gap: var(--space-6);
  max-width: 720px;
  margin-inline: auto;
}

.result__hero {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  text-align: center;
}

.result__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.result__icon .icon {
  width: 36px;
  height: 36px;
  stroke-width: 2;
}

.result__icon--error {
  background: var(--error-soft);
  border-color: var(--error-border);
  color: var(--error);
}

.result__icon--warning {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.result__icon--info {
  background: var(--info-soft);
  border-color: var(--info-border);
  color: var(--info);
}

.result__title {
  font-size: var(--fs-h2);
  color: var(--navy-900);
}

.result__lead {
  max-width: 56ch;
  color: var(--text-secondary);
}

.result__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}

@media (prefers-reduced-motion: no-preference) {
  .result__icon {
    animation: result-pop 520ms var(--ease-spring) both;
  }
}

@keyframes result-pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

/* 9. Data views (device information, tracking results, GridView) ------------------- */
.data-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-4);
}

.data-toolbar .field {
  flex: 1 1 220px;
}

.table-wrap .table {
  min-width: 560px;
}

.table tbody tr:hover > * {
  background: var(--surface-secondary);
}

.table th {
  white-space: nowrap;
}

.table caption {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

/* GridView pager row */
.table .pager td {
  padding: var(--space-3);
}

.table .pager table {
  margin: 0 auto;
}

.table .pager a,
.table .pager span {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  margin: 0 2px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-decoration: none;
}

.table .pager span {
  background: var(--brand-primary);
  color: #fff;
}

.kv-grid {
  display: grid;
  gap: var(--space-3) var(--space-6);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  margin: 0;
}

.kv-grid > div {
  display: grid;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
}

.kv-grid dt {
  font-size: var(--fs-overline);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-overline);
  text-transform: uppercase;
  color: var(--text-muted);
}

.kv-grid dd {
  margin: 0;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

/* Status timeline (order tracking) */
.timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline__item {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: var(--space-3);
  padding-bottom: var(--space-5);
}

.timeline__item::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 2px;
  background: var(--border-subtle);
}

.timeline__item:last-child::before {
  display: none;
}

.timeline__dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-primary-soft);
  border: 2px solid var(--brand-primary);
  color: var(--brand-primary);
}

.timeline__dot .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
}

/* App shell with side navigation (OEM portal) */
.app-shell {
  display: grid;
  min-height: calc(100vh - var(--header-h));
}

@media (min-width: 1024px) {
  .app-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

.app-shell__nav {
  display: none;
  padding: var(--space-5) var(--space-4);
  border-right: 1px solid var(--border-subtle);
  background: var(--surface-primary);
}

@media (min-width: 1024px) {
  .app-shell__nav {
    display: block;
  }
}

.app-shell__content {
  min-width: 0;
  background: var(--surface-secondary);
}

.side-nav {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transition: background-color var(--dur-fast), color var(--dur-fast);
}

.side-nav a:hover {
  background: var(--surface-secondary);
  color: var(--text-primary);
}

.side-nav a.active,
.side-nav a[aria-current="page"] {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

.side-nav .icon,
.side-nav .bi {
  width: 18px;
  height: 18px;
  font-size: 18px;
}

/* 9b. Partner / internal shells ---------------------------------------------------- */
.portal-header__end {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

@media (max-width: 599.98px) {
  .portal-header__label {
    display: none;
  }
}

.cobrand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding-left: var(--space-4);
  border-left: 1px solid var(--border-subtle);
}

.cobrand img {
  height: 28px;
  width: auto;
}

/* Sign-in card */
.auth {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--header-h) - 120px);
  padding-block: var(--space-10);
}

.auth__card {
  width: min(440px, 100%);
  display: grid;
  gap: var(--space-5);
  padding: clamp(var(--space-6), 4vw, var(--space-10));
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.auth__title {
  font-size: var(--fs-h2);
  color: var(--navy-900);
}

.auth__lead {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
}

/* Tool pages rendered inside the OEM portal iframe (no site chrome) */
.embed-main {
  padding: clamp(var(--space-4), 2.5vw, var(--space-8));
  background: var(--surface-secondary);
  min-height: 100vh;
}

.embed-main > .panel + .panel,
.embed-main .stack-gap {
  margin-top: var(--space-6);
}

.app-shell__frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - var(--header-h));
  border: 0;
  background: var(--surface-secondary);
}

/* WebForms asp:RadioButton / asp:CheckBox as option cards.
   Markup rendered by WebForms: <span class="option-radio"><input …/><label for="…">…</label></span> */
.option-radio {
  position: relative;
  display: block;
}

.option-radio > input {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand-primary);
}

.option-radio > label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-height: 100%;
  padding: var(--space-4) var(--space-4) var(--space-4) calc(var(--space-4) + 28px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-primary);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: border-color var(--dur-fast), background-color var(--dur-fast), box-shadow var(--dur-fast);
}

.option-radio > label:hover {
  border-color: var(--blue-300);
}

.option-radio > input:checked + label {
  border-color: var(--brand-primary);
  background: var(--brand-primary-soft);
  box-shadow: inset 0 0 0 1px var(--brand-primary);
}

.option-radio > input:focus-visible + label {
  box-shadow: var(--ring-focus), inset 0 0 0 1px var(--brand-primary);
}

.option-radio > input:disabled + label {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Inline radio list (asp:RadioButtonList / plain radios in a row) */
.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}

.radio-row input {
  accent-color: var(--brand-primary);
  margin-right: var(--space-2);
}

/* asp:ListBox renders <select size="n"> / <select multiple> */
.listbox,
select.listbox {
  width: 100%;
  min-height: 160px;
  padding: var(--space-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-primary);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-xs);
}

.listbox:focus-visible {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--ring-focus);
}

.listbox option {
  padding: 4px var(--space-2);
  border-radius: var(--radius-xs);
}

/* Scrollable list of serials / results */
.list-panel {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-primary);
}

.list-panel__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
}

.list-panel__scroll {
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 0 0 0 1.25rem;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
}

.list-panel--success {
  border-color: var(--success-border);
  background: var(--success-soft);
}

.list-panel--error {
  border-color: var(--error-border);
  background: var(--error-soft);
}

.list-panel--warning {
  border-color: var(--warning-border);
  background: var(--warning-soft);
}

/* Full-screen busy overlay (e.g. Excel export) */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  display: none;
  place-items: center;
  background: rgb(255 255 255 / 0.82);
  backdrop-filter: blur(2px);
}

.loading-overlay__box {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl);
  text-align: center;
}

/* asp:Calendar (renders a table) */
.calendar {
  border-collapse: separate;
  border-spacing: 2px;
  padding: var(--space-3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-primary);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
}

.calendar td,
.calendar th {
  padding: 4px;
  text-align: center;
}

.calendar a {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
}

.calendar a:hover {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

/* Developer console output */
.console {
  width: 100%;
  min-height: 220px;
  padding: var(--space-4);
  border: 1px solid var(--navy-700);
  border-radius: var(--radius-md);
  background: var(--navy-950);
  color: #d8edfa;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  line-height: 1.55;
  resize: vertical;
}

.status-line {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
}

/* Download / link tiles */
.link-tiles {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

/* 10. Bootstrap-JS compatibility -----------------------------------------------------
   Some internal/partner pages still load bootstrap.bundle.js (Modal, Offcanvas,
   Toast, Collapse). Bootstrap CSS is no longer loaded, so the minimum structural
   CSS those components need is provided here, styled with ACPL tokens. */
.fade {
  transition: opacity var(--dur-base) linear;
}

.fade:not(.show) {
  opacity: 0;
}

.collapse:not(.show) {
  display: none;
}

.collapsing {
  height: 0;
  overflow: hidden;
  transition: height var(--dur-base) ease;
}

.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-dialog);
  display: none;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
}

.modal-dialog {
  position: relative;
  width: auto;
  max-width: 520px;
  margin: 1.75rem auto;
  padding-inline: var(--space-4);
  pointer-events: none;
  transition: transform var(--dur-base) var(--ease-out);
}

.modal.fade .modal-dialog {
  transform: translateY(-12px);
}

.modal.show .modal-dialog {
  transform: none;
}

.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 3.5rem);
}

.modal-dialog-scrollable {
  height: calc(100% - 3.5rem);
}

.modal-dialog-scrollable .modal-content {
  max-height: 100%;
  overflow: hidden;
}

.modal-dialog-scrollable .modal-body {
  overflow-y: auto;
}

.modal-sm {
  max-width: 380px;
}

.modal-lg {
  max-width: 800px;
}

.modal-xl {
  max-width: 1140px;
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  outline: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-dialog) - 1);
  width: 100vw;
  height: 100vh;
  background: var(--navy-950);
}

.modal-backdrop.fade {
  opacity: 0;
}

.modal-backdrop.show {
  opacity: 0.55;
}

.modal-header,
.modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
}

.modal-header {
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.3;
}

.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: var(--space-5);
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.btn-close {
  box-sizing: content-box;
  width: 1em;
  height: 1em;
  padding: 0.5em;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23344054' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E")
    center / 1.1em no-repeat;
  opacity: 0.8;
  cursor: pointer;
}

.btn-close:hover {
  opacity: 1;
  background-color: var(--surface-tertiary);
}

.btn-close-white {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.offcanvas {
  position: fixed;
  bottom: 0;
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  max-width: 100%;
  visibility: hidden;
  background: var(--surface-primary);
  box-shadow: var(--shadow-xl);
  outline: 0;
  transition: transform var(--dur-base) var(--ease-out);
}

.offcanvas.offcanvas-start {
  top: 0;
  left: 0;
  width: min(320px, 86vw);
  transform: translateX(-100%);
}

.offcanvas.offcanvas-end {
  top: 0;
  right: 0;
  width: min(320px, 86vw);
  transform: translateX(100%);
}

.offcanvas.showing,
.offcanvas.show:not(.hiding) {
  transform: none;
}

.offcanvas.showing,
.offcanvas.hiding,
.offcanvas.show {
  visibility: visible;
}

.offcanvas-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-drawer) - 1);
  background: var(--navy-950);
}

.offcanvas-backdrop.fade {
  opacity: 0;
}

.offcanvas-backdrop.show {
  opacity: 0.5;
}

.offcanvas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.offcanvas-title {
  margin: 0;
  font-size: 1.0625rem;
}

.offcanvas-body {
  flex-grow: 1;
  padding: var(--space-4);
  overflow-y: auto;
}

.toast-container {
  position: fixed;
  z-index: var(--z-toast);
  display: grid;
  gap: var(--space-3);
  pointer-events: none;
}

.toast-container.top-0 {
  top: calc(var(--header-h) + var(--space-3));
}

.toast-container.end-0 {
  right: var(--space-4);
}

.toast-container.start-50 {
  left: 50%;
  transform: translateX(-50%);
}

.toast {
  width: min(380px, calc(100vw - 2rem));
  pointer-events: auto;
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-size: var(--fs-sm);
}

.toast:not(.show) {
  display: none;
}

.toast-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.toast-body {
  padding: var(--space-3) var(--space-4);
  word-wrap: break-word;
}

/* 11. Utilities (only those JS/code-behind toggle) ----------------------------------- */
.d-none {
  display: none !important;
}

.d-block {
  display: block !important;
}

.d-flex {
  display: flex !important;
}

.d-grid {
  display: grid !important;
}

.d-inline-flex {
  display: inline-flex !important;
}

.hidden {
  display: none !important;
}

.text-danger {
  color: var(--error) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-muted-soft {
  color: var(--text-muted);
}

.mt-section {
  margin-top: var(--space-6);
}

.w-100 {
  width: 100%;
}

/* 12. Page patterns (merged from the page restyles) -----------------------------------
   Each block names the page(s) using it. Generic ones are reusable. */

/* Warning title colour — showMessage() sets "modal-title fw-bold text-warning"
   (OemDeviceInformation, OemSubscriptionExtension, TCSDeviceInformation) */
.text-warning {
  color: var(--warning) !important;
}

/* Single-product offer card (ACPLProductOffers renders exactly one of #ProductA-D) */
.product-selector .product-card--offer {
  gap: var(--space-5);
  padding: var(--space-4);
}

.product-selector .product-card--offer:hover {
  transform: none;
  border-color: var(--border-subtle);
  box-shadow: none;
}

.product-selector .product-card--offer:hover .product-img {
  transform: none;
}

.product-selector .product-card--offer .product-image-wrap {
  height: 180px;
}

.product-selector .product-card--offer .product-price {
  font-size: 1.25rem;
}

.product-selector .product-card--offer .form-grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
}

@media (min-width: 640px) {
  .product-selector .product-card--offer {
    grid-template-columns: minmax(160px, 34%) minmax(0, 1fr);
    grid-template-rows: none;
    align-items: start;
  }

  .product-selector .product-card--offer .product-image-wrap {
    align-self: stretch;
    height: auto;
    min-height: 180px;
  }
}

/* Option cards whose native input stays visible (SubscribeProduct plan / add-on cards:
   asp:RadioButton + asp:Label AssociatedControlID render input and label as siblings) */
.option.option--native {
  padding-left: calc(var(--space-4) + 28px);
}

.option.option--native input {
  top: calc(var(--space-4) + 3px);
  left: var(--space-4);
  width: 18px;
  height: 18px;
  margin: 0;
  opacity: 1;
  accent-color: var(--brand-primary);
}

/* Option cards with a check badge on the selected option (OemSubscriptionExtension) */
.option-group--check .option {
  padding-right: calc(var(--space-4) + 28px);
}

.option-group--check .option:has(input:checked)::after {
  content: "";
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-primary)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E")
    center / 14px no-repeat;
  box-shadow: 0 0 0 3px #fff;
}

/* Review box — lblSummary.Text is HTML built in C# (<strong>Label:</strong> value<br/> … <hr/>)
   (SubscribeProduct step 4) */
.review-summary #lblSummary {
  display: block;
  line-height: 1.9;
  color: var(--text-primary);
}

.review-summary #lblSummary strong {
  display: inline-block;
  min-width: 8.5rem;
  margin-right: var(--space-2);
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

.review-summary #lblSummary hr {
  margin: var(--space-3) 0;
}

/* Stepper: steps before the active one read as completed (C# only writes "step"/"step active") */
.stepper .step:has(~ .step.active) {
  border-top-color: var(--brand-primary);
  color: var(--text-primary);
}

.stepper .step:has(~ .step.active)::before {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}

/* Key/value tiles: empty server labels show a dash */
.kv-grid dd > span:empty::before {
  content: "\2014";
  color: var(--text-muted);
  font-weight: var(--fw-regular);
}

/* Order-tracking result tables (OrderTracking, .track-details) */
.track-details .table-wrap .table {
  min-width: 0;
  table-layout: fixed;
}

.track-details .table th {
  white-space: normal;
}

.track-details .table td {
  overflow-wrap: anywhere;
}

.track-details .table td:empty::before {
  content: "\2014";
  color: var(--text-muted);
}

.track-details .table .badge {
  white-space: normal;
}

@media (max-width: 479.98px) {
  .track-details .table--spec,
  .track-details .table--spec tbody,
  .track-details .table--spec tr,
  .track-details .table--spec th,
  .track-details .table--spec td {
    display: block;
    width: auto;
  }

  .track-details .table--spec th {
    padding-bottom: var(--space-1);
  }

  .track-details .table--spec td {
    padding-top: 0;
    border-top: 0;
  }
}

/* Label-photo preview (TransferDeviceValidity imgL0/imgL1). Page JS toggles inline
   style.display none/block — never set display here. */
.transfer-preview {
  width: 100%;
  max-height: 16rem;
  margin-top: var(--space-1);
  padding: var(--space-2);
  object-fit: contain;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

/* Printable acknowledgement (OfflinePaymentSuccess "Print details") */
@media print {
  .result--printable .result__actions,
  .result--printable .result__help {
    display: none;
  }

  .portal-main:has(.result--printable) {
    padding-block: 0;
    background: none;
  }

  body:has(.result--printable) .portal-footer {
    display: none;
  }
}

/* RD Service test console (RDServiceCall). enableControls()/disableControls() overwrite
   the four action buttons' className with "buttonsStyle", dropping .btn/.btn--*, so the
   look is attached to the element: outline by default, primary inside .rd-actions__capture. */
.rd-actions input[type="button"] {
  --btn-bg: transparent;
  --btn-fg: var(--brand-primary);
  --btn-border: var(--blue-200);
  --btn-bg-hover: var(--brand-primary-soft);
  --btn-fg-hover: var(--brand-primary);
  --btn-border-hover: var(--blue-300);
  --btn-shadow: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h-md);
  padding: 0 var(--space-5);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  box-shadow: var(--btn-shadow);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  letter-spacing: 0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

.rd-actions__capture input[type="button"] {
  --btn-bg: var(--brand-primary);
  --btn-fg: #fff;
  --btn-border: var(--brand-primary);
  --btn-bg-hover: var(--brand-primary-hover);
  --btn-fg-hover: #fff;
  --btn-border-hover: var(--brand-primary-hover);
  --btn-shadow: var(--shadow-xs);
}

.rd-actions input[type="button"]:hover {
  background: var(--btn-bg-hover);
  border-color: var(--btn-border-hover);
  color: var(--btn-fg-hover);
}

.rd-actions input[type="button"]:active {
  transform: translateY(1px);
}

.rd-actions input[type="button"]:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.rd-actions input[type="button"][disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  transform: none;
}

@media (max-width: 479.98px) {
  .rd-actions input[type="button"] {
    flex: 1 1 100%;
    white-space: normal;
  }
}

.rd-console .console {
  min-height: 320px;
}

/* OEM app shell (OemHome): full-width header row, 1px border compensation, frame fade-in.
   Page JS adds .loaded on each frame load and removes it when a mobile menu link is tapped. */
.app-shell-header > .site-header__inner {
  max-width: none;
}

.app-shell,
.app-shell__frame {
  min-height: calc(100vh - var(--header-h) - 1px);
}

html.js .app-shell__frame {
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
}

html.js .app-shell__frame.loaded {
  opacity: 1;
}

/* Inside the OEM iframe there is no site header to clear */
.embed-main .checkout__aside {
  top: var(--space-6);
}

/* notifyExport() toast (OemDeviceInformation) — its injected <style> loads after this file,
   hence body > for specificity; stays under the modal backdrop */
body > .export-toast {
  max-width: calc(100vw - 2rem);
  padding: var(--space-4) var(--space-6);
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: var(--radius-lg);
  background: var(--navy-950);
  box-shadow: var(--shadow-xl);
  backdrop-filter: none;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-semibold);
  letter-spacing: 0;
  text-align: left;
  z-index: calc(var(--z-dialog) - 2);
}

body > .export-toast > span:first-child {
  font-size: 1.25rem !important;
}

@media (prefers-reduced-motion: reduce) {
  body > .export-toast {
    animation: none;
  }
}

/* List-panel empty states: asp:BulletedList renders no <ul> when it has no items */
.list-panel__empty {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.list-panel:not(:has(> .list-panel__scroll)) > .list-panel__empty[hidden] {
  display: block;
}

.list-panel[data-empty-text]:not(:has(li))::after {
  content: attr(data-empty-text);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

/* Date field with an asp:Calendar popover (DeviceDetailView). toggleFromCalendar() flips
   the Calendar's inline display, so only position and size are set here. */
.date-picker {
  position: relative;
}

.date-picker > .calendar {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  z-index: var(--z-sticky);
  width: max-content;
  max-width: calc(100vw - 2 * var(--gutter));
}

.date-picker .input[readonly] {
  background: var(--surface-primary);
  color: var(--text-primary);
  cursor: default;
}

/* asp:Calendar parts via TitleStyle-/DayHeaderStyle-/TodayDayStyle-/SelectedDayStyle-CssClass.
   The Calendar writes inline colours, hence !important on the selected day. */
.calendar .calendar__title {
  width: 100%;
  margin-bottom: var(--space-1);
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  color: var(--navy-900);
}

.calendar .calendar__dow {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
}

.calendar .calendar__today > a {
  box-shadow: inset 0 0 0 1px var(--blue-300);
  font-weight: var(--fw-semibold);
}

.calendar .calendar__selected {
  background: transparent !important;
}

.calendar .calendar__selected > a {
  background: var(--brand-primary);
  color: #fff !important;
  font-weight: var(--fw-semibold);
}

/* GridView: header row is the first <tr> of <tbody> (no <thead>). Pages set
   HeaderStyle-CssClass="table-head" and EmptyDataRowStyle-CssClass="table-empty". */
.table .table-head > th {
  background: var(--surface-secondary);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  vertical-align: bottom;
}

.table .table-empty > td {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--text-muted);
}

/* Attempts pivot (DeviceDetailView gvMain.attempts-table): View, SRNO, customer, one column
   per day, TOTAL ATTEMPTS last */
.attempts-table tr > td {
  vertical-align: middle;
}

.attempts-table tr:not(.table-empty) > :first-child {
  width: 1%;
}

.attempts-table td:nth-child(2) {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.attempts-table tr > :nth-child(n + 4) {
  text-align: right;
}

.attempts-table tr:not(.table-head):not(.table-empty) > td:last-child {
  font-weight: var(--fw-bold);
  color: var(--navy-900);
}

/* 13. Small modifiers (replace former inline styles on partner/internal pages) --------- */
.container--flush {
  padding-inline: 0;
}

.stepper--flush {
  margin-bottom: 0;
}

.cluster--end {
  justify-content: flex-end;
}

.btn-group--split {
  justify-content: space-between;
}

.btn-group--reverse {
  flex-direction: row-reverse;
}

.checkout__aside--static {
  position: static;
}

.form-grid--narrow {
  max-width: var(--container-narrow);
}

.text-brand {
  color: var(--brand-primary);
}

.fw-regular {
  font-weight: var(--fw-regular);
}

.kv-grid dd.kv-grid__figure {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--navy-900);
}

.loading-overlay {
  justify-content: center;
  padding: var(--space-4);
}

.loading-overlay__box {
  max-width: 420px;
}

/* OEM shell on mobile: size to the dynamic viewport when supported */
@supports (min-height: 100dvh) {
  .app-shell,
  .app-shell__frame {
    min-height: calc(100dvh - var(--header-h) - 1px);
  }
}

/* 14. Cart & checkout (Store, Cart, Checkout, OrderStatus + cart.js) -----------------
   cart.js toggles the [hidden] attribute; several components set display, so it is
   enforced here for the cart pages only. */
[data-cart-page] [hidden],
[data-cart-bar][hidden] {
  display: none !important;
}

.portal-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

/* Store: add-to-cart controls inside the product card */
.cart-add {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
}

.cart-add .qty {
  width: 100%;
}

.cart-add .qty input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}

.cart-add .btn {
  width: 100%;
}

.cart-add .btn.is-added {
  --btn-bg: var(--success);
  --btn-bg-hover: var(--success);
  --btn-border: var(--success);
}

.cart-add__status {
  min-height: 1.2em;
  font-size: var(--fs-xs);
  color: var(--success-text);
}

.cart-add__status.is-error {
  color: var(--error);
}

.product-card__cable-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
}

/* Store: mini cart in the aside */
.mini-cart__list {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.mini-cart__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.mini-cart__item:last-child {
  border-bottom: 0;
}

.mini-cart__text {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.mini-cart__name {
  font-weight: var(--fw-semibold);
  overflow-wrap: anywhere;
}

.mini-cart__meta {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.mini-cart__empty {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}

.mini-cart .panel__foot {
  display: grid;
  gap: var(--space-3);
}

/* Store (phones/tablets): the aside sits below the products, so a bar keeps the cart in reach */
.cart-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: calc(var(--z-overlay) - 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  background: var(--surface-primary);
  border-top: 1px solid var(--border-subtle);
  box-shadow: 0 -6px 18px rgb(8 28 51 / 0.08);
}

.cart-bar__text {
  display: grid;
  font-size: var(--fs-sm);
}

.cart-bar__text strong {
  font-variant-numeric: tabular-nums;
}

@media (min-width: 1024px) {
  .cart-bar {
    display: none !important;
  }
}

@media (max-width: 1023.98px) {
  [data-cart-page="store"] {
    padding-bottom: 5.5rem;
  }
}

/* Cart: line items */
.cart-lines {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cart-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.cart-line:first-child {
  padding-top: 0;
}

.cart-line:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.cart-line.has-error .cart-line__media {
  outline: 2px solid var(--error-border);
}

.cart-line__media {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background: radial-gradient(90% 90% at 50% 100%, var(--blue-50), #fff 70%);
  border: 1px solid var(--border-subtle);
}

.cart-line__media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.cart-line__info {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.cart-line__name {
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.3;
}

.cart-line__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--fs-sm);
}

.cart-line__label {
  color: var(--text-secondary);
}

.cart-line__cable {
  font-weight: var(--fw-semibold);
}

.cart-line__price {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.cart-line__total {
  display: grid;
  justify-items: end;
  min-width: 7.5rem;
  text-align: right;
}

.cart-line__total-label {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.cart-line__remove {
  color: var(--text-secondary);
}

.select--sm {
  width: auto;
  min-height: 34px;
  padding-block: 0.25rem;
  font-size: var(--fs-sm);
}

.qty--sm button {
  width: 34px;
}

.qty--sm input {
  width: 3.25rem;
  min-height: 34px;
}

@media (max-width: 719.98px) {
  .cart-line {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    grid-template-areas:
      "media info remove"
      "qty qty total";
    gap: var(--space-3);
  }

  .cart-line__media { grid-area: media; width: 64px; height: 64px; }
  .cart-line__info { grid-area: info; }
  .cart-line__qty { grid-area: qty; }
  .cart-line__total { grid-area: total; }
  .cart-line__remove { grid-area: remove; align-self: start; }
  .cart-line__remove { padding-inline: var(--space-2); }
  .cart-line__remove { font-size: 0; gap: 0; }
  .cart-line__remove .icon { font-size: 1rem; }
}

.coupon-status {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.coupon-status.is-success {
  color: var(--success-text);
}

.coupon-status.is-error {
  color: var(--error);
}

.cart-empty {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-8) var(--space-4);
  text-align: center;
}

.cart-empty .icon-tile {
  width: 56px;
  height: 56px;
}

.cart-empty p {
  max-width: 42ch;
  color: var(--text-secondary);
}

.cart-actions {
  display: grid;
  gap: var(--space-3);
}

/* Checkout: compact review of priced lines */
.review-lines {
  display: grid;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: 0 0 var(--space-4);
  list-style: none;
  border-bottom: 1px solid var(--border-subtle);
}

.review-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--fs-sm);
}

.review-line__name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.review-line__meta {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.review-line__total {
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}

.checkout-form .field-error {
  margin-top: 2px;
}

.checkout-form [aria-invalid="true"] {
  border-color: var(--error);
}

/* Order status: items table + masked details note */
.order-lines td.num,
.order-lines th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.order-lines tfoot td {
  font-weight: var(--fw-semibold);
}

.status-note {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
}
