:root {
  /* Paleta institucional ICE (doc 15) — muestreada del sistema de referencia */
  --azul: #07325C;          /* azul institucional: barras y encabezados */
  --azul-titulo: #0A2E52;   /* títulos de sección */
  --azul-claro: #2c6ca5;
  --teal-acento: #009DAC;   /* realce / estados activos / enlaces */
  --teal-etiqueta: #008780; /* etiquetas en mayúsculas */
  --gris: #F2F6F9;          /* fondo general */
  --texto: #1a1a1a;
  --borde: #d5dde5;
  --error: #b00020;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--texto);
  background: var(--gris);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.barra {
  background: var(--azul);
  color: #fff;
  padding: .8rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}
.marca { display: flex; align-items: center; gap: .7rem; }
.marca-logo { height: 40px; width: auto; background: #fff; border-radius: 6px; padding: 2px 6px; }
.marca-sub { font-weight: 400; opacity: .9; font-size: .95rem; }
.usuario-nav a { color: #fff; margin-left: 1rem; }
.contenido { flex: 1; padding: 1.5rem; max-width: 960px; margin: 0 auto; width: 100%; }
.pie { text-align: center; padding: 1rem; color: #667; font-size: .85rem; }
.tarjeta {
  background: #fff;
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.acceso { max-width: 380px; margin: 3rem auto; }
h1 { color: var(--azul); margin-top: 0; }
h2 { color: var(--azul-claro); font-size: 1.1rem; }
.ayuda { color: #556; }
.aviso { background: #fff6e5; border-left: 4px solid #e0a500; padding: .6rem .8rem; border-radius: 4px; }
.error { color: var(--error); font-weight: 600; }
.formulario { display: flex; flex-direction: column; gap: 1rem; }
.formulario label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; }
.formulario input {
  padding: .55rem .7rem; border: 1px solid var(--borde); border-radius: 6px; font-size: 1rem;
}
button {
  background: var(--azul); color: #fff; border: 0; padding: .6rem 1rem;
  border-radius: 6px; font-size: 1rem; cursor: pointer;
}
button:hover { background: var(--azul-claro); }
.tabla { width: 100%; border-collapse: collapse; margin-top: .6rem; font-size: .9rem; }
.tabla th, .tabla td { border: 1px solid var(--borde); padding: .4rem .6rem; text-align: left; }
.tabla th { background: var(--azul); color: #fff; }
.tabla tr:nth-child(even) { background: var(--gris); }
@media (max-width: 640px) { .contenido { padding: 1rem; } }

/* ── Catálogos (Fase 1) ── */
.etiqueta { color: var(--teal-etiqueta); font-weight: 700; font-size: .8rem; letter-spacing: .5px; margin: 0 0 .2rem; }
h1, h2 { color: var(--azul-titulo); }
.ayuda { color: #556; font-size: .92rem; }
.aviso-ok { color: #0a7d33; font-weight: 600; }
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem;
  font-weight: 600; vertical-align: middle; }
.pill-ok { background: #dff3e4; color: #0a7d33; }
.pill-warn { background: #fdf0d5; color: #8a5a00; }
.pill-bad { background: #fbe0e3; color: var(--error); }
.txt-bad { color: var(--error); font-weight: 600; }
.mini { font-size: .8rem; padding: .2rem .5rem; cursor: pointer; }
.acciones-mov details { margin: .2rem 0; }
.form-mov { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; align-items: center; }
.form-mov select { font-size: .8rem; }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; border-bottom: 2px solid var(--borde); }
.tabs a { padding: .4rem .8rem; text-decoration: none; color: var(--azul); border-radius: 6px 6px 0 0; }
.tabs a.tab-activa { background: var(--azul); color: #fff; font-weight: 600; }
.fila-baja { opacity: .55; }
button { background: var(--azul); color: #fff; border: 0; padding: .6rem 1rem; border-radius: 6px; font-size: 1rem; cursor: pointer; }
button:hover { background: #0a4a86; }
.grid-cat { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .6rem; margin: 1rem 0; }
.cat-card { background: var(--gris); border: 1px solid var(--borde); border-radius: 8px; padding: .7rem .9rem; display: flex; flex-direction: column; }
.cat-n { font-size: 1.5rem; font-weight: 700; color: var(--azul); }
.cat-t { font-size: .85rem; color: #556; }
.cat-links { columns: 2; }
.cat-links a { color: var(--teal-acento); }
.tabla-wrap { overflow-x: auto; }
.tabla { border-collapse: collapse; width: 100%; font-size: .9rem; }
.tabla th { background: var(--azul); color: #fff; text-align: left; padding: .5rem .7rem; }
.tabla td { border-bottom: 1px solid var(--borde); padding: .45rem .7rem; }
.tabla tr:nth-child(even) td { background: #f6f9fc; }
.tabla tbody tr:hover td { background: #eef4fb; }

/* ============================================================
   APP SHELL (Fase UI): barra superior de módulos + sidebar
   ============================================================ */
:root {
  --sombra: 0 1px 3px rgba(9, 45, 82, .08), 0 1px 2px rgba(9, 45, 82, .06);
  --sombra-med: 0 4px 16px rgba(9, 45, 82, .12);
  --radio: 12px;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --azul-grad: linear-gradient(100deg, #07325C 0%, #0a4a86 100%);
}
body.con-shell { background: var(--gris); }

/* Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  background: var(--azul-grad); color: #fff;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem; box-shadow: var(--sombra-med);
}
.topbar .marca { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: #fff; flex-shrink: 0; }
.topbar .marca-logo { height: 36px; background: #fff; border-radius: 6px; padding: 2px 5px; }
.topbar .marca-sub { font-weight: 600; font-size: .95rem; letter-spacing: .2px; }
.menu-toggle { display: none; background: transparent; border: 0; color: #fff; font-size: 1.4rem; padding: .2rem .5rem; cursor: pointer; }

/* Menú de módulos (horizontal) */
.modulos { display: flex; gap: .15rem; flex: 1; overflow-x: auto; scrollbar-width: thin; }
.modulos .mod {
  display: inline-flex; align-items: center; gap: .35rem;
  color: #dce8f5; text-decoration: none; white-space: nowrap;
  padding: .45rem .7rem; border-radius: 8px; font-size: .9rem; font-weight: 500;
}
.modulos .mod:hover { background: rgba(255,255,255,.12); color: #fff; }
.modulos .mod.activo { background: #fff; color: var(--azul); font-weight: 700; }
.modulos .mod-i { font-size: 1rem; }

/* Chip de usuario */
.usuario-chip { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.u-ini { display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; background: var(--teal-acento); color: #fff;
  font-weight: 700; }
.u-ini.grande { width: 46px; height: 46px; font-size: 1.2rem; }
.u-meta { display: flex; flex-direction: column; line-height: 1.1; }
.u-meta small { opacity: .85; font-size: .75rem; }
.u-salir { color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.4);
  padding: .25rem .6rem; border-radius: 6px; font-size: .82rem; margin-left: .3rem; }
.u-salir:hover { background: rgba(255,255,255,.15); }

/* Cuerpo: sidebar + contenido */
.app { display: flex; align-items: flex-start; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  background: #fff; border-right: 1px solid var(--borde);
  padding: 1rem .8rem; overflow-y: auto;
}
.side-user { display: flex; align-items: center; gap: .6rem; padding: .3rem .3rem 1rem; }
.side-titulo { text-transform: uppercase; font-size: .72rem; letter-spacing: .6px;
  color: #8595a6; margin: 1rem .3rem .3rem; font-weight: 700; }
.side-nav { display: flex; flex-direction: column; gap: .1rem; }
.side-nav a { display: flex; align-items: center; gap: .6rem; text-decoration: none;
  color: var(--texto); padding: .5rem .6rem; border-radius: 8px; font-size: .92rem; }
.side-nav a span { width: 1.3rem; text-align: center; }
.side-nav a:hover { background: var(--gris); }
.side-nav a.activo { background: #e6f6f8; color: var(--azul); font-weight: 700;
  box-shadow: inset 3px 0 0 var(--teal-acento); }

body.con-shell .contenido { flex: 1; max-width: 1100px; margin: 0; padding: 1.6rem; width: auto; }
.contenido-centrado { display: flex; align-items: center; justify-content: center; }

/* Responsivo: sidebar como cajón */
@media (max-width: 860px) {
  .menu-toggle { display: block; }
  .topbar .marca-sub { display: none; }
  .modulos { position: fixed; top: var(--topbar-h); left: 0; right: 0;
    background: var(--azul); padding: .4rem .6rem; display: none; box-shadow: var(--sombra-med); }
  .sidebar { position: fixed; top: var(--topbar-h); left: 0; z-index: 25;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--sombra-med); }
  body.nav-abierta .sidebar { transform: translateX(0); }
  body.nav-abierta .modulos { display: flex; flex-direction: column; }
  body.con-shell .contenido { padding: 1rem; }
}

/* Tablero: hero + tarjetas de módulo */
.hero { margin-bottom: 1.2rem; }
.hero h1 { margin: .1rem 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.card {
  display: flex; flex-direction: column; gap: .3rem;
  background: #fff; border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 1.1rem 1.2rem; text-decoration: none; color: var(--texto);
  box-shadow: var(--sombra); transition: transform .12s ease, box-shadow .12s ease, border-color .12s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--sombra-med); border-color: var(--teal-acento); }
.card-ico { font-size: 1.8rem; }
.card-t { font-weight: 700; color: var(--azul); font-size: 1.05rem; }
.card-d { color: #667; font-size: .86rem; line-height: 1.35; }
