/* Roadmap Forecaster — free tool. Builds on styles.css tokens (black background, white text). */

.page-tool main {
  display: block;
  padding-bottom: var(--space-lg);
}

.page-tool {
  --rp-surface: #0e0e0e;
  --rp-surface-2: #161616;
  --rp-border: rgba(255, 255, 255, 0.14);
  --rp-border-soft: rgba(255, 255, 255, 0.08);
  --rp-muted: rgba(255, 255, 255, 0.62);
  --rp-week-w: 84px;
  --rp-row-h: 64px;
  --rp-label-w: 116px;
  --rp-danger: #ff8a7a;
  --rp-warn: #f2c48d;
}

.page-tool .hero-headline {
  font-size: clamp(2rem, 4.5vw, 3.25rem);
}

.page-tool .hero-subhead {
  white-space: normal;
  max-width: none;
  text-wrap: pretty;
  margin-bottom: var(--space-sm);
}

.page-tool .hero {
  min-height: auto;
  padding-bottom: var(--space-sm);
}

.rp-eyebrow {
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

[hidden] {
  display: none !important;
}

/* ---------- Panels ---------- */
.rp-panel {
  background: var(--rp-surface);
  border: 1px solid var(--rp-border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.rp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.rp-panel h2 {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.rp-sub {
  color: var(--rp-muted);
  font-size: 0.875rem;
  margin-top: 0.15rem;
}

.rp-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.rp-btn {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, opacity 0.2s;
}

.rp-btn:hover {
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.06);
}

.rp-btn-primary {
  background: #fff;
  color: #000;
  border-color: #fff;
}

.rp-btn-primary:hover {
  background: #fff;
  opacity: 0.88;
}

.rp-btn-quiet {
  border-color: transparent;
  color: var(--rp-muted);
}

.rp-btn:focus-visible,
.rp-icon-btn:focus-visible,
.rp-page-link:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.rp-icon-btn {
  font: inherit;
  width: 28px;
  height: 28px;
  line-height: 1;
  font-size: 0.75rem;
  color: var(--rp-muted);
  background: transparent;
  border: 1px solid var(--rp-border);
  border-radius: 6px;
  cursor: pointer;
}

.rp-icon-btn:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
}

.rp-icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.rp-icon-btn.rp-remove:hover:not(:disabled) {
  color: var(--rp-danger);
  border-color: var(--rp-danger);
}

/* ---------- Form controls ---------- */
.rp-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rp-field > label,
.rp-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--rp-muted);
}

.rp-hint {
  font-size: 0.75rem;
  color: var(--rp-muted);
  max-width: 220px;
  line-height: 1.4;
}

.page-tool input[type="text"],
.page-tool input[type="number"],
.page-tool input[type="date"],
.page-tool select,
.page-tool textarea {
  font: inherit;
  font-size: 0.9375rem;
  color: #fff;
  background: var(--rp-surface-2);
  border: 1px solid var(--rp-border);
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  color-scheme: dark;
  min-width: 0;
}

.page-tool input:focus-visible,
.page-tool select:focus-visible,
.page-tool textarea:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.page-tool textarea {
  width: 100%;
  resize: vertical;
  line-height: 1.5;
}

.rp-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2rem;
  align-items: flex-start;
}

.rp-controls input[type="number"] {
  width: 96px;
}

.rp-controls input[type="date"] {
  width: 170px;
}

.rp-advanced {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rp-border-soft);
}

.rp-advanced summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rp-muted);
  width: fit-content;
}

.rp-advanced summary:hover {
  color: #fff;
}

.rp-advanced summary:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
  border-radius: 2px;
}

.rp-advanced-body {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.5rem;
  margin-top: 1rem;
}

.rp-off-add {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.rp-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
  max-width: 480px;
}

.rp-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  border: 1px solid var(--rp-border);
  border-radius: 999px;
  padding: 0.15rem 0.3rem 0.15rem 0.7rem;
}

