/* Manager swim-lane Gantt — design doc §13.1 + UI mandate (Apple iMessage style).
 * Flex-based rows so the sticky left "name" column reliably stays in view
 * during horizontal scroll. */

.gantt-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  color: #1c1c1e;
}

.gantt-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e5ea;
  flex-shrink: 0;
}
.gantt-toolbar .gantt-date-label {
  font-weight: 600;
  font-size: 14px;
  margin-right: auto;
}
.gantt-toolbar button {
  background: #f2f2f7;
  border: none;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 13px;
  color: #1c1c1e;
  cursor: pointer;
}
.gantt-toolbar button.active {
  background: #007aff;
  color: #fff;
}
.gantt-toolbar select {
  background: #f2f2f7;
  border: none;
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 13px;
}

.gantt-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8e8e93;
  font-size: 14px;
  padding: 40px 20px;
  text-align: center;
}

.gantt-rebook-tile {
  border-bottom: 1px solid #e5e5ea;
  padding: 8px 12px;
  background: #fafafa;
  font-size: 12px;
  flex-shrink: 0;
}
.gantt-rebook-tile .rebook-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.gantt-rebook-tile .rebook-title {
  font-weight: 600;
  color: #1c1c1e;
}
.gantt-rebook-tile .rebook-count {
  background: #007aff;
  color: #fff;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
}
.gantt-rebook-tile .rebook-list {
  margin: 0; padding: 0; list-style: none;
}
.gantt-rebook-tile .rebook-row {
  display: flex; gap: 10px; padding: 3px 0;
  border-bottom: 1px solid #f2f2f7;
}
.gantt-rebook-tile .rebook-row:last-child { border-bottom: none; }
.gantt-rebook-tile .rebook-customer { font-weight: 500; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-rebook-tile .rebook-service { color: #8e8e93; }
.gantt-rebook-tile .rebook-due { color: #48484a; font-variant-numeric: tabular-nums; }
.gantt-rebook-tile .rebook-row.urgent .rebook-due { color: #ff3b30; font-weight: 600; }
.gantt-rebook-tile .rebook-more {
  font-size: 11px; color: #8e8e93; padding-top: 4px;
}

.gantt-loading {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8e8e93;
  padding: 40px 20px;
}

/* Outer scroll wrapper. This is the scroll ancestor for sticky elements
 * (top: time axis, left: name column). */
.gantt-scroll {
  flex: 1;
  overflow: auto;
  position: relative;
}

/* Inner content sized to total grid width so horizontal scroll engages. */
.gantt-content {
  display: flex;
  flex-direction: column;
  width: max-content;
  min-width: 100%;
}

/* Time axis at top. Sticky to top of scroll container. */
.gantt-time-axis-row {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 4;
  background: #fff;
  border-bottom: 1px solid #e5e5ea;
  height: 32px;
}
.gantt-name-col-spacer {
  width: 220px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e5e5ea;
  position: sticky;
  left: 0;
  z-index: 5;  /* must beat all left-sticky row names */
}
.gantt-time-ticks {
  display: flex;
  flex-shrink: 0;
}
.gantt-time-tick {
  border-right: 1px solid #e5e5ea;
  font-size: 11px;
  color: #48484a;  /* darker than 8e8e93 for readability */
  font-weight: 500;
  display: flex;
  align-items: center;
  padding-left: 4px;
  white-space: nowrap;
}

.gantt-zone-label {
  padding: 8px 12px 4px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #48484a;
  background: #fafafa;
  border-bottom: 1px solid #e5e5ea;
  position: sticky;
  left: 0;
  z-index: 3;
}

/* Each row is a flex container with a sticky left "name" cell + lane cell. */
.gantt-row {
  display: flex;
  flex-shrink: 0;
}
.gantt-row-name {
  width: 220px;
  flex-shrink: 0;
  padding: 0 10px;
  border-right: 1px solid #e5e5ea;
  border-bottom: 1px solid #f2f2f7;
  background: #fff;
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 44px;
}
.gantt-row-name .name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-row-name .sub {
  font-size: 11px;
  color: #8e8e93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gantt-row-lane {
  position: relative;
  height: 44px;
  border-bottom: 1px solid #f2f2f7;
  flex-shrink: 0;
}

/* Hour-tick vertical guides drawn behind blocks. */
.gantt-row-lane::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, #f2f2f7 1px, transparent 1px);
  pointer-events: none;
}

/* Availability bands (template / override) — soft green tint on tech rows. */
.gantt-band {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 4px;
  pointer-events: none;
}
.gantt-band-availability { background: rgba(52, 199, 89, 0.10); }
.gantt-band-blackout {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 59, 48, 0.10),
    rgba(255, 59, 48, 0.10) 6px,
    rgba(255, 59, 48, 0.18) 6px,
    rgba(255, 59, 48, 0.18) 12px
  );
}

/* Reservation blocks. */
.gantt-block {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 6px;
  background: #007aff;
  color: #fff;
  font-size: 11px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: filter 0.1s;
}
.gantt-block:hover { filter: brightness(1.08); }
.gantt-block.tentative { background: #ff9500; }
.gantt-block.in_progress { background: #34c759; }
.gantt-block.complete { background: #8e8e93; opacity: 0.6; }
.gantt-block.cancelled { background: #ff3b30; opacity: 0.5; text-decoration: line-through; }
/* Legacy jobs: outlined dashed instead of solid so managers can tell at a
 * glance which jobs need to be rebooked through the new pipeline. */
.gantt-block.legacy {
  background: #fff;
  color: #1c1c1e;
  border: 1px dashed #8e8e93;
}

/* Now-line — vertical red line marking current time on today's view. */
.gantt-now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ff3b30;
  z-index: 1;
  pointer-events: none;
}

/* Side panel (job detail). */
.gantt-side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100vh;
  background: #fff;
  border-left: 1px solid #e5e5ea;
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.06);
  transform: translateX(100%);
  transition: transform 0.18s ease-out;
  z-index: 5500;
  display: flex;
  flex-direction: column;
}
.gantt-side-panel.open { transform: translateX(0); }
.gantt-side-panel-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e5ea;
}
.gantt-side-panel-header .title {
  font-weight: 600;
  font-size: 16px;
  flex: 1;
}
.gantt-side-panel-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: #8e8e93;
  padding: 0 4px;
}
.gantt-side-panel-body {
  padding: 16px;
  flex: 1;
  overflow: auto;
  font-size: 13px;
  line-height: 1.45;
}
.gantt-side-panel-body .label {
  color: #8e8e93;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 12px;
  margin-bottom: 2px;
}
.gantt-side-panel-body .value { color: #1c1c1e; }
.gantt-side-panel-body .badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f2f2f7;
  font-size: 11px;
  margin-right: 6px;
}
/* Tentative pill must read distinctly from the orange reservation block.
 * Switched to a desaturated yellow background + bold black text. */
.gantt-side-panel-body .badge.tentative { background: #fff7d6; color: #6b4500; font-weight: 600; }
.gantt-side-panel-body .badge.confirmed { background: #e6f0ff; color: #007aff; }

.gantt-weather-chip { display: inline-block; }
.gantt-weather-chip .weather-loading {
  font-size: 11px; color: #8e8e93; padding: 2px 8px;
}
.gantt-weather-chip .weather-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin-right: 6px;
}
.gantt-weather-chip .weather-pill.ok     { background: #e6f7ec; color: #248a3d; }
.gantt-weather-chip .weather-pill.warn   { background: #fff4e6; color: #c66e00; }
.gantt-weather-chip .weather-pill.severe { background: #ffe5e3; color: #ff3b30; }
