:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #5f6368;
  --soft: #f8fafd;
  --line: #dadce0;
  --line-dark: #c7c9cc;
  --black: #000000;
  --shadow: 0 16px 44px rgba(60, 64, 67, 0.13);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

.page,
.app-shell,
.admin-shell {
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand,
.topbar nav button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand {
  font-size: 15px;
  font-weight: 560;
  color: #202124;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: block;
  flex: 0 0 auto;
}

.brand-word {
  transform: translateY(-1px);
}

.topbar nav {
  display: flex;
  gap: 6px;
}

.topbar nav button,
.rail-back,
.icon-btn {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #3c4043;
  cursor: pointer;
  font-size: 14px;
}

.topbar nav button:hover,
.rail-back:hover,
.icon-btn:hover {
  background: #f1f3f4;
}

.landing-shell,
.confirmation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  gap: 56px;
  align-items: center;
  width: min(1180px, calc(100% - 48px));
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  padding: 48px 0;
}

.landing-copy,
.confirmation-layout > div:first-child {
  max-width: 640px;
}

.product-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: #202124;
  font-size: 15px;
  font-weight: 560;
}

.product-name::before {
  display: block;
  width: 28px;
  height: 2px;
  background: #202124;
  content: "";
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 22px;
  font-size: clamp(44px, 7vw, 86px);
  font-weight: 520;
  line-height: 0.98;
  letter-spacing: 0;
}

.lead {
  max-width: 560px;
  color: var(--muted);
  font-size: 21px;
  line-height: 1.5;
}

.action-row,
.admin-actions,
.question-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  margin-top: 26px;
  color: var(--muted);
  font-size: 13px;
}

.trust-strip span {
  padding-right: 14px;
  border-right: 1px solid var(--line);
}

.trust-strip button {
  border: 0;
  background: transparent;
  color: #202124;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}

.legal-panel {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.legal-panel h3 {
  margin-bottom: 6px;
  font-size: 16px;
  font-weight: 520;
}

.legal-panel p,
.legal-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  transform: none;
}

.btn-primary {
  border: 1px solid var(--black);
  background: var(--black);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
}

.btn-secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: #202124;
}

.output-sheet,
.login-card,
.question-card,
.brief-panel,
.detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.output-sheet {
  padding: 28px;
}

.sheet-header,
.panel-title,
.question-meta,
.detail-top,
.admin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sheet-header,
.question-meta,
.panel-title {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #202124;
  background: #f8fafd;
  font-size: 12px;
}

.output-sheet h2 {
  font-size: 30px;
  font-weight: 520;
}

.output-sheet p,
.preview-block p {
  color: var(--muted);
  line-height: 1.55;
}

.quote-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 24px 0;
}

.quote-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 4px 0 0;
  font-size: 15px;
}

pre {
  overflow: auto;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafd;
  color: #202124;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
}

.intake-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 340px;
  min-height: calc(100vh - 64px);
}

