/* ─── Roadmap Canvas ───────────────────────────────────────── */
#roadmap-canvas {
  padding: 24px;
  min-height: calc(100vh - var(--topbar-height));
}

/* ─── Quarterly View ───────────────────────────────────────── */
.quarterly-view {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 900px;
}

.quarterly-header {
  display: grid;
  grid-template-columns: 120px repeat(var(--quarter-cols, 4), 1fr);
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding-bottom: 4px;
  margin-bottom: 4px;
}

.quarterly-header-area {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 12px 8px 0;
}

.quarterly-header-quarter {
  padding: 8px 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  text-align: center;
}

.quarter-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.quarter-label.current {
  color: var(--accent-hover);
}

.quarter-year {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 400;
}

/* Milestone bar */
.milestone-bar {
  display: grid;
  grid-template-columns: 120px repeat(var(--quarter-cols, 4), 1fr);
  gap: 0;
  height: 28px;
  margin-bottom: 8px;
}

.milestone-bar-area { /* spacer */ }

.milestone-bar-col {
  position: relative;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.milestone-bar-col:last-child { border-right: 1px solid var(--border); }

.milestone-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent-hover);
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
  border-radius: 20px;
  padding: 1px 7px;
  cursor: default;
  z-index: 5;
}

.milestone-marker::before {
  content: '◆';
  font-size: 8px;
}

.milestone-marker.internal {
  color: var(--visibility-internal);
  background: var(--visibility-internal-bg);
  border-color: var(--visibility-internal);
}

.add-milestone-btn {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, border-color 0.15s, color 0.15s;
}

.milestone-bar-col:hover .add-milestone-btn {
  opacity: 1;
}

.add-milestone-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

/* Swimlane rows */
.swimlane {
  display: grid;
  grid-template-columns: 120px repeat(var(--quarter-cols, 4), 1fr);
  gap: 0;
  min-height: 80px;
  margin-bottom: 2px;
}

.swimlane-label {
  display: flex;
  align-items: flex-start;
  padding: 12px 12px 12px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  gap: 6px;
}

.swimlane-area-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}

.swimlane-cell {
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: none;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.swimlane-cell:last-child { border-right: 1px solid var(--border); }
.swimlane-cell.drop-target { background: var(--accent-subtle); border-color: var(--accent); }

/* Today line */
.today-line {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--accent);
  opacity: 0.5;
  pointer-events: none;
  z-index: 5;
}

/* Roadmap item card in quarterly view */
.q-item-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}

