/* ============================================================
   Roadmap Tool — Dark Industrial Aesthetic
   Fonts: Syne (display) + DM Mono (data/labels)
   ============================================================ */

:root {
  --bg-base:      #0e0f12;
  --bg-surface:   #13151a;
  --bg-raised:    #1a1d24;
  --bg-border:    #252830;
  --bg-hover:     #1e2128;

  --text-primary:   #e8eaf0;
  --text-secondary: #8b909e;
  --text-muted:     #555b6a;
  --text-accent:    #ffffff;

  --accent:       #4f7fff;
  --accent-dim:   #2a3f80;
  --danger:       #e05252;
  --success:      #3fcf8e;
  --warning:      #f5a623;

  --disc-color:   #6b7280;

  --nav-height: 52px;
  --sidebar-width: 260px;
  --sprint-width: 46px;
  --row-height: 38px;

  --radius: 4px;
  --font-display: 'Syne', sans-serif;
  --font-mono:    'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
}

/* ── NAV ── */
.topnav {
  display: flex;
  align-items: center;
  height: var(--nav-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
  padding: 0 16px;
  gap: 0;
  position: relative;
  z-index: 100;
}

.topnav__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 24px;
  flex-shrink: 0;
}
.brand-icon {
  font-size: 18px;
  color: var(--accent);
}
.brand-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-accent);
}

.topnav__tabs {
  display: flex;
  gap: 2px;
  flex: 1;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab-btn.active {
  color: var(--text-accent);
  background: var(--bg-raised);
  border-color: var(--bg-border);
}
.tab-icon { font-size: 14px; }

.topnav__actions { margin-left: auto; }

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: #6b91ff; }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--text-secondary); color: var(--text-primary); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 4px 9px; font-size: 10px; }

/* ── VIEWS ── */
.view {
  display: none;
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
}
.view.active { display: flex; flex-direction: column; }

/* ── TOOLBAR ── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--bg-border);
  gap: 16px;
  flex-shrink: 0;
}
.toolbar__filters { display: flex; gap: 8px; align-items: center; }

.filter-select, .filter-search {
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.filter-select:focus, .filter-search:focus { border-color: var(--accent); }
.filter-search { width: 200px; }
.filter-search::placeholder { color: var(--text-muted); }

.toolbar__legend {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-secondary);
}
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
}
.legend-disc {
  width: 12px; height: 12px;
  border-radius: 2px;
  background: var(--disc-color);
}

/* ── ROADMAP SCROLL ── */
.roadmap-scroll-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
}

.roadmap-container {
  display: flex;
  min-height: 100%;
  position: relative;
}

/* ── SIDEBAR ── */
.roadmap-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  position: sticky;
  left: 0;
  z-index: 20;
  background: var(--bg-surface);
  border-right: 1px solid var(--bg-border);
}

.sidebar-header-spacer {
  height: calc(var(--row-height) * 2);
  border-bottom: 1px solid var(--bg-border);
  background: var(--bg-surface);
}

.sidebar-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: var(--row-height);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--bg-border);
  border-left: 3px solid transparent;
}
.sidebar-group-label .group-dot {
  width: 8px; height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.sidebar-group-label .group-name {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 20px;
  height: var(--row-height);
  border-bottom: 1px solid var(--bg-border);
  cursor: pointer;
  transition: background 0.1s;
}
.sidebar-item-row:hover { background: var(--bg-hover); }
.sidebar-item-row .item-label {
  font-size: 12px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.sidebar-item-row .item-effort {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: 6px;
  flex-shrink: 0;
}

/* ── GRID WRAPPER ── */
.roadmap-grid-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.roadmap-header-months,
.roadmap-header-sprints {
  display: flex;
  position: sticky;
  z-index: 15;
  background: var(--bg-surface);
  flex-shrink: 0;
}
.roadmap-header-months {
  top: 0;
  height: var(--row-height);
  border-bottom: 1px solid var(--bg-border);
}
.roadmap-header-sprints {
  top: var(--row-height);
  height: var(--row-height);
  border-bottom: 2px solid var(--bg-border);
}

.month-cell {
  display: flex;
  align-items: center;
  padding: 0 10px;
  height: var(--row-height);
  border-right: 1px solid var(--bg-border);
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}
.month-cell.current-month {
  background: rgba(79,127,255,0.08);
  color: var(--accent);
}

.sprint-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--sprint-width);
  height: var(--row-height);
  border-right: 1px solid var(--bg-border);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  flex-shrink: 0;
  cursor: default;
}
.sprint-cell.current-sprint {
  background: rgba(79,127,255,0.12);
  color: var(--accent);
  font-weight: 700;
}

