/* GestionaYa Jurídico. Estilo tipo Clio (README, D14): barra lateral blanca, barra superior azul
   marino, tablas densas. Referencia visual: docs/maqueta/. */

:root {
  --fondo: #F5F7FA;
  --panel: #ffffff;
  --texto: #1F2933;
  --suave: #616E7C;
  --borde: #E4E7EB;
  --superior: #14324F;
  --superior-texto: #DCE6F0;
  --lateral-texto: #3E4C59;
  --acento: #0B6BCB;
  --acento-oscuro: #0957A6;
  --acento-claro: #E6F0FB;
  --verde: #1d7a46;
  --verde-c: #e5f5ec;
  --rojo: #c62f2f;
  --rojo-c: #fdecec;
  --amarillo: #8a6d00;
  --amarillo-c: #fff8d6;
  --gris-c: #eef1f5;
  --radio: 6px;
  --sombra: 0 1px 2px rgba(31, 41, 51, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo);
  color: var(--texto);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
h1 { font-size: 21px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 12px; }
.sub { color: var(--suave); margin: 0 0 20px; }

.saltar { position: absolute; left: -9999px; }
.saltar:focus { left: 16px; top: 8px; z-index: 50; background: var(--panel); padding: 8px 12px; border-radius: var(--radio); }

/* ------------------------------------------------------------ estructura */
.app { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }

.lateral {
  background: var(--panel);
  border-right: 1px solid var(--borde);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.marca {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--texto);
  font-weight: 700;
  font-size: 18px;
  padding: 4px 10px 18px;
}
.lateral a.marca:hover { background: none; text-decoration: none; }
.marca small { color: var(--suave); font-weight: 500; font-size: 14px; }
.marca-letra {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--acento);
  color: #fff;
  font-size: 15px;
}
.lateral a {
  color: var(--lateral-texto);
  padding: 9px 12px;
  border-radius: var(--radio);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  text-decoration: none;
}
.lateral a:hover { background: #F0F2F5; }
.lateral a.activo { background: var(--acento-claro); color: var(--acento); font-weight: 600; }
.lateral .ico { width: 18px; text-align: center; }
.lateral .pie {
  margin-top: auto;
  font-size: 13px;
  color: var(--suave);
  padding: 10px 12px;
  border-top: 1px solid var(--borde);
}

.principal { min-width: 0; display: flex; flex-direction: column; }
.superior {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 10px 24px;
  background: var(--superior);
  color: var(--superior-texto);
  position: sticky;
  top: 0;
  z-index: 5;
}
.contenido { padding: 24px; width: 100%; }
.contenido:focus { outline: none; }

/* ------------------------------------------------------------ usuario */
.usuario { position: relative; }
.usuario-boton {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  color: var(--superior-texto);
  font-size: 14px;
  padding: 4px 6px;
  border-radius: var(--radio);
}
.usuario-boton:hover { background: rgba(255, 255, 255, .1); }
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--acento);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.usuario-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  background: var(--panel);
  color: var(--texto);
  border: 1px solid var(--borde);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .15);
  padding: 6px;
  z-index: 10;
}
.usuario-detalle { font-size: 13px; color: var(--suave); padding: 6px 10px; border-bottom: 1px solid var(--borde); margin-bottom: 4px; }
.usuario-menu a, .usuario-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  background: none;
  color: var(--texto);
  border-radius: var(--radio);
  font-size: 14px;
}
.usuario-menu a:hover, .usuario-menu button:hover { background: var(--gris-c); text-decoration: none; }
.usuario-menu form { margin: 0; }

/* ------------------------------------------------------------ componentes */
.tarjeta {
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  padding: 18px;
}
.tarjeta.angosta { max-width: 460px; }
.vacio { color: var(--suave); text-align: center; padding: 24px; margin: 0; }

.btn {
  display: inline-block;
  border: 1px solid var(--borde);
  background: var(--panel);
  padding: 8px 14px;
  border-radius: var(--radio);
  font-weight: 600;
  color: var(--texto);
  text-align: center;
}
.btn:hover { background: #f3f5f8; text-decoration: none; }
.btn.primario { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn.primario:hover { background: var(--acento-oscuro); }
.btn.ancho { width: 100%; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; }
.apilado { display: grid; gap: 8px; }

.campo { margin-bottom: 14px; }
label { font-size: 13px; font-weight: 600; color: var(--suave); display: block; margin: 0 0 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], select, textarea {
  font: inherit;
  padding: 8px 10px;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: #fff;
  width: 100%;
  color: var(--texto);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--acento-claro); border-color: var(--acento); }
.ayuda { font-size: 12.5px; color: var(--suave); margin-top: 4px; }
.ayuda ul { margin: 4px 0 0; padding-left: 18px; }
.error-campo { color: var(--rojo); font-size: 13px; margin: 4px 0 0; }

.mensajes { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.mensaje { padding: 10px 14px; border-radius: var(--radio); background: var(--acento-claro); color: var(--acento-oscuro); margin: 0 0 14px; }
.mensajes .mensaje { margin: 0; }
.mensaje.success { background: var(--verde-c); color: var(--verde); }
.mensaje.error { background: var(--rojo-c); color: var(--rojo); }
.mensaje.warning { background: var(--amarillo-c); color: var(--amarillo); }

/* ------------------------------------------------------------ páginas sueltas (ingreso, errores) */
.centrado { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.caja { width: 100%; max-width: 380px; }
.marca-centrada { justify-content: center; padding-bottom: 20px; }
.centrado-texto { text-align: center; }
.nota-centrada { text-align: center; font-size: 13px; color: var(--suave); margin-top: 14px; }

/* ------------------------------------------------------------ pantallas chicas */
@media (max-width: 820px) {
  /* minmax(0, 1fr): la columna no se estira al ancho del menú; las filas no reparten el alto sobrante. */
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .lateral {
    min-width: 0;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 8px;
    gap: 2px;
    border-right: 0;
    border-bottom: 1px solid var(--borde);
  }
  .lateral .marca { padding: 4px 8px; font-size: 16px; }
  .lateral .marca small, .lateral .pie { display: none; }
  .lateral a { white-space: nowrap; padding: 8px 10px; font-size: 14px; }
  .superior { padding: 8px 16px; }
  .usuario-nombre { display: none; }
  .contenido { padding: 16px; }
}
