/* ============================================================================
   AIPATH — Agentic Transformation Navigator
   ----------------------------------------------------------------------------
   The components the lifecycle adds on top of the assessment shell: the
   scoring grid, the readiness heatmap, the four-read quadrant, the roadmap,
   the confirm step, and the Navigator dashboard itself.

   Everything is built on the tokens in styles.css, so dark and light both
   work without a second set of rules, and nothing here hard-codes a colour
   that the theme owns.
   ========================================================================== */

/* ---- report frame -------------------------------------------------------
   Shared by every stage report. The existing readiness report has its own
   older frame; these are the classes the lifecycle stages use. */
.rp { max-width: 940px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) var(--pad) 96px; }
.rp-head { padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.rp-eyebrow { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); font-weight: 600; }
.rp-title { font-family: var(--font-display); font-size: clamp(1.9rem, 4vw, 2.7rem);
  line-height: 1.12; margin-top: 10px; }
.rp-sub { margin-top: 10px; color: var(--ink-soft); font-size: .93rem; }
.rp-card { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(18px, 3vw, 28px); margin-bottom: 18px; }
.rp-card h2 { font-family: var(--font-display); font-size: 1.6rem; line-height: 1.2; }
.rp-card h3 { font-size: var(--h3); margin-bottom: 4px; }
.rp-floor { margin-top: 14px; color: var(--ink-soft); font-size: .93rem; line-height: 1.65; }
.rp-next .btn { margin-top: 12px; margin-right: 10px; }

/* Confidence. Deliberately loud when it is low: a score presented without
   its evidence quality is the thing this whole record exists to prevent. */
.rp-conf { border-left: 3px solid var(--line-2); }
.rp-conf.is-high { border-left-color: #3FA55F; }
.rp-conf.is-medium { border-left-color: var(--warm); }
.rp-conf.is-low { border-left-color: var(--epi-red); }
.rp-conf-h { font-size: 1.02rem; }
.rp-conf ul { margin: 10px 0 0 18px; color: var(--ink-soft); font-size: .92rem; line-height: 1.7; }
.rp-conf-note { margin-top: 12px; color: var(--ink-faint); font-size: .86rem; line-height: 1.6; }
.rp-disagree { border-left: 3px solid var(--warm); }
.rp-disagree ul { margin: 12px 0 0 18px; font-size: .93rem; line-height: 1.8; color: var(--ink-soft); }

/* ---- the scoring grid ---------------------------------------------------
   Eight rows of one to five. Shown as a grid rather than eight screens
   because the reader needs to see the shape of their own answer. */
.atn-grid { display: grid; gap: 4px; }
.atn-grid-head, .atn-grid-row {
  display: grid; grid-template-columns: minmax(150px, 1fr) repeat(5, 44px);
  align-items: center; gap: 6px;
}
.atn-grid-head { padding-bottom: 4px; }
.atn-grid-h { text-align: center; font-size: .74rem; color: var(--ink-faint); }
.atn-grid-row { padding: 7px 10px; border-radius: var(--radius-sm); }
.atn-grid-row:nth-child(odd) { background: var(--surface-2); }
.atn-grid-rowl { font-size: .93rem; line-height: 1.4; }
.atn-grid-help { display: block; color: var(--ink-faint); font-size: .8rem; margin-top: 2px; }
.atn-grid-b {
  height: 38px; border-radius: 9px; border: 1px solid var(--line-2);
  background: transparent; color: var(--ink-soft); font: inherit; font-size: .92rem;
  cursor: pointer; transition: all .14s var(--t);
}
.atn-grid-b:hover { border-color: var(--accent); color: var(--ink); }
.atn-grid-b.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
@media (max-width: 640px) {
  .atn-grid-head { display: none; }
  .atn-grid-row { grid-template-columns: 1fr; gap: 8px; }
  .atn-grid-row > .atn-grid-b { display: inline-block; width: 18%; margin-right: 2%; }
}

/* ---- free text ---------------------------------------------------------- */
.atn-text textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); color: var(--ink); font: inherit; font-size: 1rem;
  padding: 14px 16px; line-height: 1.6; resize: vertical;
}
.atn-text textarea:focus { outline: none; border-color: var(--accent); }

