:root {
  --timeline-height-offset: 74px;
}

.timeline-page-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1rem;
  min-height: calc(100vh - var(--timeline-height-offset));
}

.timeline-panel {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}

.timeline-toolbar {
  position: relative;
  width: 100%;
  max-height: none;
  overflow: visible;
  padding: 0.8rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.timeline-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.55rem;
}

.timeline-filters h2 {
  margin: 0;
  font-size: 1rem;
  width: 100%;
}

.timeline-filters label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.9rem;
  min-width: 180px;
  flex: 1 1 200px;
}

.timeline-filters input,
.timeline-filters select,
.timeline-filter-actions button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 0.42rem;
  font-size: 0.9rem;
}

.timeline-range-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  min-width: 280px;
}

.timeline-filter-actions button {
  cursor: pointer;
  border: 1px solid var(--line-strong);
}

.timeline-filter-actions button:hover {
  background: var(--surface);
}

.timeline-filter-actions {
  min-width: 220px;
  flex: 0 0 auto;
}

.timeline-stage {
  min-height: calc(100vh - 220px);
  overflow: auto;
  padding: 1rem;
}

.timeline-meta {
  margin: 0 0 0.9rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline-board {
  border: 1px solid var(--line);
  background: #fff;
  padding: 0.8rem;
  margin-bottom: 0.9rem;
}

.timeline-shared-lane {
  position: relative;
  height: 120px;
  border: 1px solid var(--line);
  background: #fdfdfd;
  overflow: hidden;
}

.timeline-shared-axis {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border-top: 2px solid var(--line-strong);
}

.timeline-cursor-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #6a6a6a;
  opacity: 0;
  pointer-events: none;
}

.timeline-cursor-note {
  position: absolute;
  top: 0.4rem;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 0.78rem;
  padding: 0.15rem 0.35rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.timeline-point-marker {
  position: absolute;
  width: 0;
  height: 68px;
  top: 26px;
  border-left: 2px solid #4472c4;
  text-decoration: none;
}

.timeline-range-marker {
  position: absolute;
  top: 50px;
  height: 16px;
  border: 1px solid #4472c4;
  background: #dce8ff;
  text-decoration: none;
}

.timeline-marker-badge {
  position: absolute;
  left: 50%;
  top: -18px;
  transform: translateX(-50%);
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid #4472c4;
  background: #ffffff;
  color: #2b4f91;
  font-size: 0.72rem;
  line-height: 16px;
  text-align: center;
}

.timeline-undated-note {
  position: absolute;
  left: 0.6rem;
  bottom: 0.45rem;
  border: 1px dashed var(--line-strong);
  background: #f2f2f2;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.15rem 0.45rem;
}

.timeline-name-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.timeline-name-item {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.4rem 0.55rem;
}

.timeline-name-index {
  display: inline-block;
  min-width: 2rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.timeline-name-item a {
  color: var(--link);
  text-decoration: none;
}

.timeline-name-item a:hover {
  text-decoration: underline;
}

.timeline-empty {
  border: 1px dashed var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  padding: 0.8rem;
}

@media (max-width: 1120px) {
  :root {
    --timeline-height-offset: 120px;
  }

  .timeline-toolbar {
    padding: 0.7rem;
  }
}

@media (max-width: 760px) {
  :root {
    --timeline-height-offset: 140px;
  }

  .timeline-page-layout {
    padding: 0.2rem;
  }

  .timeline-stage {
    padding: 0.7rem;
  }

  .timeline-filters {
    display: grid;
  }

  .timeline-filters label,
  .timeline-range-grid,
  .timeline-filter-actions {
    min-width: 0;
    width: 100%;
  }

  .timeline-range-grid {
    grid-template-columns: 1fr;
  }

  .timeline-shared-lane {
    height: 100px;
  }
}
