/* ENG-1233 — journey shell: hero welcome on every page, back navigation, the guided journey
   panel and the staged quote workspace. Loads last so it wins the cascade. Tokens only. */

/* --- Hero welcome ------------------------------------------------------ */
.hero-welcome {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(16rem, 1fr);
  gap: var(--space-6);
  align-items: end;
  margin: 0 0 var(--space-6);
  padding: var(--space-6) var(--space-6) var(--space-5);
  border-radius: var(--radius-card-lg);
  background: var(--hero-gradient);
  color: var(--chrome-text);
  box-shadow: var(--elevation-3);
  animation: cds-rise var(--motion-slow) var(--ease-out);
}
.hero-welcome:has(> .hero-welcome-lead:only-child) { grid-template-columns: minmax(0, 1fr); }
.hero-welcome-lead { min-width: 0; position: relative; z-index: 1; }
.hero-welcome h1, .workspace-topbar.hero-welcome h1 {
  margin: var(--space-1) 0 0;
  max-width: 22ch;
  color: var(--chrome-text);
  font-size: var(--fs-hero);
  font-weight: var(--fw-bold);
  line-height: var(--lh-hero);
  letter-spacing: var(--tr-tightest);
  overflow-wrap: anywhere;
}
/* The h1 badge is the one place a Decisions count lives in the hero; the strip below carries the rest. */
.hero-welcome h1 .badge { display: inline-grid; place-items: center; min-width: 2.25rem; height: 2.25rem; margin-left: var(--space-2); padding: 0 var(--space-3); vertical-align: middle; border-radius: var(--radius-pill); background: var(--accent); border: 0; color: var(--accent-text); font-size: var(--fs-body-lg); font-weight: var(--fw-bold); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.hero-welcome-greeting { margin: 0; color: var(--chrome-accent-text); font-size: var(--fs-caption); font-weight: var(--fw-bold); letter-spacing: var(--tr-wide); text-transform: uppercase; }
.hero-welcome .workspace-kicker { color: var(--chrome-muted-text); }
.hero-welcome-purpose, .workspace-topbar.hero-welcome p.hero-welcome-purpose { margin: var(--space-3) 0 0; max-width: 58ch; color: var(--text-on-dark-muted); font-size: var(--fs-body-lg); line-height: var(--lh-body-snug); }
.hero-welcome-note { margin: var(--space-2) 0 0; max-width: 58ch; color: var(--text-on-dark-muted); font-size: var(--fs-body-sm); }
.hero-welcome-changed { margin: var(--space-2) 0 0; color: var(--chrome-accent-text); font-size: var(--fs-body-sm); font-weight: var(--fw-medium); }
.hero-welcome-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }
.hero-welcome-actions .btn { width: auto; }
.hero-welcome-actions .btn:not(.btn-primary) { background: var(--hero-metric-bg); border-color: var(--hero-metric-border); color: var(--chrome-text); }
.hero-welcome-actions .btn:not(.btn-primary):hover:not(:disabled) { border-color: var(--chrome-border-strong); }
.hero-welcome-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin: 0; position: relative; z-index: 1; }
.hero-welcome-counts:has(> .hero-metric:only-child) { grid-template-columns: minmax(0, 1fr); }
.hero-welcome-counts .hero-metric, .hero-welcome-counts .quote-stat {
  display: grid; gap: var(--space-0-5); padding: var(--space-3) var(--space-3-5);
  border: 1px solid var(--hero-metric-border); border-left-width: 3px; border-radius: var(--radius-md);
  background: var(--hero-metric-bg); box-shadow: none;
}
.hero-welcome-counts .hero-metric .n, .hero-welcome-counts .quote-stat-value { font-family: var(--font-heading); font-size: var(--fs-figure); font-weight: var(--fw-bold); line-height: 1.05; color: var(--chrome-text); font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.hero-welcome-counts .hero-metric .l, .hero-welcome-counts .quote-stat-label { margin: 0; color: var(--hero-metric-text); font-size: var(--fs-caption); letter-spacing: 0; text-transform: none; font-weight: var(--fw-medium); }
.hero-welcome-counts .quote-stats, .hero-welcome-counts > [data-hero-counts] { display: contents; }
.hero-welcome-counts .hero-metric[data-hero-tile="warning"] { border-left-color: var(--warning); }
.hero-welcome-counts .hero-metric[data-hero-tile="success"] { border-left-color: var(--success); }
.hero-welcome-counts .hero-metric[data-hero-tile="info"] { border-left-color: var(--accent); }
.hero-welcome-counts[hidden] { display: none; }

/* Pages whose header row also carries actions keep them under the hero, full width. */
.assurance-header:has(.hero-welcome) { flex-direction: column; align-items: stretch; gap: var(--space-3); }
.assurance-header:has(.hero-welcome) .hero-welcome { margin-bottom: var(--space-2); }
.quote-navigation .hero-welcome { margin-bottom: var(--space-6); }

/* --- Back navigation ----------------------------------------------------- */
.journey-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-4); }
.journey-back { width: auto; min-height: var(--touch); padding: 0 var(--space-3); border-color: var(--border-visible); background: var(--bg-card-opaque); color: var(--text-primary); font-size: var(--fs-body-sm); text-decoration: none; }
.journey-back:hover { border-color: var(--accent); color: var(--accent-hover); }
.journey-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1-5); margin: 0; padding: 0; list-style: none; color: var(--text-muted); font-size: var(--fs-caption); }
.journey-crumbs li { display: inline-flex; align-items: center; gap: var(--space-1-5); }
.journey-crumbs li + li::before { content: "/"; color: var(--border-strong); }
.journey-crumbs a { color: var(--text-secondary); text-decoration: none; }
.journey-crumbs a:hover { color: var(--accent-hover); text-decoration: underline; }
.journey-crumbs [aria-current="page"] { color: var(--text-primary); font-weight: var(--fw-semibold); }
.saved-quote-trail { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.saved-quote-trail a { display: inline-flex; align-items: center; gap: var(--space-1-5); min-height: var(--touch); padding: 0 var(--space-3); border: 1px solid var(--border-visible); border-radius: var(--radius-input); background: var(--bg-card-opaque); color: var(--text-primary); font-size: var(--fs-body-sm); font-weight: var(--fw-medium); text-decoration: none; }
.saved-quote-trail a:hover { border-color: var(--accent); color: var(--accent-hover); }

/* --- Saved quote hero -------------------------------------------------- */
.saved-quote-header { padding-bottom: 0; }
.saved-quote-register { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2-5); margin: 0; color: var(--on-navy-secondary); font-size: var(--fs-meta); }
.saved-quote-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin: var(--space-3) 0 var(--space-2); }
.saved-quote-toolbar p { margin: 0; color: var(--text-secondary); font-size: var(--fs-body-sm); }
.saved-quote-toolbar [data-saved-pdf] { margin: 0; }
/* The shell's breadcrumb already carries "Back to Quotes"; the in-page trail only shows without it. */
#main:has(> [data-journey-bar]) .saved-quote-trail { display: none; }
/* The five section chips are superseded by the stage rail; they stay in the DOM for anchors. */
.saved-quote-workspace:has(.journey-stage-rail) .saved-quote-journey { display: none; }

