/* ==========================================================
   GIOIA - Inicio de sesión estándar
   Hoja de estilos compartida por todas las aplicaciones.
   ========================================================== */

:root {
  --g-bg: #181411;          /* fondo (igual al portal) */
  --g-surface: #221F1A;     /* campos y tarjetas */
  --g-border: #36322C;      /* bordes */
  --g-gold: #D4B258;        /* dorado de marca */
  --g-gold-hover: #E0C273;
  --g-text: #F4EFE6;        /* texto principal */
  --g-label: #DCD6CC;       /* etiquetas */
  --g-muted: #A9A196;       /* texto secundario */
  --g-placeholder: #958D81; /* placeholders e íconos */
  --g-footer: #8F877B;      /* pie de página */
  --g-on-gold: #1A1510;     /* texto sobre dorado */
  --g-radius: 14px;
  --g-font: "Jost", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

/* Fondo oscuro de borde a borde: evita las barras blancas de Safari */
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--g-bg);
}

body {
  color: var(--g-text);
  font-family: var(--g-font);
  -webkit-font-smoothing: antialiased;
}

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

.g-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    calc(16px + env(safe-area-inset-top, 0px))
    28px
    calc(28px + env(safe-area-inset-bottom, 0px));
}

/* Volver al portal */
.g-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: 14px;
  color: var(--g-muted);
  text-decoration: none;
}
.g-back:hover { color: var(--g-text); }
.g-back svg { width: 18px; height: 18px; }

.g-main {
  flex: 1;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-top: 64px;
}

/* Logo + nombre de la aplicación */
.g-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.g-logo { display: block; width: 190px; height: auto; }
.g-appname {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.02em;
  color: var(--g-gold);
}
.g-appname::before,
.g-appname::after {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--g-gold);
}

/* Formulario */
.g-form {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.g-field { display: flex; flex-direction: column; gap: 8px; }
.g-label { font-size: 14px; font-weight: 500; color: var(--g-label); }
.g-control { position: relative; }
.g-icon, .g-chevron {
  position: absolute;
  top: 17px;
  width: 18px;
  height: 18px;
  pointer-events: none;
}
.g-icon { left: 16px; color: var(--g-placeholder); }
.g-chevron { right: 16px; color: var(--g-muted); }

.g-input {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 46px;
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius);
  color: var(--g-text);
  font-family: inherit;
  font-size: 16px; /* 16px evita el zoom automático en iPhone */
  appearance: none;
  -webkit-appearance: none;
}
select.g-input { padding-right: 44px; cursor: pointer; }
.g-input::placeholder { color: var(--g-placeholder); }
.g-input:focus {
  outline: none;
  border-color: var(--g-gold);
  box-shadow: 0 0 0 3px rgba(212, 178, 88, 0.25);
}

/* Mantener sesión iniciada */
.g-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 14px;
  color: var(--g-muted);
  cursor: pointer;
}
.g-check input {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
  border: 1.5px solid #5A534A;
  border-radius: 6px;
  background: var(--g-surface);
  cursor: pointer;
}
.g-check input:checked {
  background: var(--g-gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A1510' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px no-repeat;
  border-color: var(--g-gold);
}

/* Botón principal */
.g-btn {
  height: 52px;
  border: 0;
  border-radius: var(--g-radius);
  background: var(--g-gold);
  color: var(--g-on-gold);
  font-family: inherit;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.g-btn:hover { background: var(--g-gold-hover); }

.g-help {
  margin: 0;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
  color: var(--g-muted);
}
.g-help a { color: var(--g-muted); }
.g-help a:hover { color: var(--g-text); }

/* Selector de origen (Bodega) */
.g-choices { margin-top: 48px; display: flex; flex-direction: column; gap: 12px; }
.g-question { margin: 0 0 8px; font-size: 14px; font-weight: 500; color: var(--g-label); }
.g-choice {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 76px;
  padding: 14px 16px;
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius);
  color: var(--g-text);
  text-decoration: none;
}
.g-choice:hover { border-color: var(--g-gold); }
.g-choice-icon { width: 22px; height: 22px; flex: none; color: var(--g-gold); }
.g-choice-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.g-choice-title { font-weight: 600; font-size: 16px; }
.g-choice-desc { font-size: 14px; line-height: 1.4; color: var(--g-muted); }
.g-choice-arrow { width: 18px; height: 18px; flex: none; color: var(--g-muted); }

/* Pie de página */
.g-footer {
  margin-top: 48px;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--g-footer);
}
.g-footer p { margin: 0; }

/* Accesibilidad */
.g-btn:focus-visible, .g-back:focus-visible, .g-choice:focus-visible,
.g-help a:focus-visible, .g-check input:focus-visible {
  outline: 2px solid var(--g-gold);
  outline-offset: 3px;
}

/* Escritorio */
@media (min-width: 768px) {
  .g-page { padding-left: 32px; padding-right: 32px; }
  .g-main { justify-content: center; padding-top: 24px; padding-bottom: 24px; }
  .g-logo { width: 210px; }
  .g-appname { font-size: 22px; }
}

/* ----------------------------------------------------------
   Agregado al aplicar el estándar (2026-11-04): las plantillas
   no traían dónde mostrar errores ni avisos, y cada app ya los
   mostraba. Mismos colores de la paleta.
   ---------------------------------------------------------- */
.g-alert {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--g-radius);
  border: 1px solid rgba(229, 103, 92, .45);
  background: rgba(229, 103, 92, .12);
  color: #EE8A80;
  font-size: 14px;
  line-height: 1.5;
}
.g-alert-info {
  border-color: rgba(212, 178, 88, .45);
  background: rgba(212, 178, 88, .12);
  color: var(--g-gold);
}
.g-alert:empty { display: none; }
.g-btn:disabled { opacity: .6; cursor: default; }
