:root {
  color-scheme: light;
  --brand-clinical-blue: #05DBF7;
  --auth-accent: var(--brand-clinical-blue);
  --auth-accent-dark: #028ca0;
  --auth-ink: #243649;
  --auth-muted: #607185;
  --auth-line: #cceef3;
  --auth-divider: #d4e9ec;
  --auth-tint: #e6fbfe;
  --auth-error: #b33b3b;
}

* { box-sizing: border-box; }
body.auth-page {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 24px;
  background: #f4fcfe;
  color: var(--auth-ink);
  font: 14px/1.4 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  isolation: isolate;
}

/* Oversized environmental outlines stay behind the card and cannot cause overflow. */
.auth-environment { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -1; }
.auth-environment::before, .auth-environment::after {
  content: "";
  position: absolute;
  filter: blur(65px);
  border-radius: 48%;
}
.auth-environment::before {
  width: 90vw;
  height: 55vh;
  top: -20%;
  left: -15%;
  transform: rotate(-24deg);
  background: #fff;
  opacity: .3;
  box-shadow: 40vw 72vh 80px 40px rgba(181, 202, 224, .55);
}
.auth-environment::after {
  width: 50vw;
  height: 115vh;
  top: -25%;
  right: -15%;
  transform: rotate(28deg);
  background: #c9f8ff;
  opacity: .4;
  box-shadow: -74vw 20vh 90px 60px rgba(255, 255, 255, .5);
}
.auth-background-icon {
  position: absolute;
  stroke: #7debf8;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .5;
}
.auth-background-heart { width: clamp(260px, 26vw, 440px); left: -3%; top: -5%; transform: rotate(-12deg); }
.auth-background-cross { width: clamp(130px, 12vw, 210px); left: 57%; top: -5%; transform: rotate(8deg); opacity: .4; }
.auth-background-stethoscope { width: clamp(260px, 26vw, 440px); left: -4%; top: 36%; transform: rotate(12deg); }
.auth-background-record { width: clamp(180px, 19vw, 310px); left: 23%; bottom: -16%; transform: rotate(-13deg); }
.auth-background-maternal { width: clamp(340px, 29vw, 480px); right: -6%; top: 3%; opacity: .45; }

