body:has(.auth-shell) {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body:has(.auth-shell) .auth-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
  padding: clamp(20px, 5vw, 48px) max(16px, 4vw);
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: min(520px, 100%);
  max-width: 520px;
  margin-inline: auto;
  gap: 0;
  align-items: start;
  justify-items: stretch;
}

.auth-card {
  border-radius: var(--radius-xl);
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--border-card, rgba(24, 24, 27, 0.08));
  box-shadow: var(--shadow-md);
  padding: 28px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 2.2vw, 2.2rem);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-group label {
  font-weight: 600;
  color: var(--ink-700);
}

.form-control {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-input, rgba(24, 24, 27, 0.1));
  background: var(--surface-50, #fafafa);
  color: var(--ink-900, #18181b);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--border-input-focus, rgba(24, 24, 27, 0.22));
  box-shadow: 0 0 0 3px var(--mp-focus-ring, rgba(24, 24, 27, 0.1));
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.form-link {
  color: var(--ink-700, #3f3f46);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: var(--mp-bw-border, #e4e4e7);
  text-underline-offset: 4px;
}

.form-link:hover,
.form-link:focus-visible {
  color: var(--ink-900, #18181b);
  text-decoration-color: var(--mp-bw-border-strong, #d4d4d8);
}

.form-message {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  display: none;
}

.form-message.is-visible {
  display: block;
}

.form-message.success {
  background: var(--success-bg, rgba(34, 197, 94, 0.08));
  color: var(--success-text, #166534);
}

.form-message.error {
  background: var(--error-bg, rgba(239, 68, 68, 0.08));
  color: var(--error-text, #b91c1c);
}

.is-hidden {
  display: none !important;
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: 500;
  color: var(--ink-600);
}

.checkbox-label input {
  margin-top: 4px;
  accent-color: var(--mp-cta-bg, #18181b);
}

.checkbox-label a {
  color: var(--ink-700, #3f3f46);
  text-decoration: underline;
  text-decoration-color: var(--mp-bw-border, #e4e4e7);
  text-underline-offset: 3px;
}

.checkbox-label a:hover,
.checkbox-label a:focus-visible {
  color: var(--ink-900, #18181b);
  text-decoration-color: var(--mp-bw-border-strong, #d4d4d8);
}

.role-options {
  display: grid;
  gap: 12px;
}

.role-option {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border-input, rgba(24, 24, 27, 0.1));
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background: var(--surface-50, #fafafa);
  cursor: pointer;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}

.role-option input {
  accent-color: var(--mp-cta-bg, #18181b);
}

.role-option span {
  display: grid;
  gap: 4px;
}

.role-option small {
  color: var(--ink-500);
}

.label-optional {
  font-weight: 400;
  color: var(--ink-500);
}

.role-option:has(input:checked) {
  border-color: var(--border-input-focus, rgba(24, 24, 27, 0.22));
  box-shadow: 0 0 0 3px var(--mp-focus-ring, rgba(24, 24, 27, 0.1));
}

html:has(body.auth-page.public-shell) {
  background: var(--home-bg, #fafafa);
}

body.auth-page.public-shell {
  background: var(--home-bg, #fafafa);
  color: var(--home-text, #18181b);
}

body.auth-page.public-shell .bg-ambient {
  display: none !important;
}

body.auth-page.public-shell .home-parallax-layers {
  display: none !important;
}

body.auth-page .auth-shell {
  background: none;
}

body.auth-page .auth-card-head {
  display: grid;
  gap: clamp(12px, 2vw, 18px);
  margin-bottom: clamp(18px, 2.5vw, 24px);
}

body.auth-page .auth-segment {
  display: flex;
  align-items: stretch;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-100, #f4f4f5);
  border: 1px solid var(--mp-bw-border, #e4e4e7);
  gap: 5px;
}

body.auth-page .auth-segment__btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.93rem;
  text-decoration: none;
  text-align: center;
  color: var(--ink-600);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

body.auth-page .auth-segment__btn:hover {
  color: var(--ink-900);
}

body.auth-page .auth-segment__btn.is-active {
  background: var(--surface-card, #ffffff);
  color: var(--ink-900, #18181b);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
}

body.auth-page .auth-segment__btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* نوع الحساب: نفس أسلوب شريط التبديل أعلاه (بدون بطاقات راديو منفصلة) */
body.auth-page.public-shell .role-options--segment {
  display: flex;
  align-items: stretch;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-100, #f4f4f5);
  border: 1px solid var(--mp-bw-border, #e4e4e7);
  gap: 5px;
}

body.auth-page.public-shell .role-option--segment {
  position: relative;
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px;
  margin: 0;
  border-radius: var(--radius-pill);
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.88rem;
  text-align: center;
  line-height: 1.35;
  color: var(--ink-600);
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

body.auth-page.public-shell .role-option--segment:hover {
  color: var(--ink-900);
}

body.auth-page.public-shell .role-option--segment:has(input:checked) {
  background: var(--surface-card, #ffffff) !important;
  color: var(--ink-900, #18181b);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06)) !important;
}

body.auth-page.public-shell .role-option--segment:has(input:checked) .role-option__text {
  color: var(--ink-900);
}

body.auth-page.public-shell .role-option--segment .role-option__text {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: 0.01em;
}

body.auth-page.public-shell .role-option--segment input[type="radio"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
  appearance: none;
}

body.auth-page.public-shell .role-option--segment:focus-within {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

@media (max-width: 400px) {
  body.auth-page.public-shell .role-options--segment {
    flex-direction: column;
  }

  body.auth-page.public-shell .role-option--segment {
    min-height: 46px;
  }
}

body.auth-page .auth-card-head h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2rem);
  line-height: 1.25;
}

/* أزرار الدخول — نفس CTA العميل */
body.auth-page.public-shell .form-actions:has(.btn-auth-pill) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}

body.auth-page.public-shell .form-actions:has(.btn-auth-pill) .btn-auth-pill {
  grid-column: 1 / -1;
}

body.auth-page.public-shell .btn-auth-pill {
  width: 100%;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  gap: 10px;
  justify-content: center;
}

body.auth-page.public-shell .btn-auth-pill .btn-auth-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 400;
  font-size: 1.08em;
  line-height: 1;
  opacity: 0.88;
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.42s;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }
}

body.auth-page.public-shell .country-combobox {
  position: relative;
}

body.auth-page.public-shell .country-combobox.country-combobox--open {
  z-index: 4000;
}

body.auth-page.public-shell .country-combobox__inner {
  position: relative;
}

body.auth-page.public-shell .country-combobox__trigger.form-control {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: start;
  cursor: pointer;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.45;
}

body.auth-page.public-shell .country-combobox__value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

body.auth-page.public-shell .country-combobox__value.is-placeholder {
  color: var(--ink-500);
  font-weight: 600;
}

body.auth-page.public-shell .country-combobox__caret {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-600);
  transition: transform 0.2s ease, color 0.15s ease;
}

body.auth-page.public-shell .country-combobox__trigger[aria-expanded="true"] .country-combobox__caret {
  transform: rotate(180deg);
  color: var(--ink-900);
}

body.auth-page.public-shell .country-combobox__panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 10;
  max-height: min(280px, 46vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background-color: var(--surface-50);
  background-clip: padding-box;
  color: var(--ink-900);
  box-shadow: var(--shadow-md, 0 12px 32px rgba(0, 0, 0, 0.08));
  isolation: isolate;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  scrollbar-width: thin;
  scrollbar-color: var(--mp-bw-border, #e4e4e7) var(--surface-50);
}

body.auth-page.public-shell .country-combobox__panel::-webkit-scrollbar {
  width: 5px;
}

body.auth-page.public-shell .country-combobox__panel::-webkit-scrollbar-track {
  background: var(--surface-50);
  margin-block: 8px;
}

body.auth-page.public-shell .country-combobox__panel::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background-color: var(--mp-bw-border, #e4e4e7);
  border: 2px solid var(--surface-50);
  background-clip: padding-box;
}

body.auth-page.public-shell .country-combobox__panel::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.35);
}

body.auth-page.public-shell .country-combobox__opt {
  width: 100%;
  display: block;
  text-align: right;
  padding: 10px 12px;
  margin: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-900);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, box-shadow 0.12s ease;
}

body.auth-page.public-shell .country-combobox__opt.is-placeholder {
  color: var(--ink-500);
}

body.auth-page.public-shell .country-combobox__opt:hover,
body.auth-page.public-shell .country-combobox__opt:focus-visible {
  background-color: var(--surface-100, #f4f4f5);
  outline: none;
}

body.auth-page.public-shell .country-combobox__opt.is-active {
  background-color: var(--surface-100, #f4f4f5);
  box-shadow: inset 0 0 0 1px var(--border-card);
}

body.auth-page.public-shell .country-combobox__trigger:focus-visible {
  outline: none;
  border-color: var(--border-input-focus) !important;
  box-shadow: 0 0 0 3px var(--mp-focus-ring) !important;
}
