/* =====================================================================
   Help Desk Grafix · Diseño corporativo (estilo A: menú lateral azul)
   Se carga en todas las páginas con sesión. gx-layout.js arma el menú.
   ===================================================================== */
:root {
  --gx-navy: #012A54;        /* Manual de marca: azul oscuro */
  --gx-navy-2: #0B3A6B;
  --gx-navy-active: #055BA6;  /* azul corporativo */
  --gx-blue: #055BA6;
  --gx-blue-dark: #012A54;
  --gx-orange: #F27507;
  --gx-bg: #F4F6FA;
  --gx-card: #FFFFFF;
  --gx-line: #E3E8EF;
  --gx-line-2: #D5DCE6;
  --gx-text: #1B2433;
  --gx-muted: #5B6577;
  --gx-nav-text: #DCE5F3;
  --gx-nav-muted: #AFC0DA;
  --gx-font: "Segoe UI", Inter, Arial, sans-serif;
}

body.gx-on {
  margin: 0;
  background: var(--gx-bg) !important;
  font-family: var(--gx-font);
  color: var(--gx-text);
}
body.gx-on::before,
body.gx-on::after { display: none !important; }

.gx-shell { display: flex; min-height: 100vh; }

/* ---------- Menú lateral ---------- */
.gx-nav {
  width: 248px;
  flex: none;
  background: var(--gx-navy);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px 16px;
  box-sizing: border-box;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
}
.gx-brand {
  background: #FFFFFF;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-decoration: none;
}
.gx-brand img { height: 50px; width: auto; max-width: 170px; object-fit: contain; }
.gx-toggle {
  display: none;
  width: 44px; height: 44px;
  border-radius: 10px;
  border: 1px solid var(--gx-line-2);
  background: #FFFFFF;
  color: var(--gx-navy);
  align-items: center; justify-content: center;
  cursor: pointer;
}
.gx-links { display: flex; flex-direction: column; gap: 18px; }
.gx-group { display: flex; flex-direction: column; gap: 3px; }
.gx-group-title {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gx-nav-muted);
  padding: 0 12px 6px;
}
.gx-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--gx-nav-text);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.25;
}
.gx-link svg { width: 18px; height: 18px; flex: none; }
.gx-link:hover { background: var(--gx-navy-2); color: #FFFFFF; }
.gx-link:focus-visible { outline: 2px solid #8FB8EA; outline-offset: 2px; }
.gx-link[aria-current="page"] { background: var(--gx-navy-active); color: #FFFFFF; font-weight: 600; }
.gx-badge {
  margin-left: auto;
  background: var(--gx-orange);
  color: var(--gx-navy);
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 2px 8px;
}
.gx-badge[hidden] { display: none; }

.gx-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--gx-navy-2);
}
.gx-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #3B6FB6;
  color: #FFFFFF;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex: none;
  overflow: hidden;
}
.gx-avatar.admin { background: var(--gx-orange); color: var(--gx-navy); }
.gx-avatar img { width: 100%; height: 100%; object-fit: cover; }
.gx-user-data { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.gx-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gx-user-role { font-size: 12px; color: var(--gx-nav-muted); }
.gx-logout {
  margin-top: 6px;
  align-self: flex-start;
  background: transparent;
  border: 1px solid #3B5688;
  color: var(--gx-nav-text);
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}
.gx-logout:hover { background: #24406F; color: #FFFFFF; }

/* ---------- Contenido ---------- */
.gx-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gx-content > main,
.gx-content > .main,
.gx-content > .dashboard-main {
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  flex: 1;
  box-sizing: border-box;
}
.gx-content > main.container {
  max-width: 1280px !important;
  width: calc(100% - 64px) !important;
  margin: 28px 32px !important;
}
.gx-content > footer,
.gx-content .footer-grafix,
.gx-content .dashboard-footer {
  margin-top: auto;
  padding: 14px 32px;
  font-size: 12px;
  color: var(--gx-muted);
  background: transparent;
  border: 0;
}
/* Elementos del diseño anterior que el menú nuevo reemplaza */
.gx-on .header-actions .action-buttons,
.gx-on #usuarioLogueado { display: none !important; }

/* Títulos y botones principales con el tono corporativo */
.gx-content h1 { color: var(--gx-navy); }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 900px) {
  .gx-shell { flex-direction: column; }
  .gx-nav { width: 100%; height: auto; position: sticky; top: 0; padding: 10px 12px; gap: 10px; }
  .gx-brand img { height: 38px; }
  .gx-toggle { display: inline-flex; }
  .gx-links, .gx-user { display: none; }
  .gx-nav.gx-open .gx-links, .gx-nav.gx-open .gx-user { display: flex; }
  .gx-content > main.container { width: auto !important; margin: 16px !important; }
}

@media print {
  .gx-nav { display: none; }
}

#gxAdmin { display: flex; flex-direction: column; gap: 18px; }
#gxAdmin[hidden] { display: none; }

/* Registrar un caso a nombre de otra persona (solo administradores) */
.gx-otro { margin: 0 0 18px; border: 1px dashed #9DB6D8; border-radius: 12px; background: #F3F7FD; padding: 14px 16px; }
.gx-otro[hidden] { display: none; }
.gx-otro.activo { border-style: solid; border-color: var(--gx-orange); background: #FFF6EC; }
.gx-otro-switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; margin: 0; font-weight: normal; }
.gx-otro-switch input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--gx-blue); }
.gx-otro-texto { display: flex; flex-direction: column; gap: 4px; }
.gx-otro-texto strong { color: var(--gx-navy); font-size: 15px; }
.gx-otro-texto small { color: var(--gx-muted); font-size: 13px; line-height: 1.45; }

