.timeline {
  display: flex;
  height: 100%;
  min-height: 0;
}

.tl-side {
  width: 264px;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-panel);
  min-height: 0;
}
.tl-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px 7px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.tl-side-head .count {
  font-family: var(--mono);
  color: var(--text-faint);
  font-size: 11px;
}
.tl-bucket {
  flex: 1;
  overflow: auto;
  padding: 8px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tl-bucket-empty {
  padding: 14px 8px;
  color: var(--text-faint);
  font-size: 12px;
}
.tl-side.drop-target {
  outline: 1px dashed var(--accent);
  outline-offset: -4px;
  background: var(--accent-soft);
}
.tl-brow {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: var(--radius-sm);
}
.tl-brow:hover {
  background: var(--bg-sunken);
}
.tl-btoggle {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
}
.tl-btoggle:hover {
  color: var(--text);
  background: var(--border);
}
.tl-btoggle-space {
  width: 16px;
  flex: 0 0 auto;
}
.tl-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  font-size: 12px;
  cursor: grab;
}
.tl-chip:hover {
  border-color: var(--border-strong);
}
.tl-chip.dragging {
  opacity: 0.4;
}
.tl-chip.is-context {
  background: transparent;
  border-style: dashed;
  color: var(--text-dim);
  cursor: default;
}
.tl-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.tl-chip .ci-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-chip .ci-dur {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
  flex: 0 0 auto;
}
.tl-chip:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}
.tl-chip.c-maybe {
  border-style: dashed;
}
.tl-chip.c-idea {
  border-style: dashed;
  opacity: 0.72;
}

.tl-center {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.tl-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  flex: 0 0 auto;
}
.tl-toolbar-info {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-left: 4px;
}
.tl-toolbar-spacer {
  flex: 1;
}
.seg {
  display: flex;
  gap: 0;
}
.seg .btn {
  border-radius: 0;
  border-left-width: 0;
}
.seg .btn:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-left-width: 1px;
}
.seg .btn:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.seg .btn.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.tl-grid-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}
.tl-grid-wrap.drop-target {
  box-shadow: inset 0 0 0 1px var(--accent);
}
.tl-grid {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  position: relative;
}

.tl-axis {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.tl-corner {
  position: sticky;
  left: 0;
  z-index: 9;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 0 12px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
}
.tl-corner-title {
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.3px;
  color: var(--text-dim);
}
.tl-corner-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
}
.tl-ticks {
  position: relative;
  flex: 0 0 auto;
}
.tl-tier {
  position: relative;
}
.tl-tier-major {
  border-bottom: 1px solid var(--border);
}
.tl-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid var(--border);
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
}
.tl-tick-major {
  padding: 0;
  overflow: visible;
  border-left-color: var(--border-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.tl-tick-label {
  position: sticky;
  left: 200px;
  padding: 0 6px;
  white-space: nowrap;
}
.tl-tick-minor {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-dim);
}
.tl-tier-days {
  border-top: 1px solid var(--border);
}
.tl-day {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--text-faint);
  border-left: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}
.tl-day.we {
  color: var(--text-dim);
  background: color-mix(in srgb, var(--text) 4%, transparent);
}
.tl-today-chip {
  position: absolute;
  bottom: 2px;
  margin-left: 4px;
  z-index: 20;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--bad);
  color: var(--accent-text);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.tl-lanes {
  position: relative;
  flex: 1 1 auto;
}
.tl-canvas-bg {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.tl-band {
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--text);
  opacity: 0.018;
}
.tl-weekend {
  position: absolute;
  inset: 0;
}
.tl-past {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: var(--bg-sunken);
  opacity: 0.55;
}
.tl-vline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
}
.tl-vline.minor {
  background: var(--border);
  opacity: 0.5;
}
.tl-vline.major {
  background: var(--border-strong);
  opacity: 0.8;
}
.tl-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--bad);
  opacity: 0.7;
}