.rp-chip button {
  font: inherit;
  background: none;
  border: none;
  color: var(--rp-muted);
  cursor: pointer;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 1;
}

.rp-chip button:hover {
  color: var(--rp-danger);
}

.rp-chip button:focus-visible {
  outline: 2px solid #fff;
}

/* ---------- Feature table ---------- */
.rp-table-scroll {
  overflow-x: auto;
}

.rp-table {
  min-width: 700px;
}

.rp-row {
  display: grid;
  grid-template-columns: 64px minmax(240px, 2.4fr) 160px 180px 68px;
  gap: 1.1rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rp-border-soft);
  position: relative;
}

.rp-row-head {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rp-muted);
  border-bottom-color: var(--rp-border);
  padding-bottom: 0.6rem;
}

.rp-row:last-child {
  border-bottom: none;
}

.rp-row.rp-dragging {
  opacity: 0.4;
}

.rp-row.rp-drop-before::before,
.rp-row.rp-drop-after::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #fff;
}

.rp-row.rp-drop-before::before {
  top: -1px;
}

.rp-row.rp-drop-after::after {
  bottom: -1px;
}

.rp-grip {
  font: inherit;
  font-size: 1.15rem;
  line-height: 1;
  width: 28px;
  height: 28px;
  color: var(--rp-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  padding: 0;
}

.rp-grip:hover {
  color: #fff;
  border-color: var(--rp-border);
}

.rp-grip:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.rp-grip:active {
  cursor: grabbing;
}

.rp-callout {
  border-left: 3px solid #fff;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 0 6px 6px 0;
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 0.9rem;
}

.rp-callout strong {
  color: #fff;
}

.rp-idx {
  color: var(--rp-muted);
  font-size: 0.875rem;
  text-align: center;
}

.rp-row-head span:nth-child(1) {
  text-align: center;
}

.rp-name-cell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.rp-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}

.rp-name-cell input {
  flex: 1;
  width: 100%;
}

.rp-size-cell {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.rp-size-cell select {
  flex: 1;
  min-width: 0;
}

.rp-size-cell input[type="number"] {
  width: 62px;
  flex: none;
}

.rp-row select,
.rp-row input {
  font-size: 0.875rem;
}

.rp-assigned {
  font-size: 0.8125rem;
  color: var(--rp-muted);
  line-height: 1.35;
}

.rp-assigned.rp-held {
  color: var(--rp-warn);
}

.rp-row-actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
  align-items: center;
}

.rp-empty {
  color: var(--rp-muted);
  padding: 1rem 0;
  font-style: italic;
}

/* Small screens: each feature becomes a card */
@media (max-width: 820px) {
  .rp-table {
    min-width: 0;
  }

  .rp-row-head {
    display: none;
  }

  .rp-row {
    grid-template-columns: 1fr 1fr;
    padding: 0.9rem 0;
    gap: 0.6rem;
  }

  .rp-idx {
    display: none;
  }

  .rp-name-cell {
    grid-column: 1 / -1;
  }

  .rp-assigned {
    grid-column: 1 / 2;
  }

  .rp-row-actions {
    grid-column: 2 / 3;
    order: 9;
    justify-content: flex-end;
  }
}

/* ---------- Summary / warnings ---------- */
.rp-summary {
  font-size: 0.9375rem;
  color: var(--rp-muted);
}

.rp-summary strong {
  color: #fff;
}

.rp-notice {
  border: 1px solid rgba(242, 196, 141, 0.45);
  background: rgba(242, 196, 141, 0.08);
  color: var(--rp-warn);
  border-radius: 6px;
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  margin-bottom: 0.9rem;
}

.rp-notice[hidden] {
  display: none;
}

/* ---------- Chart ---------- */
.rp-chart-scroll {
  overflow-x: auto;
  border: 1px solid var(--rp-border);
  border-radius: 8px;
  background: #050505;
}

.rp-chart {
  display: inline-block;
  min-width: 100%;
}

