:root {
  --fase-ink: #183044;
  --fase-ink-soft: #556b78;
  --fase-primary: #276b70;
  --fase-primary-dark: #1c555c;
  --fase-primary-light: #dceeed;
  --fase-border: #dbe4e8;
  --fase-surface: #ffffff;
  --fase-background: #f4f7f8;
  --fase-danger: #ad3b45;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body.auth-page {
  margin: 0;
  background: var(--fase-background);
  color: var(--fase-ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(390px, 46%) minmax(480px, 54%);
  min-height: 100vh;
}

.auth-brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow: hidden;
  padding: clamp(2rem, 4vw, 4.25rem);
  background:
    radial-gradient(circle at 18% 85%, rgba(139, 204, 189, 0.2), transparent 30%),
    linear-gradient(145deg, #17384d 0%, #1d535d 55%, #347a72 100%);
  color: #fff;
}

.auth-decoration {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  pointer-events: none;
}

.auth-decoration-one {
  width: 420px;
  height: 420px;
  top: -190px;
  right: -170px;
}

.auth-decoration-two {
  width: 260px;
  height: 260px;
  right: -70px;
  bottom: -90px;
  background: rgba(255, 255, 255, 0.025);
}

.fase-brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 0.7rem;
  color: var(--fase-ink);
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.fase-brand:hover {
  color: var(--fase-ink);
}

.fase-brand-light,
.fase-brand-light:hover {
  color: #fff;
}

.fase-brand-mark {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  border-radius: 0.85rem;
  background: var(--fase-primary-light);
  color: var(--fase-primary-dark);
}

.fase-brand-light .fase-brand-mark {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(8px);
}

.fase-brand-mark svg {
  width: 1.65rem;
  height: 1.65rem;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.fase-brand-mark circle {
  fill: currentColor;
  stroke: none;
}

.auth-brand-content {
  position: relative;
  z-index: 1;
  width: min(100%, 570px);
  margin: auto 0;
  padding: 3rem 0;
}

.auth-eyebrow,
.auth-heading-kicker {
  display: inline-block;
  color: #a9e0d2;
  font-size: 0.74rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.auth-brand-content h1 {
  max-width: 560px;
  margin: 1rem 0 1.25rem;
  font-size: clamp(2.3rem, 4vw, 4rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.auth-brand-content > p {
  max-width: 510px;
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 1.04rem;
  line-height: 1.7;
}

.auth-benefits {
  display: grid;
  gap: 1rem;
  margin: 2.3rem 0 0;
  padding: 0;
  list-style: none;
}

.auth-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.93rem;
  line-height: 1.5;
}

.auth-benefits strong {
  color: #fff;
  font-weight: 650;
}

.auth-check {
  display: grid;
  flex: 0 0 1.45rem;
  width: 1.45rem;
  height: 1.45rem;
  margin-top: 0.05rem;
  place-items: center;
  border-radius: 50%;
  background: rgba(174, 226, 212, 0.15);
  color: #c1f0e3;
  font-size: 0.76rem;
  font-weight: 800;
}

.auth-brand-footer {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.82rem;
}

.auth-form-panel {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: clamp(1.5rem, 4vw, 4rem);
  background:
    radial-gradient(circle at 92% 8%, rgba(197, 224, 220, 0.25), transparent 24%),
    var(--fase-surface);
}

.auth-mobile-brand {
  display: none;
}

.auth-form-container {
  width: min(100%, 440px);
  margin: auto;
  padding: 2rem 0;
}

.auth-heading {
  margin-bottom: 2.3rem;
}

.auth-heading-kicker {
  color: var(--fase-primary);
}

.auth-heading h2 {
  margin: 0.65rem 0 0.6rem;
  color: var(--fase-ink);
  font-size: clamp(2rem, 3.2vw, 2.65rem);
  font-weight: 680;
  letter-spacing: -0.04em;
  line-height: 1.12;
}

.auth-heading p {
  margin: 0;
  color: var(--fase-ink-soft);
  font-size: 0.98rem;
}

.auth-form {
  display: grid;
  gap: 1.25rem;
}

.auth-field {
  display: grid;
  gap: 0.45rem;
}

.auth-field .form-label {
  margin: 0;
  color: #284353;
  font-size: 0.86rem;
  font-weight: 650;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-icon {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 1rem;
  display: grid;
  width: 1.2rem;
  height: 1.2rem;
  color: #82949e;
  pointer-events: none;
  transform: translateY(-50%);
}

.auth-input-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.auth-control.form-control {
  min-height: 3.45rem;
  padding: 0.8rem 1rem 0.8rem 3rem;
  border: 1px solid var(--fase-border);
  border-radius: 0.85rem;
  background: #fbfcfc;
  color: var(--fase-ink);
  font-size: 0.95rem;
  box-shadow: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.auth-control-password.form-control {
  padding-right: 5.2rem;
}

.auth-control.form-control::placeholder {
  color: #9cacb4;
}

.auth-control.form-control:hover {
  border-color: #bdcdd2;
}

.auth-control.form-control:focus {
  border-color: var(--fase-primary);
  background: #fff;
  box-shadow: 0 0 0 0.22rem rgba(39, 107, 112, 0.12);
}

.auth-password-toggle {
  position: absolute;
  z-index: 2;
  top: 50%;
  right: 0.95rem;
  padding: 0.3rem 0.25rem;
  border: 0;
  background: transparent;
  color: var(--fase-primary);
  font-size: 0.76rem;
  font-weight: 700;
  transform: translateY(-50%);
}

.auth-password-toggle:hover,
.auth-password-toggle:focus-visible {
  color: var(--fase-primary-dark);
}

.auth-form-options {
  display: flex;
  align-items: center;
  min-height: 1.5rem;
}

.auth-form-options .form-check {
  margin: 0;
}

.auth-form-options .form-check-input {
  border-color: #aebfc5;
}

.auth-form-options .form-check-input:checked {
  border-color: var(--fase-primary);
  background-color: var(--fase-primary);
}

.auth-form-options .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(39, 107, 112, 0.12);
}

.auth-form-options .form-check-label {
  color: var(--fase-ink-soft);
  font-size: 0.86rem;
}

.auth-inline-link,
.auth-back-link a {
  color: var(--fase-primary);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.auth-inline-link:hover,
.auth-back-link a:hover {
  color: var(--fase-primary-dark);
  text-decoration: underline;
}

.auth-back-link {
  margin: 1.2rem 0 0;
  color: var(--fase-ink-soft);
  font-size: 0.84rem;
  text-align: center;
}

.auth-result-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid #cfe5df;
  border-radius: 0.85rem;
  background: #f3faf8;
  color: var(--fase-ink-soft);
  font-size: 0.86rem;
  line-height: 1.5;
}

.auth-result-card.is-warning {
  border-color: #efd3d0;
  background: #fff7f6;
}

.auth-result-card p {
  margin: 0;
}

.auth-result-icon {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 50%;
  background: var(--fase-primary-light);
  color: var(--fase-primary-dark);
  font-weight: 800;
}

.auth-result-card.is-warning .auth-result-icon {
  background: #f6dedb;
  color: var(--fase-danger);
}

.auth-submit-link {
  margin-top: 1.2rem;
  text-decoration: none;
}

.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3.45rem;
  gap: 0.75rem;
  border: 0;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, var(--fase-primary-dark), var(--fase-primary));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 0.7rem 1.5rem rgba(31, 88, 94, 0.18);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.auth-submit:hover {
  filter: brightness(1.04);
  box-shadow: 0 0.9rem 1.8rem rgba(31, 88, 94, 0.24);
  transform: translateY(-1px);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0.25rem 0 0;
  color: #7a8e98;
  font-size: 0.76rem;
  text-align: center;
}

.auth-security-note span {
  color: #72a99f;
  font-size: 0.5rem;
}

.auth-validation {
  min-height: 1rem;
  color: var(--fase-danger);
  font-size: 0.76rem;
}

.auth-validation:empty {
  display: none;
}

.auth-alert {
  padding: 0.85rem 1rem;
  border: 1px solid #efd1d3;
  border-radius: 0.75rem;
  background: #fff6f6;
  color: #8f2f39;
  font-size: 0.84rem;
}

.auth-alert.validation-summary-valid {
  display: none;
}

.auth-alert ul {
  margin: 0;
  padding-left: 1.1rem;
}

.auth-form-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: #8a9ba4;
  font-size: 0.76rem;
}

.auth-form-footer a {
  color: #617984;
  text-decoration: none;
}

.auth-form-footer a:hover {
  color: var(--fase-primary);
  text-decoration: underline;
}

@media (max-width: 980px) {
  .auth-shell {
    grid-template-columns: minmax(330px, 42%) minmax(430px, 58%);
  }

  .auth-brand-content h1 {
    font-size: clamp(2.1rem, 4.7vw, 3rem);
  }

  .auth-benefits {
    margin-top: 1.8rem;
  }
}

@media (max-width: 760px) {
  .auth-shell {
    display: block;
    min-height: 100vh;
  }

  .auth-brand-panel {
    display: none;
  }

  .auth-form-panel {
    min-height: 100vh;
    padding: 1.5rem;
  }

  .auth-mobile-brand {
    display: block;
  }

  .auth-form-container {
    padding: 3rem 0 2rem;
  }
}

@media (max-width: 420px) {
  .auth-form-panel {
    padding: 1.15rem;
  }

  .auth-form-options {
    flex-wrap: wrap;
    gap: .65rem;
  }

  .auth-form-footer {
    flex-wrap: wrap;
    row-gap: .55rem;
  }

  .auth-password-toggle {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }

  .auth-form-container {
    padding-top: 2.5rem;
  }

  .auth-heading {
    margin-bottom: 1.8rem;
  }

  .auth-heading h2 {
    font-size: 1.85rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Refinamento premium transversal da autenticação */
:root {
  --fase-shadow: 0 .9rem 2.4rem rgba(24, 48, 68, .075);
  --fase-focus: rgba(39, 107, 112, .34);
}

.auth-page {
  line-height: 1.45;
}

.auth-page a,
.auth-page button,
.auth-page input,
.auth-page select,
.auth-page textarea {
  -webkit-tap-highlight-color: transparent;
}

.auth-page a:focus-visible,
.auth-page button:focus-visible,
.auth-page input:focus-visible,
.auth-page select:focus-visible,
.auth-page textarea:focus-visible {
  outline: 3px solid var(--fase-focus);
  outline-offset: 3px;
}

.auth-brand-panel {
  background:
    radial-gradient(circle at 12% 78%, rgba(139, 204, 189, .22), transparent 29%),
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, .08), transparent 24%),
    linear-gradient(145deg, #17384d 0%, #1d535d 55%, #347a72 100%);
}

.auth-form-panel {
  border-left: 1px solid rgba(224, 232, 235, .8);
}

.auth-heading h2 {
  line-height: 1.06;
}

.auth-form {
  gap: 1.1rem;
}

.auth-control.form-control {
  box-shadow: 0 .25rem .9rem rgba(24, 48, 68, .025);
}

.auth-control.form-control:focus {
  box-shadow: 0 0 0 .22rem rgba(39, 107, 112, .12), 0 .35rem 1rem rgba(39, 107, 112, .05);
}

.auth-submit {
  border: 1px solid transparent;
  box-shadow: 0 .75rem 1.65rem rgba(31, 88, 94, .2);
}

.auth-submit:focus-visible {
  box-shadow: 0 0 0 .22rem rgba(255, 255, 255, .9), 0 0 0 .45rem var(--fase-focus), 0 .75rem 1.65rem rgba(31, 88, 94, .2);
}

.auth-submit:disabled {
  cursor: not-allowed;
  filter: grayscale(.15);
  opacity: .68;
  transform: none;
}

.auth-result-card,
.auth-alert {
  box-shadow: 0 .35rem 1rem rgba(24, 48, 68, .035);
}

.auth-form-footer a {
  border-radius: .35rem;
}

@media (max-width: 760px) {
  .auth-form-panel { border-left: 0; }
}

/* Rodada final: seleção de clínica */
.auth-selection-page { width: min(100%, 620px); margin: auto; padding: clamp(1.5rem, 4vw, 3rem) 0; }
.auth-selection-heading { margin-bottom: 1.8rem; }
.auth-selection-heading h1 { margin: .65rem 0 .6rem; color: var(--fase-ink); font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 680; letter-spacing: -.045em; line-height: 1.1; }
.auth-selection-heading p { max-width: 560px; margin: 0; color: var(--fase-ink-soft); font-size: .94rem; line-height: 1.6; }
.auth-clinic-list { display: grid; gap: .75rem; }
.auth-clinic-option-form { margin: 0; }
.auth-clinic-option { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; width: 100%; align-items: center; gap: .8rem; padding: .9rem 1rem; border: 1px solid var(--fase-border); border-radius: .9rem; background: #fff; color: var(--fase-ink); text-align: left; box-shadow: 0 .3rem .9rem rgba(24, 48, 68, .035); transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease; }
.auth-clinic-option:hover { border-color: #b9d8d4; background: #fbfefd; box-shadow: 0 .6rem 1.25rem rgba(31, 88, 94, .1); transform: translateY(-1px); }
.auth-clinic-option:focus-visible { outline: 3px solid rgba(39, 107, 112, .18); outline-offset: 3px; }
.auth-clinic-icon { display: grid; width: 2.6rem; height: 2.6rem; place-items: center; border-radius: .75rem; background: var(--fase-primary-light); color: var(--fase-primary-dark); }
.auth-clinic-icon svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.65; }
.auth-clinic-copy { display: grid; min-width: 0; gap: .2rem; }
.auth-clinic-copy strong { overflow: hidden; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.auth-clinic-copy small { color: var(--fase-ink-soft); font-size: .72rem; }
.auth-clinic-arrow { color: var(--fase-primary); font-size: 1.2rem; font-weight: 650; }
.auth-selection-footer { display: grid; grid-template-columns: 2rem minmax(0, 1fr) auto; align-items: center; gap: .65rem; margin-top: 1.4rem; padding: .9rem 1rem; border: 1px solid #dbe9df; border-radius: .85rem; background: #f3faf8; }
.auth-selection-footer > div { display: grid; gap: .12rem; }
.auth-selection-footer strong { color: var(--fase-ink); font-size: .74rem; }
.auth-selection-footer p { margin: 0; color: var(--fase-ink-soft); font-size: .65rem; line-height: 1.45; }
.auth-security-mark { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; background: var(--fase-primary-light); color: var(--fase-primary-dark); font-size: .75rem; font-weight: 800; }
.auth-selection-footer form { margin: 0; }

@media (max-width: 560px) {
  .auth-selection-page { padding-inline: .25rem; }
  .auth-clinic-option { grid-template-columns: 2.3rem minmax(0, 1fr) auto; padding: .8rem; }
  .auth-clinic-icon { width: 2.3rem; height: 2.3rem; }
  .auth-selection-footer { grid-template-columns: 2rem minmax(0, 1fr); }
  .auth-selection-footer form { grid-column: 2; justify-self: start; }
}
