/*
 * Pantallas de acceso: login y selector de usuario de nipol.cloud y de
 * pedidos.nipol.cloud. /var/www/pedidos/static es un symlink a este static,
 * asi que las dos apps cargan este mismo archivo.
 *
 * CSS propio y sin Tailwind a proposito: el login es la pagina publica mas
 * visitada y el CDN de Tailwind compila en el navegador (pinta tarde y salta).
 * Paleta tomada del logo: carbon #4f4f4e + verde agua #73b8b8.
 *
 * Tema: clase .dark en <html>, la pone cada pagina antes de pintar.
 */

:root {
  --acc-page: #f4f4f2;
  --acc-surface: #ffffff;
  --acc-border: #e3e3e0;
  --acc-text: #1b1b1a;
  --acc-muted: #6b6b68;
  --acc-soft: #9a9a96;
  --acc-field: #ffffff;
  --acc-field-border: #d1d1cf;
  --acc-brand: #437d7e;
  --acc-brand-hover: #3a6566;
  --acc-on-brand: #ffffff;
  --acc-brand-text: #437d7e;
  --acc-brand-tint: #eef6f6;
  --acc-brand-line: #c4e0e0;
  --acc-ring: rgba(85, 155, 155, 0.28);
  --acc-panel: #1d1d1c;
  --acc-danger-bg: #fdf2f2;
  --acc-danger-line: #f5c9c9;
  --acc-danger-text: #b42318;
  --acc-warn-bg: #fff8eb;
  --acc-warn-line: #f3d9a4;
  --acc-warn-text: #8a5a00;
  --acc-shadow: 0 1px 2px rgba(27, 27, 26, 0.04), 0 8px 24px rgba(27, 27, 26, 0.06);
  color-scheme: light;
}

.dark {
  --acc-page: #121211;
  --acc-surface: #1a1a19;
  --acc-border: #2c2c2a;
  --acc-text: #ededec;
  --acc-muted: #a3a3a0;
  --acc-soft: #74746f;
  --acc-field: #151514;
  --acc-field-border: #353533;
  --acc-brand: #73b8b8;
  --acc-brand-hover: #93c9c9;
  --acc-on-brand: #102222;
  --acc-brand-text: #93c9c9;
  --acc-brand-tint: rgba(115, 184, 184, 0.08);
  --acc-brand-line: rgba(115, 184, 184, 0.28);
  --acc-ring: rgba(115, 184, 184, 0.24);
  --acc-panel: #0c0c0b;
  --acc-danger-bg: rgba(180, 35, 24, 0.14);
  --acc-danger-line: rgba(248, 113, 113, 0.3);
  --acc-danger-text: #fca5a5;
  --acc-warn-bg: rgba(217, 149, 0, 0.12);
  --acc-warn-line: rgba(245, 190, 80, 0.3);
  --acc-warn-text: #f5c56b;
  --acc-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────────────── */

.acc-body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--acc-page);
  color: var(--acc-text);
  font-family: 'Manrope', ui-sans-serif, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.acc-body *, .acc-body *::before, .acc-body *::after { box-sizing: border-box; }

.acc-body :where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--acc-brand);
  outline-offset: 2px;
}

.acc-hidden, .acc-body .hidden { display: none !important; }

/* ── Estructura: panel de marca + columna de acceso ──────────────────── */

.acc-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1024px) {
  .acc-shell { grid-template-columns: minmax(380px, 42%) 1fr; }
}

.acc-panel {
  display: none;
  position: relative;
  overflow: hidden;
  background: var(--acc-panel);
  color: #ededec;
  padding: 48px 56px;
  flex-direction: column;
  justify-content: space-between;
}
@media (min-width: 1024px) {
  .acc-panel { display: flex; }
}

/* Eco de la hoja del logo: un cuarto de circulo verde agua, muy tenue. */
.acc-panel::before {
  content: '';
  position: absolute;
  right: -22%;
  bottom: -30%;
  width: 78%;
  aspect-ratio: 1;
  border-radius: 0 100% 0 0;
  background: #73b8b8;
  opacity: 0.09;
  transform: rotate(-90deg);
  pointer-events: none;
}
.acc-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 85%);
  pointer-events: none;
}
.acc-panel > * { position: relative; z-index: 1; }

.acc-panel-logo { width: 104px; height: auto; display: block; }