.rp-qrow,
.rp-wrow {
  display: flex;
}

.rp-corner {
  width: var(--rp-label-w);
  min-width: var(--rp-label-w);
  flex: none;
  position: sticky;
  left: 0;
  z-index: 3;
  background: #1c1c1c;
  border-right: 1px solid var(--rp-border);
}

.rp-qcell {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 700;
  background: #1c1c1c;
  border-right: 1px solid var(--rp-border);
  border-bottom: 1px solid var(--rp-border);
  white-space: nowrap;
  overflow: hidden;
}

.rp-wcell {
  width: var(--rp-week-w);
  min-width: var(--rp-week-w);
  flex: none;
  height: 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  background: #121212;
  border-right: 1px solid var(--rp-border-soft);
  border-bottom: 1px solid var(--rp-border);
  color: rgba(255, 255, 255, 0.85);
}

.rp-wcell .rp-wflag {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--rp-danger);
}

.rp-wcell.rp-off {
  background: #241413;
}

.rp-wcell.rp-target {
  box-shadow: inset -2px 0 0 #fff;
}

.rp-erow {
  display: flex;
  border-bottom: 1px solid var(--rp-border-soft);
}

.rp-erow:last-child {
  border-bottom: none;
}

.rp-elabel {
  width: var(--rp-label-w);
  min-width: var(--rp-label-w);
  flex: none;
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  padding-left: 0.85rem;
  font-size: 0.8125rem;
  font-weight: 700;
  background: #1c1c1c;
  border-right: 1px solid var(--rp-border);
}

.rp-track {
  position: relative;
  height: var(--rp-row-h);
  background-image: repeating-linear-gradient(
    to right,
    var(--rp-border-soft) 0,
    var(--rp-border-soft) 1px,
    transparent 1px,
    transparent var(--rp-week-w)
  );
}

.rp-marker {
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: none;
}

.rp-marker.rp-off {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 138, 122, 0.06) 0 6px,
    rgba(255, 138, 122, 0.16) 6px 12px
  );
}

.rp-marker.rp-pending {
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 0 6px,
    rgba(255, 255, 255, 0.09) 6px 12px
  );
}

.rp-target-line {
  position: absolute;
  top: 0;
  height: 100%;
  width: 0;
  border-right: 2px dashed rgba(255, 255, 255, 0.7);
  pointer-events: none;
  z-index: 1;
}

.rp-block {
  position: absolute;
  top: 5px;
  height: calc(var(--rp-row-h) - 10px);
  border-radius: 5px;
  padding: 0.3rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.2;
  font-weight: 600;
  color: #10131a;
  overflow: hidden;
  word-break: break-word;
  z-index: 2;
}

.rp-block small {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

.rp-block.rp-flag {
  outline: 2px dashed #fff;
  outline-offset: -3px;
}

.rp-chart.rp-reveal .rp-block {
  animation: rp-pop 0.5s ease both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

@keyframes rp-pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.rp-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin-top: 0.9rem;
  font-size: 0.8125rem;
  color: var(--rp-muted);
}

.rp-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.rp-legend .rp-sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.rp-legend .rp-sw-off {
  background: repeating-linear-gradient(45deg, #ff8a7a 0 3px, #5a2a25 3px 6px);
}

.rp-legend .rp-sw-flag {
  background: transparent;
  border: 2px dashed #fff;
}

.rp-held-box {
  margin-top: 0.9rem;
  border: 1px dashed rgba(242, 196, 141, 0.55);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--rp-warn);
}

.rp-held-box[hidden] {
  display: none;
}

.rp-held-box ul {
  margin: 0.4rem 0 0 1.1rem;
  color: #fff;
}

/* ---------- Insights ---------- */
.rp-insight {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rp-border-soft);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.rp-flag-list {
  margin: 0.5rem 0 0 1.1rem;
  font-size: 0.9rem;
  color: var(--rp-warn);
}

.rp-flag-list li {
  margin-bottom: 0.2rem;
}

.rp-flag-list strong {
  color: #fff;
}

.rp-insight-title {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rp-muted);
  margin: 0.9rem 0 0.35rem;
}

