/* =====================================================================
   login.css — Pantalla de acceso multiempresa (línea auth-carbon)
   Carga junto a tokens.css + base.css. Autocontenida.
   ===================================================================== */
body { overflow: hidden; }

/* ---------------- Layout dos columnas ---------------- */
.screen-login { position: fixed; inset: 0; display: grid; grid-template-columns: 1fr 1fr; background: var(--background); z-index: 10; }

/* `flex-end` y no `space-between`: el texto va abajo, que es donde estaba. El
   `space-between` lo repartia entre dos hijos -la marca arriba y el texto
   abajo-, asi que al quitar la marca el texto se quedo solo y subio al hueco
   que dejo. No es una decision nueva de composicion, es la de siempre escrita
   sin depender de un elemento que ya no existe. */
.login-brand { background: var(--cds-gray-100); color: #fff; display: flex; flex-direction: column; justify-content: flex-end;
  padding: var(--sp-09); position: relative; overflow: hidden; }
.login-brand::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 48px 48px; }
.brand-copy { z-index: 1; max-width: 27rem; }
.brand-copy h1 { font-size: var(--type-size-09); font-weight: var(--type-weight-light); line-height: 1.2; margin-bottom: var(--sp-05); }
.brand-copy h1 strong { font-weight: var(--type-weight-semibold); color: var(--cds-blue-40); }
.brand-copy p { color: var(--cds-gray-40); font-size: var(--type-size-03); line-height: 1.55; }
/* Los rotulos son texto, no cifras de un digito: a 1.75rem los tres no entran
   en la columna y "Por plan" se parte en dos lineas. */
