/* TeamFlow roadmap — Productive-inspired timeline (TeamFlow theme tokens only) */

.roadmap-container {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.roadmap-header {
  padding: 1.25rem 1.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.roadmap-title h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--text);
  letter-spacing: -0.02em;
}

.roadmap-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.roadmap-error {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #b91c1c;
  font-size: 0.875rem;
}

html[data-theme="dark"] .roadmap-error {
  color: #fca5a5;
}

.roadmap-loading {
  padding: 0.75rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.roadmap-summary {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) repeat(4, minmax(72px, 1fr));
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.summary-metric {
  text-align: center;
}

.summary-metric-wide {
  text-align: left;
}

.metric-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}

.metric-value-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.metric-label {
  margin-top: 0.2rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.roadmap-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.toolbar-search {
  flex: 1;
  min-width: 180px;
}

.toolbar-search input,
.filter-label select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0 0.65rem;
  font: inherit;
  font-size: 0.85rem;
}

.toolbar-search input:focus,
.filter-label select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.08);
}

.toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 120px;
}

.filter-label > span {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.view-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-subtle);
}

.view-switch button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.view-switch button[aria-pressed="true"] {
  background: var(--bg);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
}

.tool-btn {
  height: 34px;
  width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tool-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.filter-result-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.roadmap-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.1rem;
  padding: 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-swatch {
  width: 14px;
  height: 8px;
  border-radius: 2px;
}

.legend-swatch.milestone {
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border-radius: 1px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.completed,
.legend-swatch.completed { background: #16a34a; }
.status-dot.in-progress,
.legend-swatch.in-progress { background: #d97706; }
.status-dot.planned,
.legend-swatch.planned { background: #2563eb; }
.status-dot.blocked,
.legend-swatch.blocked { background: #dc2626; }
.status-dot.deferred,
.legend-swatch.deferred { background: #7c3aed; }
.status-dot.cancelled,
.legend-swatch.cancelled { background: #6b7280; }

.roadmap-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

#view-timeline,
#view-list,
#view-board {
  flex: 1;
  min-height: 0;
}

#view-timeline:not([hidden]) {
  display: flex;
  flex-direction: column;
}

/* ── Gantt / timeline ── */
.rm-gantt {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  overflow: hidden;
}

.rm-tree {
  overflow: auto;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.rm-tree-head,
.rm-timeline-head {
  height: 44px;
  display: flex;
  align-items: flex-end;
  padding: 0 0.75rem 0.45rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  position: sticky;
  top: 0;
  z-index: 3;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rm-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0.25rem;
  align-items: center;
  min-height: 40px;
  padding: 0 0.5rem 0 0.35rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.rm-row:hover,
.rm-row.is-selected {
  background: var(--bg-subtle);
}

.rm-row.is-phase {
  background: color-mix(in srgb, var(--bg-subtle) 80%, var(--accent-soft));
  font-weight: 600;
}

.rm-toggle {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rm-toggle:hover {
  background: var(--bg-muted);
  color: var(--text);
}

.rm-toggle[aria-expanded="false"] svg {
  transform: rotate(-90deg);
}

.rm-toggle.is-leaf {
  visibility: hidden;
}

.rm-row-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.35rem 0.25rem;
}

.rm-row-title {
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rm-row-meta {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.68rem;
  color: var(--text-muted);
}

.rm-type-chip {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
}

.rm-indent-1 { padding-left: 0.75rem; }
.rm-indent-2 { padding-left: 1.5rem; }

.rm-timeline-scroll {
  overflow: auto;
  position: relative;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent calc(var(--rm-day-px) - 1px),
      color-mix(in srgb, var(--border) 65%, transparent) calc(var(--rm-day-px) - 1px),
      color-mix(in srgb, var(--border) 65%, transparent) var(--rm-day-px)
    );
  background-attachment: local;
  --rm-day-px: 10px;
}

.rm-timeline-canvas {
  position: relative;
  min-height: 100%;
}

.rm-timeline-head-inner {
  display: flex;
  height: 44px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  position: sticky;
  top: 0;
  z-index: 4;
}

.rm-month {
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: flex-end;
  box-sizing: border-box;
}

.rm-track-row {
  position: relative;
  height: 40px;
  border-bottom: 1px solid var(--border);
}

.rm-bar {
  position: absolute;
  top: 10px;
  height: 20px;
  border-radius: 4px;
  min-width: 6px;
  display: flex;
  align-items: center;
  padding: 0 0.4rem;
  box-sizing: border-box;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.rm-bar .rm-bar-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.28);
  pointer-events: none;
}

.rm-bar .rm-bar-label {
  position: relative;
  z-index: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rm-bar.status-completed { background: #16a34a; }
.rm-bar.status-in-progress { background: #d97706; }
.rm-bar.status-planned { background: #2563eb; }
.rm-bar.status-blocked { background: #dc2626; }
.rm-bar.status-deferred { background: #7c3aed; }
.rm-bar.status-cancelled { background: #6b7280; }

.rm-bar.is-phase {
  top: 8px;
  height: 24px;
  opacity: 0.9;
}

.rm-milestone {
  position: absolute;
  top: 12px;
  width: 16px;
  height: 16px;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--bg);
}

.rm-milestone.status-completed { background: #16a34a; }
.rm-milestone.status-in-progress { background: #d97706; }
.rm-milestone.status-planned { background: #2563eb; }
.rm-milestone.status-blocked { background: #dc2626; }

.rm-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  z-index: 2;
  pointer-events: none;
}

.rm-deps {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
  z-index: 1;
}

.rm-deps path {
  fill: none;
  stroke: color-mix(in srgb, var(--text-muted) 70%, transparent);
  stroke-width: 1.25;
  stroke-dasharray: 3 3;
}

/* ── List view ── */
.rm-list {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.5rem 2rem;
}

.rm-list-group {
  margin-bottom: 1.25rem;
}

.rm-list-group-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.55rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--accent);
  color: var(--text);
}

.rm-list-item {
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.rm-list-item:hover {
  border-color: var(--accent);
}

.rm-list-item-title {
  font-weight: 600;
  font-size: 0.88rem;
}

.rm-list-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Board view ── */
.rm-board {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.rm-board-col {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  min-height: 180px;
}

.rm-board-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.55rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.rm-board-card {
  width: 100%;
  text-align: left;
  display: block;
  padding: 0.6rem 0.65rem;
  margin-bottom: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.rm-board-card:hover {
  border-color: var(--accent);
}

.rm-board-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.rm-board-card-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.roadmap-empty {
  padding: 1.5rem;
  color: var(--text-secondary);
}

/* ── Details drawer ── */
.roadmap-details {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
  z-index: 20;
  display: flex;
  flex-direction: column;
}

html[data-theme="dark"] .roadmap-details {
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
}

.details-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

.details-header h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--text);
}

.details-header .icon-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.2rem;
}

.details-body {
  overflow: auto;
  padding: 1rem 1.1rem 1.5rem;
}

.details-section {
  margin-bottom: 1.1rem;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.section-content {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}

.status-badge.completed { background: rgba(22, 163, 74, 0.12); color: #15803d; }
.status-badge.in-progress { background: rgba(217, 119, 6, 0.12); color: #b45309; }
.status-badge.planned { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.status-badge.blocked { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }

html[data-theme="dark"] .status-badge.completed { color: #86efac; }
html[data-theme="dark"] .status-badge.in-progress { color: #fbbf24; }
html[data-theme="dark"] .status-badge.planned { color: #93c5fd; }
html[data-theme="dark"] .status-badge.blocked { color: #fca5a5; }

.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-subtle);
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
}

.progress-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.criteria-list,
.dependencies-list,
.children-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.criteria-list li,
.dependencies-list li,
.children-list li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.25rem 0;
}

button.linkish {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
}

button.linkish:hover {
  text-decoration: underline;
}

.docs-link {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
}

.docs-link:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

@media (max-width: 960px) {
  .rm-gantt {
    grid-template-columns: 1fr;
  }

  .rm-tree {
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .roadmap-summary {
    grid-template-columns: 1fr 1fr;
  }

  .summary-metric-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .roadmap-header,
  .roadmap-toolbar,
  .roadmap-legend {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .roadmap-details {
    position: fixed;
    width: 100%;
    max-height: 55vh;
    top: auto;
  }
}