/* --- Staged workspace layout -------------------------------------------- */
.saved-quote-layout.has-stage-rail { grid-template-columns: 11rem minmax(0, 1fr) 18rem; gap: var(--space-5); }
.journey-stage-rail { position: sticky; top: var(--space-4); min-width: 0; }
.journey-stage-rail ol { display: grid; gap: var(--space-1); margin: 0; padding: var(--space-3); list-style: none; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg-card); box-shadow: var(--elevation-1); }
.journey-stage-rail li { position: relative; }
.journey-stage-rail a { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-2-5); min-height: var(--touch); padding: var(--space-2) var(--space-2-5); border-radius: var(--radius-sm); color: var(--text-secondary); text-decoration: none; }
.journey-stage-rail a:hover { background: var(--bg-elevated); color: var(--text-primary); }
.journey-stage-mark { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; margin-top: 0.1rem; border: 1px solid var(--border-strong); border-radius: 50%; font-size: var(--fs-caption); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; color: var(--text-secondary); background: var(--bg-card-opaque); }
.journey-stage-text { display: grid; gap: 0.1rem; min-width: 0; }
.journey-stage-label { font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); color: var(--text-primary); }
.journey-stage-note { font-size: var(--fs-caption); color: var(--text-muted); overflow-wrap: anywhere; }
.journey-stage-rail li[data-stage-state="done"] .journey-stage-mark { background: var(--success); border-color: var(--success); color: var(--accent-text); }
.journey-stage-rail li[data-stage-state="attention"] .journey-stage-mark { background: var(--chip-warning-bg); border-color: var(--warning); color: var(--ink-warning); }
.journey-stage-rail li[data-stage-state="attention"] .journey-stage-note { color: var(--ink-warning); font-weight: var(--fw-medium); }
.journey-stage-rail li[data-stage-state="running"] .journey-stage-mark { background: var(--accent); border-color: var(--accent); color: var(--accent-text); animation: cds-shimmer 1.4s linear infinite; }
.journey-stage-rail li[data-stage-state="running"] .journey-stage-note { color: var(--accent-hover); }
.journey-stage-rail li[data-stage-state="current"] .journey-stage-mark { border-color: var(--accent); color: var(--accent-hover); }
.journey-stage-rail li[data-stage-state="todo"] .journey-stage-label { color: var(--text-secondary); font-weight: var(--fw-medium); }
.journey-stage-rail li[aria-current="step"] > a { background: var(--accent-muted); box-shadow: inset 3px 0 0 var(--accent); }
.journey-stage-rail li[aria-current="step"] .journey-stage-label { color: var(--accent-hover); }

