/* ============================================================
   Mesa de Ayuda — Hoja de estilos principal
   ============================================================ */

:root {
  --azul:       #1e40af;
  --azul-claro: #2563eb;
  --fondo:      #f1f5f9;
  --blanco:     #ffffff;
  --texto:      #1e293b;
  --gris:       #64748b;
  --borde:      #e2e8f0;
  --radio:      10px;
  --sombra:     0 1px 3px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  line-height: 1.5;
}

a { color: var(--azul-claro); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

.contenedor { max-width: 1150px; margin: 0 auto; padding: 0 16px; }
main.contenedor { padding-top: 22px; padding-bottom: 40px; }

.titulo-pagina { font-size: 1.5rem; margin: 0 0 18px; }

/* ------------------------------------------------------------
   Barra superior
   ------------------------------------------------------------ */
.topbar {
  background: var(--azul);
  color: #e2e8f0;
  box-shadow: var(--sombra);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}
.marca {
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  white-space: nowrap;
}
.marca:hover { text-decoration: none; }

.nav-principal { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav-principal a {
  color: #dbeafe;
  padding: 7px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: .95rem;
}
.nav-principal a:hover { background: rgba(255, 255, 255, .12); text-decoration: none; }
.nav-principal a.activo { background: rgba(255, 255, 255, .2); color: #fff; font-weight: 600; }

.usuario-chip { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.usuario-chip .nombre { color: #fff; }
.usuario-chip .rol {
  background: rgba(255, 255, 255, .18);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .78rem;
}
.usuario-chip .salir { color: #fecaca; }

/* ------------------------------------------------------------
   Tarjetas
   ------------------------------------------------------------ */
.tarjeta {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 20px;
  margin-bottom: 18px;
}
.tarjeta-form { max-width: 700px; }

.cab-tarjeta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.cab-tarjeta h2 { margin: 0; }

.dos-columnas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.cuadro-info {
  margin-top: 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--borde);
  border-radius: 8px;
  font-size: .9rem;
}
.cuadro-info p { margin: 4px 0; }

/* ------------------------------------------------------------
   Estadísticas
   ------------------------------------------------------------ */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 14px;
  text-align: center;
}
.stat .numero { display: block; font-size: 1.9rem; font-weight: 700; }
.stat .etiqueta { color: var(--gris); font-size: .85rem; }
.stat-total .numero      { color: #0f172a; }
.stat-abierto .numero    { color: #1d4ed8; }
.stat-en_proceso .numero { color: #c2410c; }
.stat-resuelto .numero   { color: #15803d; }
.stat-cerrado .numero    { color: #475569; }

/* ------------------------------------------------------------
   Formularios
   ------------------------------------------------------------ */
.campo { margin-bottom: 14px; min-width: 0; }
.campo label {
  display: block;
  font-weight: 600;
  font-size: .88rem;
  margin-bottom: 5px;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font: inherit;
  color: var(--texto);
  background: var(--blanco);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #bfdbfe;
  border-color: var(--azul-claro);
}
input:disabled, select:disabled { background: #f1f5f9; color: var(--gris); }

.fila {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.fila .campo { margin-bottom: 14px; }

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: .92rem;
  cursor: pointer;
}
.check input { width: auto; }

.ayuda { color: var(--gris); font-size: .82rem; margin: 5px 0 0; }

.filtros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 14px;
  align-items: end;
}
.filtros .campo { margin-bottom: 0; }
.filtros-botones {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-bottom: 0;
  margin-top: 14px;
}
.filtros .filtros-botones { margin-top: 0; }

/* ------------------------------------------------------------
   Botones
   ------------------------------------------------------------ */
.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #e2e8f0;
  color: #0f172a;
  font: inherit;
  font-size: .93rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { filter: brightness(.95); text-decoration: none; }
.btn-primario { background: var(--azul); color: #fff; }
.btn-peligro  { background: #dc2626; color: #fff; }
.btn-bloque   { display: block; width: 100%; }
.btn-sm       { padding: 5px 11px; font-size: .83rem; }

/* ------------------------------------------------------------
   Alertas
   ------------------------------------------------------------ */
.alerta {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid transparent;
  font-size: .93rem;
}
.alerta-exito { background: #dcfce7; border-color: #86efac; color: #166534; }
.alerta-error { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.alerta-aviso { background: #fef9c3; border-color: #fde047; color: #854d0e; }
.alerta-info  { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }

.lista-errores { margin: 0; padding-left: 18px; }

/* ------------------------------------------------------------
   Tablas
   ------------------------------------------------------------ */
.tabla-wrap { overflow-x: auto; }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th {
  text-align: left;
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gris);
  padding: 10px 12px;
  border-bottom: 2px solid var(--borde);
  white-space: nowrap;
}
.tabla td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--borde);
  vertical-align: middle;
  font-size: .93rem;
}
.tabla tr:hover td { background: #f8fafc; }
.tabla .mono { font-family: ui-monospace, Consolas, monospace; font-size: .86rem; white-space: nowrap; }

.acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.en-linea { display: inline; }

.texto-suave { color: var(--gris); font-size: .85rem; }

/* ------------------------------------------------------------
   Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-abierto    { background: #dbeafe; color: #1d4ed8; }
.badge-en_proceso { background: #ffedd5; color: #c2410c; }
.badge-resuelto   { background: #dcfce7; color: #15803d; }
.badge-cerrado    { background: #e2e8f0; color: #475569; }

.prio-baja    { background: #e2e8f0; color: #475569; }
.prio-media   { background: #dbeafe; color: #1d4ed8; }
.prio-alta    { background: #ffedd5; color: #c2410c; }
.prio-urgente { background: #fee2e2; color: #b91c1c; }

.rol-admin   { background: #ede9fe; color: #6d28d9; }
.rol-tecnico { background: #cffafe; color: #0e7490; }
.rol-usuario { background: #e2e8f0; color: #475569; }

.badge-activo   { background: #dcfce7; color: #15803d; }
.badge-inactivo { background: #fee2e2; color: #b91c1c; }

/* ------------------------------------------------------------
   Paginación
   ------------------------------------------------------------ */
.paginacion { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.paginacion a, .paginacion span {
  padding: 6px 12px;
  border: 1px solid var(--borde);
  border-radius: 6px;
  background: var(--blanco);
  color: var(--texto);
  text-decoration: none;
  font-size: .9rem;
}
.paginacion a:hover { border-color: var(--azul-claro); text-decoration: none; }
.paginacion .actual { background: var(--azul); border-color: var(--azul); color: #fff; font-weight: 600; }

/* ------------------------------------------------------------
   Login / registro
   ------------------------------------------------------------ */
.login-wrap {
  display: flex;
  justify-content: center;
  padding: 40px 16px;
}
.login-caja {
  width: 100%;
  max-width: 430px;
  background: var(--blanco);
  border: 1px solid var(--borde);
  border-radius: 14px;
  box-shadow: var(--sombra);
  padding: 32px;
}
.login-logo { text-align: center; font-size: 2.2rem; }
.login-titulo { text-align: center; font-size: 1.3rem; margin: 10px 0 4px; }
.login-sub { text-align: center; color: var(--gris); font-size: .92rem; margin: 0 0 20px; }
.login-pie { text-align: center; font-size: .9rem; margin: 18px 0 0; }

/* ------------------------------------------------------------
   Vista de ticket
   ------------------------------------------------------------ */
.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}
.ticket-meta { color: var(--gris); font-size: .88rem; margin: 0; }
.ticket-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.titulo-seccion { margin: 22px 0 12px; }

.mensaje {
  border: 1px solid var(--borde);
  border-radius: 10px;
  background: var(--blanco);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.mensaje-cab {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: .85rem;
  color: var(--gris);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.mensaje-cab strong { color: var(--texto); }
.mensaje-cuerpo { overflow-wrap: anywhere; }
.etiqueta-rol {
  font-size: .72rem;
  font-weight: 600;
  background: #f1f5f9;
  border: 1px solid var(--borde);
  color: var(--gris);
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 6px;
}
.nota-interna {
  background: #fffbeb;
  border-color: #fde68a;
}

.detalles { margin: 0; font-size: .92rem; }
.detalles dt {
  color: var(--gris);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: 10px;
}
.detalles dd { margin: 3px 0 0; }

.adjuntos { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.adjunto {
  display: inline-block;
  background: #f8fafc;
  border: 1px solid var(--borde);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: .88rem;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------
   Detalles desplegables y pasos
   ------------------------------------------------------------ */
details.tarjeta summary { cursor: pointer; }
.sumario-crear {
  font-weight: 600;
  color: var(--azul);
  font-size: 1rem;
  list-style-position: inside;
}
.form-crear { margin-top: 16px; }

.lista-pasos { margin: 0; padding-left: 20px; }
.lista-pasos li { margin-bottom: 6px; }

/* ------------------------------------------------------------
   Pie de página
   ------------------------------------------------------------ */
.pie {
  padding: 22px 0;
  text-align: center;
  color: var(--gris);
  font-size: .85rem;
}

/* ------------------------------------------------------------
   Responsivo
   ------------------------------------------------------------ */
@media (max-width: 860px) {
  .ticket-layout,
  .dos-columnas { grid-template-columns: 1fr; }
  .fila { grid-template-columns: 1fr; }
  .topbar-inner { gap: 10px; }
  .usuario-chip { width: 100%; justify-content: flex-end; }
}
