:root {
  --page: #f2f5f7;
  --surface: #ffffff;
  --surface-muted: #eef2f5;
  --surface-strong: #111820;
  --ink: #111820;
  --muted: #5a6673;
  --line: #d6dde5;
  --line-strong: #aeb8c3;
  --blue: #205d86;
  --blue-soft: #e6f1f8;
  --green: #126b47;
  --green-soft: #e6f4ee;
  --amber: #8c6200;
  --amber-soft: #fff4d5;
  --red: #b42318;
  --red-soft: #fff0ed;
  --orange: #a54800;
  --orange-soft: #fff0df;
  --gray-soft: #f5f7f9;
  --shadow: 0 12px 34px rgba(17, 24, 32, 0.08);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(32, 93, 134, 0.11), rgba(32, 93, 134, 0) 260px),
    var(--page);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Aptos", "IBM Plex Sans", "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 15px;
}

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

button {
  cursor: pointer;
}

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

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 0 18px;
}

.topbar h1,
.section-heading h2,
.later-panel h2 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
  font-weight: 760;
}

.topbar h1 {
  max-width: 720px;
  font-size: 2.14rem;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.scope-note {
  max-width: 460px;
  margin: 0 0 3px;
  color: var(--muted);
  line-height: 1.48;
}

.planner-grid,
.evidence-plan-grid {
  display: grid;
  gap: 16px;
}

.planner-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(350px, 0.85fr);
  align-items: stretch;
}

.evidence-plan-grid {
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  margin-top: 16px;
}

.planner-panel,
.summary-panel,
.timeline-panel,
.results-panel,
.missing-panel,
.plan-panel,
.artifact-panel,
.later-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

.timeline-panel,
.results-panel,
.artifact-panel,
.later-panel {
  margin-top: 16px;
}

.section-heading {
  margin-bottom: 16px;
}

.section-heading h2,
.later-panel h2 {
  font-size: 1.24rem;
}

.field-label,
.manual-row span {
  display: block;
  margin: 15px 0 7px;
  font-size: 0.84rem;
  font-weight: 740;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

textarea {
  min-height: 230px;
  resize: vertical;
  padding: 13px 14px;
  font-family: "IBM Plex Mono", "SFMono-Regular", "Cascadia Code", ui-monospace, monospace;
  font-size: 0.91rem;
  line-height: 1.48;
}

input,
select {
  min-height: 40px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(32, 93, 134, 0.15);
}

.input-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.field-hint {
  min-height: 20px;
  margin: 7px 0 0;
  color: var(--red);
  font-size: 0.9rem;
}

.manual-row {
  margin: 16px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.manual-row legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

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

.field-grid label {
  min-width: 0;
}

.field-grid span {
  margin-top: 0;
}

.action-row,
.copy-actions,
.later-actions,
.artifact-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-row {
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.primary-action,
.secondary-action,
.artifact-tab {
  min-height: 40px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  padding: 0 13px;
  font-weight: 740;
}

.primary-action {
  border-color: var(--surface-strong);
  background: var(--surface-strong);
  color: #fff;
}

.primary-action:hover {
  background: #25313d;
}

.secondary-action,
.artifact-tab {
  background: var(--surface);
  color: var(--ink);
}

.secondary-action:hover,
.artifact-tab:hover {
  background: var(--gray-soft);
}

.artifact-tab.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.score-box {
  display: grid;
  place-items: center;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(32, 93, 134, 0.1), rgba(18, 107, 71, 0.08)),
    var(--gray-soft);
  text-align: center;
}

.score-box.critical {
  background: var(--red-soft);
}

.score-box.high {
  background: var(--orange-soft);
}

.score-box.watch {
  background: var(--amber-soft);
}

.score-box.current {
  background: var(--green-soft);
}

.score-value {
  display: block;
  font-size: 3.5rem;
  font-weight: 790;
  line-height: 0.95;
}

.score-label {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 740;
}

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

.metric-list div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--gray-soft);
}

.metric-list dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 760;
  text-transform: uppercase;
}

.metric-list dd {
  margin: 0;
  font-weight: 780;
}

