/* The timeline (docs/V3.md #19, R1b): the Tasks page view Timeline, the All projects Timeline and the
   phone sheet "Change dates". Only the color tokens of app.css (rule 7); a project's color is data, set
   inline as --tl-edge. Strong color only for an overdue edge (--down), the today line (--teal), the Day 0
   line (--lime) and the diamonds. One scroll box: the page itself never scrolls sideways (rule 8). */
.tl-wrap {
  --tl-shade: color-mix(in srgb, var(--text) 4%, transparent);
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
}

/* the zoom row */
.tl-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.tl-tools-label { font-size: 13px; color: var(--text-3); }
.tl-tools .btn[aria-pressed="true"] { background: var(--surface-3); border-color: var(--line-2); }
.tl-zoom { padding: 3px; }
.tl-zoom .tab { height: 30px; padding: 0 12px; font-size: 13px; }
.tl-hint { margin: -4px 0 0; text-align: right; font-size: 12.5px; color: var(--text-3); }

/* the card and the one scroll box */
.tl-card { overflow: hidden; min-width: 0; }
.tl-box {
  position: relative; overflow: auto; max-height: max(340px, calc(100dvh - 300px));
  overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.tl-grid { position: relative; user-select: none; -webkit-user-select: none; }
.tl-head { position: sticky; top: 0; z-index: 4; display: flex; background: var(--surface); border-bottom: 1px solid var(--line); }
.tl-corner {
  position: sticky; left: 0; z-index: 5; flex: none; width: var(--tl-names); display: flex; align-items: flex-end;
  padding: 0 12px 9px; background: var(--surface); border-right: 1px solid var(--line); overflow: hidden;
}
.tl-scale { position: relative; flex: none; overflow: hidden; }
.tl-hshade { position: absolute; top: 18px; bottom: 0; background: var(--tl-shade); }
.tl-hmonth {
  position: absolute; top: 0; height: 18px; display: flex; align-items: center; border-left: 1px solid var(--line-2);
  font: 600 10.5px var(--font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--text-2);
  white-space: nowrap; overflow: hidden;
}
.tl-hmonth > span { position: sticky; left: var(--tl-names); padding: 0 6px; }
.tl-htoday { position: absolute; height: 22px; display: grid; place-items: center; }
.tl-htoday > span {
  display: inline-grid; place-items: center; height: 18px; padding: 0 5px; border-radius: var(--radius-pill);
  background: var(--teal); color: var(--teal-ink); font: 600 10.5px var(--font-mono); font-variant-numeric: tabular-nums;
}
.tl-hnum { position: absolute; height: 22px; display: grid; place-items: center; font: 500 11.5px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-2); }
.tl-hnum > span { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 4px; border-radius: var(--radius-pill); }
.tl-hnum.is-we { color: var(--text-3); }
.tl-hnum.is-today > span { background: var(--teal); color: var(--teal-ink); font-weight: 600; }
.tl-htick {
  position: absolute; height: 22px; display: flex; align-items: center; padding-left: 4px; border-left: 1px solid var(--line-2);
  font: 500 10.5px var(--font-mono); color: var(--text-3); white-space: nowrap;
}
.tl-htick.is-today { color: var(--teal); font-weight: 600; border-left-color: var(--teal); }
.tl-hdl { position: absolute; height: 16px; display: grid; place-items: center; font: 500 11.5px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.tl-hdl.is-today { color: var(--teal); font-weight: 600; }
.tl-hdl.is-d0 { color: var(--lime-text); font-weight: 600; }
.tl-hwd { position: absolute; height: 16px; display: grid; place-items: center; font-size: 11.5px; color: var(--text-2); }
.tl-hline { position: absolute; bottom: 0; height: 6px; width: 2px; margin-left: -1px; border-radius: 2px 2px 0 0; }
.tl-hline.is-today { background: var(--teal); }
.tl-hline.is-d0 { background: var(--lime); box-shadow: 1px 0 0 var(--lime-text); }

/* the rows */
.tl-body { position: relative; }
.tl-under { position: absolute; top: 0; bottom: 0; left: var(--tl-names); width: var(--tl-chart); z-index: 0; pointer-events: none; }
.tl-shade { position: absolute; top: 0; bottom: 0; background: var(--tl-shade); }
.tl-vline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: .45; }
.tl-vline.is-week { opacity: .9; }
.tl-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; }
.tl-line.is-today { background: var(--teal); }
.tl-line.is-d0 { background: var(--lime); box-shadow: 1px 0 0 var(--lime-text); }   /* the olive edge finds the lime line in light */
.tl-row { position: relative; display: flex; height: var(--tl-row); }
.tl-row.is-ms, .tl-row.is-proj { border-top: 1px solid var(--line); }
.tl-under + .tl-row { border-top: 0; }
.tl-name {
  position: sticky; left: 0; z-index: 3; flex: none; width: var(--tl-names); height: 100%; display: flex; align-items: center;
  gap: 7px; min-width: 0; margin: 0; padding: 0 10px 0 12px; border: 0; border-right: 1px solid var(--line); border-radius: 0;
  background: var(--surface); color: var(--text-2); font: 500 13.5px var(--font-ui); text-align: left; cursor: pointer; overflow: hidden;
}
a.tl-name:hover, button.tl-name:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
/* The name column is a sticky row-header cell (W3C treegrid) around the name's own button or link. */
.tl-namecell { position: sticky; left: 0; z-index: 3; flex: none; display: flex; width: var(--tl-names); height: 100%;
  background: var(--surface); border-right: 1px solid var(--line); }