.journey-stage-group { position: relative; margin-block: var(--space-6); padding-top: var(--space-2); border-top: 1px solid var(--x-hairline-strong); }
.journey-stage-group:first-of-type { margin-top: var(--space-4); }
.journey-group-label { margin: 0 0 var(--space-1); color: var(--text-muted); font-size: var(--fs-label); font-weight: var(--fw-bold); letter-spacing: var(--tr-wide); text-transform: uppercase; }
.journey-stage-group > .card { margin-top: var(--space-3); }
.journey-anchor { scroll-margin-top: var(--space-6); }

/* --- ENG-1243 titled sections and card grid ------------------------------
   Every stage on the quote page is a titled section (eyebrow, h2, one-line explainer) whose cards
   sit in a grid: one column on phones, two from 1200px, three from 1440px. A card only spans the
   row when it is alone or a wide editor (scope lines). Long lists scroll inside their card. */
.journey-group-head { display: grid; gap: var(--space-1); margin: 0 0 var(--space-4); }
.journey-group-head .journey-group-label { margin: 0; }
.saved-quote-workspace h2.journey-group-title { margin: 0; color: var(--text-primary); font-family: var(--font-heading); font-size: var(--fs-h2); font-weight: var(--fw-bold); line-height: var(--lh-tight); }
.journey-group-explainer { margin: 0; color: var(--text-secondary); font-size: var(--fs-body-sm); }
.journey-group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); gap: var(--space-4); align-items: start; }
.journey-group-grid > .journey-group-note { grid-column: 1 / -1; margin: 0; }
.saved-quote-workspace .journey-group-grid > .card { margin-block: 0; min-width: 0; }
.journey-group-grid > .card:only-child, .journey-group-grid > .journey-card-wide { grid-column: 1 / -1; }
.saved-quote-workspace .journey-group-grid .card > h3 { margin: 0 0 var(--space-3); font-size: var(--fs-h3); }
.saved-needs-me .journey-stage-group:first-of-type { margin-top: var(--space-4); }
.saved-quote-workspace details.saved-quote-edit > summary { margin: 0 0 var(--space-3); }
.journey-scope-lines > fieldset { margin-block: 0; }
.journey-two-up { display: grid; gap: var(--space-4); }
.journey-two-up .saved-lodgement { min-width: 0; }
.card-scroll { max-height: 60vh; overflow: auto; padding-right: var(--space-2); }
@media (min-width: 1200px) {
  .journey-group-grid { gap: var(--space-5); }
  .journey-scope-lines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
  .journey-scope-lines > h3, .journey-scope-lines > p, .journey-scope-lines > label { grid-column: 1 / -1; }
}
#stage-scope, #stage-assumptions { scroll-margin-top: var(--space-6); }