/* Evitar que los estilos globales de botones de cada página afecten el menú */
.gx-nav button.gx-toggle { color: var(--gx-navy) !important; background: #FFFFFF !important; width: 44px !important; min-width: 44px; height: 44px; padding: 0 !important; margin: 0 !important; box-shadow: none !important; }
.gx-nav button.gx-logout { width: auto !important; height: auto; padding: 4px 10px !important; margin: 6px 0 0 !important; background: transparent !important; box-shadow: none !important; font-size: 12px !important; color: var(--gx-nav-text) !important; }

/* Buscador de personas (Office 365) al registrar un caso para otra persona */
.gx-buscador { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.gx-buscador[hidden] { display: none; }
.gx-buscador-titulo { font-size: 13px; font-weight: 700; color: var(--gx-navy); margin: 0; }
.gx-buscador-caja { position: relative; }
.gx-buscador-caja input { width: 100%; height: 44px; box-sizing: border-box; border: 1px solid #C9D3E1; border-radius: 10px; padding: 0 14px; font: inherit; font-size: 14px; background: #FFFFFF; margin: 0; }
.gx-buscador-caja input:focus { outline: 2px solid #9CC0E6; border-color: var(--gx-blue); }
.gx-resultados { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 6px; list-style: none; background: #FFFFFF; border: 1px solid var(--gx-line-2); border-radius: 10px; box-shadow: 0 10px 24px rgba(1, 42, 84, .16); max-height: 320px; overflow-y: auto; }
.gx-resultados[hidden] { display: none; }
.gx-resultado { display: grid; grid-template-columns: 1fr; gap: 1px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
.gx-resultado strong { font-size: 14px; color: var(--gx-navy); }
.gx-resultado span { font-size: 13px; color: var(--gx-text); }
.gx-resultado small { font-size: 11px; color: var(--gx-muted); }
.gx-resultado.activo, .gx-resultado:hover { background: #EAF1FA; }
.gx-buscador-estado { margin: 0; font-size: 12px; color: var(--gx-muted); min-height: 1em; }
.gx-buscador-estado:empty { display: none; }
.gx-nav ~ .gx-content .gx-btn-autorizar, .gx-btn-autorizar { align-self: flex-start; width: auto !important; height: 36px; padding: 0 14px !important; margin: 0 !important; border-radius: 8px; border: 1px solid var(--gx-blue) !important; background: #FFFFFF !important; color: var(--gx-blue) !important; font: inherit; font-size: 13px !important; font-weight: 600; box-shadow: none !important; cursor: pointer; }
.gx-btn-autorizar[hidden] { display: none !important; }
