:root {
  color-scheme: light;
  --ink: #101419;
  --muted: #66717f;
  --line: #dfe5ea;
  --surface: #ffffff;
  --surface-soft: #f5f7f9;
  --teal: #008c7a;
  --teal-strong: #006b5f;
  --amber: #c98011;
  --coral: #d94b35;
  --blue: #2563eb;
  --green: #16803a;
  --shadow: 0 18px 44px rgba(16, 20, 25, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--surface-soft);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #f7f9fa 0%, var(--surface-soft) 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

label {
  display: block;
}

fieldset {
  min-inline-size: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 68px;
  padding: 12px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid rgba(16, 20, 25, 0.1);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 760;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  font-size: 0.82rem;
}

.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.topnav a,
.topnav button {
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.topnav a:hover,
.topnav button:hover {
  color: var(--ink);
  background: #edf1f4;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.7fr);
  gap: 22px;
  align-items: start;
}

.workspace.dashboard-layout {
  grid-template-columns: minmax(0, 0.82fr) minmax(360px, 1.18fr);
}

.panel {
  border: 1px solid rgba(16, 20, 25, 0.11);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-body {
  padding: clamp(20px, 3vw, 30px);
}

.panel.compact .panel-body {
  padding: 22px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  margin: 0 0 12px;
  color: var(--teal-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.45rem;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
}

.lede {
  max-width: 720px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 1.02rem;
}

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

.field,
.full {
  min-width: 0;
}

.full {
  grid-column: 1 / -1;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #29313a;
  font-size: 0.9rem;
  font-weight: 760;
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid #cdd6de;
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.input,
.select {
  min-height: 48px;
  padding: 11px 13px;
}

.textarea {
  min-height: 112px;
  padding: 12px 13px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(0, 140, 122, 0.12);
}

.field.invalid .input,
.field.invalid .textarea,
.field.invalid .select {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(217, 75, 53, 0.1);
}

.field.invalid .goal-card,
.field.invalid .scale-option span {
  border-color: rgba(217, 75, 53, 0.6);
}

.field-error {
  display: block;
  margin-top: 7px;
  color: #9a2f20;
  font-size: 0.82rem;
  font-weight: 720;
}

.field-error[hidden] {
  display: none;
}

.form-alert {
  margin: 0 0 18px;
  padding: 12px 13px;
  border: 1px solid rgba(217, 75, 53, 0.28);
  border-radius: 8px;
  color: #8d2d20;
  background: rgba(217, 75, 53, 0.08);
  font-size: 0.9rem;
  font-weight: 720;
}

.form-alert[hidden] {
  display: none;
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.goal-option {
  position: relative;
  min-height: 84px;
}

.goal-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.goal-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  min-height: 84px;
  padding: 13px;
  border: 1px solid #cdd6de;
  border-radius: 8px;
  background: #ffffff;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.goal-card strong {
  font-size: 0.92rem;
}

.goal-card span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.25;
}

.goal-option input:checked + .goal-card {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal), 0 10px 26px rgba(0, 140, 122, 0.11);
}

.goal-option input:focus-visible + .goal-card {
  outline: 3px solid rgba(0, 140, 122, 0.22);
  outline-offset: 2px;
}

.goal-option:hover .goal-card {
  transform: translateY(-1px);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 780;
  line-height: 1.1;
  text-align: center;
  white-space: normal;
}

.button.primary {
  color: #ffffff;
  background: var(--ink);
}

.button.primary:hover {
  background: #242b34;
}

.button.secondary {
  border-color: #cfd7de;
  color: var(--ink);
  background: #ffffff;
}

.button.secondary:hover {
  background: #edf1f4;
}

.button.teal {
  color: #ffffff;
  background: var(--teal);
}

.button.teal:hover {
  background: var(--teal-strong);
}

.button.text {
  color: var(--teal-strong);
  background: transparent;
}

.button.text:hover {
  background: rgba(0, 140, 122, 0.09);
}

.preview-stack {
  display: grid;
  gap: 14px;
}

.sprint-brief {
  min-height: 300px;
  border: 1px solid rgba(16, 20, 25, 0.1);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.brief-head {
  min-height: 110px;
  padding: 18px;
  color: #ffffff;
  background:
    linear-gradient(90deg, rgba(16, 20, 25, 0.88), rgba(16, 20, 25, 0.7)),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.16),
      rgba(255, 255, 255, 0.16) 1px,
      transparent 1px,
      transparent 12px
    );
}

.brief-title {
  display: block;
  margin-bottom: 8px;
  font-size: 1.2rem;
  font-weight: 820;
}

.brief-meta {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.88rem;
}

.brief-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.brief-item {
  display: grid;
  gap: 5px;
}

.brief-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
  text-transform: uppercase;
}

.brief-item p {
  margin: 0;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(16, 20, 25, 0.1);
  border-radius: 999px;
  color: #2d3640;
  background: #f4f7f8;
  font-size: 0.8rem;
  font-weight: 730;
}

.badge.teal {
  border-color: rgba(0, 140, 122, 0.24);
  color: var(--teal-strong);
  background: rgba(0, 140, 122, 0.08);
}

.badge.amber {
  border-color: rgba(201, 128, 17, 0.26);
  color: #85510a;
  background: rgba(201, 128, 17, 0.1);
}

.badge.coral {
  border-color: rgba(217, 75, 53, 0.22);
  color: #943223;
  background: rgba(217, 75, 53, 0.08);
}

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

.metric {
  min-height: 92px;
  padding: 13px;
  border: 1px solid rgba(16, 20, 25, 0.1);
  border-radius: 8px;
  background: #ffffff;
}

.metric span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1.1;
}

