/*
   Madrasati customer portal auth V5.
   Presentation-only layer. Existing Razor handlers, validation, routes,
   localization, OTP flow, and country-picker hooks remain unchanged.
*/

@font-face {
  font-family: "Madrasati Arabic";
  src: url("/fonts/madrasati-arabic.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

.portal-shell-body {
  --auth-bg: #eef4f2;
  --auth-surface: #ffffff;
  --auth-surface-soft: #f7faf9;
  --auth-ink: #102a31;
  --auth-muted: #5f7378;
  --auth-subtle: #8aa0a3;
  --auth-line: #dbe7e5;
  --auth-line-strong: #bfd2cf;
  --auth-teal: #117d73;
  --auth-teal-hover: #0d665e;
  --auth-teal-soft: #e1f3ef;
  --auth-gold: #b4772b;
  --auth-gold-soft: #fff5e4;
  --auth-danger: #b42318;
  --auth-shadow: 0 28px 70px rgba(16, 42, 49, .12), 0 4px 12px rgba(16, 42, 49, .04);
  --auth-shadow-soft: 0 10px 28px rgba(16, 42, 49, .07);
  --auth-radius-xl: 28px;
  --auth-radius-lg: 18px;
  --auth-radius-md: 12px;
  background: var(--auth-bg);
  color: var(--auth-ink);
  font-family: Inter, "Madrasati Arabic", sans-serif;
}

/* The self-hosted Arabic face gives the portal a calmer rhythm without changing
   the Latin Fikrova/Madrasati brand treatment. */
html[lang="ar"] .portal-shell-body,
html[lang="ar"] .portal-shell-body .portal-auth-shell,
html[lang="ar"] .portal-shell-body .portal-auth-shell * {
  font-family: "Madrasati Arabic", Inter, sans-serif;
  letter-spacing: 0;
}

html[lang="ar"] .portal-shell-body .portal-card-brand small,
html[lang="ar"] .portal-shell-body .portal-powered-by {
  font-family: Inter, "Madrasati Arabic", sans-serif;
}

html[lang="ar"] .portal-shell-body .portal-auth-card-head h2,
html[lang="ar"] .portal-shell-body .portal-auth-copy-center h1 {
  font-weight: 700;
  line-height: 1.22;
}

html[data-theme="dark"] .portal-shell-body {
  --auth-bg: #0b171b;
  --auth-surface: #12252a;
  --auth-surface-soft: #172e33;
  --auth-ink: #f0f7f6;
  --auth-muted: #abc0c1;
  --auth-subtle: #7f999b;
  --auth-line: #29474b;
  --auth-line-strong: #416167;
  --auth-teal: #35c4ad;
  --auth-teal-hover: #64dbc7;
  --auth-teal-soft: rgba(53, 196, 173, .14);
  --auth-gold: #e1aa61;
  --auth-gold-soft: rgba(225, 170, 97, .14);
  --auth-danger: #ff9b91;
  --auth-shadow: 0 30px 80px rgba(0, 0, 0, .34), 0 5px 14px rgba(0, 0, 0, .2);
  --auth-shadow-soft: 0 14px 32px rgba(0, 0, 0, .2);
}

.portal-shell-body:has(.portal-auth-shell) {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 16%, rgba(17, 125, 115, .09), transparent 24rem),
    radial-gradient(circle at 92% 84%, rgba(180, 119, 43, .08), transparent 22rem),
    var(--auth-bg);
}

html[data-theme="dark"] .portal-shell-body:has(.portal-auth-shell) {
  background:
    radial-gradient(circle at 12% 16%, rgba(53, 196, 173, .10), transparent 25rem),
    radial-gradient(circle at 92% 84%, rgba(225, 170, 97, .07), transparent 24rem),
    var(--auth-bg);
}

.portal-shell-body .portal-auth-shell {
  position: relative;
  display: flex;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 54px 32px 64px;
}

.portal-shell-body .portal-auth-tools {
  position: fixed;
  z-index: 10;
  top: 24px;
  /* Use a physical edge so RTL never moves the control into the logo area. */
  right: 30px;
  left: auto;
  direction: ltr;
}

.portal-shell-body .portal-auth-layout > .portal-auth-tools-legacy {
  display: none;
}

.portal-shell-body .portal-auth-tools .portal-theme-toggle {
  width: 38px;
  height: 38px;
  border: 1px solid var(--auth-line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--auth-surface) 90%, transparent);
  color: var(--auth-muted);
  box-shadow: var(--auth-shadow-soft);
  backdrop-filter: blur(12px);
}

