/* Customer journey map, restyled in Blueprint Equity Design System v4.
   Every rule is scoped under #cj-root. Tokens only (tokens.css). */

#cj-root {
  height: min(88vh, 960px); min-height: 720px;
  display: flex; flex-direction: column;
  background: var(--bg-page); color: var(--fg-1);
  border: 1px solid var(--rule); border-radius: var(--radius-sheet); overflow: hidden;
  font-family: var(--font-sans); font-variant-numeric: tabular-nums lining-nums;
}
#cj-root *, #cj-root *::before, #cj-root *::after { box-sizing: border-box; }
#cj-root .cj-loading { padding: var(--space-7); color: var(--fg-2); font-size: 14px; }
#cj-root .cj-app { display: flex; flex-direction: column; height: 100%; min-height: 0; }
#cj-root .cj-spacer { flex: 1; }
#cj-root .cj-hairline { flex: 1; height: 1px; background: var(--rule); }
#cj-root .cj-kicker { font-size: 12.5px; line-height: 1.3; font-weight: 600; letter-spacing: .005em; color: var(--fg-2); }
#cj-root .cj-dot { width: 8px; height: 8px; border-radius: var(--radius-dot); flex-shrink: 0; display: inline-block; }
#cj-root .cj-dot-sm { width: 7px; height: 7px; }
#cj-root button { font-family: var(--font-sans); }

/* Row 1: scenarios. Tabs on a hairline; the active one carries the blue rule. */
#cj-root .cj-topbar { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-5) 0; flex-shrink: 0; border-bottom: 1px solid var(--rule); }
#cj-root .cj-pills { display: flex; align-items: center; gap: var(--space-1); overflow-x: auto; overflow-y: hidden; flex: 1; min-width: 0; }
#cj-root .cj-pill {
  appearance: none; flex-shrink: 0; display: flex; align-items: center; gap: var(--space-2);
  padding: 10px var(--space-3) 9px; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  background: transparent; color: var(--fg-2); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
#cj-root .cj-pill:hover { color: var(--fg-1); }
#cj-root .cj-pill.is-active { color: var(--fg-1); font-weight: 600; border-bottom-color: var(--bp-primary); }
#cj-root .cj-pill-count { font-size: 12.5px; font-weight: 400; color: var(--fg-2); }
#cj-root .cj-pill-new, #cj-root .cj-pill-ghost {
  height: 32px; padding: 0 var(--space-3); margin: 0 0 6px var(--space-2); border: 1px solid var(--rule-strong); border-radius: var(--radius-press);
  color: var(--fg-1); font-size: 13px;
}
#cj-root .cj-pill-new:hover { background: var(--fg-1); color: var(--bg-page); }
#cj-root .cj-pill-ghost { border-color: transparent; color: var(--fg-2); margin-left: 0; }
#cj-root .cj-pill-ghost:hover { color: var(--fg-1); background: var(--bg-raised); }
#cj-root .cj-pill-sm { margin: 0; }
#cj-root .cj-summary { flex-shrink: 0; margin-left: auto; padding-bottom: 8px; font-size: 13px; color: var(--fg-2); white-space: nowrap; }

/* Row 2: view switch and actions. */
#cj-root .cj-toolbar { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-5); flex-shrink: 0; flex-wrap: wrap; }
#cj-root .cj-tabs { display: inline-flex; align-items: center; border: 1px solid var(--rule-strong); border-radius: var(--radius-press); overflow: hidden; }
#cj-root .cj-tab {
  appearance: none; height: 34px; padding: 0 var(--space-4); border: 0; border-radius: 0;
  font-size: 13px; font-weight: 500; cursor: pointer; background: transparent; color: var(--fg-1);
}
#cj-root .cj-tab + .cj-tab { border-left: 1px solid var(--rule-strong); }
#cj-root .cj-tab:hover { background: var(--bg-raised); }
#cj-root .cj-tab.is-active { background: var(--fg-1); color: var(--bg-page); }
#cj-root .cj-btn {
  appearance: none; height: 34px; padding: 0 var(--space-4); flex-shrink: 0; white-space: nowrap;
  border: 1px solid transparent; border-radius: var(--radius-press);
  font-size: 13px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background-color .12s ease, color .12s ease;
}
#cj-root .cj-btn-primary { background: var(--action-primary); color: var(--fg-on-action); }
#cj-root .cj-btn-primary:hover { background: var(--action-primary-hover); color: var(--fg-on-action-hover); }
#cj-root .cj-btn-secondary { background: transparent; color: var(--fg-1); border-color: var(--rule-strong); }
#cj-root .cj-btn-secondary:hover { background: var(--fg-1); color: var(--bg-page); }
#cj-root .cj-btn-tertiary { background: transparent; color: var(--fg-1); }
#cj-root .cj-btn-tertiary:hover { background: var(--bg-raised); }
#cj-root .cj-presentbar { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-5); flex-shrink: 0; }

