:root {
  color-scheme: light;
  --topbar-height: 72px;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-soft: #fbfbfd;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(29, 29, 31, 0.1);
  --accent: #0066cc;
  --accent-2: #30b0c7;
  --good: #1f8f63;
  --thin: #b7791f;
  --review: #c2410c;
  --neutral: #6e6e73;
  --good-soft: #e9f8f0;
  --thin-soft: #fff5df;
  --review-soft: #fff0e8;
  --accent-soft: #eaf4ff;
  --shadow: 0 24px 70px rgba(29, 29, 31, 0.08);
  --shadow-soft: 0 12px 34px rgba(29, 29, 31, 0.06);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-height) + 24px);
}

body {
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 360px, var(--bg) 100%);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

.topbar {
  align-items: center;
  backdrop-filter: saturate(180%) blur(18px);
  background: rgba(245, 245, 247, 0.78);
  border-bottom: 1px solid rgba(29, 29, 31, 0.06);
  display: grid;
  gap: 16px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 14px max(18px, calc((100vw - 1440px) / 2 + 24px));
  position: sticky;
  top: 0;
  z-index: 90;
}

#snapshot-form,
#snapshot-output,
#research-notes {
  scroll-margin-top: calc(var(--topbar-height) + 24px);
}

.brand-mark {
  align-items: center;
  background: var(--ink);
  border-radius: var(--radius);
  color: #fff;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  letter-spacing: 0;
  text-decoration: none;
  width: 42px;
}

.top-title {
  min-width: 0;
}

.top-title h1,
.panel h2,
.snapshot-hero h2,
.section-heading h2,
.results-section h3,
.priority-panel h3,
.next-panel h3 {
  letter-spacing: 0;
  margin: 0;
}

.top-title h1 {
  font-size: clamp(1.05rem, 1.35vw, 1.24rem);
  font-weight: 780;
  line-height: 1.1;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  margin: 0 0 7px;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 22px;
}

.nav-links a {
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
  padding: 8px 0;
  text-decoration: none;
  transition: border-color 160ms ease, color 160ms ease;
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  border-color: var(--accent);
  color: var(--ink);
}

.workspace {
  align-items: start;
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1440px;
  padding: 28px 24px 54px;
}

.sidebar {
  align-self: start;
  display: grid;
  gap: 14px;
  min-width: 0;
}

.panel,
.snapshot-panel,
.research-panel,
.coverage-card,
.priority-panel,
.next-panel,
.context-details {
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 20px;
}

