:root {
  --bg: var(--ge-bg-primary);
  --card: var(--ge-bg-card);
  --border: var(--ge-border);
  --text: var(--ge-text-primary);
  --muted: var(--ge-text-secondary);
  --primary: var(--ge-violet-light);
  --gradient: var(--ge-gradient-brand);
  --error: var(--ge-error);
  --success: var(--ge-success);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.auth-body {
  min-height: 100vh; display: grid; place-items: center;
  font-family: var(--ge-font); font-feature-settings: 'ss01', 'cv11'; background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  padding: 2rem 1rem; position: relative;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 55% 45% at 15% 0%, rgba(192, 38, 211, 0.2), transparent 65%),
    radial-gradient(ellipse 50% 45% at 85% 100%, rgba(34, 211, 238, 0.14), transparent 65%),
    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: auto, auto, 56px 56px, 56px 56px;
}
.stars { position: fixed; inset: 0; background-image:
  radial-gradient(1px 1px at 20% 30%, rgba(192, 38, 211, 0.5), transparent),
  radial-gradient(1px 1px at 60% 70%, rgba(34, 211, 238, 0.4), transparent),
  radial-gradient(1px 1px at 80% 20%, rgba(255, 255, 255, 0.25), transparent),
  radial-gradient(1px 1px at 40% 80%, rgba(124, 58, 237, 0.35), transparent);
  background-size: 100% 100%; pointer-events: none; z-index: 0;
}

.auth-card {
  width: min(440px, 100%); padding: 2.25rem;
  background: linear-gradient(165deg, rgba(30, 30, 42, 0.88) 0%, rgba(18, 18, 26, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 22px;
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(168, 85, 247, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative; z-index: 1;
  animation: authIn .35s ease-out;
}
.auth-card::before {
  content: '';
  position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, rgba(192, 38, 211, 0.35), rgba(34, 211, 238, 0.2), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.auth-card-wide { width: min(540px, 100%); }

@keyframes authIn {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  margin-bottom: 1.5rem;
  padding: .5rem .25rem 0;
  overflow: visible;
  width: 100%;
}
.auth-brand img,
.auth-brand-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
}
.auth-brand--horizontal .auth-brand-logo--horizontal {
  width: min(100%, 280px);
  max-width: 280px;
  height: auto;
  aspect-ratio: 360 / 88;
}
.auth-brand--isotipo .auth-brand-logo--isotipo {
  width: 72px;
  height: 72px;
  max-width: 72px;
  max-height: 72px;
  padding: 4px;
}
.auth-brand span { font-size: .8rem; color: var(--muted); text-transform: lowercase; letter-spacing: -0.02em; }

.auth-card h1.auth-title, .auth-card h2 { font-family: var(--ge-font-display); text-align: center; font-size: 1.65rem; margin-bottom: .5rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
.auth-sub { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 1.5rem; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-form label { font-size: .85rem; color: var(--muted); display: flex; flex-direction: column; gap: .4rem; }
.auth-form label small { color: var(--ge-text-muted); font-weight: 400; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.input-icon { position: relative; }
.input-icon i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ge-violet-light); font-size: .85rem; pointer-events: none; z-index: 1;
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 8px; background: rgba(124, 58, 237, 0.12);
}
.input-icon input, .input-icon select {
  width: 100%; padding: .9rem 1rem .9rem 3rem; border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.04); color: var(--text);
  font: inherit; transition: border-color .15s, box-shadow .15s, background .15s;
  appearance: none;
}
.input-icon-password input {
  padding-right: 3.15rem;
}
.input-icon-password .password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ge-text-secondary);
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.15s;
}
.input-icon-password .password-toggle:hover {
  color: var(--ge-cyan-light);
  background: rgba(124, 58, 237, 0.18);
  border-color: rgba(168, 85, 247, 0.35);
}
.input-icon-password .password-toggle:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.55);
  outline-offset: 2px;
}
.input-icon-password .password-toggle.is-visible {
  color: var(--ge-cyan-light);
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.35);
}
.input-icon-password .password-toggle i {
  position: static;
  transform: none;
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
  font-size: 0.95rem;
  pointer-events: none;
}
.input-icon.focused {
  border-radius: 14px;
}
.input-icon select { padding-right: 2.5rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }
.input-icon input:focus, .input-icon select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.18); }

.hint { font-size: .75rem; color: var(--ge-cyan-light); margin-top: .15rem; display: flex; align-items: flex-start; gap: .35rem; line-height: 1.4; }
.hint i { margin-top: .15rem; flex-shrink: 0; }