.tl-namecell > .tl-name { position: static; flex: 1 1 auto; width: auto; border-right: 0; }
.tl-name:focus-visible { outline-offset: -2px; }
.tl-name-text { flex: 1 1 auto; min-width: 0; }
.tl-name-task { padding-left: 34px; }
.tl-name-task.is-done .tl-name-text { color: var(--text-3); }
.tl-name-ms { color: var(--text); font-weight: 600; }
.tl-name-ms > svg { flex: none; color: var(--text-3); }
.tl-name-proj { color: var(--text); font-weight: 600; }
div.tl-name-proj { cursor: default; }
.tl-proj-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.tl-nodia { width: 14px; flex: none; }
.tl-name-lock { display: inline-flex; flex: none; color: var(--text-3); }
.tl-count { flex: none; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.tl-state { flex: none; font-size: 11.5px; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.tl-state.is-done { color: var(--up); }
.tl-state.is-overdue { color: var(--down); }
.tl-name .avatar { flex: none; width: 20px; height: 20px; font-size: 9px; }
.tl-mark { flex: none; display: inline-grid; place-items: center; width: 14px; height: 16px; font: 700 13px var(--font-ui); }
.tl-mark.is-done { color: var(--up); }
.tl-mark.is-overdue { color: var(--down); }
.tl-name-more { padding-left: 34px; color: var(--text-3); font-size: 12.5px; }
.tl-lane { position: relative; flex: none; width: var(--tl-chart); height: 100%; }
.tl-empty-row { position: sticky; left: 0; display: flex; align-items: center; height: 46px; padding: 0 16px; font-size: 13.5px; color: var(--text-3); }
.tl-skel { padding: 6px 0; }

/* the diamond of a milestone: done green, overdue red, else grey (spec 3.4, 5.5). The Day 0 diamond is lime
   while it is still to come, and green or red like any other once it is done or overdue (lime is the Day 0
   line's color). */
.tl-dia { display: inline-flex; flex: none; color: var(--text-2); }
.tl-dia svg { fill: currentColor; fill-opacity: .18; }
.tl-dia.is-day0 { color: var(--lime-text); }
.tl-dia.is-day0 svg { fill: var(--lime); fill-opacity: .9; }
.tl-dia.is-done { color: var(--up); }
.tl-dia.is-overdue { color: var(--down); }
.tl-dia.is-day0.is-done svg, .tl-dia.is-day0.is-overdue svg { fill: currentColor; fill-opacity: .18; }

/* bars: soft colors with the project color as a 3 px edge, like the board's cards */
.tl-bar {
  position: absolute; top: 50%; z-index: 1; display: block; height: 20px; margin: -10px 0 0; padding: 0; min-width: 6px;
  --tl-fill: color-mix(in srgb, var(--tl-edge, var(--teal)) 20%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--tl-edge, var(--teal)) 45%, var(--line-2)); border-radius: 6px;
  background: var(--tl-fill); color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow: visible;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transition: box-shadow .15s var(--ease), border-color .15s var(--ease), transform .25s var(--ease), opacity .15s var(--ease);
}
.tl-bar::before { content: ""; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 3px; border-radius: 6px 0 0 6px; background: var(--tl-edge, var(--teal)); }
.tl-bar::after { content: ""; position: absolute; top: -7px; bottom: -7px; left: -5px; right: -5px; }   /* a bigger target */
.tl-bar:hover { border-color: var(--text-3); }
.tl-bar.is-movable { cursor: grab; }
.tl-bar.is-due { border-left: 2px dotted var(--text-3); }
.tl-bar.is-due::before { left: auto; right: -1px; border-radius: 0 6px 6px 0; }
.tl-bar.is-start { border-color: transparent; background: linear-gradient(90deg, var(--tl-fill) 15%, transparent); }
.tl-bar.is-overdue::before { background: var(--down); }
.tl-bar.is-overdue.is-due { border-left-color: var(--down); }
.tl-bar.is-done { opacity: .45; }
.tl-bar.is-done:hover { opacity: .7; }
.tl-grip { position: absolute; top: 1px; bottom: 1px; width: 8px; cursor: ew-resize; z-index: 1; }
.tl-grip.is-l { left: 0; }
.tl-grip.is-r { right: 0; }
.tl-grip::after { content: ""; position: absolute; top: 4px; bottom: 4px; left: 3px; width: 2px; border-radius: 2px; background: var(--text-3); opacity: 0; transition: opacity .12s var(--ease); }
.tl-bar:hover .tl-grip::after { opacity: .9; }
.tl-marks { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 5px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; pointer-events: none; }
.tl-mk { display: inline-grid; place-items: center; width: 14px; height: 16px; color: var(--text-3); font: 700 12.5px var(--font-ui); }
.tl-mk.is-done { color: var(--up); }
.tl-mk.is-after { color: var(--warn); }
.tl-bar-name { font-size: 12px; color: var(--text-2); }
.tl-cut { position: absolute; top: 50%; transform: translateY(-50%); display: inline-flex; color: var(--text-3); }
.tl-cut.is-l { left: 3px; }
.tl-cut.is-r { right: 2px; }
.tl-bar.is-pressing { transform: scale(.94); transition: transform .3s var(--ease); }
.tl-bar.is-dragging { z-index: 2; cursor: grabbing; border-color: var(--teal); box-shadow: var(--shadow-pop), 0 0 0 1px var(--teal-line); transition: none; }
.tl-bar.is-keyed { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal-line); }
body.tl-dragging, body.tl-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.tl-drag-label {
  position: absolute; top: 50%; z-index: 2; transform: translateY(-50%); padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--text); color: var(--bg); font: 500 12px var(--font-mono); font-variant-numeric: tabular-nums;
  white-space: nowrap; box-shadow: var(--shadow-pop); pointer-events: none;
}
.tl-drag-label.is-warn { background: var(--warn); color: var(--bg); }