/* ---- the confirm step ---------------------------------------------------
   What the Navigator worked out, shown before it is used, with the choice
   to accept it or amend it on the record. */
.atn-confirm { display: grid; gap: 8px; }
.atn-conf-row {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start;
  padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.atn-conf-n { color: var(--ink-faint); font-size: .8rem; font-variant-numeric: tabular-nums; }
.atn-conf-why { display: block; color: var(--ink-soft); font-size: .88rem; margin-top: 4px; line-height: 1.6; }
.atn-conf-tag { font-size: .73rem; color: var(--ink-faint); border: 1px solid var(--line-2);
  border-radius: 99px; padding: 3px 9px; white-space: nowrap; }
.atn-conf-tag.is-critical { color: var(--epi-red); border-color: var(--epi-red-line);
  background: var(--epi-red-soft); }
.atn-conf-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.atn-conf-actions .is-on { outline: 2px solid var(--accent); outline-offset: 2px; }
.atn-conf-amend { flex-basis: 100%; }
.atn-conf-amend textarea {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); color: var(--ink); font: inherit; padding: 12px 14px;
}
.atn-empty { color: var(--ink-soft); font-size: .94rem; }

/* ---- the heatmap --------------------------------------------------------
   One row per dimension, the bar tinted by maturity level rather than by
   how close it is to 100: level 3 is the first level at which anything may
   run with real autonomy, and the colour should say so. */