.auth-card {
  display: grid;
  grid-template-columns: 42% minmax(0, 1fr);
  width: 100%;
  max-width: 700px;
  margin-block: auto;
  background: #fff;
  border: 1px solid var(--auth-divider);
  border-radius: 18px;
  box-shadow: 0 12px 34px rgba(35, 72, 112, .09);
}
.auth-brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 24px 22px 48px;
  border-right: 1px solid var(--auth-divider);
  border-radius: 18px 0 0 18px;
}
.auth-brand-identity { position: relative; z-index: 1; width: 100%; text-align: center; }
.auth-logo { display: block; width: 184px; max-width: 100%; height: auto; margin: 0 auto; }
.auth-brand-name { max-width: 240px; margin: 12px auto 0; color: #045f6c; font-size: 16px; line-height: 1.4; font-weight: 500; text-wrap: balance; }
.auth-brand-waves { position: absolute; bottom: 0; left: 0; width: 100%; height: 112px; border-bottom-left-radius: 17px; pointer-events: none; opacity: .5; }
.auth-content { min-width: 0; padding: 28px 30px 24px; align-self: center; }
.auth-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-mark { width: 36px; height: 36px; display: grid; place-items: center; flex-shrink: 0; color: var(--auth-accent); background: #e6fbfe; border-radius: 50%; }
.auth-mark .auth-icon { width: 20px; height: 20px; }
.auth-header h1 { margin: 0; color: var(--auth-accent-dark); font-size: 25px; font-weight: 700; line-height: 1.2; letter-spacing: -.02em; }
.auth-icon, .monitoring-icon { display: block; flex: 0 0 auto; }
.auth-form { display: grid; gap: 16px; }
.auth-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; align-items: start; }
.auth-field { min-width: 0; }
.auth-field--wide { grid-column: 1 / -1; }
.auth-grid:has(> [data-field="cadre"][hidden]) > [data-field="primary_facility"] { grid-column: 1 / -1; }
.auth-field[hidden], .auth-password-toggle[hidden] { display: none; }
.auth-field label { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 6px; margin-bottom: 4px; font-size: 13px; line-height: 1.3; font-weight: 600; }
.auth-optional { color: var(--auth-muted); font-size: 11px; font-weight: 400; }
.auth-input { position: relative; }
.auth-field input, .auth-field select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--auth-line);
  border-radius: 8px;
  background-color: #fff;
  color: var(--auth-ink);
  padding: 8px 11px;
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.auth-field select { text-overflow: ellipsis; padding-right: 24px; }
.auth-field input::placeholder { color: #82968b; opacity: 1; }
.auth-field input:hover, .auth-field select:hover { border-color: #9db9ab; }
.auth-field input:focus, .auth-field select:focus { border-color: var(--auth-accent); box-shadow: 0 0 0 3px rgba(5, 219, 247, .18); outline: none; }
.auth-input--icon input { padding-left: 36px; }
.auth-input-icon { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: #6b8376; pointer-events: none; }
.auth-input-icon .auth-icon { width: 17px; height: 17px; }
.auth-input--password input { padding-right: 40px; }
.auth-password-toggle { position: absolute; right: 2px; top: 2px; bottom: 2px; display: grid; place-items: center; width: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #6b8376; cursor: pointer; }
.auth-password-toggle:hover { background: var(--auth-tint); color: var(--auth-accent); }
.auth-password-toggle .auth-icon { width: 18px; height: 18px; }
.auth-eye-slash { display: none; }
.auth-password-toggle[aria-pressed="true"] .auth-eye-slash { display: block; }
.auth-page :is(button, a):focus-visible { outline: 3px solid var(--auth-accent); outline-offset: 3px; }
.auth-submit, .auth-page .operation-notice button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 42px; padding: 9px 16px; border: 0; border-radius: 8px; background: var(--auth-accent); color: #04343b; font: inherit; font-weight: 600; cursor: pointer; }
.auth-submit .monitoring-icon { width: 17px; height: 17px; }
.auth-submit:not(:disabled):hover, .auth-page .operation-notice button:hover { background: var(--auth-accent-dark); color: #fff; }
.auth-submit:not(:disabled):active, .auth-page .operation-notice button:active { background: #045f6c; color: #fff; }
.auth-submit:disabled { background: #c7d8ce; color: #486154; cursor: not-allowed; }
.auth-footer { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--auth-divider); text-align: center; font-size: 13px; color: var(--auth-muted); }
.auth-footer a { display: inline-block; padding-block: 3px; color: var(--auth-accent); font-weight: 600; text-decoration: none; margin-left: 4px; border-radius: 2px; }
.auth-footer a:hover { color: var(--auth-accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.auth-help { margin-top: 4px; color: var(--auth-muted); font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.auth-help ul { margin: 0; padding-left: 16px; }
.auth-error { color: var(--auth-error); font-size: 12px; line-height: 1.4; margin-top: 4px; overflow-wrap: anywhere; }
.auth-alert { margin: 0; padding: 9px 12px; border: 1px solid #eed4d4; border-radius: 8px; background: #fff7f7; }
.auth-alert .errorlist { list-style: none; margin: 0; padding: 0; }
.auth-field--invalid :is(input, select), .auth-field [aria-invalid="true"] { border-color: #c94c4c; }
.auth-field--invalid :is(input, select):focus, .auth-field [aria-invalid="true"]:focus { border-color: #c94c4c; box-shadow: 0 0 0 3px rgba(201, 76, 76, .10); }

/* Five paired field rows keep registration within a normal laptop viewport. */
.auth-card--signup { max-width: 900px; grid-template-columns: 24% minmax(0, 1fr); }
.auth-card--signup .auth-brand { padding-inline: 18px; }
.auth-card--signup .auth-logo { width: 164px; }
.auth-card--signup .auth-content { padding: 18px 24px; }
.auth-card--signup .auth-header { margin-bottom: 12px; }
.auth-card--signup .auth-mark { width: 32px; height: 32px; }
.auth-card--signup .auth-header h1 { font-size: 24px; }
.auth-card--signup .auth-form { gap: 10px; }
.auth-card--signup .auth-field input, .auth-card--signup .auth-field select { height: 36px; padding-block: 6px; }
.auth-card--signup .auth-submit { min-height: 38px; padding-block: 8px; }
.auth-card--signup .auth-footer { margin-top: 10px; padding-top: 8px; }
.auth-section { min-width: 0; margin: 0; padding: 0; border: 0; }
.auth-section legend { width: 100%; margin-bottom: 6px; padding: 0 0 4px; border-bottom: 1px solid var(--auth-divider); color: var(--auth-accent-dark); font-size: 12px; line-height: 1.3; font-weight: 600; }

@media (min-width: 1100px) and (max-height: 680px) {
  body.auth-page { padding-block: 12px; }
  .auth-card--signup { max-width: 1040px; grid-template-columns: 22% minmax(0, 1fr); }
  .auth-section--personal .auth-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .auth-card--signup .auth-content { padding-block: 10px; }
}

/* Reflow groups on short desktop screens instead of shrinking text or clipping fields. */
@media (min-width: 1100px) and (max-height: 600px) {
  body.auth-page { padding-block: 6px; }
  .auth-card--signup .auth-form { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; }
  .auth-section--personal .auth-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-signup-actions, .auth-alert { grid-column: 1 / -1; }
}

@media (min-width: 1100px) and (min-height: 601px) {
  .auth-card--signup:has(.auth-field--invalid) { max-width: 1040px; grid-template-columns: 22% minmax(0, 1fr); }
  .auth-card--signup:has(.auth-field--invalid) .auth-section--personal .auth-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  body.auth-page { padding: 16px; }
  .auth-card--signup .auth-content { padding-inline: 18px; }
  .auth-brand { padding-inline: 16px; }
  .auth-grid { column-gap: 12px; }
}

@media (max-width: 760px) {
  .auth-card, .auth-card--signup { grid-template-columns: minmax(0, 1fr); max-width: 480px; border-radius: 16px; }
  .auth-brand { padding: 16px 20px; border-right: 0; border-bottom: 1px solid var(--auth-divider); border-radius: 16px 16px 0 0; }
  .auth-logo, .auth-card--signup .auth-logo { width: 110px; }
  .auth-brand-name { max-width: none; margin-top: 7px; font-size: 14px; }
  .auth-brand-waves { width: 120px; height: 54px; opacity: .4; border-bottom-left-radius: 0; }
  .auth-content, .auth-card--signup .auth-content { padding: 20px; }
  .auth-header, .auth-card--signup .auth-header { margin-bottom: 16px; }
  .auth-field input, .auth-field select, .auth-card--signup .auth-field input, .auth-card--signup .auth-field select { height: 44px; font-size: 16px; }
  .auth-password-toggle { width: 40px; }
  .auth-input--password input { padding-right: 44px; }
  .auth-submit, .auth-card--signup .auth-submit { min-height: 44px; }
  .auth-card--signup .auth-form { gap: 16px; }
  .auth-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .auth-field--wide { grid-column: auto; }
  .auth-help { font-size: 12px; line-height: 1.4; }
  .auth-background-cross, .auth-background-record { display: none; }
  .auth-background-heart { width: 250px; left: -100px; top: -20px; }
  .auth-background-stethoscope { width: 220px; left: -115px; top: 45%; }
  .auth-background-maternal { width: 320px; right: -205px; top: 18%; opacity: .35; }
}

@media (max-width: 380px) {
  body.auth-page { padding: 12px; }
  .auth-content, .auth-card--signup .auth-content { padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-field input, .auth-field select { transition: none; }
}