/* Main area: the scrolling canvas and the inspector. */
#cj-root .cj-main { flex: 1; display: flex; min-height: 0; border-top: 1px solid var(--rule); }
#cj-root .cj-pane { flex: 1; min-width: 0; background: var(--bg-raised); overflow: auto; position: relative; }

/* Journey view */
#cj-root .cj-journey { padding: var(--space-5) var(--space-5) var(--space-7); display: flex; flex-direction: column; gap: var(--space-6); }
#cj-root .cj-read { display: flex; align-items: flex-start; gap: var(--space-5); flex-wrap: wrap; }
#cj-root .cj-read-summary { flex: 1; min-width: min(100%, 260px); font-size: 14px; line-height: 1.55; color: var(--fg-2); max-width: 70ch; }
#cj-root .cj-legend { display: flex; align-items: center; gap: var(--space-2) var(--space-4); flex-wrap: wrap; }
#cj-root .cj-legend-item { display: flex; align-items: center; gap: 6px; }
#cj-root .cj-legend-name { font-size: 12.5px; font-weight: 500; color: var(--fg-1); }
#cj-root .cj-phase { display: flex; flex-direction: column; gap: var(--space-3); }
#cj-root .cj-phase-head { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
#cj-root .cj-phase-name { font-size: 17px; font-weight: 600; letter-spacing: -.005em; color: var(--fg-1); }
#cj-root .cj-phase-note { font-size: 13px; color: var(--fg-2); }
#cj-root .cj-phase-head .cj-hairline { align-self: center; min-width: 40px; }
#cj-root .cj-stages { display: flex; align-items: stretch; flex-wrap: wrap; gap: var(--space-3); }
#cj-root .cj-stage {
  width: 296px; max-width: 100%; flex-shrink: 0; background: var(--bg-page); border: 1px solid var(--rule); border-radius: var(--radius-sheet);
  padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); cursor: pointer;
  outline: 2px solid transparent; outline-offset: -1px;
}
#cj-root .cj-stage:hover { border-color: var(--rule-strong); }
#cj-root .cj-stage.is-selected { outline-color: var(--bp-primary); }
#cj-root .cj-stage-head { display: flex; align-items: center; gap: var(--space-2); }
#cj-root .cj-stage-owner { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cj-root .cj-stage-count { font-size: 12.5px; color: var(--fg-2); white-space: nowrap; }
#cj-root .cj-stage-title { display: flex; align-items: baseline; gap: var(--space-2); }
#cj-root .cj-stage-name { flex: 1; font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -.005em; }
#cj-root .cj-entry { flex-shrink: 0; font-size: 12px; font-weight: 500; color: var(--fg-2); border: 1px solid var(--rule); padding: 1px 6px; }
#cj-root .cj-touches { display: flex; flex-direction: column; gap: 4px; }
#cj-root .cj-touch {
  padding: var(--space-2) 10px; display: flex; flex-direction: column; gap: 2px; cursor: pointer;
  background: var(--bg-raised); border-left: 2px solid transparent; outline: 2px solid transparent; outline-offset: -2px;
}
#cj-root .cj-touch.is-cross { border-left-color: var(--rule-strong); }
#cj-root .cj-touch:hover { background: var(--bg-sunken); }
#cj-root .cj-touch.is-selected { outline-color: var(--bp-primary); }
#cj-root .cj-touch-name { font-size: 14px; font-weight: 500; line-height: 1.3; }
#cj-root .cj-touch-meta { font-size: 12px; line-height: 1.4; color: var(--fg-2); }
#cj-root .cj-gap { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--fg-1); }
#cj-root .cj-gap::before { content: ""; width: 7px; height: 7px; border-radius: var(--radius-dot); background: var(--status-negative); flex: none; }
#cj-root .cj-add-touch {
  appearance: none; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px; border: 1px dashed var(--rule-input); border-radius: var(--radius-press); background: transparent;
  color: var(--fg-1); font-size: 13px; font-weight: 500; cursor: pointer;
}
#cj-root .cj-add-touch:hover { border-style: solid; border-color: var(--rule-strong); }
#cj-root .cj-routes { padding-top: var(--space-3); border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: var(--space-2); }
#cj-root .cj-routes-label { font-size: 12.5px; font-weight: 600; color: var(--fg-2); }
#cj-root .cj-route { display: flex; align-items: flex-start; gap: var(--space-2); cursor: pointer; }
#cj-root .cj-route-arrow { flex-shrink: 0; display: inline-flex; padding-top: 2px; }
#cj-root .cj-route-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#cj-root .cj-route-to { font-size: 13px; font-weight: 600; line-height: 1.3; }
#cj-root .cj-route-note { font-size: 12px; line-height: 1.4; }

