*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #060910;
  --panel:     #0d1320;
  --border:    rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.14);
  --coord:     #f59e0b;
  --coord-dim: rgba(245,158,11,0.12);
  --insp:      #06b6d4;
  --insp-dim:  rgba(6,182,212,0.12);
  --text:      #f1f5f9;
  --muted:     #475569;
  --muted2:    #64748b;
}

body {
  font-family: 'Cabinet Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.bg-grid {
  position: fixed; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: gridShift 30s linear infinite;
}
@keyframes gridShift {
  0%   { background-position: 0 0; }
  100% { background-position: 48px 48px; }
}

.orb {
  position: fixed; border-radius: 50%;
  filter: blur(120px); pointer-events: none;
  animation: orbFloat 12s ease-in-out infinite;
}
.orb-1 { width: 600px; height: 600px; background: rgba(245,158,11,0.08); top: -200px; left: -200px; animation-delay: 0s; }
.orb-2 { width: 500px; height: 500px; background: rgba(6,182,212,0.07); bottom: -150px; right: -150px; animation-delay: -6s; }
.orb-3 { width: 300px; height: 300px; background: rgba(99,102,241,0.05); top: 50%; left: 50%; transform: translate(-50%,-50%); animation-delay: -3s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  33%       { transform: translate(40px,-30px) scale(1.08); }
  66%       { transform: translate(-20px,20px) scale(0.95); }
}

.card {
  position: relative; z-index: 10;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px 44px;
  width: 100%; max-width: 460px;
  box-shadow: 0 40px 80px rgba(0,0,0,0.6);
  animation: cardReveal 0.7s cubic-bezier(0.16,1,0.3,1) both;
  transition: box-shadow 0.4s;
}
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(32px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.card::before {
  content: '';
  position: absolute; top: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245,158,11,0.5), rgba(6,182,212,0.5), transparent);
  border-radius: 1px;
  transition: background 0.4s;
}

body.rol-coord .card { box-shadow: 0 40px 80px rgba(0,0,0,0.6), 0 0 120px rgba(245,158,11,0.07); }
body.rol-insp  .card { box-shadow: 0 40px 80px rgba(0,0,0,0.6), 0 0 120px rgba(6,182,212,0.07); }
body.rol-coord .card::before { background: linear-gradient(90deg, transparent, rgba(245,158,11,0.6), transparent); }
body.rol-insp  .card::before { background: linear-gradient(90deg, transparent, rgba(6,182,212,0.6), transparent); }

.logo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 40px; }
.logo-mark {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 8px 24px rgba(245,158,11,0.35), 0 0 0 1px rgba(245,158,11,0.2);
  flex-shrink: 0;
}
.logo-text-block { display: flex; flex-direction: column; }
.logo-name { font-family: 'Clash Display', sans-serif; font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.1; }
.logo-sub  { font-size: 11px; color: var(--muted2); letter-spacing: 1.8px; text-transform: uppercase; margin-top: 2px; }

h1 { font-family: 'Clash Display', sans-serif; font-size: 30px; font-weight: 600; letter-spacing: -0.5px; margin-bottom: 6px; }
.subtitle { font-size: 14px; color: var(--muted2); margin-bottom: 32px; }

.role-label { font-size: 11px; font-weight: 500; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

.role-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 28px; }

.role-btn {
  position: relative;
  padding: 14px 12px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
  display: flex; flex-direction: column;
  align-items: center; gap: 7px;
  overflow: hidden;
  /* CRÍTICO: evita que el reset global aplique width:100% */
  width: auto;
}
.role-btn::before {
  content: ''; position: absolute; inset: 0; opacity: 0; transition: opacity 0.25s;
}
.role-btn.coord::before { background: var(--coord-dim); }
.role-btn.insp::before  { background: var(--insp-dim); }
.role-btn:hover { border-color: var(--border-hover); }
.role-btn:hover::before { opacity: 1; }
.role-btn.active.coord { border-color: var(--coord); box-shadow: 0 0 0 1px rgba(245,158,11,0.15), 0 8px 24px rgba(245,158,11,0.15); }
.role-btn.active.coord::before { opacity: 1; }
.role-btn.active.insp  { border-color: var(--insp); box-shadow: 0 0 0 1px rgba(6,182,212,0.15), 0 8px 24px rgba(6,182,212,0.15); }
.role-btn.active.insp::before  { opacity: 1; }