.progress-rail,
.brief-panel {
  position: sticky;
  top: 64px;
  align-self: start;
  height: calc(100vh - 64px);
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.progress-rail {
  padding: 24px;
}

.brief-panel {
  right: 0;
  padding: 24px;
  border-right: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

.progress-label {
  margin: 24px 0 10px;
  color: #202124;
  font-size: 13px;
}

.progress-track {
  position: relative;
  width: 4px;
  height: 150px;
  margin: 0 0 28px 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f2;
}

.progress-track span {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  border-radius: inherit;
  background: #202124;
  transition: height 260ms ease;
}

.rail-steps {
  display: grid;
  gap: 10px;
}

.rail-steps div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.rail-steps .done {
  color: #202124;
}

.question-stage {
  display: grid;
  place-items: center;
  padding: 48px;
  background: linear-gradient(#ffffff, #fafafa);
}

.question-card {
  width: min(720px, 100%);
  padding: 38px;
}

.question-card h1 {
  margin-bottom: 28px;
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 480;
  line-height: 1.04;
}

.answer-input,
.login-card input,
.admin-controls input,
.admin-controls select,
.notes-box textarea {
  width: 100%;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  background: #ffffff;
  color: #202124;
  outline: 0;
  transition: border 160ms ease, box-shadow 160ms ease;
}

.answer-input,
.login-card input {
  min-height: 56px;
  padding: 15px 16px;
  font-size: 18px;
}

textarea.answer-input {
  min-height: 156px;
  resize: vertical;
  line-height: 1.55;
}

.answer-input:focus,
.login-card input:focus,
.admin-controls input:focus,
.admin-controls select:focus,
.notes-box textarea:focus {
  border-color: #202124;
  box-shadow: 0 0 0 3px rgba(32, 33, 36, 0.09);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.choice {
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #202124;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
}

.choice:hover {
  background: #f8fafd;
}

.choice.selected {
  border-color: #202124;
  background: #202124;
  color: #ffffff;
}

.question-actions {
  justify-content: flex-end;
  margin-top: 28px;
}

.preview-block {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.preview-block span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.preview-block strong {
  font-size: 18px;
  font-weight: 520;
}

.preview-block ul,
.plain-list {
  margin: 0;
  padding-left: 18px;
  color: #3c4043;
  line-height: 1.6;
}

.login-card {
  width: min(460px, calc(100% - 48px));
  margin: 12vh auto 0;
  padding: 32px;
}

.login-card h1 {
  font-size: 36px;
  line-height: 1.05;
}

.login-card input {
  margin: 18px 0 12px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: calc(100vh - 64px);
}

.project-list {
  border-right: 1px solid var(--line);
  padding: 24px;
  background: #ffffff;
}

.admin-heading h1 {
  margin-bottom: 0;
  font-size: 26px;
  font-weight: 520;
}

.admin-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 18px 0 8px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.admin-stats div {
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.admin-stats strong {
  display: block;
  font-size: 22px;
  font-weight: 560;
}

.admin-stats span {
  color: var(--muted);
  font-size: 12px;
}

.admin-filters input,
.admin-filters select {
  height: 40px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0 10px;
  color: #202124;
  font-size: 14px;
}

.project-row {
  display: grid;
  width: 100%;
  gap: 6px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
}

.project-row.selected {
  border-color: #202124;
}

.project-row small,
.muted {
  color: var(--muted);
}

.admin-detail {
  padding: 28px;
  background: #f8fafd;
}

.detail-top {
  margin-bottom: 18px;
}

.detail-top h2 {
  margin: 4px 0 0;
  font-size: 34px;
  font-weight: 520;
}

.admin-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 240px));
  gap: 12px;
  margin-bottom: 18px;
}

.admin-controls label,
.notes-box {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.admin-controls input,
.admin-controls select {
  height: 42px;
  padding: 0 10px;
  color: #202124;
  font-size: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-card {
  padding: 20px;
  box-shadow: none;
}

.detail-card h3 {
  margin-bottom: 16px;
  font-size: 17px;
  font-weight: 520;
}

.detail-card h4 {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 520;
}

.quick-actions,
.artifact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
}

.artifact-actions {
  margin-top: 16px;
}

.key-values {
  display: grid;
  gap: 12px;
}

.key-values.compact {
  gap: 8px;
}

.key-values div {
  display: grid;
  gap: 4px;
}

.notes-box {
  margin: 16px 0;
}

.notes-box textarea {
  min-height: 100px;
  padding: 12px;
  color: #202124;
  resize: vertical;
}

.markdown-preview {
  max-height: 420px;
}

.notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #202124;
  border-radius: 8px;
  background: #ffffff;
  color: #202124;
  font-size: 14px;
}

.readiness-summary {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
}

.readiness-summary strong {
  display: block;
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 560;
}

.readiness-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.score-ring {
  display: grid;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background:
    conic-gradient(#202124 var(--score), #edf0f2 0),
    #edf0f2;
}

.score-ring span {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  font-size: 16px;
  font-weight: 560;
}

.portal-shell {
  min-height: 100vh;
  background: #ffffff;
}

.portal-hero,
.portal-grid {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.portal-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 48px;
  align-items: center;
  padding: 54px 0 34px;
}

.portal-hero h1 {
  font-size: clamp(42px, 6vw, 78px);
}

.portal-status {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 48px;
}

.portal-question {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.portal-question span {
  color: #202124;
  font-size: 14px;
  font-weight: 520;
}

.portal-question small {
  color: var(--muted);
  font-size: 12px;
}

.portal-question textarea {
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--line-dark);
  border-radius: 8px;
  resize: vertical;
}

.shake {
  animation: shake 260ms ease;
}

@keyframes shake {
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

@media (max-width: 1050px) {
  .landing-shell,
  .confirmation-layout,
  .intake-layout,
  .admin-layout,
  .portal-hero,
  .portal-grid {
    grid-template-columns: 1fr;
  }

  .landing-shell,
  .confirmation-layout {
    min-height: auto;
    padding-top: 34px;
  }

  .progress-rail,
  .brief-panel {
    position: static;
    height: auto;
    border: 0;
    border-bottom: 1px solid var(--line);
  }

  .progress-rail {
    display: none;
  }

  .brief-panel {
    order: 3;
  }

  .question-stage {
    padding: 24px;
  }

  .project-list {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .portal-hero {
    padding-top: 34px;
  }
}

@media (max-width: 680px) {
  .topbar {
    height: 58px;
    padding: 0 14px;
  }

  .brand span:last-child {
    display: none;
  }

  .landing-shell,
  .confirmation-layout {
    width: min(100% - 28px, 1180px);
    gap: 24px;
  }

  h1 {
    font-size: 48px;
  }

  .lead {
    font-size: 18px;
  }

  .output-sheet,
  .question-card,
  .login-card {
    padding: 20px;
  }

  .question-card h1 {
    font-size: 35px;
  }

  .choice-grid,
  .detail-grid,
  .portal-grid,
  .admin-controls,
  .quote-grid {
    grid-template-columns: 1fr;
  }

  .admin-detail {
    padding: 16px;
  }

  .detail-top,
  .admin-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}