.atn-heat { display: grid; gap: 10px; margin-top: 14px; }
.atn-heat-row {
  display: grid; grid-template-columns: minmax(130px, 1.1fr) minmax(90px, 2fr) 46px 104px;
  gap: 10px; align-items: center;
}
.atn-heat-l { font-size: .94rem; font-weight: 500; }
.atn-heat-bar { height: 10px; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--line); overflow: hidden; }
.atn-heat-bar i { display: block; height: 100%; border-radius: 99px; }
.atn-heat-bar .lv1 { background: var(--epi-red); }
.atn-heat-bar .lv2 { background: #C9713F; }
.atn-heat-bar .lv3 { background: var(--warm); }
.atn-heat-bar .lv4 { background: #6FA860; }
.atn-heat-bar .lv5 { background: #3FA55F; }
.atn-heat-v { text-align: right; font-variant-numeric: tabular-nums; font-size: .93rem; }
.atn-heat-m { font-size: .8rem; color: var(--ink-faint); }
.atn-heat-says { grid-column: 1 / -1; color: var(--ink-faint); font-size: .84rem;
  line-height: 1.55; margin: -4px 0 6px; }
@media (max-width: 680px) {
  .atn-heat-row { grid-template-columns: 1fr 44px; }
  .atn-heat-bar { grid-column: 1 / -1; }
  .atn-heat-m { grid-column: 1 / -1; }
}

/* ---- the constraint register -------------------------------------------- */
.atn-constraints { list-style: none; display: grid; gap: 10px; margin-top: 14px; }
.atn-constraints li { padding: 14px 16px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  border-left: 3px solid var(--line-2); }
.atn-constraints li.is-critical { border-left-color: var(--epi-red); }
.atn-c-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.atn-c-sev { font-size: .74rem; color: var(--ink-faint); white-space: nowrap; }
.is-critical .atn-c-sev { color: var(--epi-red); }
.atn-constraints p { margin-top: 6px; color: var(--ink-soft); font-size: .9rem; line-height: 1.65; }

/* ---- the four reads ----------------------------------------------------- */
.atn-quad { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin-top: 18px; }
.atn-quad-c { padding: 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface-2); text-align: center; }
.atn-quad-c span { display: block; font-size: .82rem; color: var(--ink-soft); }
.atn-quad-c b { display: block; font-size: 1.9rem; font-family: var(--font-display);
  margin-top: 6px; line-height: 1; }
.atn-quad-c.is-good b { color: #3FA55F; }
.atn-quad-c.is-mid b { color: var(--warm); }
.atn-quad-c.is-bad b { color: var(--epi-red); }
.atn-quad-c.is-none b { color: var(--ink-faint); }

.atn-rank { list-style: none; counter-reset: r; display: grid; gap: 6px; margin-top: 12px; }
.atn-rank li { counter-increment: r; display: grid;
  grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: baseline;
  padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm); }
.atn-rank li::before { content: counter(r, decimal-leading-zero);
  color: var(--ink-faint); font-size: .8rem; }
.atn-rank-d { font-size: .82rem; color: var(--accent); }
.atn-rank-i { font-size: .82rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ---- the roadmap -------------------------------------------------------- */
.atn-phase-m { font-size: .76rem; color: var(--ink-faint); font-weight: 400; margin-left: 10px; }
.atn-road { list-style: none; display: grid; gap: 8px; margin-top: 12px; }
.atn-road li { padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm);
  border-left: 3px solid var(--line-2); }
.atn-road li.is-critical { border-left-color: var(--epi-red); }
.atn-road-w { display: inline-block; margin-left: 10px; font-size: .74rem; color: var(--accent); }
.atn-road-y { display: block; margin-top: 5px; color: var(--ink-soft); font-size: .88rem; line-height: 1.6; }
.atn-road-g { display: block; margin-top: 6px; font-size: .8rem; color: var(--ink-faint); }

/* ============================================================================
   THE NAVIGATOR DASHBOARD
   ========================================================================== */
.nav-body { background: var(--bg); }
.nav-main { max-width: var(--maxw); margin: 0 auto; padding: clamp(24px, 5vw, 48px) var(--pad) 110px; }
.nav-top { display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: flex-end; gap: 20px; padding-bottom: 22px;
  border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.nav-title { font-family: var(--font-display); font-size: clamp(2rem, 4.2vw, 3rem); line-height: 1.1; }
.nav-org { color: var(--ink-soft); margin-top: 8px; font-size: .96rem; }
.nav-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.nav-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.nav-prog-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--line); overflow: hidden; }
.nav-prog-bar i { display: block; height: 100%; background: var(--accent); }
.nav-prog-n { font-size: .86rem; color: var(--ink-soft); white-space: nowrap; }

/* The lifecycle, as ten cards. A shut one says what opens it rather than
   simply refusing, because a disabled control with no explanation is the
   commonest way a product loses somebody's afternoon. */
.nav-stages { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; }
.nav-stage { display: block; text-decoration: none; color: inherit;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; transition: all .16s var(--t); }
a.nav-stage:hover { border-color: var(--accent); transform: translateY(-2px); }
.nav-stage.is-shut { opacity: .62; }
.nav-stage.is-done { border-color: rgba(63,165,95,.4); }
.nav-st-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.nav-st-n { font-size: .74rem; color: var(--ink-faint); letter-spacing: .1em; }
.nav-st-s { font-size: .72rem; border-radius: 99px; padding: 3px 9px; border: 1px solid var(--line-2);
  color: var(--ink-faint); white-space: nowrap; }
.nav-stage.is-done .nav-st-s { color: #3FA55F; border-color: rgba(63,165,95,.45); }
.nav-stage.is-open .nav-st-s { color: var(--accent); border-color: var(--accent); }
.nav-st-t { font-size: 1.04rem; font-weight: 600; margin-top: 8px; line-height: 1.3; }
.nav-st-o { color: var(--ink-soft); font-size: .86rem; margin-top: 6px; line-height: 1.55; }
.nav-st-w { color: var(--ink-faint); font-size: .82rem; margin-top: 10px; line-height: 1.55; }
.nav-st-sum { margin-top: 10px; font-size: .86rem; color: var(--ink); line-height: 1.5;
  padding-top: 10px; border-top: 1px solid var(--line); }

.nav-section { margin-top: 38px; }
.nav-section > h2 { font-family: var(--font-display); font-size: 1.6rem; margin-bottom: 4px; }
.nav-section > p { color: var(--ink-soft); font-size: .93rem; max-width: 70ch; line-height: 1.65; }
.nav-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px; margin-top: 16px; }
.nav-card { background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; }
.nav-card h3 { font-size: 1.05rem; margin-bottom: 10px; }
.nav-empty { color: var(--ink-faint); font-size: .9rem; line-height: 1.6; }

/* The two matrices. Plotted rather than tabulated because the useful
   reading is which quadrant a use case is in, not its coordinates. */
.atn-matrix { position: relative; aspect-ratio: 1; margin-top: 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.atn-matrix::before, .atn-matrix::after {
  content: ""; position: absolute; background: var(--line); }
.atn-matrix::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.atn-matrix::after { top: 50%; left: 0; right: 0; height: 1px; }
.atn-pt { position: absolute; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg); transform: translate(-50%, 50%);
  cursor: help; }
.atn-pt.d-orchestrate { background: #3FA55F; }
.atn-pt.d-agentize { background: var(--accent); }
.atn-pt.d-assist { background: var(--warm); }
.atn-pt.d-automate { background: #7A8AA8; }
.atn-pt.d-human { background: var(--epi-red); }
.atn-ax { display: flex; justify-content: space-between; color: var(--ink-faint);
  font-size: .76rem; margin-top: 7px; }
.atn-ax-y { position: absolute; left: -8px; top: 50%; transform: rotate(-90deg) translateX(50%);
  transform-origin: left center; color: var(--ink-faint); font-size: .76rem; white-space: nowrap; }
.atn-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: .78rem;
  color: var(--ink-soft); }
.atn-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

/* The cash-flow curve. An inline SVG: a chart library for one chart on a
   site with no build step is a dependency that outlives its usefulness. */
.atn-chart { width: 100%; height: 220px; margin-top: 14px; }
.atn-chart .grid { stroke: var(--line); stroke-width: 1; }
.atn-chart .zero { stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 3 3; }
.atn-chart .cum { fill: none; stroke: var(--accent); stroke-width: 2.4; }
.atn-chart .ben { fill: none; stroke: #3FA55F; stroke-width: 1.6; opacity: .8; }
.atn-chart .cost { fill: none; stroke: var(--epi-red); stroke-width: 1.6; opacity: .8; }
.atn-chart text { fill: var(--ink-faint); font-size: 10px; }

.atn-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.atn-kv div { padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.atn-kv span { display: block; font-size: .78rem; color: var(--ink-soft); }
.atn-kv b { display: block; font-size: 1.35rem; font-family: var(--font-display); margin-top: 4px; }

/* Traceability. Every recommendation the Navigator makes can be opened to
   show the answers, evidence and scores under it. */
.atn-why { margin-top: 10px; }
.atn-why summary { cursor: pointer; font-size: .84rem; color: var(--accent); }
.atn-why-body { margin-top: 10px; padding: 12px 14px; background: var(--surface-2);
  border-radius: var(--radius-sm); font-size: .87rem; line-height: 1.7; color: var(--ink-soft); }
.atn-why-body b { color: var(--ink); }

.atn-facts { list-style: none; display: grid; gap: 6px; margin-top: 12px; }
.atn-facts li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px;
  align-items: baseline; padding: 9px 12px; background: var(--surface-2);
  border-radius: var(--radius-sm); font-size: .89rem; }
.atn-prov { font-size: .72rem; border: 1px solid var(--line-2); border-radius: 99px;
  padding: 2px 8px; color: var(--ink-faint); white-space: nowrap; }
.atn-prov.p-system-derived, .atn-prov.p-consultant-validated { color: #3FA55F; border-color: rgba(63,165,95,.4); }
.atn-prov.p-self-report { color: var(--warm); border-color: rgba(218,168,98,.4); }

.nav-gate-note { margin-top: 10px; color: var(--ink-faint); font-size: .84rem; line-height: 1.6; }

/* ---- print ------------------------------------------------------------- */
@media print {
  .ra-header, .ra-footer, .nav-actions, .atn-why summary { display: none !important; }
  .rp-card, .nav-card { break-inside: avoid; border-color: #ccc; }
  .atn-why-body { display: block !important; }
}