.portal-shell-body .portal-auth-tools .portal-theme-toggle:hover {
  border-color: var(--auth-teal);
  background: var(--auth-teal-soft);
  color: var(--auth-teal);
  transform: translateY(-1px);
}

.portal-shell-body .portal-auth-layout {
  position: relative;
  display: grid !important;
  grid-template-columns: minmax(0, .88fr) minmax(430px, 1.12fr) !important;
  grid-template-areas: "copy card";
  direction: ltr;
  width: min(100%, 1160px) !important;
  max-width: 1160px !important;
  min-height: 720px !important;
  overflow: hidden;
  border: 1px solid var(--auth-line) !important;
  border-radius: var(--auth-radius-xl) !important;
  background: var(--auth-surface) !important;
  box-shadow: var(--auth-shadow) !important;
}

.portal-shell-body .portal-auth-layout::before {
  position: absolute;
  z-index: 5;
  inset: 0 34px auto;
  height: 3px;
  border-radius: 0 0 99px 99px;
  background: linear-gradient(90deg, var(--auth-teal), #27b6a1 58%, var(--auth-gold));
  content: "";
  pointer-events: none;
}

.portal-shell-body .portal-auth-copy {
  position: relative;
  grid-area: copy;
  order: 1;
  display: flex !important;
  min-width: 0;
  min-height: 720px;
  flex-direction: column;
  overflow: hidden;
  padding: 38px 42px 32px;
  background: #103f40;
  color: #fff;
  isolation: isolate;
}

.portal-shell-body .portal-auth-copy::before {
  position: absolute;
  z-index: -2;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .075) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, .8) 55%, transparent 100%);
  opacity: .8;
}

.portal-shell-body .portal-auth-copy::after {
  position: absolute;
  z-index: -1;
  right: -170px;
  bottom: -210px;
  width: 470px;
  height: 470px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 50%;
  box-shadow: 0 0 0 38px rgba(255, 255, 255, .045), 0 0 0 76px rgba(255, 255, 255, .025);
  content: "";
}

.portal-shell-body .portal-auth-copy > * {
  position: relative;
  z-index: 1;
}

.portal-shell-body .portal-auth-card {
  grid-area: card;
  order: 2;
  min-width: 0;
  min-height: 720px;
  padding: 48px 64px 40px !important;
  background: var(--auth-surface) !important;
  color: var(--auth-ink);
}

.portal-shell-body .portal-card-brand,
.portal-shell-body .portal-auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.portal-shell-body .portal-card-brand {
  margin-bottom: 32px;
}

.portal-shell-body .portal-card-brand-mark,
.portal-shell-body .portal-auth-brand-mark {
  display: grid;
  width: 45px;
  height: 45px;
  flex: 0 0 45px;
  place-items: center;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.portal-shell-body .portal-card-brand-mark img,
.portal-shell-body .portal-auth-brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.portal-shell-body .portal-card-brand strong,
.portal-shell-body .portal-auth-brand strong {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.2px;
}

.portal-shell-body .portal-card-brand small,
.portal-shell-body .portal-auth-brand small {
  display: block;
  margin-top: 3px;
  color: var(--auth-subtle);
  font-size: 10px;
  font-weight: 600;
}

.portal-shell-body .portal-auth-language {
  align-self: flex-start;
  order: initial;
  margin: 0 0 32px;
  gap: 4px;
  padding: 4px 6px;
  border: 1px solid var(--auth-line);
  border-radius: 999px;
  background: var(--auth-surface-soft);
}

.portal-shell-body .portal-auth-language a {
  position: relative;
  display: inline-flex;
  min-width: auto;
  height: 30px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--auth-muted);
  font-size: 10px;
  font-weight: 750;
  text-decoration: none;
  transition: color .18s ease, transform .18s ease;
}

.portal-shell-body .portal-auth-language a:hover {
  color: var(--auth-ink);
  transform: translateY(-1px);
}

