:root {
  --ink: #171c1f;
  --ink-soft: #353b3e;
  --paper: #f5f7f4;
  --surface: #ffffff;
  --surface-muted: #eef1ed;
  --line: #d8ddd8;
  --line-strong: #b8c0ba;
  --accent: #d7153a;
  --accent-dark: #a60f2b;
  --teal: #007d75;
  --teal-soft: #dff3ef;
  --amber: #a76500;
  --amber-soft: #fff0cd;
  --red-soft: #fde8ed;
  --shadow: 0 18px 50px rgb(28 36 31 / 10%);
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgb(23 28 31 / 3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(23 28 31 / 3%) 1px, transparent 1px);
  background-size: 32px 32px;
}

button,
input {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(0 125 117 / 28%);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.top-rule {
  height: 5px;
  background: linear-gradient(90deg, var(--accent) 0 38%, #f4b41a 38% 62%, var(--teal) 62% 100%);
}

.app-header {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(20px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand img {
  flex: 0 0 42px;
}

.brand-copy {
  display: grid;
  gap: 1px;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.brand-copy strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  color: var(--ink);
}

.environment-label,
.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.environment-dot,
.connection-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px var(--teal-soft);
}

.page-shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 38px 0 50px;
}

.workspace-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.eyebrow,
.section-index,
.summary-label {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 5px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 600;
  line-height: 1.05;
}

h2,
h3,
h4 {
  margin: 0;
  color: var(--ink);
}

h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.35rem;
}

.notice,
.inline-notice {
  padding: 12px 14px;
  border: 1px solid #e2a5b2;
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  background: var(--red-soft);
  color: #6f1024;
  font-size: 0.88rem;
}

.notice {
  margin-bottom: 16px;
}

.inline-notice {
  margin-top: 22px;
}

.workspace {
  display: grid;
  min-height: 650px;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: workspace-in 420ms ease-out both;
}

.submission-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 30px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgb(255 255 255 / 85%), rgb(238 241 237 / 90%)),
    var(--surface-muted);
}

.panel-heading,
.results-heading,
.report-heading,
.recent-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.panel-heading,
.results-heading {
  align-items: flex-start;
}

.panel-heading > div,
.results-heading > div,
.report-heading > div {
  min-width: 0;
}

.panel-heading {
  display: grid;
  justify-content: stretch;
  margin-bottom: 30px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}

input:hover {
  border-color: #7e8981;
}

input[aria-invalid="true"] {
  border-color: var(--accent);
}

.field-error {
  margin: 7px 0 0;
  color: var(--accent-dark);
  font-size: 0.78rem;
}

.request-boundary {
  display: grid;
  gap: 10px;
  margin: 24px 0;
}

.request-boundary div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.request-boundary dt,
.request-boundary dd,
.assessment-metadata dt,
.assessment-metadata dd {
  margin: 0;
  font-size: 0.78rem;
}

.request-boundary dt,
.assessment-metadata dt {
  color: #69716c;
}

.request-boundary dd,
.assessment-metadata dd {
  text-align: right;
  font-weight: 700;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-weight: 800;
}

