/* Estilos del cascarón HTML (overlay de login, barra de usuario, contenedor).
   Viven aquí y no en atributos style="..." ni en un <style> embebido para que
   la CSP pueda cerrarse con `style-src 'self'`, sin 'unsafe-inline'.

   Los estilos de la app React siguen en el objeto `s` de app.jsx: React los
   aplica por CSSOM (element.style.x = y), que la CSP no intercepta. */

:root {
  --verde:        #6BBF1A;
  --verde-grad:   linear-gradient(135deg, #8DC63F, #4E8A10);
  --tinta:        #0F172A;
  --gris-texto:   #64748B;
  --gris-borde:   #E2E8F0;
  --fondo:        #F2F4F0;
  --tipo: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* Usados por el spinner y la barra de progreso de app.jsx */
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes progress { from { width: 0%; } to { width: 100%; } }

body {
  margin: 0;
  background: var(--fondo);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 32px 16px;
  font-family: var(--tipo);
}

#root {
  width: 100%;
  max-width: 760px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, .08);
  border-top: 4px solid var(--verde);
  padding: 8px;
}

/* Oculto hasta que MSAL resuelve la sesión. msal-init.js pone display:"block"
   explícitamente — nunca "" , que devolvería el elemento a este display:none. */
#root,
#login-overlay,
#user-bar { display: none; }

/* ── Overlay de login ───────────────────────────────────────────── */
#login-overlay {
  position: fixed;
  inset: 0;
  background: var(--fondo);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  font-family: var(--tipo);
}

.login-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .12);
  border-top: 4px solid var(--verde);
  padding: 48px 40px;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

.login-logo { height: 44px; width: auto; margin-bottom: 28px; }

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--tinta);
  margin: 0 0 8px;
}

.login-text {
  font-size: 14px;
  color: var(--gris-texto);
  margin: 0 0 32px;
  line-height: 1.6;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--verde-grad);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-family: var(--tipo);
  box-shadow: 0 4px 14px rgba(78, 138, 16, .3);
}

.login-note {
  font-size: 11px;
  color: #94A3B8;
  margin: 20px 0 0;
}

/* Mensaje de fallo de carga de MSAL (lo rellena msal-init.js) */
.boot-error { font-family: var(--tipo); text-align: center; padding: 40px; }
.boot-error h3 { color: var(--tinta); margin: 0 0 8px; }
.boot-error p  { color: var(--gris-texto); margin: 0 0 20px; }
.boot-error button {
  padding: 12px 24px;
  background: var(--verde);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--tipo);
  font-size: 14px;
  font-weight: 600;
}

/* ── Barra de usuario ───────────────────────────────────────────── */
#user-bar {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1000;
  background: #fff;
  border: 1px solid var(--gris-borde);
  border-radius: 40px;
  padding: 6px 12px 6px 8px;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
  font-family: var(--tipo);
}

#user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--verde-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-meta { line-height: 1.2; }
#user-name  { font-size: 12px; font-weight: 600; color: #1E293B; }
#user-email { font-size: 10px; color: #94A3B8; }

/* El hover era onmouseover/onmouseout inline; ahora es CSS de verdad. */
.logout-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #94A3B8;
  display: flex;
  align-items: center;
  border-radius: 50%;
  transition: background .15s;
}
.logout-btn:hover,
.logout-btn:focus-visible { background: #F1F5F9; }