.portal-shell-body .portal-auth-shell .portal-auth-language a.active {
  color: var(--auth-teal);
  background: transparent !important;
  box-shadow: none;
}

.portal-shell-body .portal-auth-language a.active::after {
  position: absolute;
  right: 10px;
  bottom: 1px;
  left: 10px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.portal-shell-body .portal-auth-card-head {
  display: grid;
  gap: 8px;
  margin-bottom: 26px;
}

.portal-shell-body .portal-auth-card-head h2 {
  margin: 0;
  color: var(--auth-ink);
  font-size: clamp(32px, 3.2vw, 44px);
  font-weight: 780;
  letter-spacing: -.9px;
  line-height: 1.06;
}

.portal-shell-body .portal-auth-card-head p {
  max-width: 38ch;
  margin: 0;
  color: var(--auth-muted);
  font-size: 13px;
  line-height: 1.7;
}

.portal-shell-body .portal-auth-form,
.portal-shell-body .portal-register-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.portal-shell-body .portal-register-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.portal-shell-body .portal-register-form > .portal-input-wrap,
.portal-shell-body .portal-register-form > .portal-legal-consent,
.portal-shell-body .portal-register-form > button,
.portal-shell-body .portal-register-form > .validation-summary-errors,
.portal-shell-body .portal-register-form > [asp-validation-summary] {
  min-width: 0;
}

.portal-shell-body .portal-register-form > .portal-legal-consent,
.portal-shell-body .portal-register-form > button {
  grid-column: 1 / -1;
}

.portal-shell-body .portal-input-wrap {
  position: relative;
  min-width: 0;
}

.portal-shell-body .portal-input-wrap input.form-control,
.portal-shell-body .portal-country-picker button.portal-country-trigger {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--auth-line-strong);
  border-radius: var(--auth-radius-md);
  background: var(--auth-surface-soft);
  color: var(--auth-ink);
  font-size: 13px;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.portal-shell-body .portal-input-wrap input.form-control {
  padding-block: 14px;
  padding-inline: 46px 14px;
}

.portal-shell-body .portal-input-wrap input.form-control::placeholder {
  color: var(--auth-subtle);
  opacity: 1;
}

.portal-shell-body .portal-input-wrap input.form-control:hover,
.portal-shell-body .portal-country-picker button.portal-country-trigger:hover {
  border-color: var(--auth-teal);
  background: var(--auth-surface);
}

.portal-shell-body .portal-input-wrap input.form-control:focus,
.portal-shell-body .portal-country-picker button.portal-country-trigger:focus-visible {
  border-color: var(--auth-teal);
  outline: 0;
  background: var(--auth-surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--auth-teal) 16%, transparent);
}

.portal-shell-body .portal-input-wrap input[dir="ltr"] {
  direction: ltr;
  padding-inline: 46px 14px !important;
  text-align: left;
}

.portal-shell-body .portal-input-wrap:has(> input[dir="ltr"]) .portal-auth-icon {
  inset-inline-start: auto;
  inset-inline-end: auto;
  right: auto;
  left: 15px;
}

.portal-shell-body input.form-control:-webkit-autofill,
.portal-shell-body input.form-control:-webkit-autofill:hover,
.portal-shell-body input.form-control:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--auth-ink);
  -webkit-box-shadow: 0 0 0 1000px var(--auth-surface-soft) inset;
  transition: background-color 9999s ease-out 0s;
}

.portal-shell-body .portal-auth-icon {
  position: absolute;
  z-index: 2;
  top: 50%;
  inset-inline-start: 15px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--auth-subtle);
  pointer-events: none;
  transform: translateY(-50%);
}

.portal-shell-body .portal-auth-icon svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.55;
}

.portal-shell-body .portal-input-wrap:focus-within .portal-auth-icon {
  color: var(--auth-teal);
}