/* ── GRID ROWS ── */
.roadmap-grid {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
}

.grid-group-row {
  display: flex;
  height: var(--row-height);
  background: var(--bg-raised);
  border-bottom: 1px solid var(--bg-border);
  position: relative;
}

.grid-item-row {
  display: flex;
  height: var(--row-height);
  border-bottom: 1px solid var(--bg-border);
  position: relative;
  background: var(--bg-base);
  transition: background 0.1s;
}
.grid-item-row:hover { background: var(--bg-hover); }

.grid-cell {
  width: var(--sprint-width);
  height: 100%;
  border-right: 1px solid var(--bg-border);
  flex-shrink: 0;
  position: relative;
}
.grid-cell.current-sprint-col {
  background: rgba(79,127,255,0.04);
}

/* ── ROADMAP BARS ── */
.rm-bar {
  position: absolute;
  top: 5px;
  height: calc(var(--row-height) - 10px);
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  white-space: nowrap;
  overflow: hidden;
  z-index: 5;
  user-select: none;
  min-width: calc(var(--sprint-width) - 2px);
}
.rm-bar:hover { filter: brightness(1.15); transform: translateY(-1px); }
.rm-bar.disc {
  background: var(--disc-color) !important;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-weight: 700;
}
.rm-bar .bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Drag handles */
.rm-bar .drag-handle-left,
.rm-bar .drag-handle-right {
  position: absolute;
  top: 0; bottom: 0;
  width: 6px;
  cursor: ew-resize;
  opacity: 0;
  transition: opacity 0.15s;
}
.rm-bar .drag-handle-left { left: 0; }
.rm-bar .drag-handle-right { right: 0; }
.rm-bar:hover .drag-handle-left,
.rm-bar:hover .drag-handle-right { opacity: 1; }
.rm-bar .drag-handle-left::after,
.rm-bar .drag-handle-right::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 12px;
  background: rgba(255,255,255,0.4);
  border-radius: 1px;
}
.rm-bar .drag-handle-left::after { left: 2px; }
.rm-bar .drag-handle-right::after { right: 2px; }

/* Non-contiguous gap marker */
.rm-gap {
  position: absolute;
  top: 5px;
  height: calc(var(--row-height) - 10px);
  background: repeating-linear-gradient(
    90deg,
    transparent 0px, transparent 3px,
    rgba(255,255,255,0.05) 3px, rgba(255,255,255,0.05) 6px
  );
  border-top: 1px dashed rgba(255,255,255,0.1);
  border-bottom: 1px dashed rgba(255,255,255,0.1);
  pointer-events: none;
  z-index: 3;
}

/* Discovery / unestimated banner */
.disc-priority-row {
  position: relative;
  height: var(--row-height);
  border-bottom: 1px solid var(--bg-border);
  background: var(--bg-base);
}
.disc-priority-banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 8px;
  bottom: 8px;
  border: 2px dashed var(--danger);
  border-radius: 3px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--danger);
  pointer-events: none;
}