.rp-insight-title:first-child {
  margin-top: 0;
}

/* ---------- CTA ---------- */
.rp-cta {
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  padding: 2rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 2.5rem;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.01));
}

.rp-cta h2 {
  font-size: clamp(1.25rem, 2.6vw, 1.75rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}

.rp-cta > div {
  flex: 1 1 420px;
}

.rp-cta p {
  color: rgba(255, 255, 255, 0.82);
  text-wrap: pretty;
}

.rp-footnote {
  color: var(--rp-muted);
  font-size: 0.8125rem;
  margin-top: 1rem;
}

/* ---------- Walkthrough dialog ---------- */
.rp-tour {
  margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  background: #0b0b0b;
  color: #fff;
  padding: 0;
  width: min(640px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}

.rp-tour[open] {
  display: flex;
  flex-direction: column;
}

.rp-tour::backdrop {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(3px);
}

.rp-tour-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.rp-tour-progress div {
  height: 100%;
  background: #fff;
  transition: width 0.3s ease;
}

.rp-tour-body {
  padding: 1.75rem 1.75rem 1rem;
  overflow-y: auto;
}

.rp-tour-step {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rp-muted);
  margin-bottom: 0.5rem;
}

.rp-tour h2 {
  font-size: clamp(1.4rem, 3.4vw, 1.85rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
  outline: none;
}

.rp-tour p.rp-lede {
  color: rgba(255, 255, 255, 0.78);
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
}

.rp-tour-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
}

.rp-tour-fields input[type="number"] {
  width: 100px;
}

.rp-tour-fields input[type="date"] {
  width: 180px;
}

.rp-tour-error {
  color: var(--rp-danger);
  font-size: 0.875rem;
  margin-top: 0.6rem;
  min-height: 1.3em;
}

.rp-tour-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.75rem 1.25rem;
  border-top: 1px solid var(--rp-border-soft);
}

.rp-tour-foot .rp-actions {
  margin-left: auto;
}

.rp-tour-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 44vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.rp-tour-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--rp-border-soft);
  border-radius: 8px;
  background: var(--rp-surface);
}

.rp-tour-item > span {
  font-size: 0.9375rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.rp-seg {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--rp-border);
  border-radius: 6px;
  overflow: hidden;
}

.rp-seg label {
  position: relative;
  cursor: pointer;
}

.rp-seg input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.rp-seg span {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--rp-muted);
  border-right: 1px solid var(--rp-border);
}

.rp-seg label:last-child span {
  border-right: none;
}

.rp-seg input:checked + span {
  background: #fff;
  color: #000;
}

.rp-seg input:focus-visible + span {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

.rp-size-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.8125rem;
  color: var(--rp-muted);
  margin-bottom: 0.9rem;
}

.rp-size-key strong {
  color: #fff;
}

.rp-tour-item select {
  width: 160px;
  flex: none;
}

.rp-done-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 1rem 0 0.5rem;
}

.rp-done-stats div {
  min-width: 90px;
}

.rp-done-stats b {
  display: block;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.rp-done-stats span {
  font-size: 0.75rem;
  color: var(--rp-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@media (max-width: 480px) {
  .rp-tour-body {
    padding: 1.25rem 1.1rem 0.75rem;
  }

  .rp-tour-foot {
    padding: 0.85rem 1.1rem 1rem;
  }

  .rp-panel {
    padding: 1rem;
  }

  .rp-tour-item {
    flex-wrap: wrap;
  }

  .rp-tour-item select {
    width: 100%;
  }


  .rp-cta {
    padding: 1.5rem 1.25rem;
  }
}

@media print {
  .rp-tour,
  .rp-actions,
  .rp-cta {
    display: none !important;
  }
}

.rp-insight:empty {
  display: none;
}
