:root {
  --central-blue-dark: #073b7a;
  --central-blue: #0d6efd;
  --central-blue-soft: #eaf4ff;
  --central-green: #78b942;
  --central-green-dark: #4f8d2f;
  --central-green-soft: #eff9ea;
  --central-text: #1f2d3d;
  --central-muted: #6b7b88;
  --central-border: #dce7f2;
  --central-danger: #b42318;
  --central-danger-bg: #fff1f0;
  --central-shadow:
    0 24px 60px rgba(27, 58, 90, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--central-text);
  background: #f4f8fb;
}

button,
input {
  font: inherit;
}

.central-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(
      circle at top left,
      rgba(13, 110, 253, 0.17),
      transparent 30%
    ),
    radial-gradient(
      circle at bottom right,
      rgba(120, 185, 66, 0.20),
      transparent 32%
    ),
    linear-gradient(
      135deg,
      #eef7ff 0%,
      #f5fbf3 48%,
      #e9f5ff 100%
    );
}

.central-shell {
  width: min(1100px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--central-shadow);
  backdrop-filter: blur(6px);
}

.central-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  border-right: 1px solid rgba(0, 0, 0, 0.05);
  background:
    linear-gradient(
      145deg,
      rgba(230, 245, 255, 0.98),
      rgba(240, 250, 235, 0.98)
    );
}

.brand-content {
  width: 100%;
  max-width: 430px;
  text-align: center;
}

.brand-logo {
  width: 100%;
  max-width: 430px;
  margin-bottom: 28px;
  object-fit: contain;
}

.brand-text h1 {
  margin: 0;
  color: var(--central-blue-dark);
  font-size: clamp(40px, 5vw, 52px);
  font-weight: 850;
  letter-spacing: 2px;
}

.brand-text p {
  margin: 8px 0 6px;
  color: var(--central-green-dark);
  font-size: 24px;
  font-weight: 850;
}

.brand-text span {
  display: block;
  color: var(--central-muted);
  font-size: 15px;
}

.brand-portals {
  display: inline-flex;
  margin-top: 22px;
  padding: 8px 16px;
  border: 1px solid rgba(7, 59, 122, 0.10);
  border-radius: 999px;
  color: var(--central-blue-dark);
  background:
    linear-gradient(
      90deg,
      var(--central-blue-soft),
      var(--central-green-soft)
    );
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.central-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 42px;
  background:
    linear-gradient(
      180deg,
      #ffffff 0%,
      #f9fcff 100%
    );
}

.central-view {
  width: 100%;
  max-width: 430px;
}

.hidden {
  display: none !important;
}

.loading-view {
  text-align: center;
}

.loading-view h2 {
  margin: 18px 0 6px;
  color: #153b63;
}

.loading-view p {
  margin: 0;
  color: var(--central-muted);
}

.central-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border: 4px solid #dce7f2;
  border-top-color: var(--central-green);
  border-radius: 50%;
  animation: central-spin 0.8s linear infinite;
}

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

.login-title {
  margin-bottom: 30px;
  text-align: center;
}

.login-title h2 {
  margin: 0;
  color: #153b63;
  font-size: 34px;
  font-weight: 850;
}

.login-title p {
  margin: 6px 0 0;
  color: var(--central-green-dark);
  font-size: 16px;
  font-weight: 750;
}

.mobile-brand {
  display: none;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field span {
  display: block;
  margin-bottom: 7px;
  color: #28445e;
  font-size: 14px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid #d6e2ee;
  border-radius: 14px;
  outline: none;
  color: #172b3f;
  background: #f9fcff;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.field input:focus {
  border-color: var(--central-green);
  background: #ffffff;
  box-shadow:
    0 0 0 0.2rem rgba(120, 185, 66, 0.15);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 48px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #5b7a94;
  cursor: pointer;
}

.password-toggle:hover {
  color: #28445e;
  background: rgba(40, 68, 94, 0.08);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--central-green);
  outline-offset: 2px;
}