.primary-action {
  width: 100%;
  gap: 10px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-action:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.primary-action:disabled {
  opacity: 0.72;
}

.button-progress {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgb(255 255 255 / 35%);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.primary-action[aria-busy="true"] .button-progress {
  display: block;
}

.secondary-action {
  min-width: 92px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.secondary-action:hover {
  border-color: var(--ink-soft);
  background: var(--surface-muted);
}

.quiet-action {
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
}

.quiet-action:hover {
  color: #004e49;
  text-decoration: underline;
}

.recent-section {
  margin-top: auto;
  padding-top: 34px;
}

.recent-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.recent-heading h3 {
  font-size: 0.82rem;
  text-transform: uppercase;
}

.recent-empty {
  margin: 14px 0 0;
  color: #747c77;
  font-size: 0.8rem;
}

.recent-list {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.recent-list button {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 9px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.recent-list button:hover {
  background: #e4e9e4;
}

.recent-list strong,
.recent-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-list strong {
  font-size: 0.78rem;
}

.recent-list small {
  color: #69716c;
  font-size: 0.7rem;
}

.results-panel {
  min-width: 0;
  padding: 30px clamp(24px, 4vw, 54px) 48px;
}

.results-heading {
  min-height: 66px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.results-heading > div {
  display: grid;
  gap: 5px;
}

.empty-state {
  display: grid;
  min-height: 500px;
  place-content: center;
  justify-items: center;
  padding: 40px 20px;
  color: #6d756f;
  text-align: center;
}

.empty-state img {
  margin-bottom: 18px;
  opacity: 0.42;
  filter: grayscale(1);
}

.empty-state h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
}

.empty-state p {
  max-width: 360px;
  margin: 8px 0 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

.assessment-view {
  padding-top: 28px;
  animation: content-in 300ms ease-out both;
}

.assessment-summary {
  display: grid;
  grid-template-columns: minmax(130px, 0.65fr) minmax(0, 1.35fr);
  gap: 28px;
}

.summary-label {
  margin-bottom: 9px;
  color: #69716c;
}

.status-badge,
.readiness-badge,
.outcome-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge,
.readiness-badge {
  min-height: 28px;
  padding: 5px 10px;
  font-size: 0.75rem;
}

.status-badge[data-tone="progress"],
.outcome-badge[data-tone="progress"] {
  background: var(--amber-soft);
  color: #744700;
}

.status-badge[data-tone="success"],
.readiness-badge[data-tone="success"],
.outcome-badge[data-tone="success"] {
  background: var(--teal-soft);
  color: #005d57;
}

.status-badge[data-tone="danger"],
.readiness-badge[data-tone="danger"],
.outcome-badge[data-tone="danger"] {
  background: var(--red-soft);
  color: #8d1630;
}

.readiness-badge[data-tone="warning"],
.outcome-badge[data-tone="warning"] {
  background: var(--amber-soft);
  color: #744700;
}

.identity-value {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.identity-value code {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: "Courier New", monospace;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-track {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 34px 0 26px;
  padding: 0;
  list-style: none;
}

.progress-track li {
  position: relative;
  display: grid;
  gap: 8px;
  color: #848b86;
  font-size: 0.72rem;
  font-weight: 700;
}

.progress-track li::before {
  position: absolute;
  z-index: 0;
  top: 6px;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--line);
  content: "";
}

.progress-track li:first-child::before {
  left: 7px;
}

.progress-track li:last-child::before {
  right: calc(100% - 7px);
}

.progress-track li span {
  z-index: 1;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}

.progress-track li.is-active,
.progress-track li.is-complete {
  color: var(--ink);
}

.progress-track li.is-active span {
  border-color: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-soft);
}

.progress-track li.is-complete span {
  border-color: var(--teal);
  background: var(--teal);
}

.assessment-metadata {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.assessment-metadata div {
  display: flex;
  min-width: 0;
  justify-content: space-between;
  gap: 16px;
}

.assessment-metadata dd {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report {
  margin-top: 36px;
  padding-top: 30px;
  border-top: 3px solid var(--ink);
  animation: content-in 360ms ease-out both;
}

.report-heading {
  align-items: flex-start;
}

.report-heading > div {
  display: grid;
  gap: 5px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.metric-grid div {
  display: grid;
  min-height: 92px;
  align-content: center;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.metric-grid div:last-child {
  border-right: 0;
}

.metric-grid span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 700;
}

.metric-grid small {
  margin-top: 3px;
  color: #69716c;
  font-size: 0.73rem;
}

.report-section {
  margin-top: 32px;
}

.report-section h4 {
  margin-bottom: 12px;
  font-size: 0.86rem;
  text-transform: uppercase;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.78rem;
}

th {
  background: var(--surface-muted);
  color: #59615c;
  font-size: 0.69rem;
  text-transform: uppercase;
}

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

.outcome-badge {
  min-height: 24px;
  padding: 3px 8px;
  font-size: 0.66rem;
}

.evidence-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.evidence-list li {
  padding: 12px 14px;
  border-left: 3px solid var(--teal);
  background: var(--teal-soft);
  font-size: 0.8rem;
  line-height: 1.5;
}

.evidence-list.limitations li {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(20px, 5vw, 72px) 24px;
  border-top: 1px solid var(--line);
  background: #fff;
  color: #68706b;
  font-size: 0.72rem;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 12px 16px;
  border-radius: 4px;
  background: var(--ink);
  box-shadow: 0 12px 30px rgb(23 28 31 / 25%);
  color: #fff;
  font-size: 0.8rem;
  animation: content-in 180ms ease-out both;
}

@keyframes workspace-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .page-shell {
    width: min(100% - 28px, 760px);
    padding-top: 28px;
  }

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

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

  .recent-section {
    margin-top: 8px;
  }
}

@media (max-width: 620px) {
  .app-header {
    min-height: 68px;
    padding: 12px 16px;
  }

  .brand-copy span {
    display: none;
  }

  .environment-label {
    font-size: 0.7rem;
  }

  .page-shell {
    width: calc(100% - 20px);
    padding: 22px 0 34px;
  }

  .workspace-heading {
    align-items: flex-start;
  }

  h1 {
    font-size: 2rem;
  }

  .connection-state {
    padding-top: 7px;
  }

  .submission-panel,
  .results-panel {
    padding: 22px 18px 30px;
  }

  .assessment-summary,
  .assessment-metadata {
    grid-template-columns: 1fr;
  }

  .assessment-metadata div {
    display: grid;
    gap: 4px;
  }

  .assessment-metadata dd {
    text-align: left;
  }

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

  .metric-grid div:nth-child(2) {
    border-right: 0;
  }

  .metric-grid div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .app-footer {
    display: grid;
    gap: 5px;
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