.office-code-input {
  text-transform: uppercase;
  letter-spacing: .2em;
  font-weight: 700;
  font-family: var(--ge-font-display);
  text-align: center;
  padding-left: 3rem !important;
}
.office-code-input::placeholder { letter-spacing: .15em; font-weight: 600; opacity: .55; }
.auth-links { text-align: right; }
.auth-links a { color: var(--ge-cyan-light); font-size: .85rem; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

.checkbox-label { flex-direction: row !important; align-items: flex-start; gap: .65rem; font-size: .85rem; line-height: 1.45; color: var(--text); cursor: pointer; }
.checkbox-label input[type="checkbox"] { margin-top: .2rem; width: 16px; height: 16px; accent-color: var(--ge-violet); cursor: pointer; }
.checkbox-label a { color: var(--ge-cyan-light); text-decoration: none; }
.checkbox-label a:hover { text-decoration: underline; }

.btn-gradient { font-family: var(--ge-font-display); letter-spacing: -0.01em;
  width: 100%; padding: 1rem; border-radius: 14px;
  color: #fff; font-weight: 700; font-size: 1rem;
  cursor: pointer; margin-top: .5rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}

.auth-footer { text-align: center; margin-top: 1.5rem; font-size: .9rem; color: var(--muted); }
.auth-footer a { color: var(--ge-cyan-light); text-decoration: none; font-weight: 600; }
.auth-footer a:hover { text-decoration: underline; }

.alert { padding: .85rem 1rem; border-radius: var(--ge-radius-sm); font-size: .9rem; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }
.alert i { font-size: 1rem; flex-shrink: 0; }
.alert-error { background: rgba(239, 68, 68, .12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .3); }
.alert-success { background: rgba(34, 197, 94, .12); color: #86efac; border: 1px solid rgba(34, 197, 94, .3); }
.alert-info { background: rgba(34, 211, 238, .1); color: #67E8F9; border: 1px solid rgba(34, 211, 238, .25); }

.error-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 2rem 1rem; }
.error-card { text-align: center; padding: 2.5rem 2rem; background: var(--card); border-radius: var(--ge-radius-lg); border: 1px solid var(--border); max-width: 460px; }
.error-card h1 { font-family: var(--ge-font-display); font-size: 5rem; font-weight: 800; letter-spacing: -0.04em; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1; }
.error-card .auth-brand { margin-bottom: 1rem; }
.error-card h2 { font-family: var(--ge-font-display); margin: .5rem 0 .75rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; }
.error-card p { color: var(--muted); margin-bottom: 1.75rem; }
.error-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
.btn-secondary { padding: .75rem 1.5rem; border-radius: 14px; color: var(--text); cursor: pointer; text-decoration: none; }
.btn-primary { padding: .75rem 1.5rem; border-radius: 14px; color: #fff; text-decoration: none; cursor: pointer; }

/* Selector de país con banderas (legible en todos los sistemas) */
.country-picker {
  position: relative;
  width: 100%;
}
.country-picker-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #12121a;
  color: #f5f5f7;
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, box-shadow .15s;
}
.country-picker-trigger:hover,
.country-picker.is-open .country-picker-trigger {
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.16);
}
.country-picker-flag {
  width: 28px;
  height: 20px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.country-picker-flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.country-picker-emoji {
  font-size: 1.05rem;
  line-height: 1;
}
.country-picker-label {
  flex: 1;
  min-width: 0;
  font-size: .92rem;
  color: #f5f5f7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.country-picker-caret {
  color: #a1a1aa;
  font-size: .75rem;
  transition: transform .2s ease;
}
.country-picker.is-open .country-picker-caret {
  transform: rotate(180deg);
}
.country-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 40;
  margin: 0;
  padding: .4rem;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #16161f;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}
.country-picker-option {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem .75rem;
  border-radius: 10px;
  color: #f4f4f5;
  cursor: pointer;
  font-size: .9rem;
  transition: background .15s;
}
.country-picker-option:hover,
.country-picker-option:focus-visible {
  background: rgba(124, 58, 237, 0.22);
  outline: none;
}
.country-picker-option.is-selected {
  background: rgba(34, 211, 238, 0.12);
  color: #67e8f9;
}
.country-picker-option-flag {
  width: 26px;
  height: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.country-picker-option-flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Fallback si aún se usa <select> nativo en auth */
.input-icon select,
.auth-form select {
  color: #f5f5f7;
  background-color: #12121a;
  color-scheme: dark;
}
.input-icon select option,
.auth-form select option {
  background-color: #ffffff;
  color: #111827;
}

@media (max-width: 768px) {
  .auth-body { padding: 1.25rem .85rem; align-items: flex-start; }
  .auth-card { padding: 1.85rem 1.35rem; border-radius: 18px; }
  .auth-form input,
  .auth-form select,
  .auth-form button,
  .input-icon input,
  .btn {
    min-height: 44px;
  }
}
@media (max-width: 520px) {
  .auth-card { padding: 1.5rem 1.1rem; width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .auth-brand--horizontal .auth-brand-logo--horizontal {
    width: min(100%, 220px);
    max-width: 220px;
  }
  .auth-body { padding: 1rem .75rem 1.5rem; }
}
