/* Patient portal — sign-in, register, select account (dark default, light via data-theme) */

body.auth-screen {
  --auth-bg-start: #08111f;
  --auth-bg-end: #0f1b31;
  --auth-card: rgba(14, 26, 48, 0.92);
  --auth-card-border: rgba(133, 164, 213, 0.16);
  --auth-surface: #111827;
  --auth-surface-strong: #1a2332;
  --auth-accent: #76b8ff;
  --auth-accent-strong: #2563eb;
  --auth-accent-soft: rgba(118, 184, 255, 0.16);
  --auth-text: #f5f7fb;
  --auth-text-muted: #9fb2d0;
  --auth-text-soft: #64748b;
  --auth-danger-bg: rgba(239, 68, 68, 0.12);
  --auth-danger-border: rgba(248, 113, 113, 0.28);
  --auth-danger-text: #fca5a5;
  --auth-success-bg: rgba(34, 197, 94, 0.12);
  --auth-success-border: rgba(74, 222, 128, 0.28);
  --auth-success-text: #86efac;
  --auth-shadow: 0 26px 60px rgba(2, 6, 23, 0.5);
  --auth-orb-a: rgba(59, 130, 246, 0.28);
  --auth-orb-b: rgba(14, 165, 233, 0.2);
  --auth-topline-bg: rgba(96, 165, 250, 0.12);
  --auth-topline-border: rgba(96, 165, 250, 0.2);
  --auth-topline-text: #bfdbfe;
  --auth-input-border: rgba(148, 163, 184, 0.18);
  --auth-input-focus-bg: rgba(15, 23, 42, 0.88);
  --auth-btn-text: #eff6ff;
  --auth-panel-bg: rgba(8, 15, 27, 0.98);
  --auth-dot-inactive: rgba(148, 163, 184, 0.18);
  --auth-mode-bg: rgba(15, 23, 42, 0.55);
  --auth-mode-active-bg: rgba(37, 99, 235, 0.22);
  --auth-review-bg: rgba(15, 23, 42, 0.68);
  --auth-ghost-bg: rgba(15, 23, 42, 0.48);
  --auth-link-bg: rgba(96, 165, 250, 0.12);
  --auth-summary-bg: rgba(15, 23, 42, 0.5);
}

body.auth-screen,
body.auth-screen *::before,
body.auth-screen *::after {
  box-sizing: border-box;
}

html:has(body.auth-screen),
body.auth-screen {
  min-height: 100%;
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: var(--auth-bg-start);
  color: var(--auth-text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.auth-screen {
  min-height: 100dvh;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 14px calc(32px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.22), transparent 34%),
    radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.2), transparent 30%),
    linear-gradient(180deg, var(--auth-bg-start) 0%, var(--auth-bg-end) 100%);
}

.auth-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.36;
  pointer-events: none;
  z-index: 0;
}

.auth-orb.orb-a {
  width: 250px;
  height: 250px;
  top: -75px;
  right: -50px;
  background: var(--auth-orb-a);
}

.auth-orb.orb-b {
  width: 230px;
  height: 230px;
  bottom: -75px;
  left: -65px;
  background: var(--auth-orb-b);
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.auth-shell--narrow {
  max-width: 440px;
}

.auth-card {
  background: linear-gradient(180deg, rgba(14, 26, 48, 0.96) 0%, rgba(8, 17, 31, 0.98) 100%);
  border: 1px solid var(--auth-card-border);
  border-radius: 28px;
  padding: 24px 20px 20px;
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.auth-topline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--auth-topline-bg);
  border: 1px solid var(--auth-topline-border);
  color: var(--auth-topline-text);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.auth-logo {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  background: linear-gradient(145deg, var(--auth-accent) 0%, var(--auth-accent-strong) 100%);
  color: var(--auth-btn-text);
  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.28);
  font-size: 1.45rem;
}

.auth-logo--large {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  font-size: 1.6rem;
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.3);
}

.auth-title {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 800;
  color: var(--auth-text);
}

