/* timeline.css — roadmap / gantt */

.tl-page {
  flex: 1; display: flex; flex-direction: column;
  background: var(--surface-1);
  overflow: hidden;
}

.tl-header {
  padding: 18px 24px 14px;
  background: white;
  border-bottom: 1px solid var(--divider);
}
.tl-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.tl-title { font-size: 20px; font-weight: 700; color: var(--ink-1); letter-spacing: -0.012em; }
.tl-sub   { font-size: 12px; color: var(--ink-muted); margin-top: 2px; font-weight: 500; }

.tl-kpis { display: flex; gap: 8px; }
.tl-kpi {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 14px; background: var(--surface-1);
  border-radius: 8px; min-width: 84px;
  border: 1px solid var(--divider);
}
.tl-kpi-label { font-size: 10px; color: var(--ink-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.tl-kpi-value { font-size: 16px; color: var(--ink-1); font-weight: 700; font-variant-numeric: tabular-nums; }
.tl-kpi.warn .tl-kpi-value { color: var(--warn); }
.tl-kpi.danger .tl-kpi-value { color: var(--danger); }
.tl-kpi.good .tl-kpi-value { color: var(--success); }

.tl-toolbar { display: flex; align-items: center; gap: 10px; }
.tl-zoom {
  display: inline-flex; background: var(--surface-1); border: 1px solid var(--divider);
  border-radius: 8px; padding: 3px;
}
.tl-zoom button {
  padding: 5px 12px; font-size: 12px; font-weight: 600; color: var(--ink-muted);
  background: transparent; border: none; border-radius: 5px; cursor: pointer;
}
.tl-zoom button.is-active { background: white; color: var(--ink-1); box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.tl-filters { display: inline-flex; gap: 6px; }
.tl-filter {
  padding: 5px 10px; font-size: 12px; font-weight: 500; color: var(--ink-1);
  background: white; border: 1px solid var(--divider); border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.tl-filter:hover { border-color: var(--ink-muted); }
.tl-filter.has-value { color: var(--brand); border-color: var(--brand); background: color-mix(in oklab, var(--brand) 6%, white); }

/* Legend */
.tl-legend { display: inline-flex; align-items: center; gap: 12px; font-size: 11px; color: var(--ink-muted); font-weight: 500; }
.tl-legend-item { display: inline-flex; align-items: center; gap: 5px; }
.tl-legend-dot { width: 10px; height: 10px; border-radius: 3px; }

/* ── Chart layout ──────────────────────────────────────────── */
.tl-chart {
  flex: 1; display: grid; grid-template-columns: 232px 1fr;
  min-height: 0; background: white;
}
.tl-chart-left {
  border-right: 1px solid var(--divider);
  display: flex; flex-direction: column;
  background: white;
  overflow: hidden;
}
.tl-chart-right {
  position: relative;
  overflow: auto;
  background:
    linear-gradient(to bottom, var(--divider) 1px, transparent 1px) 0 0 / 100% var(--tl-row-h, 44px);
}

/* Header cells (sticky top) */
.tl-head-left, .tl-head-right {
  position: sticky; top: 0; z-index: 4;
  background: white;
  border-bottom: 1px solid var(--divider);
}
.tl-head-left {
  padding: 8px 12px;
  display: flex; flex-direction: column; gap: 2px; justify-content: flex-end;
  height: 56px; min-height: 56px;
}
.tl-head-left .tl-head-title { font-size: 11px; color: var(--ink-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.tl-head-left .tl-head-sub   { font-size: 11px; color: var(--ink-muted); font-weight: 500; }

.tl-head-right { height: 56px; min-height: 56px; display: flex; flex-direction: column; }
.tl-quarters, .tl-months { display: flex; height: 22px; }
.tl-quarters { border-bottom: 1px solid var(--divider); }
.tl-months   { height: 34px; }

.tl-q-cell {
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--ink-2);
  border-right: 1px solid var(--divider);
  background: var(--surface-1);
  letter-spacing: .04em;
}
.tl-m-cell {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  padding: 4px 8px;
  font-size: 12px; font-weight: 700; color: var(--ink-1);
  border-right: 1px solid var(--divider);
  position: relative;
}
.tl-m-cell .tl-m-year { font-size: 9px; font-weight: 500; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .06em; margin-top: -1px; }

/* Left-side project group headers */
.tl-proj-group {
  padding: 10px 12px 6px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--divider);
  border-top: 1px solid var(--divider);
  position: sticky; left: 0;
}
.tl-proj-group:first-of-type { border-top: none; }
.tl-proj-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.tl-proj-name { font-size: 12px; font-weight: 700; color: var(--ink-1); letter-spacing: -0.005em; flex: 1; }
.tl-proj-count { font-size: 10px; color: var(--ink-muted); font-weight: 600; background: white; padding: 2px 6px; border-radius: 999px; }

/* Left-side epic rows */
.tl-epic-row {
  height: var(--tl-row-h, 44px); min-height: var(--tl-row-h, 44px);
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  font-size: 12px;
}
.tl-epic-row:hover { background: var(--surface-1); }
.tl-epic-row.is-active { background: color-mix(in oklab, var(--brand) 8%, white); }
.tl-epic-handle { width: 3px; height: 22px; border-radius: 2px; flex-shrink: 0; }
.tl-epic-name {
  font-weight: 600; color: var(--ink-1);
  flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.tl-epic-owner { flex-shrink: 0; }

/* ── Right side — bars & rows ──────────────────────────────── */
.tl-body {
  position: relative;
}
.tl-proj-group-row {
  height: 29px; background: var(--surface-1); border-bottom: 1px solid var(--divider);
  border-top: 1px solid var(--divider);
  position: relative;
}
.tl-proj-group-row:first-of-type { border-top: none; }

.tl-epic-lane {
  position: relative;
  height: var(--tl-row-h, 44px);
  border-bottom: 1px solid var(--divider);
}
.tl-epic-lane:nth-child(even) { background: color-mix(in oklab, var(--surface-1) 40%, white); }

/* Week grid lines */
.tl-week-lines {
  position: absolute; inset: 0; pointer-events: none;
  background-repeat: repeat-x;
  background-position: 0 0;
}

/* Today line */
.tl-today-line {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: var(--danger);
  pointer-events: none;
  z-index: 3;
}
.tl-today-line::before {
  content: "TODAY";
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 800; color: white; background: var(--danger);
  padding: 2px 6px; border-radius: 3px; letter-spacing: .06em; white-space: nowrap;
}

/* Sprint ribbons across the top */
.tl-sprint-ribbon {
  position: absolute; top: 0; height: 22px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
  color: var(--ink-muted);
  background: color-mix(in oklab, var(--surface-1) 40%, white);
  border: 1px solid var(--divider);
  border-top: none; border-radius: 0 0 4px 4px;
  z-index: 2;
  overflow: hidden;
}
.tl-sprint-ribbon.is-active {
  background: color-mix(in oklab, #0073ea 14%, white);
  color: #0073ea; border-color: color-mix(in oklab, #0073ea 30%, white);
}
.tl-sprint-ribbon.is-past { opacity: .5; }

/* Epic bars */
.tl-bar {
  position: absolute;
  top: 7px; height: calc(var(--tl-row-h, 44px) - 14px);
  border-radius: 7px;
  display: flex; align-items: center;
  padding: 0 10px;
  color: white; font-size: 11px; font-weight: 700;
  overflow: hidden; cursor: pointer;
  box-shadow: 0 1px 2px rgba(16,22,40,.08), inset 0 0 0 1px rgba(255,255,255,.18);
  transition: transform .12s ease, box-shadow .12s ease;
  white-space: nowrap;
}
.tl-bar:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(16,22,40,.14), inset 0 0 0 1px rgba(255,255,255,.3); }
.tl-bar.is-at-risk  { outline: 1.5px dashed var(--warn); outline-offset: 1px; }
.tl-bar.is-off-track { outline: 1.5px dashed var(--danger); outline-offset: 1px; }

.tl-bar-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: rgba(255,255,255,.26);
  pointer-events: none;
}
.tl-bar-label {
  position: relative; z-index: 1;
  text-overflow: ellipsis; overflow: hidden;
  display: flex; align-items: center; gap: 6px; min-width: 0;
}
.tl-bar-label span { overflow: hidden; text-overflow: ellipsis; }
.tl-bar-pct {
  position: relative; z-index: 1;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  opacity: .9;
  font-size: 10px;
  padding-left: 8px;
}
.tl-bar-owner {
  position: relative; z-index: 1;
  margin-right: -4px;
}

/* Status pip on bar */
.tl-bar-status {
  width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.7);
}
.tl-bar-status.on-track { background: var(--success); }
.tl-bar-status.at-risk   { background: var(--warn); }
.tl-bar-status.off-track { background: var(--danger); }

/* Milestone diamond */
.tl-milestone {
  position: absolute;
  width: 14px; height: 14px;
  top: calc(50% - 7px);
  background: #0f1729;
  transform: rotate(45deg);
  border: 2px solid white;
  z-index: 2;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.tl-milestone::after {
  content: attr(data-label);
  position: absolute;
  top: -28px; left: 50%;
  transform: rotate(-45deg) translateX(-50%);
  white-space: nowrap;
  background: #0f1729; color: white;
  font-size: 10px; font-weight: 700;
  padding: 3px 7px; border-radius: 4px;
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease;
  transform-origin: left center;
}
.tl-milestone:hover::after { opacity: 1; }

/* Dependency arrows layer */
.tl-deps { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.tl-deps path { fill: none; stroke: var(--ink-muted); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: .55; }
.tl-deps .tl-dep-head { fill: var(--ink-muted); opacity: .75; }