/* Analysis view */
#cj-root .cj-analysis { padding: var(--space-5) var(--space-5) var(--space-7); display: flex; flex-direction: column; gap: var(--space-6); }
#cj-root .cj-analysis-read { font-size: 14px; line-height: 1.55; color: var(--fg-2); max-width: 80ch; }
#cj-root .cj-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); border-top: 1px solid var(--rule-strong); }
#cj-root .cj-metric { padding: var(--space-4) var(--space-4) var(--space-4) 0; display: flex; flex-direction: column; gap: var(--space-1); border-bottom: 1px solid var(--rule); }
#cj-root .cj-metric-value { font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1.05; }
#cj-root .cj-metric-note { font-size: 13px; line-height: 1.45; color: var(--fg-2); }
#cj-root .cj-section { display: flex; flex-direction: column; gap: var(--space-3); }
#cj-root .cj-section-title { font-size: 21px; line-height: 1.28; font-weight: 600; letter-spacing: -.01em; color: var(--fg-1); }
#cj-root .cj-rows { display: flex; flex-direction: column; border-top: 1px solid var(--rule-strong); }
#cj-root .cj-row { background: transparent; border-bottom: 1px solid var(--rule); padding: var(--space-3) 0; display: flex; align-items: baseline; gap: var(--space-2) var(--space-4); flex-wrap: wrap; }
#cj-root .cj-row-badge, #cj-root .cj-row-kind { width: 150px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--fg-2); }
#cj-root .cj-row-text { flex: 1; min-width: min(100%, 220px); font-size: 14px; line-height: 1.5; color: var(--fg-2); }
#cj-root .cj-row-path .cj-row-text { color: var(--fg-1); }
#cj-root .cj-row-pair { width: 210px; flex-shrink: 0; font-size: 14px; font-weight: 600; }
#cj-root .cj-row-where { width: 210px; flex-shrink: 0; font-size: 14px; font-weight: 600; }
#cj-root .cj-row-risk { flex-shrink: 0; font-size: 13px; font-weight: 500; }
#cj-root .cj-load { border-top: 1px solid var(--rule-strong); padding-top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
#cj-root .cj-load-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
#cj-root .cj-load-name { width: 150px; flex-shrink: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#cj-root .cj-load-track { flex: 1; min-width: 80px; height: 8px; background: var(--bg-sunken); position: relative; }
#cj-root .cj-load-fill { position: absolute; left: 0; top: 0; height: 8px; }
#cj-root .cj-load-badge { width: 190px; flex-shrink: 0; text-align: right; font-size: 12.5px; color: var(--fg-2); white-space: nowrap; }