/* --- Guided journey panel ----------------------------------------------- */
.journey-guide { margin: 0 0 var(--space-5); padding: var(--space-5); border: 1px solid var(--chrome-border-strong); border-radius: var(--radius-card); background: var(--bg-card); box-shadow: var(--elevation-2); }
.journey-guide-head { display: flex; align-items: start; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); }
.journey-guide-head h2 { margin: var(--space-1) 0 0; font-size: var(--fs-h3); }
.journey-guide-head .btn { width: auto; flex: none; min-height: var(--touch); }
.journey-guide-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.journey-card { display: grid; align-content: start; gap: var(--space-2); min-width: 0; padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-panel); background: var(--bg-elevated); }
.journey-card-eyebrow { margin: 0; color: var(--text-muted); font-size: var(--fs-label); font-weight: var(--fw-bold); letter-spacing: var(--tr-wide); text-transform: uppercase; }
.journey-card-action { margin: 0; color: var(--text-primary); font-size: var(--fs-body); font-weight: var(--fw-semibold); line-height: var(--lh-body-snug); overflow-wrap: anywhere; }
.journey-card-detail { margin: 0; color: var(--text-body); font-size: var(--fs-body-sm); line-height: var(--lh-body-snug); max-width: 56ch; overflow-wrap: anywhere; }
.journey-card-lines, .journey-card-facts { display: grid; gap: var(--space-1); margin: 0; padding: 0; list-style: none; color: var(--text-body); font-size: var(--fs-body-sm); }
.journey-card-lines li { overflow-wrap: anywhere; }
.journey-card-facts li::before { content: "· "; color: var(--accent); }
.journey-card .btn { justify-self: start; width: auto; margin-top: var(--space-1); text-decoration: none; }
.journey-agent-dot { display: inline-block; width: 0.5rem; height: 0.5rem; margin-right: var(--space-2); border-radius: 50%; background: var(--text-muted); vertical-align: middle; }
.journey-card[data-agent-status="running"] .journey-agent-dot { background: var(--accent); animation: cds-shimmer 1.4s linear infinite; }
.journey-card[data-agent-status="waiting"] .journey-agent-dot { background: var(--warning); }
.journey-card[data-agent-status="done"] .journey-agent-dot { background: var(--success); }
.journey-guide-restore { display: flex; justify-content: flex-end; margin: 0 0 var(--space-3); }
.journey-guide-restore .btn { width: auto; min-height: var(--touch); font-size: var(--fs-caption); }

/* --- Intake upload state (beside the picker) ----------------------------- */
.intake-upload-state { margin: var(--space-2) 0; }
.intake-upload-state[hidden] { display: none; }
.intake-upload-card { display: grid; gap: var(--space-1-5); padding: var(--space-3) var(--space-4); border: 1px solid var(--border-visible); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--bg-card-opaque); box-shadow: var(--elevation-1); }
.intake-upload-card[data-intake-upload-phase="failed"] { border-left-color: var(--error); }
.intake-upload-card[data-intake-upload-phase="opened"] { border-left-color: var(--success); }
.intake-upload-file { margin: 0; font-size: var(--fs-body-sm); color: var(--text-primary); overflow-wrap: anywhere; }
.intake-upload-size { color: var(--text-muted); }
.intake-upload-line { margin: 0; font-size: var(--fs-body-sm); color: var(--text-body); }
.intake-upload-card[data-intake-upload-phase="uploading"] .intake-upload-line { color: var(--accent-hover); font-weight: var(--fw-medium); }
.intake-upload-error { color: var(--ink-error); font-weight: var(--fw-medium); }
.intake-upload-card .actions { display: flex; gap: var(--space-2); margin-top: var(--space-1); }
.intake-upload-card .btn { width: auto; }

