:root {
  --background: #07090d;
  --surface: #0d1118;
  --surface-hover: #121824;
  --border: #202838;
  --text: #f5f7fb;
  --muted: #8f99aa;
  --blue: #4d8cff;
  --purple: #7d5cff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(
      circle at 78% 8%,
      rgba(77, 140, 255, 0.08),
      transparent 30%
    ),
    radial-gradient(
      circle at 92% 18%,
      rgba(125, 92, 255, 0.08),
      transparent 26%
    ),
    var(--background);
  color: var(--text);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.main {
  min-width: 0;
  padding: 24px 28px 30px;
}

.eyebrow {
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 54px);
  letter-spacing: -0.035em;
}

#journey > h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  color: var(--muted);
}

#journey > p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

#journey > h3 {
  margin: 32px 0 12px;
  font-size: 21px;
}

#journey > button {
  padding: 10px 16px;
  border: 1px solid rgba(77, 140, 255, 0.35);
  border-radius: 8px;
  background: linear-gradient(
    135deg,
    rgba(77, 140, 255, 0.18),
    rgba(125, 92, 255, 0.14)
  );
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

#journey > button:hover {
  background: var(--surface-hover);
}

#journey-result {
  max-width: 1000px;
  margin-top: 18px;
  padding: 0;
  color: var(--text);
}

#journey-result:not(:empty) {
  padding: 16px 18px;
  border: 1px solid rgba(77, 140, 255, 0.28);
  border-left: 2px solid var(--purple);
  border-radius: 10px;
  background: rgba(13, 17, 24, 0.84);
}

.questions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  max-width: 1500px;
  padding-top: 22px;
  border-top: 2px solid #9b86ff;
}

.question-card {
  min-width: 0;
  padding: 22px;
  border: 2px solid #9b86ff;
  border-radius: 14px;
  background: rgba(13, 17, 24, 0.84);
}

.question-card > p:first-child {
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.question-title {
  min-height: 3.2em;
  margin: 8px 0 16px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.question-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}

.question-status-label {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.question-card label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.question-card textarea,
.question-card input,
.question-card select {
  width: 100%;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #090d13;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.question-card textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.45;
}

.question-card select {
  min-height: 40px;
}

.question-card textarea:focus,
.question-card input:focus,
.question-card select:focus {
  outline: 1px solid var(--blue);
  border-color: rgba(77, 140, 255, 0.55);
}

.rag {
  display: inline-block;
  min-width: 88px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.rag.UNASSESSED {
  color: var(--muted);
}
.rag.GREEN {
  color: #79e8aa;
  background: rgba(71, 201, 126, 0.08);
  border-color: rgba(71, 201, 126, 0.24);
}
.rag.AMBER {
  color: #ffd27a;
  background: rgba(255, 184, 77, 0.08);
  border-color: rgba(255, 184, 77, 0.24);
}
.rag.RED {
  color: #ff8b8b;
  background: rgba(255, 74, 74, 0.08);
  border-color: rgba(255, 74, 74, 0.24);
}

.selection-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 6px 0 0;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #090d13;
  color: var(--text);
  font-size: 12px;
}

.selection-chip button {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-weight: bold;
  padding: 0;
}

.chip-container {
  margin-top: 4px;
}

.coverage-detail {
  margin-bottom: 20px;
}

.coverage-detail summary {
  cursor: pointer;
  display: inline-block;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  user-select: none;
}

.coverage-detail summary:hover {
  border-color: #39455a;
}

.coverage-detail-content {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(8, 11, 16, 0.5);
}

.question-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.question-save-status {
  min-width: 64px;
  color: var(--muted);
  font-size: 12px;
}

.question-save-status.saved {
  color: #79e8aa;
}

.question-save-status.failed {
  color: #ff8b8b;
}

.question-actions button,
.summary-button {
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-hover);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.question-actions button:first-child {
  border-color: rgba(77, 140, 255, 0.35);
  background: rgba(77, 140, 255, 0.12);
}

.question-actions button:hover,
.summary-button:hover {
  border-color: #39455a;
}

.missing-field {
  outline: 2px solid #f44336 !important;
  outline-offset: 2px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.76);
  z-index: 1000;
}

.modal-overlay.open {
  display: flex;
}

.modal-panel {
  width: min(720px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.modal-x-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
  width: 42px;
  height: 42px;
  margin: -8px -8px 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.modal-x-close:hover {
  background: var(--surface-hover);
}

.modal-panel h2 {
  margin-top: 0;
}
.modal-panel p {
  line-height: 1.5;
  color: #d9deea;
}
.modal-panel ul {
  padding-left: 22px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
  flex-wrap: wrap;
}

.modal-actions button {
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.modal-close {
  background: transparent;
  color: var(--text);
}
.modal-primary {
  background: var(--text);
  color: #111;
}

.validation-question {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #090d13;
}

.validation-question strong {
  display: block;
  margin-bottom: 6px;
}

@media (max-width: 1180px) {
  .questions-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  html,
  body,
  .app,
  .main {
    max-width: 100%;
  }

  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .main {
    padding: 28px 20px;
  }
  .questions-grid {
    grid-template-columns: 1fr;
  }

  .question-card textarea,
  .question-card input,
  .question-card select,
  #journeyPicker,
  #summaryJourneyPicker {
    min-width: 0;
    max-width: 100%;
  }
}

/* Tier 1 journey selector and assessment controls */
#journeyPicker {
  width: 100%;
  min-height: 44px;
  padding: 10px 56px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background-color: #090d13;
  color: var(--text);
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23f5f7fb' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 20px 20px;
}

#journeyPicker:focus {
  outline: 1px solid var(--blue);
  border-color: rgba(77, 140, 255, 0.55);
}

.assessment-heading-row {
  max-width: 1500px;
  margin: 22px 0 12px;
}

.assessment-heading-row h2 {
  margin: 0;
  font-size: 32px;
  letter-spacing: -0.025em;
}

.evaluate-assessment-button {
  padding: 10px 16px;
  border: 1px solid var(--purple);
  border-radius: 8px;
  background: var(--purple);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.evaluate-assessment-button:hover {
  filter: brightness(1.08);
}

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  vertical-align: middle;
}

.info-tip-button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(143, 153, 170, 0.55);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
}