/* Inspector */
#cj-root .cj-inspector {
  width: 324px; flex-shrink: 0; background: var(--bg-page); border-left: 1px solid var(--rule);
  overflow: auto; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-5);
}
#cj-root .cj-inspector-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
#cj-root .cj-link-btn {
  appearance: none; background: none; border: 0; padding: 0; font-size: 13px; font-weight: 500; color: var(--fg-link);
  text-decoration: underline; text-underline-offset: .2em; cursor: pointer; flex-shrink: 0;
}
#cj-root .cj-link-btn:hover { text-decoration-thickness: 2px; }
#cj-root .cj-link-danger { color: var(--status-negative); }
#cj-root .cj-fields { display: flex; flex-direction: column; gap: var(--space-4); }
#cj-root .cj-field { display: flex; flex-direction: column; gap: 6px; }
#cj-root .cj-field .cj-kicker { color: var(--fg-1); }
#cj-root .cj-field-routes { gap: var(--space-2); }
#cj-root .cj-input, #cj-root .cj-select {
  width: 100%; min-width: 0; background: var(--bg-sunken); border: 0; border-bottom: 1px solid var(--rule-input); border-radius: var(--radius-sheet);
  padding: 9px 10px 8px; font: 400 15px/1.4 var(--font-sans); color: var(--fg-1); outline: none;
}
#cj-root .cj-input:hover, #cj-root .cj-select:hover { border-bottom-color: var(--rule-strong); }
#cj-root .cj-input:focus, #cj-root .cj-select:focus { border-bottom: 2px solid var(--focus); padding-bottom: 7px; }
#cj-root .cj-select { font-size: 14px; font-weight: 500; cursor: pointer; }
#cj-root .cj-input-note { font-size: 13px; }
#cj-root .cj-hint { font-size: 12.5px; line-height: 1.45; color: var(--fg-2); }
#cj-root .cj-route-card { border-top: 1px solid var(--rule); padding: var(--space-2) 0; display: flex; flex-direction: column; gap: var(--space-2); }
#cj-root .cj-route-card-head { display: flex; align-items: center; gap: var(--space-2); }
#cj-root .cj-route-card-to { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.3; }
#cj-root .cj-inspector-actions { display: flex; flex-direction: column; gap: var(--space-3); border-top: 1px solid var(--rule); padding-top: var(--space-4); }
#cj-root .cj-inspector-summary { font-size: 13px; color: var(--fg-2); line-height: 1.5; }
#cj-root .cj-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
#cj-root .cj-act {
  appearance: none; height: 36px; padding: 0 14px; border: 1px solid var(--rule-strong); border-radius: var(--radius-press);
  background: transparent; color: var(--fg-1); font-size: 13px; font-weight: 500; cursor: pointer;
}
#cj-root .cj-act:hover { background: var(--fg-1); color: var(--bg-page); }
#cj-root .cj-act-primary { background: var(--action-primary); color: var(--fg-on-action); border-color: transparent; }
#cj-root .cj-act-primary:hover { background: var(--action-primary-hover); color: var(--fg-on-action-hover); }
#cj-root .cj-act-danger { border-color: var(--rule); color: var(--status-negative); }
#cj-root .cj-act-danger:hover { background: var(--status-negative); color: var(--fg-inverse); border-color: var(--status-negative); }

@media (max-width: 900px) {
  #cj-root { height: auto; min-height: 640px; }
  #cj-root .cj-main { flex-direction: column; }
  #cj-root .cj-pane { max-height: 75vh; }
  #cj-root .cj-inspector { width: auto; border-left: 0; border-top: 1px solid var(--rule); }
  #cj-root .cj-topbar, #cj-root .cj-toolbar, #cj-root .cj-presentbar { padding-left: var(--space-4); padding-right: var(--space-4); }
  #cj-root .cj-summary { display: none; }
  #cj-root .cj-journey, #cj-root .cj-analysis { padding: var(--space-4) var(--space-4) var(--space-6); }
  #cj-root .cj-stage { width: 100%; }
  #cj-root .cj-row-pair, #cj-root .cj-row-where, #cj-root .cj-row-badge, #cj-root .cj-row-kind { width: auto; }
  #cj-root .cj-load-badge { width: auto; text-align: left; }
}

@media print {
  #cj-root { height: auto !important; min-height: 0 !important; overflow: visible !important; border: 0; }
  #cj-root [data-chrome], #cj-root [data-inspector], #cj-root .cj-presentbar { display: none !important; }
  #cj-root .cj-pane { overflow: visible !important; background: transparent !important; max-height: none; }
  #cj-root [data-phase] { break-inside: avoid; }
}