.role-icon { font-size: 26px; line-height: 1; position: relative; z-index: 1; transition: transform 0.25s cubic-bezier(0.16,1,0.3,1); }
.role-btn:hover .role-icon,
.role-btn.active .role-icon { transform: scale(1.15); }

.role-name { font-family: 'Clash Display', sans-serif; font-size: 13px; font-weight: 600; position: relative; z-index: 1; transition: color 0.2s; color: var(--muted2); }
.role-btn.active.coord .role-name { color: var(--coord); }
.role-btn.active.insp  .role-name { color: var(--insp); }

.role-check {
  position: absolute; top: 10px; right: 10px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; opacity: 0; transform: scale(0);
  transition: all 0.2s cubic-bezier(0.16,1,0.3,1);
}
.role-btn.active.coord .role-check { background: var(--coord); color: #000; opacity: 1; transform: scale(1); }
.role-btn.active.insp  .role-check { background: var(--insp);  color: #000; opacity: 1; transform: scale(1); }

.field { margin-bottom: 18px; }
.field-label { font-size: 11px; font-weight: 500; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: block; }

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrap > svg {
  position: absolute; left: 14px;
  width: 15px; height: 15px;
  color: var(--muted); pointer-events: none;
  transition: color 0.2s;
  /* CRÍTICO: z-index para que no tape el input */
  z-index: 1;
}

.field-input {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 13px 46px 13px 42px; /* derecha: espacio para el botón */
  font-family: 'Cabinet Grotesk', sans-serif;
  font-size: 15px; color: var(--text);
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.field-input::placeholder { color: var(--muted); opacity: 0.5; }
.field-input:focus { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.2); box-shadow: 0 0 0 3px rgba(255,255,255,0.04); }

body.rol-coord .field-input:focus { border-color: rgba(245,158,11,0.5); box-shadow: 0 0 0 3px rgba(245,158,11,0.08); }
body.rol-insp  .field-input:focus { border-color: rgba(6,182,212,0.5);  box-shadow: 0 0 0 3px rgba(6,182,212,0.08); }
body.rol-coord .input-wrap:focus-within > svg { color: var(--coord); }
body.rol-insp  .input-wrap:focus-within > svg { color: var(--insp); }

/* TOGGLE PASSWORD — el fix principal */
.toggle-pass {
  position: absolute;
  right: 0;
  top: 0; bottom: 0;
  width: 44px;          /* área de click generosa */
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  z-index: 2;           /* encima del input */
  border-radius: 0 12px 12px 0;
  transition: color 0.2s;
}
.toggle-pass:hover { color: var(--text); }
.toggle-pass svg { width: 15px; height: 15px; pointer-events: none; }

.btn-login {
  width: 100%; padding: 15px;
  border: none; border-radius: 12px;
  font-family: 'Clash Display', sans-serif;
  font-size: 15px; font-weight: 600; letter-spacing: 0.3px;
  cursor: pointer; margin-top: 6px;
  position: relative; overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16,1,0.3,1);
}
.btn-login::before { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(255,255,255,0.1), transparent); }
.btn-login.coord-btn { background: linear-gradient(135deg, #f59e0b, #d97706); color: #000; box-shadow: 0 6px 24px rgba(245,158,11,0.35); }
.btn-login.coord-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(245,158,11,0.5); }
.btn-login.insp-btn  { background: linear-gradient(135deg, #06b6d4, #0891b2); color: #000; box-shadow: 0 6px 24px rgba(6,182,212,0.35); }
.btn-login.insp-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 32px rgba(6,182,212,0.5); }
.btn-login:active:not(:disabled) { transform: translateY(0) scale(0.99); }
.btn-login:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-inner { display: flex; align-items: center; justify-content: center; gap: 8px; position: relative; z-index: 1; }

.alert {
  display: none; padding: 12px 16px; border-radius: 10px;
  font-size: 13px; margin-bottom: 18px;
  animation: alertIn 0.3s ease both;
  border: 1px solid rgba(239,68,68,0.3);
  background: rgba(239,68,68,0.08); color: #fca5a5;
}
@keyframes alertIn { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card-foot {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  gap: 8px; font-size: 11px; color: var(--muted); letter-spacing: 0.5px;
}
.foot-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }