/* ═══════════════════════════════════════════════════════════════
   gantt.css — Estilos SCOPED bajo #gantt-root
   Todos los selectores están prefijados con #gantt-root
   para no afectar el resto del sistema.
   Paleta: warm-slate profesional (tonos cálidos, no dark puro)
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── Variables — solo aplican dentro de #gantt-root ─────────── */
#gantt-root {
  --g-bg:            #f0ece6;
  --g-surface:       #faf7f4;
  --g-surface2:      #ede8e1;
  --g-border:        #d8d0c5;
  --g-border-light:  #c8bfb3;
  --g-txt:           #2c2825;
  --g-txt-dim:       #7a6e64;
  --g-txt-muted:     #b0a59a;
  --g-accent:        #c2410c;
  --g-accent2:       #ea580c;
  --g-green:         #15803d;
  --g-yellow:        #b45309;
  --g-red:           #b91c1c;
  --g-purple:        #6d28d9;
  --g-lime:          #4d7c0f;
  --g-today:         #dc2626;
  --g-today-col-bg:  rgba(220,38,38,0.05);
  --g-row-h:         30px;
  --g-header-h:      52px;
  --g-col-w:         52px;
  --g-grid-w:        647px; /*620 580*/

  /* contención — no afecta nada fuera */
  box-sizing: border-box;
  font-family: 'DM Sans', sans-serif;
  color: var(--g-txt);
  background: var(--g-bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#gantt-root *,
#gantt-root *::before,
#gantt-root *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ════════════════════════════════════════════════════════════
   TOP BAR
════════════════════════════════════════════════════════════ */
#gantt-root #topbar {
  height: 44px;
  background: var(--g-surface);
  border-bottom: 2px solid var(--g-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  flex-shrink: 0;
}

#gantt-root #topbar h1 {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--g-txt);
  letter-spacing: .07em;
  text-transform: uppercase;
}

#gantt-root .g-pill {
  background: var(--g-accent);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: .06em;
}

/* ════════════════════════════════════════════════════════════
   ZOOM BAR
════════════════════════════════════════════════════════════ */
#gantt-root #zoombar {
  height: 38px;
  background: var(--g-surface);
  border-bottom: 1px solid var(--g-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 6px;
  flex-shrink: 0;
}

#gantt-root #zoombar span {
  font-size: 11px;
  color: var(--g-txt-dim);
  font-weight: 500;
  margin-right: 2px;
}

#gantt-root .zbtn {
  background: var(--g-surface2);
  border: 1px solid var(--g-border);
  color: var(--g-txt-dim);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all .15s;
}

#gantt-root .zbtn:hover,
#gantt-root .zbtn.active {
  background: var(--g-accent);
  color: #fff;
  border-color: var(--g-accent);
}

/* Legend */
#gantt-root .g-legend {
  display: flex;
  gap: 10px;
  margin-left: auto;
  align-items: center;
}
#gantt-root .g-li {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--g-txt-dim);
}
#gantt-root .g-ld {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   MAIN LAYOUT
════════════════════════════════════════════════════════════ */
#gantt-root #gantt-wrap {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ════════════════════════════════════════════════════════════
   LEFT GRID PANEL
════════════════════════════════════════════════════════════ */
#gantt-root #grid-panel {
  width: var(--g-grid-w);
  min-width: var(--g-grid-w);
  max-width: var(--g-grid-w);
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--g-border);
  overflow: hidden;
  flex-shrink: 0;
}

#gantt-root #grid-header {
  height: var(--g-header-h);
  background: var(--g-surface2);
  border-bottom: 1px solid var(--g-border);
  display: flex;
  flex-shrink: 0;
}

#gantt-root .gh {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--g-txt-dim);
  letter-spacing: .06em;
  text-transform: uppercase;
  border-right: 1px solid var(--g-border);
  padding: 0 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
#gantt-root .gh.act {
  flex: 1;
  justify-content: flex-start;
  padding-left: 28px;
}

/* Grid body scroll */
#gantt-root #grid-body {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}
#gantt-root #grid-body::-webkit-scrollbar       { width: 5px; }
#gantt-root #grid-body::-webkit-scrollbar-track { background: var(--g-surface); }
#gantt-root #grid-body::-webkit-scrollbar-thumb { background: var(--g-border-light); border-radius: 3px; }

/* Grid rows */
#gantt-root .gr {
  display: flex;
  align-items: center;
  height: var(--g-row-h);
  border-bottom: 1px solid var(--g-border);
  transition: background .1s;
  cursor: default;
}
#gantt-root .gr:hover            { background: var(--g-surface2); }
#gantt-root .gr.row-project      { background: #e4ddd5; }
#gantt-root .gr.row-planned      { background: #f0eef8; } /*var(--g-surface);*/
#gantt-root .gr.row-real         { background: #f5f2ee; }
#gantt-root .gr.row-financial    { background: #f2f5ee; }
#gantt-root .gr.row-antici       { background: #f2f5ee; }

/* Grid cells */
#gantt-root .gc {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--g-txt);
  border-right: 1px solid var(--g-border);
  height: 100%;
  padding: 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
#gantt-root .gc.act  { flex: 1; justify-content: flex-start; padding-left: 0; }
#gantt-root .gc.mono { font-family: 'DM Mono', monospace; font-size: 10.5px; }

/* Tree indent */
#gantt-root .tree-indent {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#gantt-root .toggle-btn {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  background: var(--g-border-light);
  color: var(--g-txt-dim);
  font-size: 9px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
  border: none;
  font-family: 'DM Sans', sans-serif;
}
#gantt-root .toggle-btn:hover { background: var(--g-accent); color: #fff; }

/* Activity names */
#gantt-root .act-name {
  margin-left: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#gantt-root .act-name.proj    { font-size: 12px; font-weight: 600; color: var(--g-txt); }
#gantt-root .act-name.planned { font-size: 11px; color: var(--g-txt-dim); }
#gantt-root .act-name.sub     { font-size: 10.5px; color: var(--g-txt-muted); }

/* CTR badge */
#gantt-root .ctr-badge {
  background: var(--g-purple);
  color: #fff;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: .06em;
  flex-shrink: 0;
}

/* RC dot */
#gantt-root .rc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--g-today);
  display: inline-block;
}

/* Pct text colors */
#gantt-root .pct-plan { color: var(--g-accent2)  !important; font-weight: 600; font-family: 'DM Mono', monospace; font-size: 10.5px; }
#gantt-root .pct-ok   { color: var(--g-green)    !important; font-weight: 600; font-family: 'DM Mono', monospace; font-size: 10.5px; }
#gantt-root .pct-warn { color: var(--g-yellow)   !important; font-weight: 600; font-family: 'DM Mono', monospace; font-size: 10.5px; }
#gantt-root .pct-bad  { color: var(--g-red)      !important; font-weight: 600; font-family: 'DM Mono', monospace; font-size: 10.5px; }
#gantt-root .pct-fin  { color: var(--g-lime)     !important; font-weight: 600; font-family: 'DM Mono', monospace; font-size: 10.5px; }
#gantt-root .pct-proj { color: var(--g-txt-dim)  !important; font-weight: 500; font-family: 'DM Mono', monospace; font-size: 10.5px; }

/* Duration with ? */
#gantt-root .dur-uncertain { color: var(--g-red) !important; }

/* ════════════════════════════════════════════════════════════
   RIGHT TIMELINE PANEL
════════════════════════════════════════════════════════════ */
#gantt-root #timeline-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#gantt-root #tl-header {
  height: var(--g-header-h);
  background: var(--g-surface2);
  border-bottom: 1px solid var(--g-border);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

#gantt-root #tl-header-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
}

#gantt-root .tl-row-months,
#gantt-root .tl-row-quinc {
  display: flex;
  align-items: center;
  height: 50%;
}

/* Month header */
#gantt-root .tl-month {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  color: var(--g-txt-dim);
  letter-spacing: .05em;
  text-transform: uppercase;
  border-right: 1px solid var(--g-border);
  border-bottom: 1px solid var(--g-border);
  background: var(--g-surface2);
  flex-shrink: 0;
  height: 100%;
}

/* Quincena header */
#gantt-root .tl-quinc {
  width: var(--g-col-w);
  flex-shrink: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  color: var(--g-txt-muted);
  border-right: 1px solid var(--g-border);
}
#gantt-root .tl-quinc.q2    { color: var(--g-txt-dim); }
#gantt-root .tl-quinc.today {
  background: rgba(220,38,38,.08);
  color: var(--g-today) !important;
  font-weight: 600;
}

/* Timeline body */
#gantt-root #tl-body {
  overflow: auto;
  flex: 1;
  position: relative;
}
#gantt-root #tl-body::-webkit-scrollbar        { width: 5px; height: 5px; }
#gantt-root #tl-body::-webkit-scrollbar-track  { background: var(--g-surface); }
#gantt-root #tl-body::-webkit-scrollbar-thumb  { background: var(--g-border-light); border-radius: 3px; }

#gantt-root #tl-body-inner { position: relative; }

/* Timeline rows */
#gantt-root .tl-row {
  display: flex;
  height: var(--g-row-h);
  border-bottom: 1px solid var(--g-border);
  position: absolute;
  left: 0;
}
#gantt-root .tl-row.row-project   { background: #e4ddd5; }
#gantt-root .tl-row.row-planned   { background: #f0eef8; } /*var(--g-surface);*/
#gantt-root .tl-row.row-real      { background: #f5f2ee; }
#gantt-root .tl-row.row-financial { background: #f2f5ee; }
#gantt-root .tl-row.row-antici    { background: #f2f5ee; }


/* Quincena data cells */
#gantt-root .tl-cell {
  width: var(--g-col-w);
  flex-shrink: 0;
  height: 100%;
  border-right: 1px solid var(--g-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 9.5px;
  position: relative;
}
#gantt-root .tl-cell.today-col { background: var(--g-today-col-bg); }

/* ════════════════════════════════════════════════════════════
   GANTT BARS
════════════════════════════════════════════════════════════ */
#gantt-root .bar-wrap {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 14px;
  border-radius: 3px;
  overflow: visible;
  display: flex;
  align-items: center;
  z-index: 3;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
  transition: filter .15s;
  cursor: pointer;
}
#gantt-root .bar-wrap:hover         { filter: brightness(.93); z-index: 10; }
#gantt-root .bar-wrap.bar-project   { background: rgba(100,80,60,.15); height: 10px; }
#gantt-root .bar-wrap.bar-planned   { background: rgba(194,65,12,.15); }
#gantt-root .bar-wrap.bar-real-ok   { background: rgba(21,128,61,.12); }
#gantt-root .bar-wrap.bar-real-warn { background: rgba(180,83,9,.15); }
#gantt-root .bar-wrap.bar-real-bad  { background: rgba(185,28,28,.15); }
#gantt-root .bar-wrap.bar-financial { background: rgba(77,124,15,.12); }
#gantt-root .bar-wrap.bar-ctr       { background: rgba(109,40,217,.15); }

#gantt-root .bar-fill { height: 100%; border-radius: 3px 0 0 3px; opacity: .82; transition: border-radius .1s; }
#gantt-root .bar-fill.bar-project   { background: #8c7b6e; }
#gantt-root .bar-fill.bar-planned   { background: rgba(194, 65, 12, 0.4); }
#gantt-root .bar-fill.bar-real-ok   { background: rgba(21, 128, 61, 0.4); }
#gantt-root .bar-fill.bar-real-warn { background: rgba(180, 83, 9, 0.4); }
#gantt-root .bar-fill.bar-real-bad  { background: rgba(185, 28, 28, 0.4); }
#gantt-root .bar-fill.bar-financial { background: rgba(77, 124, 15, 0.4); }
#gantt-root .bar-fill.bar-ctr       { background: #6d28d9; }

#gantt-root .bar-label {
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  color: #292727;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  padding: 0 5px;
  white-space: nowrap;
  z-index: 1;
  flex-shrink: 0;
}

/* CTR bar */
#gantt-root .ctr-bar {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 14px;
  border-radius: 3px;
  z-index: 4;
  background: #6d28d9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  letter-spacing: .06em;
  box-shadow: 0 1px 4px rgba(109,40,217,.3);
  cursor: pointer;
  transition: filter .15s;
}
#gantt-root .ctr-bar:hover { filter: brightness(.9); z-index: 10; }

/* Today line */
#gantt-root #today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--g-today);
  z-index: 20;
  pointer-events: none;
  box-shadow: 0 0 6px rgba(220,38,38,.3);
}

/* ════════════════════════════════════════════════════════════
   TOOLTIP — fuera del root porque va en body
════════════════════════════════════════════════════════════ */
#gantt-tooltip {
  position: fixed;
  background: #faf7f4;
  border: 1px solid #c8bfb3;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 12px;
  font-family: 'DM Sans', sans-serif;
  color: #2c2825;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  z-index: 9999;
  pointer-events: none;
  display: none;
  line-height: 1.7;
  min-width: 200px;
}
#gantt-tooltip b       { color: #ea580c; }
#gantt-tooltip .tt-val { font-family: 'DM Mono', monospace; font-weight: 600; }

#gantt-root .gr.row-contrato      { background: #f5f2ee; } /* background: # f0eef8; */
#gantt-root .tl-row.row-contrato  { background: #f5f2ee; }
#gantt-root .bar-wrap.bar-contrato{ background: rgba(60,64,63,.15); } /* rgba(124,58,237,.15);*/
#gantt-root .bar-fill.bar-contrato{ background: rgba(124, 58, 237, 0.4); }

#gantt-root .bar-fill.bar-anticipo{ background: rgba(160, 125, 222, 0.4); }