.support-note {
  margin: 0 0 14px;
  padding: 12px;
  border-left: 4px solid var(--blue);
  background: var(--blue-soft);
  color: var(--ink);
  line-height: 1.45;
}

.copy-actions {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.timeline-item {
  min-width: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--gray-soft);
}

.timeline-item.is-critical {
  border-color: rgba(180, 35, 24, 0.35);
  background: var(--red-soft);
}

.timeline-item.is-high {
  border-color: rgba(165, 72, 0, 0.35);
  background: var(--orange-soft);
}

.timeline-item.is-watch {
  border-color: rgba(140, 98, 0, 0.35);
  background: var(--amber-soft);
}

.timeline-item.is-current {
  border-color: rgba(18, 107, 71, 0.35);
  background: var(--green-soft);
}

.version-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  font-weight: 790;
}

.version-label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 740;
}

.timeline-bar {
  height: 7px;
  margin: 12px 0;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.timeline-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.timeline-item.is-critical .timeline-bar span {
  background: var(--red);
}

.timeline-item.is-high .timeline-bar span {
  background: var(--orange);
}

.timeline-item.is-watch .timeline-bar span {
  background: var(--amber);
}

.timeline-item.is-current .timeline-bar span {
  background: var(--green);
}

.timeline-dates {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.32;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.findings-table {
  width: 100%;
  min-width: 1020px;
  border-collapse: collapse;
  background: var(--surface);
}

.findings-table th,
.findings-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.36;
}

.findings-table th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.findings-table tr:last-child td {
  border-bottom: 0;
}

.empty-row td {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 0.78rem;
  font-weight: 780;
  white-space: nowrap;
}

.badge.critical {
  background: var(--red-soft);
  color: var(--red);
}

.badge.high {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge.watch {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.current {
  background: var(--green-soft);
  color: var(--green);
}

.badge.unknown {
  background: var(--surface-muted);
  color: var(--muted);
}

.source-pill {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

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

.missing-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--gray-soft);
  padding: 12px;
}

.missing-card strong {
  display: block;
  margin-bottom: 5px;
}

.missing-card span,
.plan-list span {
  color: var(--muted);
  line-height: 1.38;
}

.plan-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

.plan-list li {
  padding: 12px 12px 12px 6px;
  border-bottom: 1px solid var(--line);
}

.plan-list li:last-child {
  border-bottom: 0;
}

.plan-list strong {
  display: block;
  margin-bottom: 4px;
}

.artifact-heading,
.later-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.artifact-heading .section-heading {
  margin-bottom: 0;
}

#artifact-preview {
  min-height: 280px;
  max-height: 520px;
  margin: 18px 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1720;
  color: #eef6ff;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", "SFMono-Regular", "Cascadia Code", ui-monospace, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
}

.later-panel {
  align-items: center;
}

.later-panel p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  transform: translateY(12px);
  border-radius: 8px;
  background: var(--surface-strong);
  color: #fff;
  padding: 12px 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: 0 14px 36px rgba(17, 24, 32, 0.22);
}

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

@media (max-width: 1050px) {
  .planner-grid,
  .evidence-plan-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 14px;
  }

  .topbar,
  .artifact-heading,
  .later-panel {
    display: block;
  }

  .topbar h1 {
    font-size: 1.72rem;
  }

  .scope-note {
    margin-top: 10px;
  }

  .planner-panel,
  .summary-panel,
  .timeline-panel,
  .results-panel,
  .missing-panel,
  .plan-panel,
  .artifact-panel,
  .later-panel {
    padding: 16px;
  }

  .field-grid,
  .metric-list {
    grid-template-columns: 1fr;
  }

  .input-meta {
    display: block;
  }

  textarea {
    min-height: 210px;
  }

  .action-row {
    justify-content: stretch;
  }

  .action-row button,
  .copy-actions button,
  .later-actions button {
    width: 100%;
  }

  .artifact-tabs,
  .later-actions {
    margin-top: 14px;
  }

  .artifact-tab {
    flex: 1 1 calc(50% - 8px);
  }
}
