:root {
  --bg: #f5f3ec;
  --panel: #fffdf7;
  --panel-strong: #ffffff;
  --ink: #15171c;
  --muted: #5c6470;
  --line: #d8d5ca;
  --line-strong: #bdb8a8;
  --green: #0f6b5f;
  --green-dark: #08483f;
  --blue: #2756b3;
  --blue-soft: #e8eefb;
  --amber: #a76100;
  --amber-soft: #fff2d8;
  --red: #b3261e;
  --red-soft: #fde8e6;
  --purple: #6550a4;
  --purple-soft: #eee9ff;
  --shadow: 0 16px 44px rgba(37, 35, 29, 0.10);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

button {
  border: 0;
}

a {
  color: var(--blue);
}

.app-shell {
  min-height: 100vh;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--green);
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
  flex: 0 0 auto;
}

.brand h1,
.panel-heading h2,
.snippet-heading h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 1.28rem;
  line-height: 1.2;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  background: #f2efe4;
  border-color: #9f9988;
}

.button:active {
  transform: translateY(1px);
}

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

.button.primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.button.secondary {
  background: #ffffff;
}

.button.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.88rem;
}

.file-button {
  position: relative;
}

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

.modebar {
  display: flex;
  gap: 10px;
  padding: 14px 28px 0;
  overflow-x: auto;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.mode-tab span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ebe7da;
  color: var(--muted);
  font-size: 0.82rem;
}

.mode-tab.is-active {
  background: var(--panel);
  border-color: var(--line);
  border-bottom-color: var(--panel);
  color: var(--ink);
}

.mode-tab.is-active span {
  background: var(--green);
  color: #ffffff;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 0 28px 28px;
  max-width: 1500px;
  margin: 0 auto;
}

.workspace-main {
  min-width: 0;
}

.panel,
.inspector-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  align-items: flex-start;
}

.panel-heading h2 {
  max-width: 760px;
  font-size: 1.35rem;
  line-height: 1.25;
}

.panel-note {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.is-hidden {
  display: none !important;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0 0 18px;
  border: 0;
}

.scenario-grid legend,
.questionnaire legend {
  margin-bottom: 10px;
  font-weight: 850;
}

.scenario-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  cursor: pointer;
}

.scenario-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.scenario-card:has(input:checked) {
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px rgba(15, 107, 95, 0.16);
}

.scenario-title {
  display: block;
  font-weight: 850;
}

.scenario-card span:last-child {
  color: var(--muted);
  font-size: 0.92rem;
}

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

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

.span-2 {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 7px;
  color: #30343b;
  font-weight: 780;
}

input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(39, 86, 179, 0.14);
}

textarea {
  resize: vertical;
}

.output-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  margin-top: 18px;
}

.snippet-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 16px;
}

.snippet-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.snippet-heading h3 {
  font-size: 1rem;
}

#shortNotice,
#longNotice {
  border-color: #c6c0ae;
  background: #fbfaf5;
  color: #171a20;
}

.inline-status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--green-dark);
  font-weight: 800;
}

.register-form,
.oversight-form {
  display: grid;
  gap: 18px;
}

.questionnaire {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0;
  background: #fbfaf5;
}

.check-row {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding-top: 30px;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
}

.risk-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.risk-preview p {
  margin: 0;
  color: var(--muted);
}

.risk-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.risk-pill.prohibited {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(179, 38, 30, 0.26);
}

.risk-pill.high {
  color: #7c4000;
  background: var(--amber-soft);
  border: 1px solid rgba(167, 97, 0, 0.28);
}

.risk-pill.limited {
  color: var(--blue);
  background: var(--blue-soft);
  border: 1px solid rgba(39, 86, 179, 0.24);
}

.risk-pill.minimal {
  color: var(--green-dark);
  background: #e6f3ef;
  border: 1px solid rgba(15, 107, 95, 0.22);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-wrap {
  margin-top: 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

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

th {
  background: #f3efe3;
  color: #31343a;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

td {
  color: #24272e;
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.text-button {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--blue);
  font-weight: 850;
  cursor: pointer;
}

.text-button.danger {
  color: var(--red);
}

.empty-state {
  margin: 12px 0 0;
  color: var(--muted);
}

.inspector {
  display: grid;
  gap: 14px;
  align-content: start;
  position: sticky;
  top: 104px;
}

.inspector-block {
  padding: 16px;
  box-shadow: none;
}

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

.metric-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.metric-grid span {
  display: block;
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}

.metric-grid p,
.status-list,
.disclaimer p {
  margin: 6px 0 0;
  color: var(--muted);
}

.compact-list {
  margin: 8px 0 12px;
  padding-left: 18px;
  color: #30343b;
}

.compact-list li + li {
  margin-top: 6px;
}

.source-link {
  font-weight: 850;
}

.test-summary {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ece7d9;
  color: #343026;
  font-weight: 900;
}

.test-summary.pass {
  background: #e6f3ef;
  color: var(--green-dark);
}

.test-summary.fail {
  background: var(--red-soft);
  color: var(--red);
}

.test-results {
  display: grid;
  gap: 6px;
  margin: 12px 0 0;
  padding-left: 20px;
}

.test-results li {
  color: var(--muted);
}

.test-results li.pass {
  color: var(--green-dark);
  font-weight: 800;
}

.test-results li.fail {
  color: var(--red);
  font-weight: 800;
}

.print-bundle {
  display: none;
}

.noscript {
  max-width: 680px;
  margin: 40px auto;
  padding: 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

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

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

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

  .top-actions {
    justify-content: flex-start;
  }

  .modebar {
    padding: 12px 18px 0;
  }

  .workspace {
    padding: 0 18px 18px;
  }

  .panel {
    padding: 18px;
  }

  .panel-heading,
  .output-grid,
  .risk-preview {
    display: grid;
    grid-template-columns: 1fr;
  }

  .scenario-grid,
  .form-grid,
  .form-grid.wide,
  .inspector {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

  .check-row {
    padding-top: 0;
  }
}

@media print {
  @page {
    margin: 16mm;
  }

  body {
    background: #ffffff;
    color: #000000;
  }

  .no-print {
    display: none !important;
  }

  .print-bundle {
    display: block;
    font-family: Arial, sans-serif;
    color: #000000;
  }

  .print-bundle h1 {
    margin: 0 0 8px;
    font-size: 22pt;
  }

  .print-bundle h2 {
    margin: 22px 0 8px;
    font-size: 15pt;
    border-bottom: 1px solid #777777;
    padding-bottom: 4px;
  }

  .print-bundle p {
    margin: 4px 0;
  }

  .print-bundle table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    page-break-inside: auto;
  }

  .print-bundle th,
  .print-bundle td {
    border: 1px solid #777777;
    padding: 6px;
    font-size: 9pt;
  }

  .print-bundle th {
    background: #eeeeee;
  }
}