/* milestone rows: the summary bar, the diamond, the Launch day fold */
.tl-sum { position: absolute; top: 50%; height: 6px; margin-top: -3px; border-radius: var(--radius-pill); background: var(--line-2); }
.tl-sum.is-proj { height: 8px; margin-top: -4px; background: var(--surface-3); box-shadow: inset 3px 0 0 var(--tl-edge, var(--teal)); }
.tl-ms {
  position: absolute; top: 50%; z-index: 1; display: inline-flex; align-items: center; gap: 3px; height: 24px;
  margin: -12px 0 0 -9px; padding: 0 2px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer;
}
.tl-ms .tl-dia svg { width: 18px; height: 18px; }
.tl-ms.is-movable { cursor: grab; }
.tl-ms-lock { display: inline-flex; }
.tl-ms.is-shake { animation: tl-shake .32s var(--ease); }
@keyframes tl-shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.tl-ms-label { position: absolute; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; pointer-events: none; }
.tl-fold {
  position: absolute; top: 50%; z-index: 1; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 11px; border-radius: var(--radius-pill); border: 1px solid var(--line-2); background: var(--surface);
  color: var(--text-2); font-size: 12.5px; white-space: nowrap;
}
.tl-fold:hover { border-color: var(--text-3); color: var(--text); text-decoration: none; }
.tl-fold-link { color: var(--teal); font-weight: 600; }