/* --- Sign-in and context review ----------------------------------------- */
.auth-welcome { margin: 0 0 var(--space-4); color: var(--text-secondary); font-size: var(--fs-body); }
.context-review-shell { max-width: 60rem; margin: var(--space-4) auto 0; padding: 0 var(--space-4); }
.context-review-shell .journey-bar { margin-bottom: var(--space-2); }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .hero-welcome { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .hero-welcome-counts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .saved-quote-layout.has-stage-rail { grid-template-columns: 11rem minmax(0, 1fr); }
  .saved-quote-layout.has-stage-rail .saved-quote-rail { grid-column: 1 / -1; order: 1; position: static; }
}
@media (max-width: 880px) {
  .saved-quote-layout.has-stage-rail { grid-template-columns: minmax(0, 1fr); }
  .journey-stage-rail { position: static; order: -1; margin-bottom: var(--space-2); }
  .journey-stage-rail ol { display: flex; gap: var(--space-1); overflow-x: auto; padding: var(--space-2); scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
  .journey-stage-rail li { flex: 1 0 auto; min-width: 6.25rem; scroll-snap-align: start; }
  .journey-stage-rail a { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: var(--space-2) var(--space-1-5); }
  .journey-stage-note { display: none; }
  .journey-stage-rail li[aria-current="step"] .journey-stage-note { display: block; }
  .journey-stage-rail li[aria-current="step"] > a { box-shadow: inset 0 -3px 0 var(--accent); }
}
@media (max-width: 600px) {
  .hero-welcome { padding: var(--space-5) var(--space-4) var(--space-4); border-radius: var(--radius-card); }
  .hero-welcome h1, .workspace-topbar.hero-welcome h1 { font-size: var(--fs-h2); }
  .hero-welcome-purpose, .workspace-topbar.hero-welcome p.hero-welcome-purpose { font-size: var(--fs-body-sm); }
  /* command-centre.css sets four columns on `.hero-panel-compact .hero-metrics` at this width; this
     three-class selector wins so phone tiles are two across and a label never wraps past two lines. */
  .hero-panel-compact.hero-welcome .hero-metrics.hero-welcome-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
  .hero-panel-compact.hero-welcome .hero-welcome-counts .hero-metric, .hero-panel-compact.hero-welcome .hero-welcome-counts .quote-stat { padding: var(--space-2-5) var(--space-3); }
  .hero-panel-compact.hero-welcome .hero-welcome-counts .hero-metric .n, .hero-panel-compact.hero-welcome .hero-welcome-counts .quote-stat-value { font-size: var(--fs-figure-sm); }
  .hero-panel-compact.hero-welcome .hero-welcome-counts .hero-metric .l, .hero-panel-compact.hero-welcome .hero-welcome-counts .quote-stat-label { font-size: var(--fs-caption); line-height: 1.3; }
  /* A phone keeps the one-line purpose and the single primary action; secondary actions live in the page. */
  .hero-welcome .hero-welcome-purpose, .hero-panel-compact.hero-welcome .hero-lede { display: block; margin-top: var(--space-2); }
  .hero-welcome-actions { display: grid; gap: var(--space-2); }
  .hero-welcome-actions .btn { width: 100%; }
  .hero-welcome-actions .btn:not(.btn-primary) { display: none; }
  .journey-guide { padding: var(--space-4); }
  .journey-guide-head { flex-direction: column; }
  .journey-guide-cards { grid-template-columns: minmax(0, 1fr); }
  .journey-bar { gap: var(--space-2); }
  .journey-back { width: auto; }
}
/* ENG-1234 expanded agent focus owns the layout: the quote folds into its reference rail, so the
   stage rail steps aside and the agent column keeps the place agent-focus.css gives it. */
@media (min-width: 601px) {
  [data-agent-focus-host][data-agent-focus="expanded"] .journey-stage-rail { display: none; }
  [data-agent-focus-host][data-agent-focus="expanded"] .saved-quote-layout.has-stage-rail { grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr); }
  [data-agent-focus-host][data-agent-focus="expanded"] .saved-quote-layout.has-stage-rail .saved-quote-rail { grid-column: auto; order: 0; position: static; }
}
.saved-lodgement-banner { margin: 0 0 var(--space-3); }

/* --- ENG-1238 desktop-first workspace (1200px and wider) ------------------
   Joe reviews on 1440+; the saved-quote workspace fills the page with a 240px stage rail, a fluid
   canvas and a 400px agent column. Phones keep the sheet rules above untouched. */
.saved-quote-status-note { margin: 0; color: var(--text-secondary); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.saved-quote-workspace .saved-quote-toolbar [role="status"].saved-quote-status-note:not(:empty) { padding: 0; border: 0; background: transparent; border-radius: 0; }
.saved-quote-status-note:empty { display: none; }
.saved-quote-toolbar-lead { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-3); min-width: 0; }
.lodgement-hitl-group { display: grid; gap: var(--space-2); margin: 0 0 var(--space-3); }
.lodgement-hitl-group-owner { margin: 0; color: var(--text-muted); font-size: var(--fs-caption); font-weight: var(--fw-bold); letter-spacing: 0.06em; text-transform: uppercase; }
.lodgement-hitl-cards { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.lodgement-hitl-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3) var(--space-4); padding: var(--space-3) var(--space-4); border: 1px solid var(--chip-warning-border); border-left: 3px solid var(--warning); border-radius: var(--radius-sm); background: var(--bg-card-opaque); box-shadow: var(--elevation-1); }
.lodgement-hitl-chip { display: inline-flex; align-items: center; padding: 0.15rem var(--space-2-5); border: 1px solid var(--chip-warning-border); border-radius: var(--radius-pill); background: var(--chip-warning-bg); color: var(--ink-warning); font-size: var(--fs-label); font-weight: var(--fw-bold); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
.lodgement-hitl-text { display: grid; gap: var(--space-0-5); min-width: 0; }
.lodgement-hitl-title { margin: 0; color: var(--text-primary); font-size: var(--fs-body); font-weight: var(--fw-semibold); line-height: var(--lh-body-snug); overflow-wrap: anywhere; }
.lodgement-hitl-line { margin: 0; color: var(--text-secondary); font-size: var(--fs-body-sm); line-height: var(--lh-body-snug); }
.saved-quote-workspace a.lodgement-hitl-confirm { justify-self: end; width: auto; min-height: var(--touch); margin: 0; padding: 0 var(--space-4); border: 1px solid var(--accent); border-radius: var(--radius-input); background: var(--accent); color: var(--accent-text); font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); text-decoration: none; white-space: nowrap; }
.saved-quote-workspace a.lodgement-hitl-confirm:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
@media (max-width: 600px) {
  .lodgement-hitl-card { grid-template-columns: auto minmax(0, 1fr); }
  .saved-quote-workspace a.lodgement-hitl-confirm { grid-column: 1 / -1; justify-self: stretch; justify-content: center; }
}