.brand-stats { display: flex; gap: var(--sp-06); margin-top: var(--sp-07); z-index: 1; flex-wrap: wrap; }
.brand-stats div { flex: 1 1 0; min-width: 8rem; }
.brand-stats div b { display: block; font-size: var(--type-size-04); font-weight: var(--type-weight-regular); color: #fff; white-space: nowrap; }
.brand-stats div span { display: block; margin-top: var(--sp-02); font-size: var(--type-size-01); line-height: 1.4; color: var(--cds-gray-50); }
.brand-foot { z-index: 1; color: var(--cds-gray-60); font-size: var(--type-size-01); }

.login-form-col { display: flex; align-items: center; justify-content: center; padding: var(--sp-07); overflow-y: auto; background: var(--background); }
.login-card { width: 100%; max-width: 25rem; }
.login-card .eyebrow { font-size: var(--type-size-01); letter-spacing: .32px; color: var(--text-secondary); margin-bottom: var(--sp-03); }
.login-card h2 { font-size: var(--type-size-07); font-weight: var(--type-weight-regular); margin-bottom: var(--sp-02); color: var(--text-primary); }
.login-card .sub { color: var(--text-secondary); margin-bottom: var(--sp-07); font-size: var(--type-size-02); }

/* ---------------- Campos ---------------- */
.lg-field { margin-bottom: var(--sp-06); }
.lg-field label { display: block; font-size: var(--type-size-01); color: var(--text-secondary); letter-spacing: .32px; margin-bottom: var(--sp-03); }
.lg-input-wrap { position: relative; }
.lg-input { width: 100%; height: 2.5rem; border: none; outline: 2px solid transparent; outline-offset: -2px;
  background: var(--field-01); border-bottom: 1px solid var(--border-strong); padding: 0 var(--sp-05);
  font-family: inherit; font-size: var(--type-size-02); color: var(--text-primary); transition: outline-color .11s var(--ease); }
.lg-input::placeholder { color: var(--text-placeholder); }
.lg-input:focus { outline-color: var(--brand); }
.lg-field.invalid .lg-input { outline-color: var(--support-error); }
.lg-field .helper-error { display: none; font-size: var(--type-size-01); color: var(--support-error); margin-top: var(--sp-02); }
.lg-field.invalid .helper-error { display: block; }
.pw-toggle { position: absolute; right: 0; top: 0; height: 2.5rem; width: 2.5rem; display: grid; place-items: center; color: var(--text-secondary); background: transparent; border: none; }
.pw-toggle:hover { background: var(--layer-hover); }
.pw-toggle svg { width: 16px; height: 16px; }

/* ---------------- Botón primario Carbon ---------------- */
.lg-btn { display: inline-flex; align-items: center; justify-content: space-between; min-height: 3rem; padding: 0 var(--sp-05); width: 100%;
  background: var(--button-primary); color: #fff; font-size: var(--type-size-02); text-align: left; letter-spacing: .16px; border: none;
  transition: background .11s var(--ease); }
.lg-btn:hover { background: var(--button-primary-hover); }
.lg-btn:active { background: var(--button-primary-active); }
.lg-btn[disabled] { background: var(--text-disabled); color: #fff; cursor: not-allowed; }
.lg-btn svg { flex: none; margin-left: var(--sp-07); width: 16px; height: 16px; }
.lg-btn .btn-spinner { display: none; }
.lg-btn.loading .btn-spinner { display: block; }
.lg-btn.loading .btn-arrow { display: none; }

/* ---------------- Notificación inline ---------------- */
.inline-notif { display: none; align-items: flex-start; gap: var(--sp-04); background: var(--cds-red-10, #fff1f1);
  border-left: 3px solid var(--support-error); border-top: 1px solid #ffd7d9; border-right: 1px solid #ffd7d9; border-bottom: 1px solid #ffd7d9;
  padding: var(--sp-04) var(--sp-05); margin-bottom: var(--sp-06); }
[data-theme="dark"] .inline-notif { background: rgba(218,30,40,.14); border-color: rgba(218,30,40,.4); }
.inline-notif.show { display: flex; }
.inline-notif svg { flex: none; margin-top: 1px; color: var(--support-error); width: 18px; height: 18px; }
.inline-notif b { display: block; font-weight: var(--type-weight-semibold); font-size: var(--type-size-02); }
.inline-notif span { font-size: var(--type-size-02); color: var(--text-secondary); }

/* ---------------- Modal selección de empresa ---------------- */
.company-modal { position: fixed; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; }
.company-modal.open { display: flex; }
.modal-ovl { position: absolute; inset: 0; background: var(--overlay); }
.modal-card { position: relative; background: var(--layer-02); width: min(40rem, calc(100% - 2rem)); max-height: calc(100vh - 4rem);
  display: flex; flex-direction: column; box-shadow: var(--shadow-md); }
.modal-head { padding: var(--sp-05) var(--sp-05) var(--sp-03); display: flex; justify-content: space-between; align-items: flex-start; }
.modal-head .mh-label { font-size: var(--type-size-01); color: var(--text-secondary); margin-bottom: var(--sp-02); }
.modal-head h3 { font-size: var(--type-size-05); font-weight: var(--type-weight-regular); color: var(--text-primary); }
.modal-x { width: 3rem; height: 3rem; display: grid; place-items: center; margin: -1rem -1rem 0 0; color: var(--icon-primary); background: transparent; border: none; }
.modal-x:hover { background: var(--layer-hover); }
.modal-bd { padding: var(--sp-03) var(--sp-05) var(--sp-06); overflow-y: auto; }
.company-option { display: flex; align-items: center; gap: var(--sp-05); width: 100%; text-align: left; padding: var(--sp-05);
  border: 1px solid var(--border-subtle); margin-bottom: var(--sp-03); background: var(--layer-02); transition: border-color .11s, background .11s; }
.company-option:hover { background: var(--layer-01); border-color: var(--border-strong); }
.company-option .co-logo { width: 48px; height: 48px; flex: none; display: grid; place-items: center; color: #fff; font-weight: var(--type-weight-bold); font-size: var(--type-size-03); }
.company-option .co-info { flex: 1; min-width: 0; }
.company-option .co-info b { display: block; font-weight: var(--type-weight-semibold); font-size: var(--type-size-03); margin-bottom: 2px; color: var(--text-primary); }
.company-option .co-info span { font-size: var(--type-size-02); color: var(--text-secondary); }
.company-option .co-meta { font-size: var(--type-size-01); color: var(--text-helper); white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.company-option .co-role { color: #fff; padding: 0 var(--sp-03); line-height: 1.25rem; border-radius: .75rem; font-size: var(--type-size-01); }
.company-option .co-arrow { color: var(--brand); flex: none; width: 16px; height: 16px; }

/* ---------------- Loader ---------------- */
.loader { position: fixed; inset: 0; background: var(--cds-gray-100); z-index: 50; display: none; align-items: center; justify-content: center; color: #fff; }
.loader.open { display: flex; }
.loader-inner { text-align: center; }
.loader-logo { width: 64px; height: 64px; margin: 0 auto var(--sp-05); display: grid; place-items: center; font-size: var(--type-size-06); font-weight: var(--type-weight-bold); color: #fff; }
.loader-name { font-size: var(--type-size-04); font-weight: var(--type-weight-regular); margin-bottom: var(--sp-02); }
.loader-sub { font-size: var(--type-size-02); color: var(--cds-gray-50); margin-bottom: var(--sp-06); }
.loader-bar { width: 14rem; height: 2px; background: var(--cds-gray-80); margin: 0 auto; overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 100%; background: var(--cds-blue-40); transform: scaleX(0); transform-origin: left; }

/* ---------------- Spinner ---------------- */
.lg-spinner { animation: lg-spin .69s linear infinite; }
@keyframes lg-spin { to { transform: rotate(360deg); } }
.lg-spinner circle { stroke: currentColor; stroke-dasharray: 60; stroke-dashoffset: 20; fill: none; stroke-width: 3; }

/* ---------------- Responsive ---------------- */
@media (max-width: 880px) {
  .screen-login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}
@media (prefers-reduced-motion: reduce) { .lg-spinner { animation-duration: 1.5s; } }


/* ---------------- Ico en el acceso ----------------
   Ico va al costado del encabezado y entra con sus tres lineas. Se apoya en
   la linea del subtitulo: alineado arriba quedaba flotando sobre el bloque.
   El margen inferior lo lleva .login-head, ya no la .sub. */
.login-head { display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--sp-05); margin-bottom: var(--sp-07); }
.login-head-txt { min-width: 0; }
.login-head-txt .sub { margin-bottom: 0; }
/* El riel se queda solo con los rombos: aqui ninguna fila lleva un valor
   detras, asi que la barra seria un contenedor vacio. */
.login-head .ico__barra { display: none; }

/* validation.css pinta su icono de error como fondo del input en
   "right 12px", justo debajo del ojo de ver contrasena, que es un boton
   absoluto de 40px pegado a la derecha; y su "padding-right: 36px !important"
   se come el hueco que el campo reservaba para ese boton. Aqui el icono se
   corre a la izquierda del ojo y el padding deja sitio a los dos. */
#field-pass input.fv-invalid { background-position: right 46px center; padding-right: 68px !important; }

/* En pantallas estrechas Ico le devuelve el ancho al titulo: baja a sm y
   suelta el riel. Con los 87px del riel puesto, a 320px la tarjeta deja 153px
   de texto y "Iniciar sesion" se parte en dos lineas. */
@media (max-width: 480px) {
  .login-head .ico { --ico-esc: .5; }
  .login-head .ico__riel { display: none; }
}
