/* Carbon Verify guided workflow layer.
   The calculation and document engine remain unchanged; this stylesheet turns
   the existing long form into a task-led, one-stage-at-a-time journey. */

:root {
  --cv-navy: #0c3f63;
  --cv-navy-deep: #082f49;
  --cv-green: #1e7e36;
  --cv-green-soft: #e9f7ed;
  --cv-blue-soft: #eef7ff;
  --cv-paper: #f4f8f6;
  --cv-line: #d7e4e1;
  --cv-amber: #9a5b07;
}

body.cv-guided {
  background: var(--cv-paper);
}

.cv-guided header {
  background: linear-gradient(115deg, var(--cv-navy-deep), var(--cv-navy));
}

.cv-guided .container {
  max-width: 1480px;
  align-items: start;
}

.cv-guided .main-content,
.cv-guided .dashboard-sticky {
  min-width: 0;
}

.cv-journey {
  margin-bottom: 1.25rem;
  border: 1px solid var(--cv-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(12, 63, 99, 0.08);
  overflow: hidden;
}

.cv-journey-head {
  padding: 1.35rem 1.4rem 1.1rem;
  background: linear-gradient(135deg, #ffffff 0%, var(--cv-blue-soft) 100%);
}

.cv-journey-kicker {
  color: var(--cv-green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.cv-journey h2 {
  color: var(--cv-navy-deep);
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  margin: 0.25rem 0 0.3rem;
}

.cv-journey-summary {
  color: #4d6474;
  font-size: 0.9rem;
  margin: 0;
  max-width: 64ch;
}

.cv-journey-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  margin-top: 0.9rem;
}

/* The project bar already supplies save/status controls. Keep recovery in its
   expandable save details instead of repeating them in the journey heading. */
.cv-project-controls-elsewhere .cv-journey-meta,
.cv-project-controls-elsewhere .cv-recovery-note {
  display: none;
}

.cv-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #cfe0dc;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.85);
  color: #496272;
  font-size: 0.76rem;
  font-weight: 650;
}

.cv-status-chip[data-state="saved"]::before {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: var(--cv-green);
}

.cv-text-action {
  appearance: none;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--cv-navy);
  cursor: pointer;
  font: inherit;
  font-size: 0.77rem;
  font-weight: 700;
  padding: 0.35rem 0.25rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cv-text-action:hover {
  color: var(--cv-green);
}

.cv-journey-progress {
  height: 5px;
  background: #e1ebe8;
}

.cv-journey-progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cv-green), #46a85c);
  transition: width 220ms ease;
}

.cv-step-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(96px, 1fr));
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--cv-line);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scrollbar-color: #9cb5c2 transparent;
  scrollbar-width: thin;
}

.cv-step-list li {
  min-width: 96px;
  scroll-snap-align: center;
}

.cv-step-button {
  appearance: none;
  width: 100%;
  min-height: 74px;
  border: 0;
  border-right: 1px solid var(--cv-line);
  background: #fff;
  color: #5c7180;
  cursor: pointer;
  padding: 0.65rem 0.45rem;
  text-align: center;
  font: inherit;
}

.cv-step-list li:last-child .cv-step-button {
  border-right: 0;
}

.cv-step-button:hover {
  background: #f7faf9;
}

.cv-step-button[aria-current="step"] {
  background: var(--cv-navy);
  color: #fff;
}

.cv-step-number {
  display: grid;
  place-items: center;
  width: 1.45rem;
  height: 1.45rem;
  margin: 0 auto 0.3rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
}

.cv-step-button[data-complete="true"] .cv-step-number {
  border-color: var(--cv-green);
  background: var(--cv-green);
  color: #fff;
}

.cv-step-button[aria-current="step"][data-complete="true"] .cv-step-number {
  border-color: #b8f2c5;
  background: #b8f2c5;
  color: var(--cv-navy-deep);
}

.cv-step-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
}

.cv-stage-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.9rem;
  padding: 0.25rem 0.2rem;
}

.cv-stage-intro h2 {
  color: var(--cv-navy-deep);
  font-size: 1.3rem;
  margin: 0 0 0.2rem;
}

.cv-stage-intro h2[tabindex="-1"]:focus {
  outline: 0;
  box-shadow: none;
}

.cv-stage-intro p {
  color: #607584;
  font-size: 0.86rem;
  margin: 0;
}

.cv-stage-count {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--cv-line);
  color: var(--cv-navy);
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 750;
}

.cv-stage-side {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}

.cv-mobile-summary {
  display: none;
  gap: 0.45rem;
}

.cv-mobile-summary span {
  border: 1px solid var(--cv-line);
  border-radius: 8px;
  background: #fff;
  color: #536a78;
  font-size: 0.72rem;
  padding: 0.38rem 0.55rem;
}

.cv-mobile-summary strong {
  color: var(--cv-navy-deep);
}