/*
 * PORTAL_S5_CSP_EYE_V1
 *
 * El atributo HTML `hidden` ya oculta el elemento por sí
 * mismo (estilo por defecto del user agent), esta regla es
 * un respaldo explícito en CSS externo (permitido por
 * style-src 'self') por si alguna otra regla de este mismo
 * archivo llegara a fijar `display` sobre estos SVG.
 */
.password-toggle svg[hidden] {
  display: none;
}

.primary-button {
  width: 100%;
  min-height: 50px;
  margin-top: 3px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  color: #ffffff;
  background:
    linear-gradient(
      90deg,
      var(--central-blue-dark) 0%,
      var(--central-green) 100%
    );
  font-size: 16px;
  font-weight: 800;
  transition:
    transform 0.15s ease,
    filter 0.15s ease;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.message {
  margin-bottom: 17px;
  padding: 11px 13px;
  border: 1px solid #f1b7b2;
  border-radius: 12px;
  color: var(--central-danger);
  background: var(--central-danger-bg);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.central-footer {
  margin-top: 24px;
  color: #7b8794;
  text-align: center;
  font-size: 12px;
}

.portal-view {
  max-width: 560px;
}

.portal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e9eff5;
}

.portal-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--central-green-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.portal-header h2 {
  margin: 0;
  color: #153b63;
  font-size: 25px;
  line-height: 1.15;
}

.portal-header p {
  margin: 6px 0 0;
  color: var(--central-muted);
  font-size: 13px;
  line-height: 1.4;
}

.logout-button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid #efc3c0;
  border-radius: 10px;
  cursor: pointer;
  color: #a61b13;
  background: #fff8f7;
  font-size: 12px;
  font-weight: 800;
}

.portal-instructions {
  margin: 20px 0 14px;
}

.portal-instructions h3 {
  margin: 0;
  color: #203b55;
  font-size: 17px;
}

.portal-instructions p {
  margin: 5px 0 0;
  color: var(--central-muted);
  font-size: 12px;
}

.portal-grid {
  display: grid;
  gap: 12px;
}

.portal-card {
  width: 100%;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid #dce7f2;
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  background: #ffffff;
  box-shadow:
    0 9px 22px rgba(27, 58, 90, 0.07);
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.portal-card:hover {
  transform: translateY(-2px);
  border-color: rgba(13, 110, 253, 0.32);
  box-shadow:
    0 14px 30px rgba(27, 58, 90, 0.12);
}

.portal-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #ffffff;
  background:
    linear-gradient(
      135deg,
      var(--central-blue-dark),
      var(--central-green)
    );
  font-size: 13px;
  font-weight: 900;
}

.portal-info strong {
  display: block;
  margin-bottom: 3px;
  color: #173b5f;
  font-size: 15px;
}

.portal-info span {
  display: block;
  color: var(--central-muted);
  font-size: 11px;
  line-height: 1.35;
}

.portal-role {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  color: #285f31;
  background: var(--central-green-soft);
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.empty-portals {
  padding: 22px;
  border: 1px dashed #bdcddd;
  border-radius: 14px;
  color: var(--central-muted);
  text-align: center;
  background: #fbfdff;
  font-size: 13px;
}

@media (max-width: 900px) {
  .central-page {
    padding: 18px;
  }

  .central-shell {
    max-width: 560px;
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .central-brand {
    display: none;
  }

  .central-content {
    min-height: 620px;
    padding: 34px 26px;
  }

  .mobile-brand {
    display: grid;
    justify-items: center;
    gap: 8px;
    margin-bottom: 24px;
  }

  .mobile-brand img {
    width: 220px;
    max-width: 100%;
  }

  .mobile-brand strong {
    color: var(--central-blue-dark);
    font-size: 15px;
  }
}

@media (max-width: 560px) {
  .central-page {
    padding: 0;
  }

  .central-shell {
    min-height: 100vh;
    border-radius: 0;
  }

  .central-content {
    min-height: 100vh;
    padding: 28px 20px;
  }

  .portal-header {
    flex-direction: column;
  }

  .logout-button {
    align-self: flex-end;
  }

  .portal-card {
    grid-template-columns: 44px 1fr;
  }

  .portal-icon {
    width: 44px;
    height: 44px;
  }

  .portal-role {
    grid-column: 2;
    justify-self: start;
  }
}