.acc-panel-eyebrow {
  margin: 0 0 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #93c9c9;
}
.acc-panel-title {
  margin: 0;
  max-width: 22rem;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fafaf9;
}
.acc-panel-title span { color: #93c9c9; }

.acc-features { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 14px; }
.acc-features li {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  color: #c9c9c6;
}
.acc-features i {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  color: #93c9c9;
  font-size: 13px;
}

.acc-panel-foot { margin: 0; font-size: 12px; color: #858581; }

/* ── Columna de acceso ───────────────────────────────────────────────── */

.acc-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px 16px 28px;
}
@media (min-width: 640px) { .acc-main { padding: 28px 40px 32px; } }

.acc-topbar {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.acc-logo { height: 52px; width: auto; display: block; }
.acc-logo--oscuro { display: none; }
.dark .acc-logo--claro { display: none; }
.dark .acc-logo--oscuro { display: block; }
@media (min-width: 1024px) {
  /* En desktop el logo ya esta en el panel. */
  .acc-topbar .acc-logo { display: none !important; }
}

.acc-icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--acc-border);
  background: var(--acc-surface);
  color: var(--acc-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.acc-icon-btn:hover { color: var(--acc-brand-text); border-color: var(--acc-brand-line); }
.acc-icon-btn .fa-sun { display: none; }
.dark .acc-icon-btn .fa-sun { display: inline-block; }
.dark .acc-icon-btn .fa-moon { display: none; }

.acc-content {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 0 24px;
}

.acc-content > * { min-width: 0; }

.acc-head { margin-bottom: 28px; }
.acc-eyebrow {
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--acc-brand-text);
}
.acc-eyebrow::before {
  content: '';
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.acc-title {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--acc-text);
}
.acc-sub { margin: 8px 0 0; font-size: 14px; color: var(--acc-muted); }

.acc-foot {
  margin: 28px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--acc-soft);
}

/* ── Avisos ──────────────────────────────────────────────────────────── */

.acc-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--acc-danger-line);
  background: var(--acc-danger-bg);
  color: var(--acc-danger-text);
  font-size: 14px;
}
.acc-alert i { margin-top: 3px; flex-shrink: 0; }
.acc-alert--warn {
  border-color: var(--acc-warn-line);
  background: var(--acc-warn-bg);
  color: var(--acc-warn-text);
}

/* ── Formulario ──────────────────────────────────────────────────────── */

.acc-form { display: grid; gap: 18px; }

.acc-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--acc-text);
}

.acc-field-wrap { position: relative; }
.acc-field-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--acc-soft);
  pointer-events: none;
  transition: color 0.15s ease;
}
.acc-field-wrap:focus-within .acc-field-icon { color: var(--acc-brand-text); }

.acc-input {
  width: 100%;
  height: 50px;
  padding: 0 14px 0 42px;
  border-radius: 12px;
  border: 1px solid var(--acc-field-border);
  background: var(--acc-field);
  color: var(--acc-text);
  font: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.acc-input--con-boton { padding-right: 52px; }
.acc-input::placeholder { color: var(--acc-soft); }
.acc-input:focus {
  outline: none;
  border-color: var(--acc-brand);
  box-shadow: 0 0 0 4px var(--acc-ring);
}
.acc-input:-webkit-autofill,
.acc-input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--acc-field) inset;
  -webkit-text-fill-color: var(--acc-text);
  caret-color: var(--acc-text);
  transition: background-color 5000s ease-in-out;
}

.acc-eye {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--acc-soft);
  cursor: pointer;
}
.acc-eye:hover { color: var(--acc-brand-text); background: var(--acc-brand-tint); }

.acc-caps {
  display: none;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--acc-warn-text);
}
.acc-caps.is-on { display: flex; }

/* Opt-in de cambio rapido como interruptor. */
.acc-switch {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--acc-border);
  background: var(--acc-surface);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.acc-switch:hover { border-color: var(--acc-brand-line); }
.acc-switch:has(input:checked) { border-color: var(--acc-brand-line); background: var(--acc-brand-tint); }
.acc-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.acc-switch-track {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--acc-field-border);
  transition: background-color 0.15s ease;
}
.acc-switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}
.acc-switch input:checked + .acc-switch-track { background: var(--acc-brand); }
.acc-switch input:checked + .acc-switch-track::after { transform: translateX(16px); }
.acc-switch input:focus-visible + .acc-switch-track { box-shadow: 0 0 0 4px var(--acc-ring); }
.acc-switch-text { font-size: 14px; font-weight: 600; color: var(--acc-text); }
.acc-switch-text small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--acc-muted);
}

/* ── Botones ─────────────────────────────────────────────────────────── */