.auth-subtitle {
  margin: 10px 0 0;
  color: var(--auth-text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 20px 0 18px;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--auth-danger-bg);
  border: 1px solid var(--auth-danger-border);
  color: var(--auth-danger-text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-error i {
  margin-top: 1px;
  flex-shrink: 0;
}

.auth-success {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0px 0 18px;
  padding: 13px 14px;
  border-radius: 16px;
  background: var(--auth-success-bg);
  border: 1px solid var(--auth-success-border);
  color: var(--auth-success-text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.auth-success i {
  margin-top: 1px;
  flex-shrink: 0;
}

.auth-success--email {
  align-items: stretch;
  gap: 14px;
  padding: 16px 16px 16px 14px;
  border-radius: 18px;
  border-left: 4px solid #4ade80;
  box-shadow:
    0 10px 28px rgba(34, 197, 94, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.auth-success__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.28);
  color: #86efac;
  font-size: 1.15rem;
}

.auth-success__content {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.auth-success__eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(74, 222, 128, 0.24);
  color: #bbf7d0;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-success__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: #ecfdf5;
}

.auth-success__text {
  margin: 0;
  color: var(--auth-success-text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-success__email {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.34);
  border: 1px solid rgba(74, 222, 128, 0.22);
  color: #f0fdf4;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
}

.auth-success__email i {
  flex-shrink: 0;
  color: #86efac;
  font-size: 0.95rem;
}

.auth-success__hint {
  margin: 0;
  padding-top: 2px;
  color: #bbf7d0;
  font-size: 0.84rem;
  line-height: 1.5;
}

.auth-form-grid {
  display: grid;
  gap: 16px;
}

.auth-field-error,
.auth-field-hint {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.45;
}

.auth-field-hint {
  color: var(--auth-text-muted);
}

.auth-field-error {
  color: var(--auth-danger-text);
}

.auth-field-link-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.auth-inline-link {
  color: var(--auth-accent);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
}

.auth-inline-link:hover {
  text-decoration: underline;
}

.auth-button-link {
  text-decoration: none;
}

.auth-button-link--secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
 }

.field-group {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--auth-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-wrap {
  position: relative;
}

.field-icon,
.field-action {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--auth-text-soft);
}

.field-icon {
  left: 14px;
  pointer-events: none;
  font-size: 1rem;
}

.field-action {
  right: 14px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
}

.auth-input {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-surface);
  color: var(--auth-text);
  padding: 14px 16px 14px 44px;
  font: inherit;
  font-size: 0.98rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.auth-input::placeholder {
  color: var(--auth-text-soft);
}

.auth-input:focus {
  border-color: rgba(96, 165, 250, 0.82);
  box-shadow: 0 0 0 4px var(--auth-accent-soft);
  background: var(--auth-input-focus-bg);
}

select.auth-input {
  color-scheme: dark;
}

select.auth-input option {
  background-color: var(--auth-surface);
  color: var(--auth-text);
}

select.auth-input option:checked,
select.auth-input option:hover,
select.auth-input option:focus {
  background-color: var(--auth-surface-strong);
  color: var(--auth-text);
}

.field-wrap:focus-within .field-icon,
.field-action:hover {
  color: var(--auth-accent);
}

#password {
  padding-right: 44px;
}

.btn-primary-auth,
.btn-next {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-strong) 100%);
  color: var(--auth-btn-text);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn-primary-auth .btn-text,
.btn-next .btn-label,
.btn-next {
  white-space: nowrap;
}

.btn-primary-auth .btn-text,
.btn-next .btn-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1;
}

.btn-primary-auth .btn-text svg,
.btn-primary-auth .btn-text i,
.btn-next svg,
.btn-next i,
.btn-next .btn-label svg,
.btn-next .btn-label i {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: block;
}

.btn-next {
  min-height: 52px;
  font-size: 0.96rem;
}

.btn-primary-auth:hover,
.btn-next:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(37, 99, 235, 0.32);
}

.btn-primary-auth:disabled,
.btn-next:disabled {
  cursor: not-allowed;
  opacity: 0.7;
  transform: none;
}

.btn-back {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-ghost-bg);
  color: var(--auth-text-muted);
  font: inherit;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #ffffff;
  display: none;
  animation: auth-spin 0.7s linear infinite;
}

.loading .spinner {
  display: block;
}

