:root {
  --tyrone: #1F5F99; --freddy: #C2571A; --ambos: #5B6770;
  --f0: #6B7A89; --f1: #1B4C88; --f2: #4F3489; --f3: #0A6157; --f4: #9A2950;
  --fondo: #F5F6F8; --tarjeta: #FFFFFF; --texto: #1D2733; --suave: #5E6B78;
  --borde: #E1E5EA; --acento: #1B4C88;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fondo); color: var(--texto); line-height: 1.5; font-size: 15px; }
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
header.barra { background: #13233A; color: #fff; position: sticky; top: 0; z-index: 20; }
.barra .dentro { max-width: 1200px; margin: 0 auto; display: flex; align-items: center;
  gap: 1rem; padding: .6rem 1rem; flex-wrap: wrap; }
.marca { font-weight: 700; color: #fff; letter-spacing: .2px; }
.marca small { font-weight: 400; opacity: .7; margin-left: .4rem; }
nav { display: flex; gap: .2rem; flex-wrap: wrap; margin-left: auto; }
nav a { color: #C9D4E2; padding: .35rem .65rem; border-radius: 6px; font-size: .92rem; }
nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
nav a.activa { background: #fff; color: #13233A; font-weight: 600; }
main { max-width: 1200px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
.sub { color: var(--suave); font-size: .9rem; }
.tarjeta { background: var(--tarjeta); border: 1px solid var(--borde); border-radius: 10px;
  padding: 1rem 1.1rem; }
.rejilla { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cifra { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.etq { font-size: .78rem; text-transform: uppercase; letter-spacing: .6px; color: var(--suave); }
.pastilla { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem;
  font-weight: 600; color: #fff; white-space: nowrap; }
.barra-avance { height: 10px; background: #E6EAEF; border-radius: 999px; overflow: hidden; }
.barra-avance > span { display: block; height: 100%; background: var(--acento); }
.persona { border-left: 5px solid var(--ambos); }
.persona.Tyrone { border-left-color: var(--tyrone); }
.persona.Freddy { border-left-color: var(--freddy); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .45rem .55rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--suave); }
.tabla-scroll { overflow-x: auto; }
.hip { display: flex; gap: .8rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px solid var(--borde); }
.hip:last-child { border-bottom: 0; }
.hip b { min-width: 2rem; }
.vacio { color: var(--suave); font-style: italic; padding: 1rem; text-align: center; }
.filtros { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
select { padding: .4rem .5rem; border: 1px solid var(--borde); border-radius: 6px; background: #fff; font: inherit; }

/* Gantt */
.gantt { position: relative; overflow-x: auto; }
.gantt-int { position: relative; min-width: 900px; }
.g-escala { position: relative; height: 34px; margin-left: 260px; border-bottom: 1px solid var(--borde); }
.g-mes { position: absolute; top: 0; font-size: .75rem; font-weight: 600; color: var(--suave); }
.g-sem { position: absolute; top: 18px; font-size: .68rem; color: #9AA5B1; transform: translateX(-50%); }
.g-fila { display: flex; align-items: center; height: 30px; border-bottom: 1px solid #F0F2F5; cursor: pointer; }
.g-fila:hover { background: #F7F9FC; }
.g-fila.fase { background: #F2F4F7; cursor: default; font-weight: 700; }
.g-nombre { width: 260px; flex: none; font-size: .82rem; padding: 0 .5rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.g-pista { position: relative; flex: 1; height: 100%; }
.g-barra { position: absolute; top: 7px; height: 16px; border-radius: 4px; opacity: .9;
  overflow: hidden; border: 2px solid transparent; }
.g-barra .hecho { position: absolute; inset: 0 auto 0 0; background: rgba(255,255,255,.45); }
.g-barra.est-completada { opacity: 1; }
.g-barra.est-pendiente { opacity: .55; }
.g-barra.est-en_progreso { border-color: #1F7AE0; }
.g-barra.est-esperando_evidencia { border-color: #D9A21B; }
.g-barra.est-bloqueada { border-color: #C7372F; }
.g-hito { position: absolute; top: 8px; width: 14px; height: 14px; transform: translateX(-7px) rotate(45deg); }
.g-hoy { position: absolute; top: 0; bottom: 0; width: 2px; background: #C7372F; z-index: 5; pointer-events: none; }
.g-hoy span { position: absolute; top: -2px; left: 4px; font-size: .7rem; color: #C7372F; font-weight: 700; }
.leyenda { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--suave); margin: .6rem 0; }
.leyenda i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }

/* Panel de detalle */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: #fff;
  box-shadow: -8px 0 30px rgba(0,0,0,.15); transform: translateX(100%); transition: transform .2s;
  z-index: 40; overflow-y: auto; padding: 1.2rem; }
.panel.abierto { transform: none; }
.panel .cerrar { float: right; border: 0; background: #EEF1F4; border-radius: 6px; padding: .3rem .6rem; cursor: pointer; font: inherit; }

/* Bitácora */
.linea { position: relative; padding-left: 1.4rem; }
.linea::before { content: ""; position: absolute; left: 5px; top: 0; bottom: 0; width: 2px; background: var(--borde); }
.entrada { position: relative; margin-bottom: 1rem; }
.entrada::before { content: ""; position: absolute; left: -1.4rem; top: 1.1rem; width: 12px; height: 12px;
  border-radius: 50%; background: var(--c, var(--ambos)); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--borde); }
.entrada .cab { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .3rem; }
.entrada p { margin: .35rem 0; }
.entrada ul { margin: .2rem 0 .4rem 1.1rem; padding: 0; }

/* Galería */
.galeria { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.galeria figure { margin: 0; background: #fff; border: 1px solid var(--borde); border-radius: 8px; overflow: hidden; }
.galeria img { width: 100%; height: 140px; object-fit: cover; display: block; background: #EEF1F4; }
.galeria figcaption { font-size: .78rem; padding: .4rem .5rem; word-break: break-all; }
.archivo-icono { height: 140px; display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 700; color: var(--suave); background: #EEF1F4; }

/* Riesgos */
.matriz { display: grid; grid-template-columns: 40px repeat(3, 1fr); grid-template-rows: repeat(3, minmax(110px, auto)) 34px; gap: 4px; }
.celda { border-radius: 6px; padding: .4rem; display: flex; flex-wrap: wrap; gap: .3rem; align-content: flex-start; }
.n1, .n2 { background: #DCEFE2; } .n3, .n4 { background: #FBEFC9; } .n6, .n9 { background: #F7D3CF; }
.eje { display: flex; align-items: center; justify-content: center; font-size: .75rem; color: var(--suave); font-weight: 600; }
.riesgo-chip { background: #fff; border-radius: 6px; padding: .2rem .45rem; font-size: .78rem;
  border-left: 4px solid var(--ambos); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

canvas { max-width: 100%; }
@media (max-width: 700px) {
  nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .g-nombre { width: 150px; }
  .g-escala { margin-left: 150px; }
  .cifra { font-size: 1.6rem; }
}
