/* Identidad visual de Nodia para las pantallas de acceso (login y selección de sucursal). */
  .nodia-login {
    display: grid;
    grid-template-columns: minmax(0, 57fr) minmax(0, 43fr);
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--nd-text);
    font-size: 16px;
  }

  .nodia-login *,
  .nodia-login *::before,
  .nodia-login *::after { box-sizing: border-box; }

  .nodia-identity {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    padding: clamp(30px, 4vw, 64px);
    background:
      radial-gradient(ellipse at 94% 64%, rgba(8, 127, 140, .28), transparent 49%),
      linear-gradient(150deg, var(--nd-blue) 0%, var(--nd-blue-deep) 78%);
    color: #fff;
  }

  .nodia-identity > :not(.nodia-identity-art) { position: relative; z-index: 1; }

  .nodia-identity-art {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .nodia-network {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: .5;
    animation: nodia-drift 20s ease-in-out infinite alternate;
    /* las conexiones se atenúan donde van el título y la descripción */
    -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.35) 20%, rgba(0,0,0,.08) 34%, rgba(0,0,0,.08) 56%, #000 74%);
            mask-image: linear-gradient(180deg, #000 0%, rgba(0,0,0,.35) 20%, rgba(0,0,0,.08) 34%, rgba(0,0,0,.08) 56%, #000 74%);
  }

  /* Símbolo de fondo: se recorta del logo oficial con una máscara y se tiñe de azul→turquesa. */
  .nodia-ghost {
    position: absolute;
    left: 55%;
    bottom: -13%;
    width: 74%;
    aspect-ratio: 540 / 495;
    transform: translateX(-50%);
    background: linear-gradient(145deg, var(--nd-teal-light) 0%, #1596A8 45%, #1F5C86 100%);
    opacity: .13;
    -webkit-mask-image: url("../img/nodia-wordmark.2a45335cf7e7.webp");
            mask-image: url("../img/nodia-wordmark.2a45335cf7e7.webp");
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
    -webkit-mask-size: 402.2% auto;
            mask-size: 402.2% auto;
    -webkit-mask-position: 8.58% 47.2%;
            mask-position: 8.58% 47.2%;
  }

  .nodia-brand {
    display: block;
    width: fit-content;
    max-width: 100%;
  }

  .nodia-brand img {
    display: block;
    width: min(300px, 100%);
    height: auto;
    filter: brightness(0) invert(1);
  }

  .nodia-identity-copy { max-width: none; padding: clamp(40px, 6vh, 76px) 0 clamp(96px, 16vh, 150px); }

  .nodia-identity-copy h1 {
    margin: 0 0 22px;
    color: #fff;
    font-size: clamp(34px, 3.2vw, 56px);
    font-weight: 700;
    line-height: 1.14;
  }

  .nodia-identity-copy h1 .nodia-line { display: block; }

  .nodia-identity-copy p {
    max-width: 560px;
    margin: 0;
    color: rgba(255, 255, 255, .86);
    font-size: clamp(17px, 1.3vw, 19px);
    line-height: 1.55;
  }

  .nodia-identity-foot {
    color: #C6DCE9;
    font-size: 13px;
    font-weight: 600;
  }

  .nodia-access {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 36px clamp(20px, 3.5vw, 68px);
    background: var(--nd-bg);
  }

  .nodia-card {
    width: min(460px, 100%);
    padding: clamp(28px, 3vw, 40px);
    border: 1px solid #E8EEF4;
    border-radius: 22px;
    background: var(--nd-surface);
    box-shadow: 0 18px 46px rgba(16, 38, 61, .07), 0 2px 8px rgba(16, 38, 61, .03);
    animation: nodia-card-in .38s ease-out both;
  }

  .nodia-card-head { text-align: center; margin-bottom: 30px; }

  .nodia-card-symbol {
    display: block;
    width: 72px;
    height: 68px;
    margin: 0 auto 12px;
    overflow: hidden;
    background-image: url("../img/nodia-wordmark.2a45335cf7e7.webp");
    background-repeat: no-repeat;
    background-size: 270px auto;
    background-position: -14px -10px;
  }

  .nodia-card h2 {
    margin: 0 0 7px;
    color: var(--nd-blue-deep);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
  }

  .nodia-card-intro {
    margin: 0;
    color: var(--nd-muted);
    font-size: 14px;
    line-height: 1.5;
  }

  .nodia-feedback:empty { display: none; }

  .nodia-feedback .login-errors,
  body.is-nodia-login .toast-stack .toast {
    width: 100%;
    margin: 0 0 20px;
    padding: 12px 14px;
    border: 1px solid #F7C9C5;
    border-radius: 10px;
    background: #FFF4F2;
    color: var(--nd-error);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
  }

  .nodia-feedback .login-errors p { margin: 0 0 5px; }
  .nodia-feedback .login-errors p:last-child { margin-bottom: 0; }

  body.is-nodia-login .toast-stack {
    position: static;
    display: block;
    width: 100%;
    margin: 0;
  }

  body.is-nodia-login .toast-stack .toast.success,
  body.is-nodia-login .toast-stack .toast.info {
    border-color: #B9E6DC;
    background: #EFFAF6;
    color: #075747;
  }

  .nodia-field { margin-bottom: 19px; }

  .nodia-field label {
    display: block;
    margin: 0 0 8px;
    color: var(--nd-blue-deep);
    font-size: 14px;
    font-weight: 700;
  }

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

  .nodia-input-icon {
    position: absolute;
    top: 50%;
    left: 15px;
    width: 19px;
    height: 19px;
    transform: translateY(-50%);
    color: #75869A;
    pointer-events: none;
  }

  .nodia-login .nodia-input-wrap input {
    display: block;
    width: 100%;
    height: 50px;
    margin: 0;
    padding: 0 16px 0 46px;
    border: 1px solid var(--nd-border);
    border-radius: 11px;
    background: #fff;
    color: var(--nd-text);
    font: inherit;
    font-size: 16px;
    transition: border-color .18s ease, box-shadow .18s ease;
  }

  .nodia-login .nodia-password-wrap input { padding-right: 54px; }

  .nodia-login .nodia-input-wrap input::placeholder { color: #8997A8; }

  .nodia-login .nodia-input-wrap input:focus {
    outline: none;
    border-color: var(--nd-teal);
    box-shadow: 0 0 0 3px rgba(8, 127, 140, .17);
  }

  .nodia-login .nodia-input-wrap input[aria-invalid="true"] { border-color: var(--nd-error); }

  .nodia-login .nodia-password-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #627387;
    cursor: pointer;
  }

  .nodia-password-toggle:hover { background: #F0F5F8; color: var(--nd-blue); }
  .nodia-password-toggle svg { width: 19px; height: 19px; }
  .nodia-password-toggle .icon-eye-off { display: none; }
  .nodia-password-toggle[aria-pressed="true"] .icon-eye { display: none; }
  .nodia-password-toggle[aria-pressed="true"] .icon-eye-off { display: block; }

  .nodia-login .nodia-password-toggle:focus-visible,
  .nodia-login .nodia-submit:focus-visible {
    outline: 3px solid rgba(8, 127, 140, .38);
    outline-offset: 2px;
  }

  .nodia-field-errors {
    margin: 7px 0 0;
    padding: 0;
    list-style: none;
    color: var(--nd-error);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
  }

  .nodia-login .nodia-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 50px;
    margin: 8px 0 0;
    padding: 12px 18px;
    border: 0;
    border-radius: 11px;
    background: var(--nd-teal);
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .18s ease, box-shadow .18s ease;
  }

  .nodia-login .nodia-submit:hover { background: #066A75; box-shadow: 0 7px 18px rgba(8, 127, 140, .16); }
  .nodia-login .nodia-submit:disabled { cursor: progress; opacity: .86; }

  .nodia-submit-spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, .55);
    border-top-color: #fff;
    border-radius: 50%;
    animation: nodia-spin .7s linear infinite;
  }

  .nodia-submit.is-submitting .nodia-submit-spinner { display: block; }

  .nodia-authorized {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 26px;
    padding-top: 22px;
    border-top: 1px solid #E8EEF4;
    color: var(--nd-muted);
    font-size: 12px;
    font-weight: 600;
  }

  .nodia-authorized svg { width: 16px; height: 16px; }

  .nodia-technology {
    margin: 22px 0 0;
    color: var(--nd-muted);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
  }

  body.is-nodia-login .auth-loader { display: none; }

  @keyframes nodia-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  @keyframes nodia-drift {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-14px, 10px, 0); }
  }

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

  @media (max-width: 860px) {
    .nodia-login { display: block; }
    .nodia-identity {
      min-height: 0;
      padding: 16px 22px;
      overflow: visible;
    }
    .nodia-brand img { width: 190px; }
    .nodia-identity-art,
    .nodia-identity-copy,
    .nodia-identity-foot { display: none; }
    .nodia-access {
      min-height: calc(100vh - 84px);
      min-height: calc(100dvh - 84px);
      justify-content: flex-start;
      padding: 28px 18px 32px;
    }
    .nodia-card { margin: auto 0; }
  }

  @media (max-width: 480px) {
    .nodia-card { padding: 28px 24px; border-radius: 20px; }
    .nodia-card-head { margin-bottom: 26px; }
    .nodia-card h2 { font-size: 26px; }
  }


  /* Destellos tipo estrella en los nodos, a destiempo y al azar (ver script en login/select_branch). */
  .nd-spark, .nd-dot { transform-box: fill-box; transform-origin: center; }
  .nd-spark { opacity: 0; }
  @keyframes nd-twinkle {
    0%, 50% { opacity: 0; transform: scale(.2); }
    62% { opacity: 1; transform: scale(1.15); }
    74% { opacity: .35; transform: scale(.8); }
    88%, 100% { opacity: 0; transform: scale(.4); }
  }
  @keyframes nd-glow {
    0%, 55%, 100% { transform: scale(1); filter: none; }
    66% { transform: scale(1.9); filter: drop-shadow(0 0 4px #7CF3F7); }
  }

  @media (prefers-reduced-motion: reduce) {
    .nodia-login *, .nodia-login *::before, .nodia-login *::after {
      animation-duration: .01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .01ms !important;
    }
  }

/* ── Selección de sucursal ─────────────────────────────────────────────────────────────────── */
.nodia-hello {
  margin: 0 0 10px;
  color: var(--nd-teal-light);
  font-size: clamp(20px, 1.9vw, 28px);
  font-weight: 650;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.nodia-identity-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #E6F0F7;
  font-size: 14px;
  font-weight: 600;
}

.nodia-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .02em;
}

.nodia-identity-user span:last-child { min-width: 0; overflow-wrap: anywhere; }

.nodia-branch-card { width: min(520px, 100%); }

.nodia-branch-label {
  display: block;
  margin: 0 0 10px;
  color: var(--nd-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nodia-branch-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 12px;
}

.nodia-branch-sep::before,
.nodia-branch-sep::after { content: ""; flex: 1; height: 1px; background: #E8EEF4; }
.nodia-branch-sep .nodia-branch-label { margin: 0; }

.nodia-branch-form { margin: 0; }

.nodia-branch-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #E6F5F6;
  color: var(--nd-teal);
}

.nodia-branch-icon svg { width: 22px; height: 22px; }

.nodia-branch-name { display: block; color: var(--nd-blue-deep); font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.nodia-branch-sub { display: block; margin-top: 3px; color: var(--nd-muted); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }

.nodia-branch-featured {
  padding: 16px;
  border: 1px solid #B5E3E6;
  border-radius: 14px;
  background: #EAF8F9;
}

.nodia-branch-featured-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.nodia-branch-featured .nodia-branch-icon { background: #fff; }

.nodia-login .nodia-branch-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  border: 0;
  border-radius: 11px;
  background: var(--nd-teal);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .18s ease, box-shadow .18s ease;
}

.nodia-login .nodia-branch-go:hover { background: #066A75; box-shadow: 0 7px 18px rgba(8, 127, 140, .16); }
.nodia-branch-go svg { width: 18px; height: 18px; }

.nodia-branch-list { display: grid; gap: 10px; }

.nodia-login .nodia-branch-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--nd-border);
  border-radius: 12px;
  background: #fff;
  color: var(--nd-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}

.nodia-login .nodia-branch-row:hover { background: #F1FAFA; border-color: #9FD6DA; }
.nodia-login .nodia-branch-row:active { background: #E6F5F6; }
.nodia-branch-row > span:nth-child(2) { flex: 1; min-width: 0; }
.nodia-branch-arrow { flex: none; width: 18px; height: 18px; color: #8997A8; }

.nodia-login .nodia-branch-row:focus-visible,
.nodia-login .nodia-branch-go:focus-visible,
.nodia-login .nodia-logout:focus-visible {
  outline: 3px solid rgba(8, 127, 140, .45);
  outline-offset: 2px;
}

.nodia-branch-form.is-submitting .nodia-branch-row,
.nodia-branch-form.is-submitting .nodia-branch-go { cursor: progress; opacity: .85; }
.nodia-branch-form.is-submitting .nodia-branch-arrow { display: none; }
.nodia-branch-form.is-submitting .nodia-branch-row::after,
.nodia-branch-form.is-submitting .nodia-branch-go::after {
  content: "";
  flex: none;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(8, 127, 140, .35);
  border-top-color: var(--nd-teal);
  border-radius: 50%;
  animation: nodia-spin .7s linear infinite;
}
.nodia-branch-form.is-submitting .nodia-branch-go::after { border-color: rgba(255, 255, 255, .5); border-top-color: #fff; }

.nodia-branch-empty { margin: 0; padding: 18px; border: 1px dashed var(--nd-border); border-radius: 12px; text-align: center; }
.nodia-branch-empty strong { display: block; color: var(--nd-blue-deep); margin-bottom: 4px; }
.nodia-branch-empty span { color: var(--nd-muted); font-size: 14px; }

.nodia-logout-form { display: flex; justify-content: center; margin: 22px 0 0; }

.nodia-login .nodia-logout {
  display: inline-flex;
  width: auto;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--nd-teal);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.nodia-login .nodia-logout:hover { background: #E6F5F6; }
.nodia-logout svg { width: 17px; height: 17px; }

.nodia-branch-scroll-pad { padding-block: 32px; }

@media (max-width: 860px) {
  .nodia-identity.is-branch { padding: 16px 22px 20px; }
  .nodia-identity.is-branch .nodia-identity-copy { display: block; padding: 10px 0 0; }
  .nodia-identity.is-branch .nodia-identity-copy h1 { margin: 0; font-size: 24px; }
  .nodia-identity.is-branch .nodia-identity-copy h1 .nodia-line { display: inline; }
  .nodia-identity.is-branch .nodia-identity-copy p:not(.nodia-hello) { display: none; }
  .nodia-identity.is-branch .nodia-hello { margin: 0 0 4px; font-size: 16px; }
  .nodia-identity.is-branch .nodia-identity-user { display: none; }
  .nodia-identity.is-branch ~ .nodia-access { min-height: 0; }
}

/* Pantallas bajas (portátiles): la selección de sucursal se compacta para evitar el desplazamiento */
@media (min-width: 861px) and (max-height: 860px) {
  .nodia-branch-scroll-pad { padding-block: 12px; }
  .nodia-branch-card { padding: 22px 28px; }
  .nodia-branch-card .nodia-card-head { margin-bottom: 14px; }
  .nodia-branch-card .nodia-card-symbol { height: 52px; margin-bottom: 6px; background-size: 205px auto; background-position: -11px -8px; width: 56px; }
  .nodia-branch-card h2 { font-size: 24px; }
  .nodia-branch-sep { margin: 14px 0 8px; }
  .nodia-branch-featured { padding: 12px; }
  .nodia-branch-featured-head { margin-bottom: 10px; }
  .nodia-branch-icon { width: 38px; height: 38px; }
  .nodia-login .nodia-branch-row { min-height: 60px; padding: 8px 14px; }
  .nodia-branch-list { gap: 8px; }
  .nodia-logout-form { margin-top: 10px; }
  .nodia-branch-card ~ .nodia-technology { margin-top: 12px; }
}