.cv-tender-start {
  margin: 0 0 1.25rem;
  padding: 1.1rem;
  border: 1px solid #c7dce8;
  border-radius: 12px;
  background: linear-gradient(135deg, #f6fbff, #ffffff);
}

.cv-tender-start h3 {
  color: var(--cv-navy-deep);
  font-size: 1rem;
  margin: 0 0 0.35rem;
}

.cv-tender-start > p {
  color: #587080;
  font-size: 0.82rem;
  margin: 0 0 0.9rem;
}

.cv-tender-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.cv-tender-grid label,
.cv-tender-confirm {
  color: #314d5d;
  font-size: 0.8rem;
  font-weight: 700;
}

.cv-tender-grid select,
.cv-tender-grid input {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid #cfdddf;
  border-radius: 7px;
  background: #fff;
  color: #183747;
  font: inherit;
  font-size: 0.85rem;
}

.cv-tender-confirm {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin-top: 0.85rem;
  font-weight: 600;
  line-height: 1.45;
}

.cv-tender-confirm input {
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
}

.cv-guided .cv-step-hidden {
  display: none !important;
}

.cv-guided .card.cv-step-active {
  border-color: #cfdfdb;
  box-shadow: 0 7px 22px rgba(12, 63, 99, 0.06);
}

.cv-step-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin: 1rem 0 0;
  padding: 1rem 0.2rem 0.25rem;
  border-top: 1px solid var(--cv-line);
}

.cv-step-footer button {
  min-height: 44px;
}

.cv-readiness {
  margin-bottom: 1.15rem;
  padding: 1.05rem;
  border: 1px solid #bfd9c4;
  border-radius: 12px;
  background: var(--cv-green-soft);
}

.cv-readiness[data-ready="false"] {
  border-color: #ead6b6;
  background: #fff8e8;
}

.cv-readiness h3 {
  color: var(--cv-navy-deep);
  font-size: 1rem;
  margin: 0 0 0.35rem;
}

.cv-readiness p {
  color: #536a78;
  font-size: 0.84rem;
  margin: 0;
}

.cv-readiness ul {
  display: grid;
  gap: 0.35rem;
  list-style: none;
  margin: 0.7rem 0 0;
  padding: 0;
  color: #71501e;
  font-size: 0.82rem;
}

.cv-readiness-link {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.55rem;
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(154, 91, 7, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  color: #60451d;
  cursor: pointer;
  font: inherit;
  padding: 0.55rem 0.65rem;
  text-align: left;
}

.cv-readiness-link:hover {
  border-color: var(--cv-amber);
  background: #fff;
}

.cv-readiness-link span {
  border-radius: 999px;
  background: #f4e4c7;
  color: #71470b;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.42rem;
  white-space: nowrap;
}

.cv-readiness-more {
  padding: 0.35rem 0.65rem;
}

.cv-output-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1rem;
}

.cv-document-option {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid var(--cv-line);
  border-radius: 12px;
  background: #fff;
}

.cv-document-option h3 {
  margin: 0;
  color: var(--cv-navy-deep);
  font-size: 1rem;
}

.cv-document-option p {
  margin: 0 0 0.25rem;
  color: #536a78;
  font-size: 0.84rem;
  line-height: 1.5;
}

.cv-document-option .btn {
  width: 100%;
  margin-top: auto;
  min-height: 44px;
}

.cv-output-shortcuts details.cv-document-option {
  display: block;
}

.cv-output-shortcuts details.cv-document-option > summary {
  min-height: 44px;
  padding: 0.55rem 0;
  color: var(--cv-navy-deep);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.5;
}

.cv-output-shortcuts details.cv-document-option > summary:focus-visible {
  outline: 3px solid #2784bb;
  outline-offset: 3px;
}

.cv-document-detail {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.cv-document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.cv-document-actions .btn {
  flex: 1 1 10rem;
  width: auto;
  margin-top: 0;
}

.cv-output-shortcuts .btn {
  justify-content: center;
  text-align: center;
  white-space: normal;
}

.cv-recovery-note {
  margin-top: 0.85rem;
  border-left: 3px solid #7da9c4;
  padding: 0.55rem 0.75rem;
  background: #f6fbff;
  color: #536b7b;
  font-size: 0.77rem;
  line-height: 1.45;
}

@media (max-width: 1050px) {
  .cv-guided .container {
    grid-template-columns: 1fr;
  }
  .cv-guided .dashboard-sticky {
    position: static;
  }
  .cv-step-list {
    grid-template-columns: repeat(7, 112px);
    max-width: 100%;
  }
  .cv-mobile-summary {
    display: flex;
  }
}

@media (max-width: 720px) {
  .cv-guided header {
    position: static;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .cv-guided .header-actions {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
  }
  .cv-guided .container {
    padding: 1rem;
  }
  .cv-journey-head {
    padding: 0.9rem 1rem 0.85rem;
  }
  .cv-journey-summary {
    font-size: 0.82rem;
    line-height: 1.45;
  }
  .cv-step-button {
    min-height: 64px;
    padding: 0.5rem 0.35rem;
  }
  .cv-step-list {
    grid-template-columns: repeat(7, 104px);
  }
  .cv-step-label {
    font-size: 0.69rem;
  }
  .cv-stage-intro {
    flex-direction: column;
  }
  .cv-stage-side {
    width: 100%;
    align-items: stretch;
  }
  .cv-mobile-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .cv-output-shortcuts {
    grid-template-columns: 1fr;
  }
  .cv-tender-grid {
    grid-template-columns: 1fr;
  }
  .cv-tender-grid select,
  .cv-tender-grid input {
    font-size: 16px;
  }
  .cv-tender-confirm {
    min-height: 44px;
  }
  .cv-step-footer {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin-left: -1rem;
    margin-right: -1rem;
    padding: 0.8rem 1rem calc(0.8rem + env(safe-area-inset-bottom));
    background: rgba(244, 248, 246, 0.96);
    backdrop-filter: blur(8px);
  }
  .cv-readiness-link {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cv-journey-progress > span {
    transition: none;
  }
}