.portal-shell-body .portal-forgot-link {
  align-self: flex-end;
  margin-top: -2px;
  color: var(--auth-gold);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.portal-shell-body .portal-forgot-link:hover {
  color: var(--auth-teal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-shell-body .portal-auth-form .btn-primary,
.portal-shell-body .portal-register-form .btn-primary {
  min-height: 54px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--auth-radius-md);
  background: var(--auth-teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(17, 125, 115, .20);
  font-size: 13px;
  font-weight: 800;
  transition: background .18s ease, box-shadow .18s ease, transform .18s ease;
}

.portal-shell-body .portal-auth-form .btn-primary:hover,
.portal-shell-body .portal-register-form .btn-primary:hover {
  background: var(--auth-teal-hover);
  box-shadow: 0 11px 22px rgba(17, 125, 115, .25);
  transform: translateY(-1px);
}

.portal-shell-body .portal-auth-form .btn-primary:focus-visible,
.portal-shell-body .portal-register-form .btn-primary:focus-visible,
.portal-shell-body .portal-auth-switch button:focus-visible,
.portal-shell-body .btn-auth-ghost:focus-visible,
.portal-shell-body .portal-auth-tools button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--auth-teal) 34%, transparent);
  outline-offset: 3px;
}

.portal-shell-body .portal-auth-switch {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin: 26px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--auth-line);
  color: var(--auth-muted);
  font-size: 12px;
  text-align: center;
}

.portal-shell-body .portal-auth-switch button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--auth-teal);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.portal-shell-body .portal-auth-switch button:hover {
  color: var(--auth-gold);
}

.portal-shell-body .portal-powered-inline {
  justify-content: center;
  margin-top: 30px;
  color: var(--auth-subtle);
  font-size: 10px;
}

.portal-shell-body .portal-powered-by img {
  width: 14px;
  height: 14px;
}

.portal-shell-body .portal-auth-copy .portal-auth-brand {
  color: #fff;
}

.portal-shell-body .portal-auth-copy .portal-auth-brand small {
  color: rgba(255, 255, 255, .58);
}

.portal-shell-body .portal-auth-copy .portal-auth-brand-mark {
  background: rgba(255, 255, 255, .12);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .16);
}

.portal-shell-body .portal-auth-copy-center {
  display: flex;
  max-width: 34rem;
  margin-block: auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
}

.portal-shell-body .portal-auth-copy-center h1 {
  max-width: 10ch;
  margin: 0;
  color: #fff;
  font-size: clamp(42px, 4vw, 58px);
  font-weight: 760;
  letter-spacing: -1.4px;
  line-height: 1.02;
}

.portal-shell-body .portal-auth-copy-center p {
  max-width: 34ch;
  margin: 0;
  color: rgba(255, 255, 255, .72);
  font-size: 14px;
  line-height: 1.8;
}

.portal-shell-body .btn-auth-ghost {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 11px;
  background: rgba(255, 255, 255, .10);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

.portal-shell-body .btn-auth-ghost:hover {
  border-color: rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .17);
  transform: translateY(-1px);
}

.portal-shell-body .portal-auth-feature-list {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.portal-shell-body .portal-auth-feature-list span {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 10px;
  background: rgba(255, 255, 255, .075);
  color: rgba(255, 255, 255, .88);
  font-size: 11px;
  font-weight: 700;
}

.portal-shell-body .portal-auth-feature-list svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.portal-shell-body .portal-auth-copy > .portal-powered-by {
  margin-top: 28px;
  color: rgba(255, 255, 255, .62);
  font-size: 10px;
}

.portal-shell-body .portal-country-picker {
  min-width: 0;
}

.portal-shell-body .portal-country-picker button.portal-country-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-block: 0;
  padding-inline: 46px 14px;
  color: var(--auth-subtle);
  font-size: 13px;
  text-align: start;
}

.portal-shell-body .portal-country-picker button.portal-country-trigger.has-value {
  color: var(--auth-ink);
}

.portal-shell-body .portal-country-trigger-flag {
  width: 20px;
  height: 15px;
  flex: 0 0 20px;
  object-fit: cover;
  border-radius: 3px;
}

.portal-shell-body .portal-country-caret {
  position: absolute;
  inset-inline-end: 13px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: var(--auth-subtle);
}

.portal-shell-body .portal-country-caret svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.portal-shell-body .portal-country-menu {
  inset-inline-start: 0;
  inset-inline-end: auto;
  width: min(320px, calc(100vw - 32px));
  max-height: 360px;
  padding: 8px;
  gap: 8px;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-md);
  background: var(--auth-surface);
  box-shadow: var(--auth-shadow);
  overflow: hidden;
}