/* the No dates tray (and the All projects foot) */
.tl-tray { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 12px 16px; border-top: 1px solid var(--line); min-width: 0; }
.tl-tray-title { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.tl-tray-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; max-width: 100%; }
.tl-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; height: 32px; padding: 0 12px;
  border-radius: var(--radius-pill); border: 1px dashed var(--line-2); background: var(--surface-2); color: var(--text); font-size: 13px; cursor: pointer;
}
.tl-chip:hover { border-color: var(--teal-line); background: var(--teal-soft); }
.tl-chip-who { flex: none; color: var(--text-3); }
.tl-tray-hint { font-size: 12.5px; color: var(--text-3); }
.tl-tray-toggle { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 36px; padding: 0; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.tl-tray-toggle svg { color: var(--text-3); }
.tl-pfoot { flex-direction: column; align-items: flex-start; gap: 4px; }
.tl-pfoot p { margin: 0; }

/* All projects: one bar per project */
.tl-pbar {
  position: absolute; top: 50%; height: 14px; margin-top: -7px; border-radius: 5px; z-index: 1;
  background: color-mix(in srgb, var(--tl-edge, var(--teal)) 22%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--tl-edge, var(--teal)) 50%, var(--line-2));
  box-shadow: inset 3px 0 0 var(--tl-edge, var(--teal));
}
.tl-pbar:hover { border-color: var(--text-3); }
.tl-pbar.is-later { height: 6px; margin-top: -3px; background: transparent; border: 1px dashed var(--tl-edge, var(--teal)); box-shadow: none; }
.tl-pbar.is-done { opacity: .45; }
.tl-pms { position: absolute; top: 50%; z-index: 2; margin: -8px 0 0 -8px; display: inline-flex; pointer-events: auto; }
.tl-pms .tl-dia svg { width: 16px; height: 16px; }
.tl-pd0 { position: absolute; top: 3px; bottom: 3px; width: 2px; margin-left: -1px; z-index: 2; background: var(--lime); box-shadow: 1px 0 0 var(--lime-text); pointer-events: none; }
.tl-row.is-proj .tl-name .avatar { width: 20px; height: 20px; font-size: 9px; }

/* the sheet "Change dates" (a bottom sheet under 600 px, like every dialog) */
.tl-cd { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tl-cd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.tl-cd-name { font-weight: 600; font-size: 15.5px; line-height: 1.35; min-width: 0; overflow-wrap: anywhere; }
.tl-cd-see { flex: none; }
.tl-cd-meta { margin-top: -9px; font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.tl-cd-grid { display: grid; grid-template-columns: minmax(84px, auto) minmax(0, 1fr); gap: 12px 14px; align-items: start; min-width: 0; }
.tl-cd-label { padding-top: 11px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.tl-cd-ctl { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tl-cd-help { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-cd-steps { display: flex; gap: 8px; min-width: 0; }
.tl-cd-steps .btn { flex: 1 1 0; min-width: 0; min-height: 36px; padding: 0 8px; font-family: var(--font-mono); font-size: 13px; }
.tl-cd-change { padding: 9px 12px; border-radius: 11px; background: var(--teal-soft); border: 1px solid var(--teal-line); color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.tl-cd-note { font-size: 12.5px; color: var(--warn); }
.tl-cd-err { font-size: 12.5px; color: var(--down); }

/* the phone layout (the Tasks page's own phone width) */
@media (max-width: 700px) {
  .tl-box { max-height: max(300px, calc(100dvh - 260px)); }
  .tl-name { gap: 5px; padding: 0 6px 0 8px; font-size: 12.5px; }
  .tl-name-task, .tl-name-more { padding-left: 14px; }
  .tl-name .avatar, .tl-count, .tl-state { display: none; }
  .tl-corner { padding: 0 8px 9px; }
  .tl-tray { padding: 8px 12px; }
  .tl-tools { gap: 6px; }
  .tl-tools .btn { min-height: 32px; }
  .tl-zoom .tab { height: 32px; padding: 0 10px; }   /* tap targets of at least 32 px (3.11) */
  .tl-cd .input { font-size: 16px; }                  /* an iPhone does not zoom into the box */
}
@media (prefers-reduced-motion: reduce) {
  .tl-bar.is-pressing { transform: none; }
  .tl-ms.is-shake { animation: none; }
}