.tl-lane {
  display: flex;
  position: relative;
  z-index: 2;
}
.tl-lane-label {
  position: sticky;
  left: 0;
  z-index: 6;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.lane-color {
  width: 13px;
  height: 13px;
  padding: 0;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: none;
  cursor: pointer;
}
.lane-name {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lane-count {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-faint);
}
.lane-del {
  opacity: 0;
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 12px;
  padding: 2px;
  border-radius: 2px;
}
.tl-lane-label:hover .lane-del {
  opacity: 1;
}
.lane-del:hover {
  color: var(--bad);
}
.tl-lane-track {
  position: relative;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--border);
}

.tl-item {
  position: absolute;
  height: 26px;
  display: flex;
  align-items: center;
  padding: 0 9px;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 72%, var(--border-strong));
  background: color-mix(in srgb, var(--c, var(--accent)) 24%, var(--bg-elev));
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: grab;
  user-select: none;
  overflow: hidden;
  z-index: 3;
  touch-action: none;
}
.tl-item.dragging {
  cursor: grabbing;
  z-index: 12;
  opacity: 0.9;
}
.tl-item:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
  z-index: 5;
}
.tl-item.c-maybe {
  border-style: dashed;
}
.tl-item.c-idea {
  border-style: dashed;
  opacity: 0.72;
}
.tl-item.is-done {
  opacity: 0.55;
}
.tl-item.is-overdue {
  border-color: var(--bad);
}
.tl-item.is-done .tl-item-title {
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
}
.tl-cap {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: color-mix(in srgb, var(--c, var(--accent)) 88%, transparent);
}
.tl-item-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--c, var(--accent)) 38%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--c, var(--accent)) 60%, transparent);
  pointer-events: none;
}
.tl-item-title {
  position: relative;
  z-index: 2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 10px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: ew-resize;
  border-left: 1px solid color-mix(in srgb, var(--c, var(--accent)) 40%, transparent);
  background: color-mix(in srgb, var(--c, var(--accent)) 8%, transparent);
}
.tl-grip {
  width: 2px;
  height: 11px;
  border-radius: 1px;
  background: color-mix(in srgb, var(--c, var(--accent)) 65%, var(--text-faint));
  opacity: 0.55;
}
.tl-item:hover .tl-grip {
  opacity: 1;
}

.tl-point {
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
  width: 0;
}
.tl-marker {
  position: absolute;
  left: 0;
  top: 7px;
  width: 12px;
  height: 12px;
  background: color-mix(in srgb, var(--c, var(--accent)) 34%, var(--bg-elev));
  border: 1.5px solid var(--c, var(--accent));
  border-radius: 2px;
  transform: rotate(45deg);
}
.tl-point.is-done .tl-marker {
  opacity: 0.5;
}
.tl-point.is-overdue .tl-marker {
  border-color: var(--bad);
}
.tl-point-label {
  position: absolute;
  left: 16px;
  top: 2px;
  height: 22px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  background: var(--bg-panel);
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 60%, var(--border-strong));
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  z-index: 2;
}
.tl-point.is-done .tl-point-label {
  text-decoration: line-through;
  text-decoration-color: var(--text-faint);
  opacity: 0.7;
}
.tl-point.is-overdue .tl-point-label {
  border-color: var(--bad);
}
.tl-point-label .pct {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}

.tl-deps {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  overflow: visible;
  pointer-events: none;
}
.tl-dep {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.25;
  stroke-linejoin: round;
}
.tl-dep-dot {
  fill: var(--border-strong);
}
.tl-arrow-head {
  fill: var(--border-strong);
}

.tl-empty-hint {
  position: absolute;
  left: 50%;
  top: 92px;
  transform: translateX(-50%);
  z-index: 10;
  max-width: 420px;
  padding: 12px 16px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text-dim);
  font-size: 12.5px;
  pointer-events: none;
}