.portal-shell-body .portal-country-search {
  min-height: 38px;
  padding: 0 11px;
  gap: 8px;
  border: 1px solid var(--auth-line);
  border-radius: 10px;
  border-bottom-color: var(--auth-line);
  background: var(--auth-surface-soft);
}

.portal-shell-body .portal-country-search svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--auth-subtle);
}

.portal-shell-body .portal-country-search input {
  color: var(--auth-ink);
  min-width: 0;
  font-family: Inter, "Madrasati Arabic", sans-serif;
}

.portal-shell-body .portal-country-list {
  max-height: 278px;
  padding: 2px;
  gap: 2px;
  scrollbar-color: color-mix(in srgb, var(--auth-teal) 55%, transparent) transparent;
  scrollbar-width: thin;
}

.portal-shell-body .portal-country-list::-webkit-scrollbar {
  width: 7px;
}

.portal-shell-body .portal-country-list::-webkit-scrollbar-track {
  background: transparent;
}

.portal-shell-body .portal-country-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--auth-teal) 55%, transparent);
  background-clip: padding-box;
}

.portal-shell-body .portal-country-option {
  color: var(--auth-ink);
  width: 100%;
  min-height: 40px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  text-align: start;
  transition: background .16s ease, color .16s ease;
}

.portal-shell-body .portal-country-option:hover,
.portal-shell-body .portal-country-option.is-selected {
  background: var(--auth-teal-soft);
}

.portal-shell-body .portal-country-option:hover {
  color: var(--auth-teal);
}

.portal-shell-body .portal-country-flag {
  width: 22px;
  height: 16px;
  border-radius: 3px;
}

.portal-shell-body .portal-country-name {
  min-width: 0;
  text-align: start;
}

.portal-shell-body .portal-country-code {
  color: var(--auth-subtle);
  min-width: 46px;
  direction: ltr;
  text-align: end;
}

.portal-shell-body .portal-legal-consent {
  color: var(--auth-muted);
  font-size: 11px;
  line-height: 1.55;
}

.portal-shell-body .portal-legal-consent a {
  color: var(--auth-teal);
  font-weight: 750;
}

.portal-shell-body .portal-alert {
  margin-bottom: 18px;
  border-radius: var(--auth-radius-md);
}

.portal-shell-body .portal-auth-form .text-danger,
.portal-shell-body .portal-register-form .text-danger {
  margin-top: 4px;
  color: var(--auth-danger) !important;
  font-size: 11px;
}

html[dir="rtl"] .portal-shell-body .portal-auth-layout {
  /* Keep the product panel stable when the language changes. RTL is applied
     inside each panel so the page does not jump between languages. */
  grid-template-areas: "copy card";
}

html[dir="rtl"] .portal-shell-body .portal-auth-copy,
html[dir="rtl"] .portal-shell-body .portal-auth-card {
  direction: rtl;
}

html[dir="rtl"] .portal-shell-body .portal-auth-copy {
  order: initial;
}

html[dir="rtl"] .portal-shell-body .portal-auth-card {
  order: initial;
}

html[dir="rtl"] .portal-shell-body .portal-auth-copy::after {
  right: auto;
  left: -170px;
}

html[dir="rtl"] .portal-shell-body .portal-auth-copy-center,
html[dir="rtl"] .portal-shell-body .portal-auth-feature-list {
  align-items: flex-end;
}

html[dir="rtl"] .portal-shell-body .portal-auth-copy-center h1,
html[dir="rtl"] .portal-shell-body .portal-auth-copy-center p {
  text-align: right;
}

@media (max-width: 1040px) {
  .portal-shell-body .portal-auth-shell {
    padding-inline: 20px;
  }

  .portal-shell-body .portal-auth-layout {
    grid-template-columns: minmax(0, .82fr) minmax(390px, 1.18fr) !important;
  }

  .portal-shell-body .portal-auth-card {
    padding-inline: 44px !important;
  }

  .portal-shell-body .portal-auth-copy {
    padding-inline: 34px;
  }
}