.info-tip-text {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  transform: translateX(-50%);
  width: 260px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111722;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity 120ms ease;
}

.info-tip:hover .info-tip-text,
.info-tip:focus-within .info-tip-text {
  opacity: 1;
}

/* Tier 1 journey creation form */
.create-journey-form {
  display: grid;
  gap: 14px;
}

.create-journey-form label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.create-journey-form input,
.create-journey-form textarea {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #090d13;
  color: var(--text);
  font: inherit;
}

@media (max-width: 980px) {
    }

/* Subtle RAG border treatment */
.question-card.rag-green {
  border-color: #47c97e;
}

.question-card.rag-amber {
  border-color: #ffb84d;
}

.question-card.rag-red {
  border-color: #ff4a4a;
}

@media (max-width: 780px) {
  .evaluate-assessment-button {
    width: 100%;
  }

  .info-tip-text {
    left: auto;
    right: 0;
    transform: none;
    width: min(260px, calc(100vw - 32px));
  }
}


.is-hidden {
  display: none;
}

.modal-actions-start {
  justify-content: flex-start;
}

/* Tier 1 workflow header aligned with Tier 2 */

.tier1-journey-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 14px;
}

.tier1-header-main {
  min-width: 0;
}

.tier1-journey-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.tier1-header-company {
  flex: 0 0 auto;
  padding-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.tier1-status-strip {
  display: grid;
  grid-template-columns:
    minmax(360px, 0.9fr)
    minmax(340px, 1.25fr)
    minmax(220px, 0.65fr);
  gap: 10px;
  margin-bottom: 10px;
}

.tier1-status-card {
  min-height: 92px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(13, 17, 24, 0.88);
}

.tier1-outcome-card {
  flex-wrap: nowrap;
}

.tier1-outcome-copy {
  flex: 0 0 auto;
  min-width: 112px;
}

.tier1-status-label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.tier1-status-value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 800;
}

.tier1-outcome-value {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.tier1-journey-nav {
  min-width: 0;
  flex: 1;
}

.tier1-journey-nav label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.tier1-journey-nav #journeyPicker {
  width: 100%;
  min-width: 145px;
  min-height: 38px;
  margin: 0;
  padding: 6px 34px 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background-color: #090d13;
  color: var(--text);
  font: inherit;
}

.tier1-context-card {
  padding: 12px 16px;
}

.tier1-context-content {
  width: 100%;
}

.tier1-context-meta {
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 800;
}

.tier1-context-dot {
  margin: 0 4px;
  color: var(--muted);
}

.tier1-context-explainer {
  margin-top: 9px;
  font-size: 13px;
  line-height: 1.35;
}

.tier1-action-card {
  justify-content: center;
}

.tier1-action-card .evaluate-assessment-button {
  width: 100%;
  min-height: 42px;
  margin: 0;
  padding: 9px 14px;
  border: 1px solid var(--purple);
  border-radius: 8px;
  background: var(--purple);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
}

@media (max-width: 1250px) {
  .tier1-status-strip {
    grid-template-columns: 1fr 1fr;
  }

  .tier1-action-card {
    grid-column: 1 / -1;
  }
}

/* Tier 1 mobile layout and containment */
@media (max-width: 850px) {
  .main {
    width: 100%;
    max-width: 100vw;
    padding-left: 20px;
    padding-right: 20px;
    overflow-x: hidden;
  }

  .tier1-journey-header {
    flex-direction: column;
  }

  .tier1-header-company {
    text-align: left;
  }

  .tier1-status-strip {
    grid-template-columns: 1fr;
  }

  .tier1-action-card {
    grid-column: auto;
  }

  .tier1-status-strip,
  .tier1-status-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .tier1-outcome-card {
    flex-wrap: wrap;
  }

  .tier1-journey-nav {
    min-width: 0;
    width: 100%;
  }

  .tier1-journey-nav #journeyPicker {
    min-width: 0;
    max-width: 100%;
  }

  .info-tip-text {
    left: 0;
    right: auto;
    transform: none;
    max-width: min(260px, calc(100vw - 48px));
  }
}


.tier1-read-only-message {
  color: #ff5e67;
  font-weight: 800;
}

.tier1-read-only-message span {
  color: #ff8b91;
  font-weight: 600;
}

/* Primary Tier 1 Save action */
.question-card button[onclick^="saveResponse"] {
  background: #6d5dfc;
  border-color: #6d5dfc;
  color: #ffffff;
}

.question-card button[onclick^="saveResponse"]:hover {
  background: #7a6bff;
  border-color: #7a6bff;
}