/* ── LIST VIEW ── */
.list-container {
  flex: 1;
  overflow: auto;
  padding: 24px;
}
.list-group {
  margin-bottom: 32px;
}
.list-group__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--bg-border);
}
.list-group__header .group-dot {
  width: 10px; height: 10px; border-radius: 2px;
}
.list-group__header h3 {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.list-item {
  display: grid;
  grid-template-columns: 1fr 160px 80px;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.1s;
}
.list-item:hover { background: var(--bg-raised); border-color: var(--accent-dim); }
.list-item__name { font-size: 13px; font-weight: 500; }
.list-item__sprints { font-size: 11px; color: var(--text-secondary); }
.list-item__category {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
}

/* ── CONFIG VIEW ── */
.config-container {
  flex: 1;
  overflow: auto;
  padding: 32px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}
.config-section {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: 6px;
  padding: 24px;
  margin-bottom: 24px;
}
.config-section__title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.config-field label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.config-field input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s;
}
.config-field input:focus { border-color: var(--accent); }

/* Categories list */
.categories-list { display: flex; flex-direction: column; gap: 8px; }
.category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
}
.category-row .cat-swatch {
  width: 16px; height: 16px; border-radius: 3px; flex-shrink: 0;
}
.category-row .cat-name {
  flex: 1;
  font-size: 13px;
}
.category-row .cat-actions { display: flex; gap: 6px; }

/* ── MODALS ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 500;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }

.modal {
  display: none;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: 8px;
  width: min(620px, 94vw);
  max-height: 90vh;
  overflow: hidden;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: modal-in 0.18s ease;
}
.modal.open { display: flex; }

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--bg-border);
  flex-shrink: 0;
}
.modal__header h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.modal__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  transition: color 0.15s;
}
.modal__close:hover { color: var(--text-primary); }

.modal__body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--bg-border);
  flex-shrink: 0;
}
.modal__footer .btn-danger { margin-right: auto; }

/* Form fields */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.req { color: var(--danger); }

.form-field input[type="text"],
.form-field select,
.form-field textarea {
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.form-field input[type="text"]:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--accent); }
.form-field textarea { resize: vertical; min-height: 70px; }
.form-field select option { background: var(--bg-raised); }

/* Sprint picker */
.sprint-picker {
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg-raised);
  max-height: 180px;
  overflow-y: auto;
}
.sprint-picker__row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.sprint-picker__row + .sprint-picker__row { margin-top: 4px; }
.sprint-btn {
  width: 36px;
  height: 28px;
  border-radius: 3px;
  border: 1px solid var(--bg-border);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.1s;
  flex-shrink: 0;
}
.sprint-btn:hover { border-color: var(--accent); color: var(--accent); }
.sprint-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.sprint-picker-summary {
  font-size: 11px;
  color: var(--text-secondary);
  min-height: 16px;
}

/* GitHub links */
.github-links-list { display: flex; flex-direction: column; gap: 6px; }
.github-link-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.github-link-row input {
  flex: 1;
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 9px;
  outline: none;
}
.github-link-row input:focus { border-color: var(--accent); }
.github-link-remove {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 16px;
  padding: 2px 6px; border-radius: 3px;
  transition: color 0.15s;
}
.github-link-remove:hover { color: var(--danger); }

/* Colour picker */
.colour-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.colour-picker-row input[type="color"] {
  width: 40px; height: 32px;
  border: 1px solid var(--bg-border);
  border-radius: var(--radius);
  background: none;
  cursor: pointer;
  padding: 2px;
}
.colour-preview {
  display: inline-block;
  width: 60px; height: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--bg-border);
  transition: background 0.2s;
}
.colour-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.colour-preset {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.colour-preset:hover { transform: scale(1.15); }
.colour-preset.selected { border-color: var(--text-accent); }

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--bg-border);
  border-radius: 6px;
  font-size: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  animation: toast-in 0.2s ease;
  pointer-events: all;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── DRAG ACTIVE ── */
.rm-bar.dragging {
  opacity: 0.85;
  filter: brightness(1.2);
  transform: translateY(-2px);
  z-index: 50;
  cursor: grabbing;
}

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state__icon { font-size: 36px; opacity: 0.4; }
.empty-state__text {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