@media (max-width: 860px) {
  .portal-shell-body .portal-auth-layout {
    grid-template-columns: 1fr !important;
    grid-template-areas: "card";
    min-height: 0 !important;
  }

  .portal-shell-body .portal-auth-copy,
  html[dir="rtl"] .portal-shell-body .portal-auth-copy {
    display: none !important;
  }

  .portal-shell-body .portal-auth-card,
  html[dir="rtl"] .portal-shell-body .portal-auth-card {
    grid-area: card;
    order: initial;
    min-height: 0;
    padding: 38px 42px 34px !important;
  }

}

@media (max-width: 620px) {
  .portal-shell-body .portal-auth-shell {
    align-items: stretch;
    padding: 52px 12px 24px;
  }

  .portal-shell-body .portal-auth-tools {
    top: 16px;
    right: 18px;
  }

  .portal-shell-body .portal-auth-layout {
    width: 100% !important;
    border-radius: 21px !important;
  }

  .portal-shell-body .portal-auth-copy {
    min-height: 190px;
    padding: 24px 22px 20px;
  }

  .portal-shell-body .portal-auth-copy-center {
    margin-top: 22px;
  }

  .portal-shell-body .portal-auth-copy-center h1 {
    font-size: 34px;
  }

  .portal-shell-body .portal-auth-card {
    padding: 30px 22px 28px !important;
  }

  .portal-shell-body .portal-card-brand {
    margin-bottom: 24px;
  }

  .portal-shell-body .portal-auth-language a {
    padding-inline: 8px;
  }

  .portal-shell-body .portal-register-form {
    display: flex;
  }

  .portal-shell-body .portal-auth-card-head h2 {
    font-size: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-shell-body .portal-auth-layout *,
  .portal-shell-body .portal-auth-layout *::before,
  .portal-shell-body .portal-auth-layout *::after {
    animation-duration: 0s !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
  }
}

/* Accessible premium file picker used by receipt uploads. */
.portal-shell-body .modern-file-picker {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  min-height: 66px;
  align-items: center;
  gap: 12px;
  margin-top: 7px;
  overflow: hidden;
  border: 1px dashed var(--pv4-line-strong, var(--pv-line-strong));
  border-radius: 12px;
  background: var(--pv4-surface-soft, var(--pv-surface-soft));
  padding: 9px;
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}
.portal-shell-body .modern-file-picker:hover,
.portal-shell-body .modern-file-picker.is-dragging {
  border-color: var(--pv4-accent, var(--pv-accent));
  background: color-mix(in srgb, var(--pv4-accent, var(--pv-accent)) 6%, var(--pv4-surface, var(--pv-surface)));
}
.portal-shell-body .modern-file-picker.is-focused {
  border-color: var(--pv4-accent, var(--pv-accent));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--pv4-accent, var(--pv-accent)) 14%, transparent);
}
.portal-shell-body .modern-file-input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.portal-shell-body .modern-file-icon { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--pv4-line, var(--pv-line)); border-radius: 10px; background: var(--pv4-surface, var(--pv-surface)); color: var(--pv4-accent, var(--pv-accent)); }
.portal-shell-body .modern-file-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.portal-shell-body .modern-file-copy { display: grid; min-width: 0; gap: 3px; }
.portal-shell-body .modern-file-copy strong { color: var(--pv4-ink, var(--pv-ink)); font-size: 12px; font-weight: 750; }
.portal-shell-body .modern-file-copy small { overflow: hidden; color: var(--pv4-subtle, var(--pv-subtle)); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.portal-shell-body .modern-file-picker.has-file .modern-file-copy small { color: var(--pv4-accent, var(--pv-accent)); }
.portal-shell-body .modern-file-action { display: inline-flex; min-height: 36px; align-items: center; border: 1px solid var(--pv4-line-strong, var(--pv-line-strong)); border-radius: 9px; background: var(--pv4-surface, var(--pv-surface)); padding: 0 13px; color: var(--pv4-ink, var(--pv-ink)); font-size: 11px; font-weight: 750; white-space: nowrap; }
.portal-shell-body .modern-file-picker:hover .modern-file-action { border-color: var(--pv4-accent, var(--pv-accent)); color: var(--pv4-accent, var(--pv-accent)); }
[dir="rtl"] .portal-shell-body .modern-file-picker { direction: rtl; }

@media (max-width: 540px) {
  .portal-shell-body .modern-file-picker { grid-template-columns: 42px minmax(0, 1fr); }
  .portal-shell-body .modern-file-action { grid-column: 1 / -1; justify-content: center; }
}

.portal-shell-body .portal-release-benefits {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  color: var(--pv4-muted, var(--pv-muted));
  font-size: 11px;
  line-height: 1.55;
  list-style: none;
}

.portal-shell-body .portal-release-benefits li {
  position: relative;
  padding-inline-start: 18px;
}

.portal-shell-body .portal-release-benefits li::before {
  content: "✓";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  color: var(--pv4-accent, var(--pv-accent));
  font-weight: 900;
}

/* Final narrow-screen safeguards for the customer portal and account flows. */
.portal-shell-body .portal-machine-row > div,
.portal-shell-body .portal-account-license-row > div,
.portal-shell-body .portal-copy-strip > div,
.portal-shell-body .portal-account-welcome-copy {
  min-width: 0;
}

.portal-shell-body .portal-machine-row strong,
.portal-shell-body .portal-account-license-row span,
.portal-shell-body .portal-account-welcome-copy p,
.portal-shell-body .portal-trial-facts strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 1080px) {
  .portal-shell-body .portal-workspace-rail .portal-workspace-tabs {
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
    scrollbar-color: var(--pv4-line-strong, var(--pv-line-strong)) transparent;
    scrollbar-width: thin;
  }

  .portal-shell-body .portal-workspace-rail .portal-workspace-tabs a {
    scroll-snap-align: start;
  }
}

