:root {
  --blue: #0f4f8b;
  --surface: #fff;
  --text: #202637;
  --muted: #687386;
  --field-error: #b3261e;
  font: 14px/1.45 Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: #eaf0f5;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

main {
  display: grid;
  min-height: 100svh;
  align-content: center;
  width: min(100% - 48px, 350px);
  margin: 0 auto;
  padding-block: 28px;
}

.panel {
  min-width: 0;
  padding: clamp(18px, 2.3vw, 26px);
  border: 1px solid #edf0f5;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 5px #17203305;
}

h1 { margin: 0 0 19px; font-size: 27px; line-height: 1.2; letter-spacing: -.9px; }
form { display: grid; gap: 19px; }
.note { margin: 12px 0 0; font-size: 12px; color: var(--muted); }


/* Campos de la referencia Material Outlined del proyecto. */
.field {
  --field-outline: #79747e;
  --field-focus: #757575;
  --field-height: 56px;
  position: relative;
  align-self: start;
  min-width: 0;
}

.compact .field { --field-height: 44px; }

.field > label {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 11px;
  max-width: calc(100% - 42px);
  padding-inline: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 16px;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
  transform: translateY(calc(var(--field-height) / 2 - 50%));
  transform-origin: left center;
  transition: transform 340ms cubic-bezier(.37, 0, .27, 1), color 280ms ease, background-color 280ms ease, font-weight 220ms ease;
}

.field:is(:focus-within, :has(> input[placeholder]:not(:placeholder-shown))) > label {
  background-color: var(--surface);
  transform: translateY(-50%) scale(.75);
}

.field:focus-within > label { font-weight: 700; }
.field:has(> [aria-invalid="true"]) { z-index: 3; }
.field:has(> [aria-invalid="true"]) > label { color: var(--field-error); }

.field > :is(input[type="email"], input[type="password"], input[type="text"]) {
  width: 100%;
  min-width: 0;
  min-height: var(--field-height);
  border: 1px solid var(--field-outline);
  border-radius: 4px;
  background-color: transparent;
  font-size: 16px;
  line-height: 24px;
  padding: 8px 15px;
  transition: border-color .15s, box-shadow .15s;
}

.field > :is(input[type="email"], input[type="password"], input[type="text"]):hover:not(:focus-within) { border-color: var(--text); }
.field > :is(input[type="email"], input[type="password"], input[type="text"]):focus {
  outline: 0;
  border-color: var(--field-focus);
  box-shadow: inset 0 0 0 1px var(--field-focus);
}
.field > input[aria-invalid="true"],
.field > input[aria-invalid="true"]:is(:focus, :hover) { border-color: var(--field-error); }
.field > input[aria-invalid="true"]:focus { box-shadow: inset 0 0 0 1px var(--field-error); }

.validation-popup {
  position: absolute;
  z-index: 3;
  inset-block-start: calc(100% + 7px);
  inset-inline-start: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 12px);
  padding: 8px 10px;
  border: 1px solid #cbd4dd;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 3px 10px #20263733;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
  pointer-events: none;
}

.validation-popup::before {
  content: "";
  position: absolute;
  inset-block-start: -5px;
  inset-inline-start: 12px;
  width: 8px;
  height: 8px;
  border-block-start: 1px solid #cbd4dd;
  border-inline-start: 1px solid #cbd4dd;
  background: #fff;
  transform: rotate(45deg);
}

.validation-symbol {
  display: grid;
  place-items: center;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: #a94509;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.field.password > input { padding-inline-end: 47px; }
.field.password > label { max-width: calc(100% - 62px); }
.field.password > input::-ms-reveal { display: none; }

.reveal {
  position: absolute;
  inset: 0 1px 0 auto;
  display: grid;
  place-items: center;
  min-width: 44px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
}

.reveal:hover { color: var(--blue); }
.reveal:focus-visible { outline-offset: -4px; }
.reveal svg { width: 20px; height: 20px; }
.reveal[aria-pressed="false"] .eye-slash { display: none; }

.remember-option {
  position: relative;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-block: -8px;
}
.remember-label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.remember-label input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.remember-label input[type="checkbox"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

.remember-tip {
  position: absolute;
  z-index: 2;
  grid-column: 2 / 3;
  inset-inline: 0;
  top: 50%;
  transform: translateY(-50%);
  justify-self: start;
  padding: 7px 9px;
  border: 1px solid #d4d9e2;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 18px #0002;
  color: var(--text);
  font-size: 12px;
  line-height: 1.25;
  visibility: hidden;
  pointer-events: none;
}

.remember-option:has(.remember-label:hover, .remember-label input:focus-visible):not(.tip-dismissed, :has(.recovery-trigger:focus-visible)) .remember-tip {
  visibility: visible;
}

.recovery-trigger {
  display: flex;
  grid-column: 2;
  justify-self: end;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--surface);
  color: var(--blue);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
  text-align: start;
  overflow-wrap: anywhere;
}
.recovery-trigger:hover { background: #edf3f8; border-color: var(--blue); }
.recovery-mark { display: block; width: 13px; height: 13px; flex: none; }
.recovery-help {
  padding: 10px 12px;
  border: 1px solid #d4d9e2;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 18px #0002;
  font-size: 12px;
}
.recovery-help h2 { margin: 0 0 4px; font-size: 13px; }
.recovery-help p { margin: 0; color: var(--muted); }
.actions { display: grid; gap: 8px; }

.primary, .biometric {
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  font-weight: 600;
}

.primary {
  background: var(--blue);
  color: #fff;
}

.primary:hover { filter: brightness(.93); }

.biometric {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding-block: 4px;
  background: var(--surface);
  color: var(--blue);
}

.biometric:hover { background: #edf3f8; }
.biometric img { width: 28px; height: 28px; flex: none; }

@media (max-width: 640px) {
  main { width: min(100% - 28px, 350px); padding-block: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .field > label, .field > input { transition: none !important; }
}
