/* Tour Dash — systems map.
   Built on the tokens in brand.css. No new colors are introduced: status uses the
   existing --shipped / --progress / --planned semantics, and chartreuse stays
   reserved for step markers and active state, never decoration. */

.wrap.wide { max-width: 1140px; }

/* ---------- shared status vocabulary ---------- */
.legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0 0 30px; }
.legend .lg { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: hsl(var(--muted-foreground)); }
.legend .sw { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }
.sw.live { background: hsl(var(--shipped)); }
.sw.part { background: hsl(var(--progress)); }
.sw.miss { background: hsl(var(--planned)); }

/* ---------- layered stack ---------- */
.stack { display: grid; gap: 10px; }
.layer {
  display: grid; grid-template-columns: 148px 1fr; gap: 20px; align-items: start;
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  background: hsl(var(--card)); padding: 18px 20px;
}
.layer-label { padding-top: 2px; }
.layer-label .lt { font-size: 15px; font-weight: 510; letter-spacing: -0.005em; }
.layer-label .ls { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 4px; line-height: 1.45; }
.nodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr)); gap: 10px; }
.node {
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 5px);
  background: hsl(var(--background)); padding: 12px 13px; min-width: 0;
}
.node .n-t { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 510; line-height: 1.3; }
.node .n-t::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: hsl(var(--shipped)); flex-shrink: 0; }
.node.part .n-t::before { background: hsl(var(--progress)); }
.node.miss .n-t::before { background: hsl(var(--planned)); }
.node .n-s { font-size: 12px; line-height: 1.5; color: hsl(var(--muted-foreground)); margin-top: 5px; }
.node.miss { border-style: dashed; background: transparent; }
.node.miss .n-t { color: hsl(var(--muted-foreground)); }

/* the connective seam between layers */
.seam { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 2px 0; }
.seam span {
  font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase;
  color: hsl(var(--muted-foreground)); font-weight: 510;
}
.seam::before, .seam::after { content: ""; height: 1px; flex: 1; background: hsl(var(--border)); }

@media (max-width: 720px) {
  .layer { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------- vertical flow ---------- */
.flow { display: grid; gap: 0; margin-bottom: 8px; }
.fstep { display: grid; grid-template-columns: 34px 1fr 1fr; gap: 20px; padding: 0 0 26px; position: relative; }
.fstep:last-child { padding-bottom: 0; }
.fstep .rail { position: relative; display: flex; justify-content: center; }
.fstep .rail::after {
  content: ""; position: absolute; top: 32px; bottom: -26px; width: 1px;
  background: hsl(var(--border));
}
.fstep:last-child .rail::after { display: none; }
.fstep-n {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0; z-index: 1;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13.5px; font-weight: 590;
}
.fstep .who {
  font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase;
  color: hsl(var(--muted-foreground)); font-weight: 510; margin-bottom: 6px;
}
.fstep .what { font-size: 16.5px; font-weight: 510; line-height: 1.4; letter-spacing: -0.005em; margin-bottom: 6px; }
.fstep .detail { font-size: 14.5px; line-height: 1.55; color: hsl(var(--muted-foreground)); }
.fires {
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 5px);
  background: hsl(var(--card)); padding: 13px 15px; align-self: start;
}
.fires .fh {
  font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 510;
  color: hsl(var(--muted-foreground)); margin-bottom: 9px;
}
.fires ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.fires li { font-size: 13.5px; line-height: 1.5; display: flex; gap: 9px; color: hsl(var(--foreground)); }
.fires li::before { content: ""; width: 5px; height: 5px; border-radius: 999px; background: hsl(var(--shipped)); flex-shrink: 0; margin-top: 7px; }
.fires code { font-size: 12.5px; }

/* the missing link */
.fstep.gap .fstep-n { background: hsl(var(--progress-bg)); color: hsl(var(--progress)); border: 1px dashed hsl(var(--progress)); }
.fstep.gap .rail::after { background: repeating-linear-gradient(to bottom, hsl(var(--border)) 0 4px, transparent 4px 9px); }
.fstep.gap .what { color: hsl(var(--progress)); }
.fstep.gap .fires { border-style: dashed; border-color: hsl(var(--progress)); background: hsl(var(--progress-bg)); }
.fstep.gap .fires li::before { background: hsl(var(--progress)); }
.fstep.gap .fires .fh { color: hsl(var(--progress)); }

@media (max-width: 820px) {
  .fstep { grid-template-columns: 30px 1fr; }
  .fires { grid-column: 2; margin-top: 14px; }
}

/* ---------- ERD ---------- */
.erd-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 26px; }
.erd { display: block; width: 100%; min-width: 940px; height: auto; }
.erd .box { fill: hsl(var(--card)); stroke: hsl(var(--border)); stroke-width: 1; }
.erd .hub { fill: hsl(var(--secondary)); stroke: hsl(var(--border)); }
.erd .tname { fill: hsl(var(--foreground)); font-size: 14.5px; font-weight: 510; letter-spacing: -0.005em; }
.erd .fld { fill: hsl(var(--muted-foreground)); font-size: 11.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.erd .fld.pk { fill: hsl(var(--foreground)); }
.erd .link { stroke: hsl(var(--border)); stroke-width: 1.5; fill: none; }
.erd .link.flow { stroke: hsl(var(--muted-foreground)); }
.erd .lbl { fill: hsl(var(--muted-foreground)); font-size: 11px; font-weight: 510; }
.erd .lbl-bg { fill: hsl(var(--background)); }
.erd .dot-live { fill: hsl(var(--shipped)); }
.erd .dot-part { fill: hsl(var(--progress)); }
.erd .rls { fill: hsl(var(--muted-foreground)); font-size: 10px; font-weight: 510; letter-spacing: 0.06em; }
.erd .rls-bg { fill: hsl(var(--muted)); stroke: none; }
.erd .arrow { fill: hsl(var(--muted-foreground)); }

/* ---------- automation cards ---------- */
.autos { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 12px; }
.auto {
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 4px);
  background: hsl(var(--card)); padding: 15px 16px;
}
.auto .a-n {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px; color: hsl(var(--foreground)); font-weight: 500;
  margin-bottom: 7px; word-break: break-word;
}
.auto .a-s { font-size: 13.5px; line-height: 1.55; color: hsl(var(--muted-foreground)); }