@media (max-width: 720px) {
  .portal-shell-body .company-footer-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 4px 12px;
  }

  .portal-shell-body .company-footer-links a {
    min-width: 0;
    min-height: 44px;
    align-items: center;
    padding: 7px 0;
    overflow-wrap: anywhere;
  }

  .portal-shell-body .company-footer-links a + a {
    padding-inline-start: 0;
    border-inline-start: 0;
  }
}

@media (max-width: 620px) {
  .portal-shell-body .portal-auth-layout {
    overflow: visible;
  }

  .portal-shell-body .portal-auth-tools .portal-theme-toggle {
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    height: 44px;
  }

  .portal-shell-body .portal-auth-language a {
    width: auto;
    min-width: 44px;
    min-height: 44px;
    height: 44px;
    padding-inline: 10px;
  }

  .portal-shell-body .portal-country-menu {
    max-height: min(360px, calc(100dvh - 150px));
  }

  .portal-shell-body .portal-country-list {
    max-height: min(278px, calc(100dvh - 232px));
  }
}

@media (max-width: 560px) {
  .portal-shell-body .portal-page {
    width: min(100% - 12px, 620px);
  }

  .portal-shell-body .portal-top {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 10px;
  }

  .portal-shell-body .portal-top-actions {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    width: 100%;
    gap: 8px;
  }

  .portal-shell-body .portal-top-actions > .portal-theme-toggle {
    grid-column: 1;
    width: 44px;
    height: 44px;
  }

  .portal-shell-body .portal-language {
    grid-column: 2;
    display: flex;
    width: 100%;
  }

  .portal-shell-body .portal-language a {
    min-width: 0;
    min-height: 44px;
    height: 44px;
    flex: 1 1 0;
  }

  .portal-shell-body .portal-user-bar,
  .portal-shell-body .portal-top-signin {
    grid-column: 1 / -1;
    width: 100%;
  }

  .portal-shell-body .portal-user-bar {
    justify-content: space-between;
    margin-inline-start: 0;
  }

  .portal-shell-body .portal-top-signin,
  .portal-shell-body .portal-top-signout {
    min-height: 44px;
  }

  .portal-shell-body .portal-onboarding-card.portal-trial-card,
  .portal-shell-body .portal-trial-form-panel,
  .portal-shell-body .portal-trial-result-panel {
    padding: 16px;
  }

  .portal-shell-body .portal-copy-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
  }

  .portal-shell-body .portal-copy-strip code {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .portal-shell-body .portal-copy-strip .btn {
    min-width: 44px;
    min-height: 44px;
  }

  .portal-shell-body .portal-trial-facts > div {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

@media (max-width: 390px) {
  .portal-shell-body .company-footer-links {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-shell-body .portal-copy-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-shell-body .portal-copy-strip .btn {
    width: 100%;
  }
}
