:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --ink: #1d2521;
  --muted: #5b6861;
  --line: #d9e0da;
  --accent: #10695f;
  --accent-2: #d96b32;
  --hold: #a7302c;
  --review: #946000;
  --pass: #1d6c45;
  --shadow: 0 18px 42px rgba(31, 45, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
  z-index: 20;
}

.skip-link:focus {
  top: 12px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

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

nav {
  display: flex;
  gap: 16px;
  font-size: 14px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

nav a:hover {
  color: var(--accent);
}

main {
  padding: 28px;
}

.workspace,
.results-section,
.next-step-section,
.rules-section {
  max-width: 1260px;
  margin: 0 auto 28px;
}

.workspace-header {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.65fr);
  gap: 24px;
  align-items: stretch;
}

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

h1 {
  max-width: 780px;
  margin-bottom: 14px;
  font-size: clamp(34px, 4vw, 56px);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 6px;
  font-size: 18px;
  line-height: 1.2;
}

.workspace-header > div:first-child p {
  max-width: 850px;
  color: var(--muted);
  font-size: 17px;
}

.mobile-hero-run {
  display: none;
}

.privacy-card,
.input-panel,
.score-card,
.metric,
.mapping-panel,
.table-wrap,
.rules-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.privacy-card {
  padding: 18px;
}

.privacy-card span,
.score-card span,
.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.privacy-card strong {
  display: block;
  margin: 4px 0 6px;
  font-size: 18px;
}

.privacy-card p {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
}

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

dd {
  margin: 0;
  font-weight: 800;
}

.notice {
  margin: 18px 0;
  padding: 12px 14px;
  background: #fff7e8;
  border: 1px solid #efd4a5;
  border-radius: 8px;
  color: #573d10;
}

.quick-sample-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 18px;
  padding: 14px;
  background: #eaf6f3;
  border: 1px solid #b8d4ce;
  border-radius: 8px;
}

.quick-sample-panel strong,
.quick-sample-panel span {
  display: block;
}

.quick-sample-panel strong {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 16px;
}

.quick-sample-panel span {
  color: #43544f;
  font-size: 14px;
}

.process-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.process-strip div {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid #c6d7d2;
  border-radius: 8px;
  background: #fff;
}

.process-strip strong {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
}

.process-strip span {
  color: #344942;
  font-size: 14px;
  font-weight: 850;
  line-height: 1.25;
}

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

.input-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-height: 88px;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

label,
.file-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.file-drop {
  margin-top: 12px;
  padding: 12px;
  border: 2px dashed #b7c8bf;
  border-radius: 8px;
  background: #f7fbf8;
  transition: border-color 140ms ease, background 140ms ease;
}

.file-drop.is-dragging {
  border-color: var(--accent);
  background: #e6f4f1;
}

.file-drop .file-label {
  margin-top: 0;
  color: #24473f;
}

.file-drop span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

input[type="file"] {
  width: 100%;
  min-height: 42px;
  padding: 9px;
  border: 1px dashed #b9c5bc;
  border-radius: 8px;
  background: #fafbf9;
  color: var(--muted);
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 12px;
  border: 1px solid #cbd5ce;
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
}

textarea:focus,
input[type="file"]:focus,
button:focus-visible {
  outline: 3px solid rgba(16, 105, 95, 0.22);
  outline-offset: 2px;
}

.action-row,
.result-controls,
.download-row,
.tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.action-row {
  margin-top: 16px;
}

.report-ready {
  margin: -4px 0 16px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.action-row span {
  color: var(--muted);
  font-size: 14px;
}

.button,
.tab {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 13px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

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

.button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.25fr) repeat(3, minmax(150px, 0.5fr));
  gap: 16px;
}

.score-card,
.metric {
  padding: 18px;
}

.score-card strong {
  display: block;
  margin: 4px 0;
  font-size: 44px;
  line-height: 1;
}

.score-card p,
.metric p {
  margin-bottom: 0;
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 2px 0;
  font-size: 36px;
}

.metric.hold {
  border-top: 5px solid var(--hold);
}

.metric.review {
  border-top: 5px solid var(--review);
}

.metric.pass {
  border-top: 5px solid var(--pass);
}

.result-controls {
  justify-content: space-between;
  margin: 16px 0;
}

.tab {
  background: #fff;
  border-color: var(--line);
  color: var(--muted);
}

.tab.active {
  background: var(--ink);
  color: #fff;
}

.mapping-panel {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px;
}

.mapping-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.mapping-chip {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbf9;
}

.mapping-chip span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.mapping-chip strong {
  display: block;
  margin-top: 3px;
  word-break: break-word;
}

.table-wrap {
  overflow: auto;
}

.mobile-result-list {
  display: none;
}

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 14px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: normal;
}

th {
  background: #f9faf8;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  text-transform: uppercase;
  box-shadow: inset 0 -1px 0 var(--line);
}

tbody tr:first-child td {
  border-top: 1px solid var(--line);
}

tbody tr:nth-child(even) td {
  background: #fbfcfb;
}

th:nth-child(1),
td:nth-child(1) {
  width: 8%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 6%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 16%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 12%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 9%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 10%;
}

th:nth-child(7),
td:nth-child(7) {
  width: 11%;
}

th:nth-child(8),
td:nth-child(8) {
  width: 28%;
}

.queue-badge {
  display: inline-block;
  min-width: 68px;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.queue-badge.hold {
  background: var(--hold);
}

.queue-badge.review {
  background: var(--review);
}

.queue-badge.pass {
  background: var(--pass);
}

.reason-list {
  margin: 0;
  padding-left: 18px;
}

.reason-list li + li {
  margin-top: 4px;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.next-step-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.section-kicker {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.next-step-section h2 {
  margin: 0;
  font-size: 28px;
}

.next-step-section p {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
}

.next-step-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-width: 260px;
}

.rules-section {
  padding: 22px;
}

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

.rule-grid article {
  min-height: 126px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.rule-grid p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .topbar,
  .workspace-header,
  .input-grid,
  .summary-grid,
  .mapping-panel,
  .next-step-section,
  .rule-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .input-grid {
    display: grid;
  }

  .process-strip {
    grid-template-columns: 1fr;
  }

  .mapping-list {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  main,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  nav,
  .mapping-list,
  dl {
    grid-template-columns: 1fr;
  }

  nav {
    flex-wrap: wrap;
  }

  h1 {
    font-size: 34px;
  }

  .workspace-header > div:first-child p {
    margin-bottom: 18px;
  }

  .mobile-hero-run {
    display: inline-flex;
    justify-content: center;
    width: 100%;
  }

  .panel-heading,
  .result-controls,
  .next-step-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .button,
  .tab {
    width: 100%;
  }

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

  .table-wrap {
    display: none;
  }

  .mobile-result-list {
    display: grid;
    gap: 12px;
  }

  .mobile-result-card {
    padding: 14px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }

  .mobile-result-topline {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
  }

  .mobile-result-topline strong {
    font-size: 20px;
  }

  .mobile-result-topline span:last-child {
    justify-self: end;
    font-weight: 800;
  }

  .mobile-result-card dl {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 0 0 12px;
  }

  .mobile-result-card dd small {
    display: block;
    color: var(--muted);
    font-weight: 400;
  }

  .mobile-result-reasons {
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .mobile-result-reasons > span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }
}
