.clinical-timeline {
  min-width: 0;
}

.timeline-toolbar,
.timeline-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-toolbar {
  justify-content: space-between;
  gap: 16px;
}

.timeline-eyebrow {
  margin: 0 0 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.timeline-eyebrow span {
  margin-left: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

.timeline-range {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.timeline-legend {
  margin: 16px 0 8px;
}

.timeline-kind--diagnosis {
  --timeline-event-color: var(--accent-dim);
}

.timeline-kind--finding {
  --timeline-event-color: var(--success);
}

.timeline-kind--therapy {
  --timeline-event-color: var(--warning);
}

.timeline-symbol {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--timeline-event-color);
}

.timeline-symbol.timeline-kind--finding,
.timeline-plot .vis-dot.timeline-kind--finding {
  border-radius: 1px;
}

.timeline-symbol.timeline-kind--therapy,
.timeline-plot .vis-dot.timeline-kind--therapy {
  border-radius: 1px;
  rotate: 45deg;
}

.clinical-timeline .timeline-plot .vis-timeline {
  border: 0;
  font-family: var(--font-sans);
  font-size: 12px;
}

.clinical-timeline .timeline-plot .vis-panel,
.clinical-timeline .timeline-plot .vis-time-axis .vis-grid.vis-major {
  border-color: var(--border);
}

.clinical-timeline .timeline-plot .vis-time-axis .vis-grid.vis-minor {
  border-color: var(--border-subtle);
}

.clinical-timeline .timeline-plot .vis-time-axis .vis-text {
  color: var(--text-secondary);
}

.clinical-timeline .timeline-plot .vis-item.vis-point {
  border: 0;
  background: transparent;
  color: var(--text-primary);
}

.clinical-timeline .timeline-plot .vis-item .vis-item-content {
  padding: 0;
}

.clinical-timeline .timeline-plot .vis-item.vis-dot {
  border-width: 5px;
  border-color: var(--timeline-event-color);
  border-radius: 50%;
  background: var(--timeline-event-color);
}

.timeline-plot .vis-item.vis-dot.timeline-kind--finding,
.timeline-plot .vis-item.vis-dot.timeline-kind--therapy {
  border-radius: 1px;
}

.timeline-plot .vis-dot.vis-selected {
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.timeline-point {
  display: block;
  min-width: 22px;
  min-height: 28px;
  padding: 4px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.timeline-point:hover,
.vis-selected .timeline-point {
  background: var(--accent-soft);
}

.timeline-point:focus-visible,
.timeline-window button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.timeline-point-caption {
  display: block;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline--compact .timeline-point-caption {
  display: none;
}

.timeline-hint {
  margin: 8px 0 16px;
  color: var(--text-secondary);
  font-size: 12px;
}

.timeline-navigator {
  padding: 14px 0;
  border-block: 1px solid var(--border);
}

.timeline-overview {
  position: relative;
  height: 64px;
  margin: 12px 24px 8px;
  background: var(--bg-surface);
  touch-action: none;
}

.timeline-overview svg {
  display: block;
  width: 100%;
  height: 100%;
}

.timeline-overview-point {
  fill: var(--timeline-event-color);
}

.timeline-window {
  position: absolute;
  top: 0;
  height: 100%;
  border-block: 1px solid var(--accent-border);
  background: var(--accent-soft);
}

.timeline-window-move {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: grab;
}

.timeline-window-move:active {
  cursor: grabbing;
}

.timeline-window-handle {
  position: absolute;
  top: -1px;
  width: 24px;
  height: calc(100% + 2px);
  padding: 0;
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--accent-dim);
  font-size: 20px;
  cursor: ew-resize;
}

.timeline-window-handle--start {
  left: 0;
  translate: -100% 0;
}

.timeline-window-handle--end {
  right: 0;
  translate: 100% 0;
}

.timeline-extent {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.timeline-selection {
  display: block;
  margin: 20px 0;
}

.timeline-selection[busy] {
  opacity: 0.5;
}

.timeline-event-table {
  margin-top: 16px;
}

.timeline-event-table summary {
  padding: 8px 0;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}

.timeline-event-table .table-wrapper {
  overflow-x: auto;
}

.timeline-event.card {
  margin: 0;
  padding: 20px;
}

.timeline-event-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.timeline-event-kind {
  margin: 0 0 3px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.3;
  text-transform: uppercase;
}

.timeline-event-date {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
}

.timeline-event-date--unknown {
  color: var(--text-muted);
  font-weight: 400;
}

.timeline-event-title {
  margin: 0 0 5px;
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.2;
}

.timeline-event-meta {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.timeline-event-copy {
  margin-top: 16px;
}

.timeline-event-copy p {
  margin: 0 0 8px;
}

.timeline-event-copy p:last-child {
  margin-bottom: 0;
}

.timeline-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 18px;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.timeline-details > div {
  min-width: 0;
}

.timeline-details dt {
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.timeline-details dd {
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.timeline-event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

@media (max-width: 640px) {
  .timeline-eyebrow span {
    display: block;
    margin: 4px 0 0;
  }

  .timeline-event.card {
    padding: 16px;
  }

  .timeline-event-header {
    display: block;
  }

  .timeline-event-date {
    margin-top: 8px;
  }
}