.q-item-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.q-item-card:hover {
  border-color: var(--border-hover);
  background: var(--surface-3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.q-item-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.q-item-card.done { opacity: 0.5; }
.q-item-card.cancelled { opacity: 0.4; }

.q-item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}

.q-item-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.priority-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.priority-dot.critical { background: var(--priority-critical); }
.priority-dot.high     { background: var(--priority-high); }
.priority-dot.medium   { background: var(--priority-medium); }
.priority-dot.low      { background: var(--priority-low); }

.lock-icon {
  width: 10px;
  height: 10px;
  color: var(--visibility-internal);
  opacity: 0.8;
  flex-shrink: 0;
}

/* Spanning items (span multiple quarters) */
.q-item-card.spans-right { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: none; }
.q-item-card.spans-left  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
.q-item-card.spans-both  { border-radius: 0; border-left: none; border-right: none; }

/* ─── List View ─────────────────────────────────────────────── */
.list-view {
  padding: 24px 32px;
  overflow-y: auto;
}

/* Filter bar */
.list-filters {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-search-wrap {
  flex: 1;
  max-width: 320px;
}

.list-search {
  width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.list-search:focus {
  border-color: var(--accent);
}

.list-filter-clear {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.list-filter-clear:hover {
  background: var(--surface2);
  color: var(--text);
}

.list-filter-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.list-filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  min-width: 60px;
}

.list-filter-pill {
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
  text-transform: capitalize;
}

.list-filter-pill:hover {
  border-color: var(--accent);
  color: var(--text);
}

.list-filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.list-filter-pill.tag-pill {
  border: none;
}

.list-empty {
  color: var(--text-muted);
  padding: 32px;
  text-align: center;
}

.list-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 0;
}

.list-cards .nnl-item-card {
  max-width: 520px;
}

.list-filter-divider {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

/* Section headers */
.list-section-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
}
.list-section-header:first-child { margin-top: 0; }
.list-section-header:hover { color: var(--text); opacity: 0.8; }

.list-section-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
}
.list-section-body.collapsed { display: none; }

.list-section-chevron {
  display: inline-block;
  transition: transform 0.15s;
  font-style: normal;
  color: var(--text-muted);
  display: none;
}
.list-section-chevron.collapsed { transform: rotate(-90deg); }

.list-section-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.list-section-count {
  margin-left: 2px;
  font-size: 12px;
  color: var(--text-faint);
  font-weight: 400;
}

/* ─── Now / Next / Later View ──────────────────────────────── */
.nnl-view {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 1400px;
}

.nnl-column {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nnl-column-header {
  padding: 14px 16px 10px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nnl-column-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.nnl-column-count {
  font-size: 12px;
  background: var(--surface-3);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: 20px;
  font-weight: 500;
}

.nnl-column-title.now    { color: var(--status-in-progress); }
.nnl-column-title.next   { color: var(--accent-hover); }
.nnl-column-title.later  { color: var(--text-muted); }

.nnl-column-body {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 300px;
}

.nnl-column-body.drop-target {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

/* NNL item card */
.nnl-item-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}

.nnl-item-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.nnl-item-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.nnl-item-card.selected  { border-color: var(--accent); }
.nnl-item-card.done      { opacity: 0.5; }
.nnl-item-card.cancelled { opacity: 0.35; text-decoration: line-through; }

.nnl-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.nnl-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nnl-item-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* NNL area section header */
.nnl-area-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  padding: 6px 2px 2px;
  margin-top: 4px;
}

.nnl-area-header:first-child {
  margin-top: 0;
}

.nnl-area-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Area indicator colors ────────────────────────────────── */
[data-area-index="0"]::before { background: var(--area-0); }
[data-area-index="1"]::before { background: var(--area-1); }
[data-area-index="2"]::before { background: var(--area-2); }
[data-area-index="3"]::before { background: var(--area-3); }
[data-area-index="4"]::before { background: var(--area-4); }
[data-area-index="5"]::before { background: var(--area-5); }
[data-area-index="6"]::before { background: var(--area-6); }
[data-area-index="7"]::before { background: var(--area-7); }

.area-dot[data-area-index="0"] { background: var(--area-0); }
.area-dot[data-area-index="1"] { background: var(--area-1); }
.area-dot[data-area-index="2"] { background: var(--area-2); }
.area-dot[data-area-index="3"] { background: var(--area-3); }
.area-dot[data-area-index="4"] { background: var(--area-4); }
.area-dot[data-area-index="5"] { background: var(--area-5); }
.area-dot[data-area-index="6"] { background: var(--area-6); }
.area-dot[data-area-index="7"] { background: var(--area-7); }

/* ─── Item reorder controls ────────────────────────────────── */
.item-reorder-controls {
  position: absolute;
  top: 4px;
  right: 4px;
  display: none;
  flex-direction: column;
  gap: 1px;
  z-index: 2;
}

.nnl-item-card:hover .item-reorder-controls,
.q-item-card:hover .item-reorder-controls {
  display: flex;
}

.reorder-btn {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.1s;
}

.reorder-btn:hover:not(:disabled) {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: var(--accent);
}

.reorder-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

/* ─── Mobile / Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
  /* Canvas padding */
  #roadmap-canvas { padding: 12px; }

  /* Now/Next/Later: stack columns */
  .nnl-view {
    grid-template-columns: 1fr;
    gap: 12px;
    max-width: 100%;
  }

  /* List view: tighter padding */
  .list-view { padding: 16px; }
  .list-search-wrap { max-width: 100%; }

  /* Quarterly: allow horizontal scroll */
  #roadmap-canvas:has(.quarterly-view) {
    overflow-x: auto;
    padding: 12px 0 12px 12px;
  }
}

@media (max-width: 480px) {
  #roadmap-canvas { padding: 8px; }
  .list-view { padding: 10px; }
}

/* ─── Add item button ──────────────────────────────────────── */
.add-item-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-faint);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 2px;
}

.add-item-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}