.acc-btn {
  width: 100%;
  height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  background: var(--acc-brand);
  color: var(--acc-on-brand);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
.acc-btn:hover { background: var(--acc-brand-hover); }
.acc-btn:active { transform: scale(0.99); }
.acc-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.acc-btn i { font-size: 12px; }

.acc-spinner {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  opacity: 0.85;
  animation: acc-spin 0.65s linear infinite;
}
@keyframes acc-spin { to { transform: rotate(360deg); } }

.acc-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--acc-soft);
  cursor: pointer;
}
.acc-link:hover { color: var(--acc-text); text-decoration: underline; }
.acc-link--danger { color: #d64545; }
.acc-link--danger:hover { color: #b42318; }

/* ── Acceso rapido: sesiones guardadas e inicio desde nipol.cloud ────── */

.acc-quick { margin-bottom: 4px; }
.acc-quick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.acc-quick-title {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--acc-muted);
}
.acc-quick-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.acc-account {
  border-radius: 14px;
  border: 1px solid var(--acc-border);
  background: var(--acc-surface);
  box-shadow: var(--acc-shadow);
  transition: border-color 0.15s ease;
}
.acc-account:hover, .acc-account:focus-within { border-color: var(--acc-brand-line); }

.acc-account-row { display: flex; align-items: center; }

/* Toda la fila es el boton de entrar: blanco de toque grande en el local. */
.acc-account-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 6px 12px 12px;
  border: 0;
  border-radius: 14px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.acc-account-main:hover .acc-account-go { background: var(--acc-brand); color: var(--acc-on-brand); }

.acc-avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--acc-brand-tint);
  box-shadow: inset 0 0 0 1px var(--acc-brand-line);
  color: var(--acc-brand-text);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.acc-account-info { flex: 1; min-width: 0; line-height: 1.3; }
.acc-account-name {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 14px;
  font-weight: 800;
  color: var(--acc-text);
}
.acc-account-meta {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-top: 2px;
  font-size: 12px;
  color: var(--acc-muted);
}

.acc-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--acc-page);
  color: var(--acc-muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.acc-pill i { font-size: 10px; }
@media (max-width: 359px) { .acc-pill { display: none; } }
.acc-pill--lock { color: var(--acc-warn-text); }

.acc-account-go {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--acc-brand-tint);
  color: var(--acc-brand-text);
  font-size: 12px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.acc-account-x {
  width: 36px;
  height: 36px;
  margin-right: 6px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--acc-soft);
  cursor: pointer;
}
.acc-account-x:hover { color: #d64545; background: var(--acc-danger-bg); }

.acc-account-pin { padding: 0 12px 12px 64px; }
.acc-account-pin label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--acc-muted);
}
.acc-pin-row { display: flex; gap: 8px; }
.acc-pin-row .acc-input { height: 42px; padding-left: 14px; font-size: 15px; letter-spacing: 0.1em; }
.acc-pin-row .acc-btn { width: auto; height: 42px; padding: 0 16px; font-size: 13px; }
.acc-account-pin p { margin: 6px 0 0; font-size: 11px; color: var(--acc-muted); }

/* Variante destacada: la sesion abierta en nipol.cloud. */
.acc-account--sso {
  border-color: var(--acc-brand-line);
  background: var(--acc-brand-tint);
  box-shadow: none;
  padding: 12px;
}
.acc-account--sso .acc-avatar { background: var(--acc-brand); color: var(--acc-on-brand); box-shadow: none; }
.acc-sso-row { display: flex; align-items: center; gap: 12px; }
.acc-sso-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.acc-sso-actions .acc-btn { flex: 1; height: 44px; font-size: 14px; }
.acc-sso-error { margin: 8px 0 0; font-size: 12px; color: var(--acc-danger-text); }

/* Las sesiones guardadas y el inicio desde nipol.cloud van juntos; el
   divisor hacia el formulario aparece solo si alguno de los dos se ve (el de
   nipol.cloud lo muestra el JS despues de cargar). */
.acc-quick-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }

.acc-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acc-soft);
}
.acc-divider.acc-divider--auto { display: none; }
.acc-quick-group:has(> .acc-quick:not(.hidden)) + .acc-divider.acc-divider--auto { display: flex; }
.acc-divider::before, .acc-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--acc-border);
}

.acc-empty {
  margin: 0 0 20px;
  padding: 22px 16px;
  border-radius: 14px;
  border: 1px dashed var(--acc-field-border);
  text-align: center;
  font-size: 14px;
  color: var(--acc-muted);
}
.acc-empty i { display: block; margin-bottom: 8px; font-size: 18px; color: var(--acc-soft); }

/* ── Movimiento ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .acc-rise { animation: acc-rise 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
  .acc-rise-2 { animation-delay: 0.06s; }
  .acc-rise-3 { animation-delay: 0.12s; }
  @keyframes acc-rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .acc-spinner { animation: none; }
  .acc-body * { transition-duration: 0.01ms !important; }
}
