.timeline { overflow: hidden; }
.timeline-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid #E6E6E0;
}
.timeline-toolbar .summary { font-size: 13px; color: var(--text-2); }
.timeline-toolbar .btn { height: 30px; font-size: 12px; }
.timeline-toolbar .spacer { flex: 1; }
.timeline-scroll { overflow-x: auto; }
.timeline-inner { min-width: 1180px; }

.axis { display: flex; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.axis-head {
  width: var(--name-col); flex: none; height: 34px; padding: 0 14px; display: flex; align-items: center;
  font-size: 12px; color: var(--text-muted); border-right: 1px solid #E6E6E0; position: sticky; left: 0; z-index: 3;
  background: var(--surface-2);
}
.axis-hours { position: relative; flex: 1; height: 34px; }
.hour {
  position: absolute; top: 0; bottom: 0; padding-left: 6px; display: flex; align-items: center;
  font-size: 11px; color: var(--text-muted);
}
.hour.line { border-left: 1px solid #E6E6E0; }
.now-pill {
  position: absolute; top: 7px; transform: translateX(-50%); background: var(--now); color: #FFFFFF;
  font-size: 11px; font-weight: 500; padding: 2px 6px; border-radius: 5px; z-index: 1;
}

.rows { position: relative; }
.row, .group-row { display: flex; }
.group-row { background: var(--surface-2); border-bottom: 1px solid #E6E6E0; }
.group-head {
  width: var(--name-col); flex: none; position: sticky; left: 0; z-index: 2; background: var(--surface-2);
  border-right: 1px solid #E6E6E0; display: flex;
}
.group-head button {
  flex: 1; min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 0;
  background: transparent; text-align: left;
}
.chev { width: 14px; height: 14px; transition: transform .15s; }
.chev.open { transform: rotate(90deg); }
.group-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.group-text .name { font-weight: 600; font-size: 13px; }
.group-text .sub { font-size: 11px; color: var(--text-muted); }
.group-head .badge { margin-left: auto; }

.row-head {
  width: var(--name-col); flex: none; height: var(--row-h); padding: 0 12px 0 14px; display: flex; align-items: center;
  gap: 10px; border-right: 1px solid #E6E6E0; border-bottom: 1px solid var(--border-soft); position: sticky; left: 0;
  z-index: 2; background: var(--surface);
}
.row-head.sel { background: var(--select-head); }
.row-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.row-name .name, .row-name .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-name .name { font-weight: 500; font-size: 13px; }
.row-name .sub { font-size: 11px; color: var(--text-muted); }
.conflict-badge {
  flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--conflict); color: #FFFFFF;
  font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}

.track { position: relative; flex: 1; border-bottom: 1px solid var(--border-soft); background-color: var(--surface); }
.group-row .track { background-color: var(--surface-2); }
.track.sel { background-color: var(--select-row); }
.track.grid {
  background-image: repeating-linear-gradient(90deg, var(--grid) 0, var(--grid) 1px, transparent 1px, transparent calc(100% / var(--hours)));
}

.block {
  position: absolute; border-radius: var(--radius-sm); padding: 0 8px; text-align: left; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px;
  background: var(--c-bg); color: var(--c-fg); border: 1px solid var(--c-line); transition: opacity .15s;
}
.block:hover { filter: brightness(0.96); }
.block.absence {
  background: repeating-linear-gradient(135deg, var(--absence-a) 0 6px, var(--absence-b) 6px 12px);
}
.block.conflict { border: 1.5px solid var(--conflict); }
.block.selected { border: 2px solid var(--text); }
.block.dim { opacity: 0.32; }
.block-title {
  font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.block-time { font-size: 11px; font-weight: 400; }
.block-crew { display: flex; gap: 4px; max-width: 100%; overflow: hidden; white-space: nowrap; }
.block-sub {
  display: flex; align-items: center; gap: 3px; font-size: 11px; max-width: 100%; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.chip-mini {
  display: inline-flex; align-items: center; gap: 3px; font-size: 11px; line-height: 16px; padding: 0 5px;
  border-radius: 4px; background: rgba(255, 255, 255, 0.55); flex: none;
}
.chip-mini.declined { color: var(--conflict); text-decoration: line-through; }
.chip-mini.more { font-family: var(--font-mono); }
.icon-mini { width: 11px; height: 11px; flex: none; }

.sum-row { position: absolute; left: 0; right: 0; height: 5px; }
.sum-bar { position: absolute; top: 0; bottom: 0; background: var(--c-dot); border-radius: 3px; opacity: 0.9; }
.sum-bar.absence { opacity: 0.45; }

.now-layer { position: absolute; top: 0; bottom: 0; left: var(--name-col); right: 0; pointer-events: none; z-index: 1; }
.past { position: absolute; top: 0; bottom: 0; left: 0; background: var(--past); }
.now-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--now); }
.now-dot { position: absolute; top: -1px; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }
.empty { padding: 24px; color: var(--text-muted); margin: 0; }

/* Week view */
.week { overflow: hidden; }
.wk-scroll { overflow-x: auto; }
.wk-grid { min-width: 1100px; }
.wk-row { display: grid; grid-template-columns: 200px repeat(7, minmax(120px, 1fr)); border-bottom: 1px solid var(--border-soft); }
.wk-head { background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.wk-head .wk-day { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.wk-name { display: flex; align-items: center; gap: 8px; padding: 6px 10px; font-size: 13px; font-weight: 500; position: sticky; left: 0;
  background: var(--surface); border-right: 1px solid var(--border-soft); min-width: 0; }
.wk-head .wk-name { background: var(--surface-2); font-size: 12px; color: var(--text-muted); font-weight: 400; }
.wk-name span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-cell { padding: 4px; display: flex; flex-direction: column; gap: 3px; min-height: 40px; border-left: 1px solid var(--border-soft); min-width: 0; }
.wk-day.today, .wk-cell.today { background: var(--select-row); }
.wk-group { padding: 8px 10px; font-size: 13px; font-weight: 600; background: var(--surface-2); border-bottom: 1px solid #E6E6E0;
  display: flex; align-items: center; gap: 8px; position: sticky; left: 0; }
.wk-chip { display: flex; gap: 5px; align-items: baseline; width: 100%; padding: 2px 6px; border-radius: 5px; font-size: 11px; text-align: left;
  background: var(--c-bg); color: var(--c-fg); border: 1px solid var(--c-line); overflow: hidden; }
.wk-chip .mono { flex: none; }
.wk-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.wk-chip.absence { background: repeating-linear-gradient(135deg, var(--absence-a) 0 6px, var(--absence-b) 6px 12px); }
.wk-chip.conflict { border: 1.5px solid var(--conflict); }
.wk-chip.selected { border: 2px solid var(--text); }
.wk-section { margin: 14px 0 6px; font-size: 14px; display: flex; gap: 10px; align-items: baseline; }

/* Month / year occupation grid */
.ld-grid { min-width: calc(200px + var(--cols) * 26px); }
.ld-row { display: grid; grid-template-columns: 200px repeat(var(--cols), minmax(22px, 1fr)); border-bottom: 1px solid var(--border-soft); }
.ld-head { background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.ld-head .wk-name { background: var(--surface-2); font-size: 12px; color: var(--text-muted); font-weight: 400; }
.ld-day { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 0; font-size: 10px; color: var(--text-muted); line-height: 1.2; }
.ld-day strong { font-size: 12px; color: var(--text-2); font-weight: 600; }
.ld-day.we { background: #F1F1EC; }
.ld-day.today strong { color: var(--now); }
.ld-week span { height: 12px; font-weight: 600; color: var(--text-2); text-transform: capitalize; }
.ld-week.month-start { border-left: 1px solid var(--border); }
.ld-cell { border: 0; border-left: 1px solid var(--border-soft); padding: 0; min-height: 34px; cursor: pointer;
  background: color-mix(in srgb, var(--c-dot, var(--cat-montage-dot)) calc(var(--fill) * 80%), var(--surface)); }
.ld-cell.cat-none { --c-dot: #4F6B8F; }
.ld-cell.we:not(.absent):not(.nodata) { background-color: color-mix(in srgb, var(--c-dot, #4F6B8F) calc(var(--fill) * 80%), #F1F1EC); }
.ld-cell.absent { background: repeating-linear-gradient(135deg, var(--absence-a) 0 5px, var(--absence-b) 5px 10px); }
.ld-cell.nodata { background: repeating-linear-gradient(90deg, #ECECE7 0 2px, #F4F4F0 2px 6px); cursor: default; }
.ld-cell.today { box-shadow: inset 0 0 0 2px var(--now); }
.ld-cell:hover, .ld-cell:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; position: relative; z-index: 1; }
.ld-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--text-muted); }
.ld-legend span { display: inline-flex; align-items: center; gap: 6px; }
.ld-swatch { width: 18px; height: 12px; border-radius: 3px; border: 1px solid var(--border); --c-dot: #4F6B8F;
  background: color-mix(in srgb, var(--c-dot) calc(var(--fill, 0) * 80%), var(--surface)); }
.ld-swatch.absent { background: repeating-linear-gradient(135deg, var(--absence-a) 0 4px, var(--absence-b) 4px 8px); }
.ld-swatch.nodata { background: repeating-linear-gradient(90deg, #ECECE7 0 2px, #F4F4F0 2px 6px); }