.metric small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.score-panel {
  display: grid;
  gap: 16px;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 168px;
  height: 168px;
  margin: 6px auto 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 0 56%, transparent 57%),
    conic-gradient(var(--teal) calc(var(--score) * 1%), #e6edf1 0);
}

.score-ring span {
  font-size: 2.6rem;
  font-weight: 850;
}

.score-ring small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 760;
  text-align: center;
  text-transform: uppercase;
}

.link-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(16, 20, 25, 0.1);
  border-radius: 8px;
  background: #f8fafb;
}

.link-box code {
  display: block;
  overflow: hidden;
  color: #2d3640;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-main {
  display: grid;
  gap: 18px;
}

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

.insight {
  min-height: 148px;
  padding: 16px;
  border: 1px solid rgba(16, 20, 25, 0.1);
  border-radius: 8px;
  background: #ffffff;
}

.insight p {
  margin-bottom: 0;
  color: var(--muted);
}

.bars {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  min-height: 30px;
  font-size: 0.88rem;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #e7edf1;
  overflow: hidden;
}

.bar-fill {
  display: block;
  width: calc(var(--value) * 20%);
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.bar-fill.warn {
  background: var(--amber);
}

.bar-fill.risk {
  background: var(--coral);
}

.quote-list {
  display: grid;
  gap: 10px;
}

.quote-card {
  padding: 14px;
  border: 1px solid rgba(16, 20, 25, 0.1);
  border-radius: 8px;
  background: #ffffff;
}

.quote-card blockquote {
  margin: 0 0 10px;
  color: #29313a;
}

.quote-card footer {
  color: var(--muted);
  font-size: 0.82rem;
}

.packet-details {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(16, 20, 25, 0.1);
  border-radius: 8px;
  background: #f8fafb;
}

.packet-details summary {
  color: #2d3640;
  font-size: 0.9rem;
  font-weight: 760;
  cursor: pointer;
}

.packet-details label {
  margin-top: 14px;
}

.empty-state {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px dashed #b8c3cc;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
}

.tester-shell {
  width: min(820px, 100%);
  margin: 0 auto;
}

.mission {
  display: grid;
  gap: 16px;
}

.mission-url {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(16, 20, 25, 0.1);
  border-radius: 8px;
  background: #f8fafb;
}

.scale-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.scale-option {
  position: relative;
  min-height: 54px;
}

.scale-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.scale-option span {
  display: grid;
  place-items: center;
  min-height: 54px;
  border: 1px solid #cdd6de;
  border-radius: 8px;
  background: #ffffff;
  font-weight: 790;
}

.scale-option input:checked + span {
  border-color: var(--teal);
  color: #ffffff;
  background: var(--teal);
}

.scale-option input:focus-visible + span {
  outline: 3px solid rgba(0, 140, 122, 0.22);
  outline-offset: 2px;
}

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

.divider {
  height: 1px;
  margin: 20px 0;
  background: var(--line);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .workspace,
  .workspace.dashboard-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 740px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topnav {
    width: 100%;
    justify-content: stretch;
  }

  .topnav a,
  .topnav button {
    flex: 1 1 0;
  }

  .app-shell {
    width: min(100% - 22px, 1180px);
    padding-top: 20px;
  }

  h1 {
    font-size: 2rem;
  }

  .field-grid,
  .goal-grid,
  .signal-strip,
  .insight-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 82px minmax(0, 1fr) 38px;
  }

  .scale-grid {
    grid-template-columns: repeat(5, minmax(46px, 1fr));
  }
}

@media (max-width: 430px) {
  .panel-body {
    padding: 18px;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }
}