@media (min-width: 1200px) {
  .main:has(.saved-quote-workspace) { max-width: 105rem; padding-inline: var(--space-8); }
  .saved-quote-workspace { max-width: none; padding-inline: 0; }
  .saved-quote-layout.has-stage-rail { grid-template-columns: 11.5rem minmax(0, 1fr) 19rem; gap: var(--space-6); }
  .saved-quote-layout.has-stage-rail .saved-quote-rail { grid-column: auto; order: 0; position: sticky; }
  .saved-quote-workspace .card { padding: var(--space-6); }
  .saved-quote-workspace .card p, .saved-quote-workspace .card li, .saved-quote-workspace .card label, .saved-quote-workspace .card small, .saved-quote-workspace .card summary { font-size: var(--fs-body-md); line-height: var(--lh-body-card); }
  .saved-quote-workspace .card p { max-width: 80ch; }
  .saved-quote-workspace .card .lodgement-hitl-line, .saved-quote-workspace .card .card-meta, .saved-quote-workspace .card #saved-pdf-note { font-size: var(--fs-body-sm); }
  .journey-guide { padding: var(--space-6); }
  .journey-guide-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
  .journey-card { padding: var(--space-5); }
  .journey-card-detail { max-width: none; }
  .journey-card-action, .journey-card-lines, .journey-card-facts { font-size: var(--fs-body-md); line-height: var(--lh-body-card); }
  .journey-stage-rail a { padding: var(--space-2-5) var(--space-3); }
}
@media (prefers-reduced-motion: reduce) {
  .hero-welcome, .journey-stage-rail li[data-stage-state="running"] .journey-stage-mark, .journey-card[data-agent-status="running"] .journey-agent-dot { animation: none; }
}

/* --- ENG-1518 Price basis: navy header, one provenance chip per line, TBC lines tinted and outside the total --- */
.price-basis { margin-top: var(--space-4); }
.price-basis-table { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.price-basis-head, .price-basis-row { display: grid; grid-template-columns: minmax(0, 1fr) 6rem 7rem 7rem; align-items: center; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4); }
.price-basis-head { background: var(--navy-solid); color: var(--on-navy-emphasis); font-size: var(--fs-label); font-weight: var(--fw-heavy); letter-spacing: 0.06em; text-transform: uppercase; }
.price-basis-row { border-top: 1px solid var(--border); background: var(--bg-card-opaque); color: var(--text-body); }
.price-basis-head > :not(:first-child), .price-basis-row > [data-price-cell] { text-align: right; font-variant-numeric: tabular-nums; }
.price-basis-row > [data-price-cell="amount"] { color: var(--text-primary); font-weight: var(--fw-bold); }
.price-basis-row.is-tbc { background: var(--attention-row); }
.price-basis-row.is-tbc .price-basis-item, .price-basis-row.is-tbc > [data-price-cell="amount"] { color: var(--ink-warning); }
.price-basis-cell-item { display: grid; gap: var(--space-1-5); min-width: 0; }
.price-basis-item { color: var(--text-primary); font-weight: var(--fw-bold); overflow-wrap: anywhere; }
.price-basis-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); color: var(--text-secondary); font-size: var(--fs-body-sm); }
.price-basis-meta > .dl-chip { font-size: var(--fs-label); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }
.price-basis-detail { overflow-wrap: anywhere; }
.price-basis-foot { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3) var(--space-4); margin-top: var(--space-4); }
.price-basis-sum { display: grid; gap: var(--space-1); margin: 0; }
.price-basis-total { color: var(--navy-solid); font-size: var(--fs-figure-sm); font-weight: var(--fw-heavy); font-variant-numeric: tabular-nums; }
.price-basis-total small { color: var(--text-secondary); font-size: var(--fs-body-sm); font-weight: var(--fw-regular); }
.price-basis-gst, .price-basis-empty { margin: 0; color: var(--text-secondary); font-size: var(--fs-body-sm); }
.price-basis-outside, .price-basis-unbacked { max-width: 22rem; margin: 0; padding: var(--space-2-5) var(--space-3-5); border: 1px solid var(--attention-band-border); border-radius: var(--radius-md); background: var(--attention-row); color: var(--ink-warning); font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); }
@media (max-width: 640px) {
  .price-basis-head, .price-basis-row { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: var(--space-3); }
  .price-basis-head > :first-child, .price-basis-cell-item { grid-column: 1 / -1; }
}