.loading .btn-text,
.loading .btn-label {
  display: none;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-footer {
  margin-top: 18px;
  text-align: center;
  color: var(--auth-text-muted);
  font-size: 0.9rem;
}

.auth-footer a {
  color: var(--auth-accent);
  text-decoration: none;
  font-weight: 600;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-footer--stacked {
  display: grid;
  gap: 10px;
  text-align: stretch;
}

/* Register wizard */
.progress-bar {
  display: flex;
  gap: 10px;
  margin: 22px 0 18px;
}

.step-dot {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--auth-dot-inactive);
  transition: background 0.2s ease, transform 0.2s ease;
}

.step-dot.active,
.step-dot.done {
  background: linear-gradient(135deg, var(--auth-accent) 0%, var(--auth-accent-strong) 100%);
}

.form-step {
  display: none;
}

.form-step.is-active {
  display: block;
}

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

.mode-btn {
  min-height: 48px;
  border-radius: 15px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-mode-bg);
  color: var(--auth-text-muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.mode-btn.is-active {
  color: var(--auth-btn-text);
  border-color: rgba(96, 165, 250, 0.45);
  background: var(--auth-mode-active-bg);
}

.phone-layout {
  display: grid;
  grid-template-columns: minmax(118px, 148px) minmax(0, 1fr);
  gap: 10px;
}

.prefix-picker {
  position: relative;
}

.prefix-input {
  padding-left: 18px;
  padding-right: 18px;
}

.prefix-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
  border-radius: 16px;
  border: 1px solid rgba(96, 165, 250, 0.22);
  background: var(--auth-panel-bg);
  box-shadow: 0 20px 38px rgba(2, 6, 23, 0.45);
}

.prefix-option {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  background: transparent;
  color: var(--auth-text);
  text-align: left;
  padding: 11px 14px;
  font: inherit;
  cursor: pointer;
}

.prefix-option:last-child {
  border-bottom: 0;
}

.prefix-option:hover,
.prefix-option.is-active {
  background: rgba(37, 99, 235, 0.16);
}

.prefix-meta {
  margin-top: 8px;
  color: var(--auth-text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.step-note {
  margin: -4px 0 16px;
  color: var(--auth-text-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.review-card,
.info-box {
  border-radius: 18px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-review-bg);
  padding: 16px;
}

.review-card {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.review-row {
  display: grid;
  gap: 4px;
}

.review-label {
  color: var(--auth-text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-value {
  color: var(--auth-text);
  font-size: 0.96rem;
  line-height: 1.45;
  word-break: break-word;
}

.info-box {
  color: var(--auth-text-muted);
  font-size: 0.88rem;
  line-height: 1.55;
  margin-bottom: 14px;
}

.info-box p {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 6px;
}

.info-box p:last-child {
  margin-bottom: 0;
}

.info-box strong {
  color: var(--auth-text);
}

.step-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.auth-open-app-install {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-summary-bg);
  color: var(--auth-text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-open-app-install[hidden] {
  display: none !important;
}

.auth-open-app-install strong {
  color: var(--auth-text);
  display: block;
  margin-bottom: 6px;
}

.auth-open-app-install a {
  color: var(--auth-link, #93c5fd);
  font-weight: 600;
}

.patient-platform-continue .patient-platform-pane {
  display: grid;
  gap: 10px;
}

.patient-platform-continue .patient-platform-pane[hidden] {
  display: none !important;
}

.patient-platform-copy {
  margin: 0;
  color: var(--auth-text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.patient-platform-continue .auth-inline-link {
  text-align: center;
}

/* Select account */
.selection-summary {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-summary-bg);
  color: var(--auth-text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.selection-summary strong {
  color: var(--auth-text);
}

.accounts-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.account-form {
  margin: 0;
}

.account-card {
  width: 100%;
  border: 1px solid var(--auth-input-border);
  background: var(--auth-surface);
  border-radius: 22px;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.account-card:hover {
  transform: translateY(-1px);
  border-color: rgba(96, 165, 250, 0.42);
  background: var(--auth-surface-strong);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.26);
}

.account-avatar {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(96, 165, 250, 0.96), rgba(37, 99, 235, 0.94));
  color: var(--auth-btn-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.04em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.account-copy {
  min-width: 0;
  flex: 1;
}

.account-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--auth-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-hint {
  margin-top: 4px;
  color: var(--auth-text-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.account-arrow {
  color: var(--auth-text-soft);
  font-size: 1rem;
  flex-shrink: 0;
}

.link-btn,
.ghost-btn {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
}

.ghost-btn {
  border: 1px solid var(--auth-input-border);
  background: var(--auth-ghost-bg);
  color: var(--auth-text-muted);
}

.link-btn {
  border: 0;
  background: var(--auth-link-bg);
  color: var(--auth-topline-text);
}

[hidden] {
  display: none !important;
}

@media (max-width: 480px) {
  .auth-card {
    border-radius: 24px;
    padding: 22px 16px 18px;
  }

  .auth-title {
    font-size: 1.62rem;
  }

  .auth-subtitle {
    font-size: 0.9rem;
  }

  .phone-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 760px) {
  body.auth-screen {
    display: block;
  }
}

/* Login & register pages — polished layout (dark default) */
body.auth-screen.patient-login-page,
body.auth-screen.patient-register-page,
body.auth-screen.patient-password-reset-page {
  background:
    radial-gradient(circle at 12% 8%, rgba(118, 184, 255, 0.14), transparent 32%),
    radial-gradient(circle at 88% 92%, rgba(37, 99, 235, 0.12), transparent 34%),
    linear-gradient(160deg, var(--auth-bg-start) 0%, var(--auth-bg-end) 100%);
}

body.auth-screen.patient-login-page::before,
body.auth-screen.patient-register-page::before,
body.auth-screen.patient-password-reset-page::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(118, 184, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(118, 184, 255, 0.04) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent 80%);
}

body.auth-screen.patient-login-page .auth-shell,
body.auth-screen.patient-register-page .auth-shell,
body.auth-screen.patient-password-reset-page .auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(28px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

body.auth-screen.patient-login-page .auth-card,
body.auth-screen.patient-register-page .auth-card,
body.auth-screen.patient-password-reset-page .auth-card {
  width: min(100%, 440px);
  padding: 30px;
  border-radius: 30px;
  position: relative;
  overflow: hidden;
}

body.auth-screen.patient-login-page .auth-topline,
body.auth-screen.patient-register-page .auth-topline,
body.auth-screen.patient-password-reset-page .auth-topline {
  margin-bottom: 22px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.auth-screen.patient-login-page .auth-logo,
body.auth-screen.patient-register-page .auth-logo,
body.auth-screen.patient-password-reset-page .auth-logo {
  width: 68px;
  height: 68px;
  margin-inline: auto;
  border-radius: 24px;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

body.auth-screen.patient-login-page .auth-logo img,
body.auth-screen.patient-register-page .auth-logo img,
body.auth-screen.patient-password-reset-page .auth-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: inherit;
}

body.auth-screen.patient-login-page .auth-title,
body.auth-screen.patient-register-page .auth-title,
body.auth-screen.patient-password-reset-page .auth-title {
  font-size: clamp(1.85rem, 8vw, 2.625rem);
  letter-spacing: -0.055em;
  font-weight: 700;
}

body.auth-screen.patient-login-page .auth-subtitle,
body.auth-screen.patient-register-page .auth-subtitle,
body.auth-screen.patient-password-reset-page .auth-subtitle {
  margin: 12px 0 24px;
  font-size: 0.94rem;
  line-height: 1.6;
  max-width: 34rem;
}

body.auth-screen.patient-login-page #loginForm,
body.auth-screen.patient-register-page #regForm,
body.auth-screen.patient-password-reset-page .auth-form-grid {
  display: grid;
  gap: 16px;
}

body.auth-screen.patient-register-page .progress-bar {
  margin: 0 0 4px;
}

body.auth-screen.patient-register-page .form-step.is-active {
  display: grid;
  gap: 16px;
}

body.auth-screen.patient-register-page .step-note {
  margin: 0;
}

body.auth-screen.patient-register-page .step-actions {
  margin-top: 6px;
  gap: 10px;
}

body.auth-screen.patient-login-page .field-group,
body.auth-screen.patient-register-page .field-group,
body.auth-screen.patient-password-reset-page .field-group {
  margin-bottom: 0;
  display: grid;
  gap: 8px;
}

body.auth-screen.patient-login-page .field-label,
body.auth-screen.patient-register-page .field-label,
body.auth-screen.patient-password-reset-page .field-label {
  margin-bottom: 0;
  font-size: 0.81rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--auth-text-muted);
}

body.auth-screen.patient-login-page .field-wrap,
body.auth-screen.patient-register-page .field-wrap,
body.auth-screen.patient-password-reset-page .field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 56px;
  border-radius: 18px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-input-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

body.auth-screen.patient-login-page .field-wrap:focus-within,
body.auth-screen.patient-register-page .field-wrap:focus-within,
body.auth-screen.patient-password-reset-page .field-wrap:focus-within {
  border-color: rgba(118, 184, 255, 0.55);
  box-shadow: 0 0 0 4px var(--auth-accent-soft);
  transform: translateY(-1px);
}

body.auth-screen.patient-login-page .auth-input,
body.auth-screen.patient-register-page .auth-input,
body.auth-screen.patient-password-reset-page .auth-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 54px;
  height: 54px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  padding: 0 16px 0 48px;
  font-size: 0.94rem;
  font-weight: 600;
}

body.auth-screen.patient-login-page .auth-input#password {
  padding-right: 52px;
}

body.auth-screen.patient-login-page .auth-input:focus,
body.auth-screen.patient-register-page .auth-input:focus,
body.auth-screen.patient-password-reset-page .auth-input:focus {
  box-shadow: none;
  background: transparent;
}

body.auth-screen.patient-login-page .field-icon,
body.auth-screen.patient-register-page .field-icon,
body.auth-screen.patient-password-reset-page .field-icon {
  left: 17px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  font-size: 1.125rem;
}

body.auth-screen.patient-login-page .field-action {
  position: absolute;
  top: 50%;
  right: 10px;
  width: 38px;
  height: 38px;
  margin: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--auth-text-muted);
  transform: translateY(-50%);
  z-index: 2;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

body.auth-screen.patient-login-page .field-action:hover {
  background: rgba(37, 99, 235, 0.22);
  color: var(--auth-accent);
  transform: translateY(-50%);
}

body.auth-screen.patient-login-page .field-action:active {
  transform: translateY(-50%) scale(0.96);
}

body.auth-screen.patient-login-page .btn-primary-auth,
body.auth-screen.patient-register-page .btn-next,
body.auth-screen.patient-password-reset-page .btn-primary-auth {
  min-height: 58px;
  margin-top: 6px;
  border-radius: 18px;
  font-size: 0.94rem;
  font-weight: 800;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.14), transparent 40%),
    linear-gradient(135deg, var(--auth-accent-strong) 0%, #0284c7 100%);
}

body.auth-screen.patient-login-page .btn-primary-auth.loading .spinner,
body.auth-screen.patient-register-page .btn-next.loading .spinner,
body.auth-screen.patient-password-reset-page .btn-primary-auth.loading .spinner {
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

body.auth-screen.patient-login-page .btn-primary-auth.loading .btn-text,
body.auth-screen.patient-register-page .btn-next.loading .btn-label,
body.auth-screen.patient-password-reset-page .btn-primary-auth.loading .btn-text {
  display: none;
}

body.auth-screen.patient-register-page .btn-back {
  min-height: 54px;
  border-radius: 18px;
  font-size: 0.94rem;
  font-weight: 700;
}

body.auth-screen.patient-login-page .auth-footer,
body.auth-screen.patient-register-page .auth-footer,
body.auth-screen.patient-password-reset-page .auth-footer {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--auth-card-border);
}

body.auth-screen.patient-login-page .auth-footer a,
body.auth-screen.patient-register-page .auth-footer a,
body.auth-screen.patient-password-reset-page .auth-footer a {
  color: var(--auth-accent);
  font-weight: 800;
}

@media (min-width: 860px) {
  body.auth-screen.patient-login-page .auth-shell,
  body.auth-screen.patient-register-page .auth-shell {
    padding: 36px;
  }

  body.auth-screen.patient-login-page .auth-card,
  body.auth-screen.patient-register-page .auth-card {
    padding: 34px;
  }
}

@media (max-width: 480px) {
  body.auth-screen.patient-login-page .auth-shell,
  body.auth-screen.patient-register-page .auth-shell {
    align-items: center;
    padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
  }

  body.auth-screen.patient-login-page .auth-card,
  body.auth-screen.patient-register-page .auth-card {
    width: 100%;
    min-height: 70%;
    border-radius: 28px;
    padding: 24px 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* ==========================================================================
   Light theme — auth pages
   ========================================================================== */
html[data-theme="light"] body.auth-screen {
  --auth-bg-start: #f1f5f9;
  --auth-bg-end: #e8eef5;
  --auth-card: #ffffff;
  --auth-card-border: #e2e8f0;
  --auth-surface: #ffffff;
  --auth-surface-strong: #f8fafc;
  --auth-accent: #3b82f6;
  --auth-accent-strong: #2563eb;
  --auth-accent-soft: rgba(37, 99, 235, 0.12);
  --auth-text: #0f172a;
  --auth-text-muted: #64748b;
  --auth-text-soft: #94a3b8;
  --auth-danger-bg: #fef2f2;
  --auth-danger-border: #fecaca;
  --auth-danger-text: #b91c1c;
  --auth-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --auth-orb-a: rgba(59, 130, 246, 0.14);
  --auth-orb-b: rgba(14, 165, 233, 0.1);
  --auth-topline-bg: #eff6ff;
  --auth-topline-border: #bfdbfe;
  --auth-topline-text: #1d4ed8;
  --auth-input-border: #cbd5e1;
  --auth-input-focus-bg: #ffffff;
  --auth-btn-text: #ffffff;
  --auth-panel-bg: #ffffff;
  --auth-dot-inactive: #e2e8f0;
  --auth-mode-bg: #f8fafc;
  --auth-mode-active-bg: #dbeafe;
  --auth-review-bg: #f8fafc;
  --auth-ghost-bg: #f8fafc;
  --auth-link-bg: #eff6ff;
  --auth-summary-bg: #f8fafc;
}

html[data-theme="light"]:has(body.auth-screen),
html[data-theme="light"] body.auth-screen {
  background: var(--patient-bg-primary, #f4f7fb);
  color: var(--auth-text);
}

html[data-theme="light"] body.auth-screen {
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.1), transparent 34%),
    radial-gradient(circle at bottom left, rgba(37, 99, 235, 0.08), transparent 30%),
    linear-gradient(180deg, var(--auth-bg-start) 0%, var(--auth-bg-end) 100%);
}

html[data-theme="light"] .auth-card {
  background: var(--auth-card);
  border-color: var(--auth-card-border);
  box-shadow: var(--auth-shadow);
}

html[data-theme="light"] .auth-orb {
  opacity: 0.55;
}

html[data-theme="light"] .mode-btn.is-active {
  color: #1e40af;
}

html[data-theme="light"] .prefix-panel {
  border-color: #cbd5e1;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] .prefix-option {
  border-bottom-color: #f1f5f9;
}

html[data-theme="light"] .prefix-option:hover,
html[data-theme="light"] .prefix-option.is-active {
  background: #eff6ff;
}

html[data-theme="light"] .account-card:hover {
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .link-btn {
  color: #1d4ed8;
}

html[data-theme="light"] .auth-footer a {
  color: #2563eb;
}

html[data-theme="light"] body.auth-screen .auth-input[type="date"] {
  color-scheme: light;
}

html[data-theme="light"] select.auth-input {
  color-scheme: light;
}

html[data-theme="light"] select.auth-input option {
  background-color: var(--auth-surface);
  color: var(--auth-text);
}

html[data-theme="light"] select.auth-input option:checked,
html[data-theme="light"] select.auth-input option:hover,
html[data-theme="light"] select.auth-input option:focus {
  background-color: #eff6ff;
  color: var(--auth-text);
}

/* Login & register pages — light theme */
html[data-theme="light"] body.auth-screen.patient-login-page,
html[data-theme="light"] body.auth-screen.patient-register-page,
html[data-theme="light"] body.auth-screen.patient-password-reset-page {
  background:
    radial-gradient(circle at 12% 12%, rgba(37, 99, 235, 0.14), transparent 28%),
    radial-gradient(circle at 92% 18%, rgba(14, 165, 233, 0.1), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #eef4ff 48%, #f7f9fc 100%);
}

html[data-theme="light"] body.auth-screen.patient-login-page::before,
html[data-theme="light"] body.auth-screen.patient-register-page::before,
html[data-theme="light"] body.auth-screen.patient-password-reset-page::before {
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px);
}

html[data-theme="light"] body.auth-screen.patient-login-page .auth-card,
html[data-theme="light"] body.auth-screen.patient-register-page .auth-card,
html[data-theme="light"] body.auth-screen.patient-password-reset-page .auth-card {
  background: rgba(255, 255, 255, 0.94);
}

html[data-theme="light"] body.auth-screen.patient-login-page .auth-topline,
html[data-theme="light"] body.auth-screen.patient-register-page .auth-topline,
html[data-theme="light"] body.auth-screen.patient-password-reset-page .auth-topline {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

html[data-theme="light"] body.auth-screen.patient-login-page .field-label,
html[data-theme="light"] body.auth-screen.patient-register-page .field-label,
html[data-theme="light"] body.auth-screen.patient-password-reset-page .field-label {
  color: #344054;
}

html[data-theme="light"] body.auth-screen.patient-login-page .field-wrap,
html[data-theme="light"] body.auth-screen.patient-register-page .field-wrap,
html[data-theme="light"] body.auth-screen.patient-password-reset-page .field-wrap {
  background: #ffffff;
  border-color: #d0d5dd;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

html[data-theme="light"] body.auth-screen.patient-login-page .field-wrap:focus-within,
html[data-theme="light"] body.auth-screen.patient-register-page .field-wrap:focus-within,
html[data-theme="light"] body.auth-screen.patient-password-reset-page .field-wrap:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.14);
}

html[data-theme="light"] body.auth-screen.patient-login-page .field-action {
  background: #f2f4f7;
  color: #667085;
}

html[data-theme="light"] body.auth-screen.patient-login-page .field-action:hover {
  background: #dbeafe;
  color: #2563eb;
}

html[data-theme="light"] body.auth-screen.patient-login-page .auth-footer,
html[data-theme="light"] body.auth-screen.patient-register-page .auth-footer,
html[data-theme="light"] body.auth-screen.patient-password-reset-page .auth-footer {
  border-top-color: rgba(148, 163, 184, 0.22);
}

html[data-theme="light"] body.auth-screen.patient-login-page .auth-footer a,
html[data-theme="light"] body.auth-screen.patient-register-page .auth-footer a,
html[data-theme="light"] body.auth-screen.patient-password-reset-page .auth-footer a {
  color: #3b82f6;
}

@media (max-width: 480px) {
  html[data-theme="light"] body.auth-screen.patient-login-page,
  html[data-theme="light"] body.auth-screen.patient-register-page,
  html[data-theme="light"] body.auth-screen.patient-password-reset-page {
    background:
      radial-gradient(circle at 20% 4%, rgba(37, 99, 235, 0.16), transparent 30%),
      linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  }
}

/* Account deletion & privacy pages */
.patient-delete-back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
  color: var(--auth-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.patient-delete-back:hover {
  color: var(--auth-accent);
}

.auth-topline--danger {
  background: var(--auth-danger-bg);
  border-color: var(--auth-danger-border);
  color: var(--auth-danger-text);
}

.patient-delete-lead {
  text-align: left;
}

.patient-delete-retained {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: var(--auth-review-bg);
  border: 1px solid var(--auth-card-border);
  text-align: left;
}

.patient-delete-retained-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.patient-delete-retained-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--auth-text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.patient-delete-retained-list li + li {
  margin-top: 0.35rem;
}

.patient-delete-retained-note {
  margin: 0.75rem 0 0;
  font-size: 0.82rem;
  color: var(--auth-text-soft);
  line-height: 1.45;
}

.patient-delete-confirm {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin: 1rem 0 1.25rem;
  font-size: 0.88rem;
  color: var(--auth-text-muted);
  line-height: 1.45;
  text-align: left;
}

.patient-delete-confirm input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.auth-submit--danger {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border-color: rgba(248, 113, 113, 0.35);
}

.auth-submit--danger:hover {
  filter: brightness(1.05);
}

.patient-delete-support {
  margin: 1.25rem 0 0;
  font-size: 0.82rem;
  color: var(--auth-text-soft);
  line-height: 1.45;
  text-align: center;
}

.patient-delete-support a,
.patient-privacy-secondary {
  color: var(--auth-accent);
  text-decoration: none;
  font-weight: 500;
}

.patient-privacy-actions {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.patient-privacy-secondary {
  display: block;
  text-align: center;
  font-size: 0.9rem;
}