.panel-heading,
.section-heading,
.card-top,
.snapshot-hero,
.actions,
.cta-row {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.panel-heading > div,
.section-heading > div,
.card-top > div,
.snapshot-hero > div {
  min-width: 0;
}

.field-group {
  border: 0;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
}

.field-group legend {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 850;
  margin-bottom: 10px;
  padding: 0;
}

.form-grid {
  display: grid;
  gap: 10px;
}

.two-columns {
  grid-template-columns: 1fr 1fr;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.field-label {
  cursor: help;
  display: inline-flex;
  line-height: 1.25;
  text-decoration: underline;
  text-decoration-color: rgba(0, 102, 204, 0.25);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  position: relative;
  width: fit-content;
}

.field-label:hover,
.field-label:focus,
.field-label.is-open {
  color: var(--accent);
  outline: none;
  text-decoration-color: currentColor;
}

.tooltip {
  --tip-left: 0;
  --tip-right: auto;
  --tip-x: 0;
  background: #1d1d1f;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  bottom: calc(100% + 10px);
  box-shadow: 0 18px 46px rgba(29, 29, 31, 0.24);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.77rem;
  font-weight: 650;
  left: var(--tip-left);
  letter-spacing: 0;
  line-height: 1.42;
  opacity: 0;
  padding: 11px 12px;
  pointer-events: none;
  position: absolute;
  right: var(--tip-right);
  text-transform: none;
  transform: translate(var(--tip-x), 4px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  visibility: hidden;
  width: min(280px, calc(100vw - 48px));
  z-index: 120;
}

.tooltip::after {
  background: #1d1d1f;
  bottom: -5px;
  content: "";
  height: 10px;
  left: 12px;
  position: absolute;
  transform: rotate(45deg);
  width: 10px;
}

.two-columns .field:nth-child(2) .tooltip {
  --tip-left: auto;
  --tip-right: 0;
}

.two-columns .field:nth-child(2) .tooltip::after {
  left: auto;
  right: 12px;
}

.field-label:hover .tooltip,
.field-label:focus .tooltip,
.field-label:focus-within .tooltip,
.field-label.is-open .tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translate(var(--tip-x), 0);
  visibility: visible;
}

.tooltip strong {
  color: #ffffff;
  font-weight: 900;
}

.tooltip .tip-key {
  color: #9ee6c3;
}

.tooltip .tip-warning {
  color: #ffd48a;
}

.tip-example {
  color: #8bd3ff;
  display: block;
  font-weight: 800;
  margin-top: 6px;
}

.field input,
.field select,
.field textarea {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 42px;
  outline: none;
  padding: 10px 11px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
  width: 100%;
}

.field textarea {
  line-height: 1.45;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.12);
}

.assumption-panel {
  background: rgba(118, 118, 128, 0.08);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  padding: 12px;
}

.assumption-panel summary,
.context-details summary,
.coverage-card summary {
  color: var(--accent);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
}

.assumption-panel[open] summary {
  margin-bottom: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.primary-link {
  border-radius: var(--radius);
  min-height: 40px;
  padding: 9px 14px;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.primary-button,
.primary-link {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #fff;
  display: inline-flex;
  font-weight: 780;
  justify-content: center;
  text-decoration: none;
}

.secondary-button,
.ghost-button {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost-button {
  min-height: 34px;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.primary-link:hover {
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.content {
  display: grid;
  gap: 24px;
  min-width: 0;
}

.snapshot-hero p,
.empty-state p,
.site-footer p,
.issue-item p,
.coverage-card p,
.next-panel li,
.context-details p,
.source-card span {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}

.snapshot-panel {
  display: grid;
  gap: 24px;
  min-height: 360px;
  overflow: hidden;
  padding: clamp(22px, 4vw, 42px);
}

.empty-state {
  align-content: center;
  display: grid;
  gap: 10px;
  min-height: 270px;
  text-align: center;
}

.empty-state h2 {
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1;
  margin: 0;
}

.snapshot-hero {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
}

.snapshot-hero h2 {
  font-size: clamp(2.2rem, 5vw, 4.7rem);
  line-height: 0.96;
}

.snapshot-hero p {
  margin-top: 12px;
  max-width: 720px;
}

.score-ring {
  --score: 0%;
  align-items: center;
  aspect-ratio: 1;
  background:
    radial-gradient(circle at center, var(--surface-solid) 58%, transparent 59%),
    conic-gradient(var(--accent) var(--score), rgba(118, 118, 128, 0.16) 0);
  border-radius: 50%;
  display: grid;
  flex: 0 0 auto;
  height: 122px;
  justify-items: center;
  place-content: center;
}

.score-ring strong {
  font-size: 2rem;
  line-height: 1;
}

.score-ring span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

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

.metric {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 14px;
}

.metric span,
.metric small,
.coverage-card p:first-child,
.issue-item span,
.source-note {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.metric strong {
  font-size: clamp(1.1rem, 2vw, 1.42rem);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.results-section {
  display: grid;
  gap: 16px;
}

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

.coverage-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfbfd 100%);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 14px;
  padding: 16px;
}

.coverage-card.good {
  border-color: rgba(31, 143, 99, 0.22);
}

.coverage-card.thin {
  border-color: rgba(183, 121, 31, 0.28);
}

.coverage-card.review {
  border-color: rgba(194, 65, 12, 0.24);
}

.coverage-card.neutral {
  border-color: var(--line);
}

.coverage-card h4 {
  font-size: 1.08rem;
  line-height: 1.15;
  margin: 4px 0 0;
}

.status-pill {
  border-radius: 999px;
  color: var(--ink);
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 850;
  padding: 7px 10px;
}

.good .status-pill {
  background: var(--good-soft);
  color: var(--good);
}

.thin .status-pill {
  background: var(--thin-soft);
  color: var(--thin);
}

.review .status-pill {
  background: var(--review-soft);
  color: var(--review);
}

.neutral .status-pill {
  background: rgba(118, 118, 128, 0.12);
  color: var(--neutral);
}

.card-headline {
  min-height: 42px;
}

.range-block {
  display: grid;
  gap: 8px;
}

.range-labels {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.range-labels span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.range-labels strong {
  font-size: 0.82rem;
}

.coverage-meter {
  background: rgba(118, 118, 128, 0.13);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  position: relative;
}

.target-range,
.actual-range {
  border-radius: inherit;
  display: block;
  height: 100%;
  position: absolute;
  top: 0;
}

.target-range {
  background: rgba(0, 102, 204, 0.16);
}

.actual-range {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  left: 0;
}

.qualitative-row {
  align-items: center;
  background: rgba(118, 118, 128, 0.08);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  min-height: 42px;
  padding: 10px 12px;
}

.qualitative-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.coverage-card details {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding-top: 10px;
}

.coverage-card details[open] summary {
  margin-bottom: 8px;
}

.coverage-card ul {
  color: var(--muted);
  margin: 8px 0 0;
  padding-left: 18px;
}

.coverage-card li {
  margin: 4px 0;
}

.split-section {
  align-items: start;
  grid-template-columns: 1fr 1fr;
}

.priority-panel,
.next-panel,
.context-details,
.research-panel {
  display: grid;
  gap: 14px;
  padding: 20px;
}

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

.issue-item {
  align-items: start;
  background: rgba(118, 118, 128, 0.08);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  grid-template-columns: 88px minmax(0, 1fr);
  padding: 12px;
}

.issue-item strong {
  display: block;
  margin-bottom: 4px;
}

.step-list {
  color: var(--muted);
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 20px;
}

.cta-row {
  justify-content: flex-start;
}

.context-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.context-grid h4 {
  margin: 0 0 6px;
}

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

.source-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  display: grid;
  gap: 8px;
  min-height: 114px;
  padding: 14px;
  text-decoration: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.source-card:hover {
  border-color: rgba(0, 102, 204, 0.28);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.site-footer {
  padding: 0 24px 32px;
}

.footer-inner {
  margin: 0 auto;
  max-width: 1440px;
}

.site-footer section {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  padding-top: 22px;
}

.top-button {
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  bottom: 20px;
  box-shadow: var(--shadow-soft);
  color: #fff;
  height: 44px;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  right: 20px;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  width: 44px;
  z-index: 80;
}

.top-button.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.print-report {
  display: none;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .nav-links {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 20px 16px 42px;
  }

}

@media (min-width: 981px) {
  body:not(.has-result) .content {
    align-self: start;
    position: sticky;
    top: calc(var(--topbar-height) + 16px);
  }

  body:not(.has-result) .research-panel {
    display: none;
  }

  body:not(.has-result) .nav-links a[href="#research-notes"] {
    display: none;
  }
}

@media (max-width: 720px) {
  .workspace {
    display: block;
    overflow: hidden;
  }

  .sidebar,
  .content,
  .panel {
    max-width: 100%;
    width: 100%;
  }

  .content {
    margin-top: 24px;
  }

  .two-columns,
  .metric-grid,
  .coverage-grid,
  .split-section,
  .context-grid,
  .source-grid {
    grid-template-columns: 1fr;
  }

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

  .actions button {
    width: 100%;
  }

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

  .panel-heading h2 {
    overflow-wrap: anywhere;
  }

  .snapshot-hero {
    gap: 18px;
  }

  .score-ring {
    height: 112px;
  }

  .issue-item {
    grid-template-columns: 1fr;
  }

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

  .primary-link,
  .cta-row button {
    width: 100%;
  }
}

@media print {
  @page {
    margin: 12mm;
    size: A4;
  }

  body {
    background: #fff;
  }

  body > :not(.print-report) {
    display: none !important;
  }

  .print-report {
    color: #111;
    display: block;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  .print-page {
    display: grid;
    gap: 16px;
  }

  .print-header {
    align-items: end;
    border-bottom: 2px solid #111;
    display: flex;
    justify-content: space-between;
    padding-bottom: 12px;
  }

  .print-header p,
  .print-header h1,
  .print-summary,
  .print-issues p {
    margin: 0;
  }

  .print-header p,
  .print-header span,
  .print-disclaimer {
    color: #555;
    font-size: 9pt;
  }

  .print-header h1 {
    font-size: 26pt;
    line-height: 1;
  }

  .print-header strong {
    font-size: 28pt;
  }

  .print-summary {
    color: #333;
    font-size: 11pt;
  }

  .print-table {
    border-collapse: collapse;
    width: 100%;
  }

  .print-table th,
  .print-table td {
    border-bottom: 1px solid #ddd;
    font-size: 9pt;
    padding: 8px;
    text-align: left;
    vertical-align: top;
  }

  .print-table th {
    background: #f4f4f4;
  }

  .print-issues {
    display: grid;
    gap: 8px;
  }

  .print-issues h2 {
    font-size: 14pt;
    margin: 0;
  }

  .print-issues .issue-item {
    border: 1px solid #ddd;
    display: grid;
    gap: 4px;
    grid-template-columns: 76px 1fr;
    padding: 8px;
  }

  .print-issues .issue-item span {
    color: #555;
    font-size: 8pt;
    font-weight: 800;
  }

  .print-issues .issue-item strong,
  .print-issues .issue-item p {
    font-size: 9pt;
  }

  .print-disclaimer {
    border-top: 1px solid #ddd;
    padding-top: 10px;
  }
}