/* --- ENG-1517 Decision view · Changes · Full record, and the one Needs you list --- */
.saved-quote-switch { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); margin: var(--space-4) 0 var(--space-2); }
.saved-quote-switch-note { flex: 1 1 18rem; margin: 0; color: var(--text-secondary); font-size: var(--fs-body-sm); }
.saved-quote-save-state { margin: 0; color: var(--text-secondary); font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); }
.saved-quote-save-state:not([data-save-state="saved"]) { color: var(--ink-warning); }
.saved-quote-lens[hidden] { display: none; }
.needs-you-list, .changes-list { display: grid; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.changes-list > li { display: grid; gap: var(--space-1); padding-bottom: var(--space-3); border-bottom: 1px solid var(--border); }
.needs-you-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: var(--space-3) var(--space-4); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card-opaque); }
.needs-you-rank { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border: 1px solid var(--chip-warning-border); border-radius: 50%; color: var(--ink-warning); font-size: var(--fs-caption); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.needs-you-body { display: grid; gap: var(--space-1); min-width: 0; }
.needs-you-chips { display: flex; flex-wrap: wrap; gap: var(--space-1-5); margin: 0; }
.needs-you-title { margin: 0; color: var(--text-primary); font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.needs-you-reason, .needs-you-raised, .needs-you-empty, .changes-note { margin: 0; color: var(--text-body); font-size: var(--fs-body-sm); }
.needs-you-raised, .changes-note { color: var(--text-secondary); }
.changes-note { margin-top: var(--space-3); }
@media (max-width: 720px) {
  .needs-you-row { grid-template-columns: auto minmax(0, 1fr); }
  .needs-you-row > .dl-button { grid-column: 2; justify-self: start; }
}
.needs-you-tbc { display: grid; gap: var(--space-1-5); margin-top: var(--space-4); }
.needs-you-tbc ul { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: 0; padding: 0; list-style: none; font-size: var(--fs-body-sm); }

/* --- ENG-1519 right rail: Ask the agent, Since revision N, On this quote, Where this came from ---
   One scroll region at viewport height beside the quote on a desktop; the bottom sheet on a phone. */
.saved-quote-rail { display: grid; gap: var(--space-4); align-content: start; }
.saved-quote-rail:focus-visible { outline: 0; box-shadow: var(--focus-ring); border-radius: var(--radius-section); }
.saved-quote-rail > .agent-chat { border: 1px solid var(--x-panel-border); border-radius: var(--radius-section); background: var(--bg-card-opaque); box-shadow: var(--panel-shadow); }
.agent-chat-titles { display: grid; gap: var(--space-0-5); min-width: 0; }
.agent-chat-title { margin: 0; color: var(--navy-solid); font-size: var(--fs-panel-title); font-weight: var(--fw-heavy); line-height: var(--lh-tight); letter-spacing: var(--tr-snug); }
.agent-chat-bound { margin: 0; color: var(--text-secondary); font-size: var(--fs-body-sm); }
.agent-capabilities { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.agent-capabilities p { margin: 0; padding: var(--space-2-5) var(--space-3); border-radius: var(--radius-md); font-size: var(--fs-caption); line-height: var(--lh-body-snug); color: var(--text-body); }
.agent-capabilities strong { display: block; font-size: var(--fs-label); letter-spacing: 0.08em; text-transform: uppercase; }
.agent-capabilities [data-agent-can] { background: var(--chip-success-bg); }
.agent-capabilities [data-agent-can] strong { color: var(--ink-success); }
.agent-capabilities [data-agent-never] { background: var(--chip-error-bg); }
.agent-capabilities [data-agent-never] strong { color: var(--ink-error); }
.agent-suggestion-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.agent-dismiss { min-height: 36px; padding: 0 var(--space-3); font-size: var(--fs-body-sm); background: transparent; }
.agent-prepared-note { margin: 0; color: var(--text-secondary); font-size: var(--fs-caption); line-height: var(--lh-body-snug); }
.agent-prepared-note strong { color: var(--text-primary); }
.saved-quote-rail-context { display: grid; gap: var(--space-4); min-width: 0; }
.saved-quote-rail-context .dl-panel__head { padding: var(--space-5) var(--space-5) var(--space-3); }
.saved-quote-rail-context .dl-panel__body { display: grid; gap: var(--space-3); padding: 0 var(--space-5) var(--space-5); }
.quote-rail-list { display: grid; gap: var(--space-2-5); margin: 0; padding: 0; list-style: none; }
.quote-rail-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.quote-rail-row-text, .quote-rail-request { display: grid; gap: var(--space-0-5); min-width: 0; }
.quote-rail-meta { color: var(--text-secondary); font-size: var(--fs-caption); }
.quote-rail-what { margin: 0; color: var(--text-primary); font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); line-height: var(--lh-body-snug); overflow-wrap: anywhere; }
.quote-rail-row > .dl-chip { flex: none; }
.quote-rail-note { margin: 0; color: var(--text-secondary); font-size: var(--fs-caption); line-height: var(--lh-body-snug); }
.quote-rail-link { justify-self: start; color: var(--accent); font-size: var(--fs-body-sm); font-weight: var(--fw-semibold); }
.quote-rail-link::after { content: " →"; }
/* Sticky rails sit below the sticky global nav. */
.journey-stage-rail { top: calc(var(--global-nav-height) + var(--space-4)); }
@media (min-width: 1101px) {
  .saved-quote-rail { position: sticky; top: calc(var(--global-nav-height) + var(--space-4)); max-height: calc(100dvh - var(--global-nav-height) - var(--space-8)); overflow-y: auto; overscroll-behavior: contain; }
  [data-agent-focus-host][data-agent-focus="expanded"] .saved-quote-rail { max-height: none; overflow: visible; }
}
@media (min-width: 601px) {
  [data-agent-focus-host][data-agent-focus="expanded"] .saved-quote-rail-context { display: none; }
}
@media (max-width: 600px) {
  /* The tablet rule above (.saved-quote-layout.has-stage-rail .saved-quote-rail, static) outranks
     agent-focus.css, so the sheet restates its fixed position at the same weight. */
  [data-agent-focus-host] .saved-quote-layout.has-stage-rail .saved-quote-rail { position: fixed; inset: auto 0 var(--mobile-nav-height) 0; z-index: var(--z-sticky); max-height: min(88dvh, calc(100dvh - var(--global-nav-height) - var(--mobile-nav-height))); }
  [data-agent-focus-host] .saved-quote-rail { gap: 0; overflow-y: auto; overscroll-behavior: contain; border-radius: var(--radius-card-lg) var(--radius-card-lg) 0 0; background: var(--bg-card-opaque); box-shadow: var(--elevation-3); }
  [data-agent-focus-host] .saved-quote-rail > .agent-chat { flex: 0 0 auto; border: 0; border-radius: 0; box-shadow: none; }
  [data-agent-focus-host] .agent-sheet-bar { position: sticky; top: 0; z-index: 1; background: var(--bg-card-opaque); }
  [data-agent-focus-host][data-agent-focus="expanded"] .agent-chat-body-wrap { overflow: visible; }
  [data-agent-focus-host] .saved-quote-rail-context { display: none; }
  [data-agent-focus-host][data-agent-focus="expanded"] .saved-quote-rail-context { display: grid; padding: 0 var(--space-4) var(--space-4); }
  .agent-capabilities { grid-template-columns: minmax(0, 1fr); }
}
.agent-prefill { display: grid; gap: var(--space-2); margin: 0; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); min-width: 0; }
.agent-prefill-check { padding: 0; color: var(--text-primary); font-weight: var(--fw-heavy); font-size: var(--fs-body-sm); }
.agent-prefill-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.agent-prefill-field { display: grid; gap: var(--space-0-5); min-width: 0; }
.agent-prefill-field label { font-size: var(--fs-caption); color: var(--text-secondary); }
.agent-prefill-field input, .agent-prefill-field select { width: 100%; min-width: 0; min-height: 36px; }
.agent-prefill-field:last-child { grid-column: 1 / -1; }
.agent-suggestions .agent-prefill-error { margin: 0; color: var(--ink-error); font-size: var(--fs-body-sm); }
